ubit
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
UMServer Class Reference

UMS server main class. More...

#include <umserver.hpp>

Public Member Functions

 UMServer (const char *display_name, int ums_port, bool reuse_address, int cursor_mode, int neighbor_mode)
 constructor. More...
 
bool isInit () const
 checks if the UMS is initialized. More...
 
void start ()
 starts the main loop of the UMS server. More...
 
void setPublicDir (const char *s)
 
const std::string & getPublicDir ()
 
void setNativeButton (int raw_btn_number, unsigned int raw_mod_mask, unsigned int to_btn_mask, unsigned int ro_mod_mask)
 
void setActionKey (unsigned int keycode, int modifier, void(*press_action)(class UMServer &, XEvent &), void(*release_action)(class UMServer &, XEvent &))
 this key will perform some useful action when pressed and/or released.
 
RemoteUMSList::iterator findRemoteUMS (const char *name)
 
RemoteUMSaddRemoteUMS (const char *name, const char *address, int port, int pos)
 
void removeRemoteUMS (const char *name)
 
RemoteUMSgetNeighborUMS (int pos) const
 
RemoteUMSsetNeighborUMS (int pos, const char *name)
 
void sendRemoteUMSState (RemoteUMS *, int state)
 sends an added/removed state when a RemoteUMS is created or deleted.
 
void sendRemoteUMSList (Cnx *to)
 sends the list of RemoteUMSs that are currently browsed to a client.
 
void sendNeighborList (Cnx *to)
 
void sendNeighborState (RemoteUMS *, int pos)
 
std::string resolveDeviceName (const char *)
 returns the /dev/ttxx name from a shortcut.
 
bool addEventSource (EventSource *)
 adds an event source. More...
 
bool removeEventSource (EventSource *)
 removes an event source. More...
 
MouseFlowgetNativeMouseFlow () const
 returns the native mouse flow. More...
 
MouseFlowgetMouseFlow (int id) const
 returns this mouse flow if 'id' is defined and it is a mouse flow. More...
 
MouseFlowgetOrCreateMouseFlow (int id)
 returns this mouse flow or creates it if it does not exist
 
EventFlowgetEventFlow (int id) const
 returns this mouse flow if 'id' is defined and it is a mouse flow. More...
 
bool addEventFlow (EventFlow *)
 adds an event flow. More...
 
bool removeEventFlow (EventFlow *)
 removes an event flow. More...
 
CnxList::iterator findCnxIt (USocket *)
 
CnxfindCnx (USocket *)
 
CnxaddCnx (USocket *)
 
void removeCnx (USocket *)
 
XDisplay * getDisplay () const
 
XScreen * getScreen () const
 
WindowID getRoot () const
 
int getXConnection () const
 
long getScreenWidth () const
 
long getScreenHeight () const
 
int getScreenDepth () const
 
struct CalibrationgetCalibration ()
 
WinaddWin (WindowID, bool notify)
 
void removeWin (WindowID, bool notify)
 
void reorderWin (WinList::iterator &from, const WinList::iterator &to)
 
void retrieveXWindows ()
 
void raiseXWindows ()
 
void sendWindowState (Win *, int state)
 
void sendWindowList (Cnx *to)
 
WinfindWin (const char *name)
 
WinfindWin (WindowID)
 
WinList::iterator findWinIt (WindowID)
 searches a window from its name or its ID in the X window list.
 
bool getXWin (int root_x, int root_y, Pos &, bool check_props)
 returns the window and pos that contains this point.
 
bool getXSubwin (const Pos &wp, int x, int y, Pos &)
 trouver subwindow de wp.win contenant le point (x,y) relatif a wp.win.
 
bool getXWinPos (const Win *w, Pos &)
 trouver position de w dans root.
 
bool isPointer (WindowID)
 true if this window is a pseudo pointer.
 
void moveNativePointerBackHome (bool center)
 move the native pointer back to the home server.
 
class UServerSocketgetServerSocket ()
 
WinList & getWins ()
 
CnxList & getCnxs ()
 
void processRequest (USocket *, class UInbuf &)
 
bool initX (const char *display_name, int cursor_mode, int neighbor_mode)
 
void getAndProcessXEvents ()
 
bool addSourceToMainLoop (USocket *)
 
bool addSourceToMainLoop (EventSource *)
 
void initMainLoop ()
 
void runMainLoop ()
 

Static Public Member Functions

static TimeID getTime ()
 in millisec.
 

Public Attributes

AtomID _WM_DELETE_WINDOW
 
AtomID _UMS_WINDOW
 
AtomID _UMS_MESSAGE
 
bool is_init
 
class UServerSocketserv_sock
 
int xconnection
 
XDisplay * xdisplay
 
XScreen * xscreen
 
WindowID xrootwin
 
CursorID root_cursor
 
CursorID grab_cursor
 
struct Eventsevents
 
struct Edgesedges
 
struct Calibrationcalib
 
struct Mdnsmdns
 
std::string hostname
 
std::string system
 
std::string public_dir
 
EventSourcenatsource
 the native event source.
 
std::vector< EventSource * > sources
 list of event sources (= the devices that are connected to the eflows)
 
std::vector< EventFlow * > eflows
 list of event flows (eflows[0] corresponds to the standard X server)
 
CnxList cnxs
 lists of connections (= connected applications) and their opened windows
 
WinList wins
 list of the windows of this X server
 
RemoteUMSList remotes
 the list of RemoteUMS that are currently browsed.
 
RemoteUMSl_neighbor
 neigbhors of this UMS server.
 
RemoteUMSr_neighbor
 
RemoteUMSt_neighbor
 
RemoteUMSb_neighbor
 
std::vector< ActionKeyaction_keys
 predefined keys that perform some action
 

Static Public Attributes

static const TimeID NEIGHBOR_RETRY_DELAY = 6*1000
 attempt to re-connect (if connection failed) after this delay
 

Detailed Description

UMS server main class.

Constructor & Destructor Documentation

§ UMServer()

UMServer::UMServer ( const char *  display_name,
int  ums_port,
bool  reuse_address,
int  cursor_mode,
int  neighbor_mode 
)

constructor.

Args:

  • ums_port: the port used by the UMS; uses UMS_DEFAULT_PORT if 0
  • display_name == NULL means "local host"

Member Function Documentation

§ addEventFlow()

bool UMServer::addEventFlow ( EventFlow fl)

adds an event flow.

NB: - several event flows can be created

  • their IDs MUST be != 0 (and have different values)
  • the native event flow (that corresponds to the standard X mouse) is created implicitely by the UMServer. Its ID is always 0. Return value:
  • true if this flow could be added (ie. ID is != 0 and not flow was registered with the same ID)

§ addEventSource()

bool UMServer::addEventSource ( EventSource so)

adds an event source.

NB: - several event sources can be created Return value:

  • true if this source could be added (ie. if this source was not previously registered)

§ getEventFlow()

EventFlow * UMServer::getEventFlow ( int  id) const

returns this mouse flow if 'id' is defined and it is a mouse flow.

equivalent to dynamic_cast<MouseFlow*>(getEventFlow(id)) the id of the native mouse flow is 0.

§ getMouseFlow()

MouseFlow * UMServer::getMouseFlow ( int  id) const

returns this mouse flow if 'id' is defined and it is a mouse flow.

equivalent to dynamic_cast<MouseFlow*>(getEventFlow(id) the id of the native mouse flow is 0.

§ getNativeMouseFlow()

MouseFlow & UMServer::getNativeMouseFlow ( ) const

returns the native mouse flow.

equivalent to getMouseFlow(0)

§ isInit()

bool UMServer::isInit ( ) const
inline

checks if the UMS is initialized.

NB: returns true if the UMS port and the X display could be opened.

§ removeEventFlow()

bool UMServer::removeEventFlow ( EventFlow fl)

removes an event flow.

NB: - this fct does not delete the flow.

  • the native event flow (whose ID = 0) can't be removed. Return value:
  • true if this flow could be removed (= ID is != 0 and this flow was previously registered

§ removeEventSource()

bool UMServer::removeEventSource ( EventSource so)

removes an event source.

NB: - this fct does not delete the source. Return value:

  • true if this source could be removed (= if this source was previously registered

§ start()

void UMServer::start ( )

starts the main loop of the UMS server.

NB: the UMS must be initialized (see: isInit())


The documentation for this class was generated from the following files: