1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
3 // Copyright (c) 2001 - 2003 Jason 'vanRijn' Kasper <vR at movingparts dot net>
5 // Permission is hereby granted, free of charge, to any person obtaining a
6 // copy of this software and associated documentation files (the "Software"),
7 // to deal in the Software without restriction, including without limitation
8 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 // and/or sell copies of the Software, and to permit persons to whom the
10 // Software is furnished to do so, subject to the following conditions:
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 // DEALINGS IN THE SOFTWARE.
30 #include <X11/Xatom.h>
42 class Netclient
: public bt::Netwm
48 Atom xa_wm_colormap_windows
, xa_wm_protocols
, xa_wm_state
,
49 xa_wm_delete_window
, xa_wm_take_focus
, xa_wm_change_state
,
50 motif_wm_hints
, xa_wm_name
, xa_wm_class
;
52 Atom openbox_show_root_menu
, openbox_show_workspace_menu
;
54 bool getValue(Window win
, Atom atom
, Atom type
,
55 unsigned long &nelements
, unsigned char **value
,
58 void init_icccm(void);
59 void init_extras(void);
63 Netclient (Display
* display
);
66 // various value accessors...
67 std::string
getWindowTitle(Window win
) const;
68 unsigned int getDesktop(Window win
) const;
71 // atoms Netwm doesn't provide
74 inline Atom
xaWmColormapWindows(void) const {return xa_wm_colormap_windows
;}
75 inline Atom
xaWmProtocols(void) const {return xa_wm_protocols
;}
76 inline Atom
xaWmState(void) const {return xa_wm_state
;}
77 inline Atom
xaWmClass(void) const {return xa_wm_class
;}
78 inline Atom
xaWmName(void) const {return xa_wm_name
;}
79 inline Atom
xaWmDeleteWindow(void) const {return xa_wm_delete_window
;}
80 inline Atom
xaWmTakeFocus(void) const {return xa_wm_take_focus
;}
81 inline Atom
xaWmChangeState(void) const {return xa_wm_change_state
;}
82 inline Atom
xaMotifWmHints(void) const {return motif_wm_hints
;}
85 inline Atom
xaOpenboxShowRootMenu(void) const {return openbox_show_root_menu
;}
86 inline Atom
xaOpenboxShowWorkspaceMenu(void) const
87 {return openbox_show_workspace_menu
;}
96 typedef std::vector
<std::string
> StringVect
;
98 bool getValue(Window win
, Atom atom
, Atom type
,
99 unsigned long &nelements
, unsigned long **value
) const;
100 bool getValue(Window win
, Atom atom
, Atom type
, unsigned long &value
) const;
101 bool getValue(Window win
, Atom atom
, StringType type
,
102 std::string
&value
) const;
103 bool getValue(Window win
, Atom atom
, StringType type
,
104 unsigned long &nelements
, StringVect
&strings
) const;
106 void eraseValue(Window win
, Atom atom
) const;
108 // sends a client message a window
109 void sendClientMessage(Window target
, Atom type
, Window about
,
110 long data
= 0, long data1
= 0, long data2
= 0,
111 long data3
= 0, long data4
= 0) const;