ubit
events.hpp
1 /*************************************************************************
2  *
3  * events.hpp - UMS Server
4  * Ubit GUI Toolkit - Version 6.0
5  * (C) 2003-2008 Eric Lecolinet / ENST Paris / www.enst.fr/~elc/ubit
6  *
7  * ***********************************************************************
8  * COPYRIGHT NOTICE :
9  * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY AND WITHOUT EVEN THE
10  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
11  * YOU CAN REDISTRIBUTE IT AND/OR MODIFY IT UNDER THE TERMS OF THE GNU
12  * GENERAL PUBLIC LICENSE AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
13  * EITHER VERSION 2 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
14  * SEE FILES 'COPYRIGHT' AND 'COPYING' FOR MORE DETAILS.
15  * ***********************************************************************/
16 
17 #ifndef _events_hpp_
18 #define _events_hpp_
19 #include "umserver.hpp"
20 
21 struct Events {
22  UMServer& ums;
23  struct MacEvents* macev;
24  static bool has_xtest;
25 
26  static int Bmasks[];
27  static unsigned int Bmask_Count;
28 
29  static int Mmasks[];
30  static unsigned int Mmask_Count;
31 
32  static unsigned int xbuttonToMask(int xbtn_no);
33  static unsigned int mbuttonToMask(int xbtn_no);
34  static unsigned int maskToXButton(unsigned int btn_mask);
35  static unsigned int keySymToModMask(unsigned long mod_keysym);
36  static unsigned long modMaskToKeySym(unsigned int mod_mask);
37 
38  // ------------------------------------------------------------
39 
40  Events(UMServer*);
41  ~Events();
42 
43  bool init();
44  void leaveLocalDisplay();
45  void enterLocalDisplay();
46 
47  void getNativePointer(long& x, long& y);
48  void warpNativePointer(long x, long y);
50 
51  void getPointer(const MouseFlow&, long& x, long& y);
52  void warpPointer(MouseFlow&, long x, long y);
54 
55  bool getPointer(const MouseFlow&, Pos&, bool check_props = false);
57 
58  // ------------------------------------------------------------
59 
60  void sendKey(MouseFlow&, unsigned long keysym, bool press, Pos* use_pos = 0);
63 
64  void sendButton(MouseFlow&, int btn_id, bool press, Pos* use_pos = 0);
65 
66  void sendMotion(MouseFlow& outflow, long x, long y, bool move_ptr);
68 
69  void sendMessage(USocket*, const char* message);
70 
71  // ------------------------------------------------------------
72  void getXPointer(long& x, long& y);
73  bool getXPointer(Pos&);
74  void warpXPointer(long x, long y);
75 
76  void sendXKey(MouseFlow&, unsigned long keysym, bool press, Pos* use_pos);
77  void sendXButton(MouseFlow&, int btn_id, bool press, Pos* use_pos);
78  void sendXMotion(MouseFlow&, long x, long y, bool move_ptr);
79  void sendXMessage(WindowID, const char* message);
80 };
81 
82 #endif
83 /* ==================================================== [(c)Elc] ======= */
84 /* ==================================================== ======== ======= */
85 
86 
Definition: events.cpp:9
UMS mouse event flow.
Definition: flow.hpp:40
void warpPointer(MouseFlow &, long x, long y)
get/set the location of the pointer of this flow.
Definition: events.cpp:98
position on the screen
Definition: umserver.hpp:81
UMS server main class.
Definition: umserver.hpp:152
Ubit Simple Sockets.
Definition: usocket.hpp:64
void sendKey(MouseFlow &, unsigned long keysym, bool press, Pos *use_pos=0)
pos : envoyer event a cette position directement sans gerer le MouseFlow ni afficher le ptr (utilise ...
Definition: events.cpp:166
void warpNativePointer(long x, long y)
get/set the location of the native pointer.
Definition: events.cpp:89
Definition: macevents.hpp:23
void sendMotion(MouseFlow &outflow, long x, long y, bool move_ptr)
move sthe pointer if 'move_pointer' is true.
Definition: events.cpp:115