]> Dogcows Code - chaz/openbox/blob - src/Netizen.cc
had an extra window placement menu
[chaz/openbox] / src / Netizen.cc
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
2 // Netizen.cc for Blackbox - An X11 Window Manager
3 // Copyright (c) 2001 Sean 'Shaleh' Perry <shaleh@debian.org>
4 // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a
7 // copy of this software and associated documentation files (the "Software"),
8 // to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 // and/or sell copies of the Software, and to permit persons to whom the
11 // Software is furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 // DEALINGS IN THE SOFTWARE.
23
24 #ifdef HAVE_CONFIG_H
25 #include "../config.h"
26 #endif // HAVE_CONFIG_H
27
28 #include "Netizen.hh"
29 #include "Screen.hh"
30 #include "XAtom.hh"
31
32 Netizen::Netizen(BScreen *scr, Window win) {
33 screen = scr;
34 blackbox = scr->getBlackbox();
35 xatom = blackbox->getXAtom();
36 window = win;
37
38 event.type = ClientMessage;
39 event.xclient.message_type =
40 xatom->getAtom(XAtom::blackbox_structure_messages);
41 event.xclient.display = blackbox->getXDisplay();
42 event.xclient.window = window;
43 event.xclient.format = 32;
44 event.xclient.data.l[0] = xatom->getAtom(XAtom::blackbox_notify_startup);
45 event.xclient.data.l[1] = event.xclient.data.l[2] =
46 event.xclient.data.l[3] = event.xclient.data.l[4] = 0l;
47
48 XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
49 }
50
51
52 void Netizen::sendWorkspaceCount(void) {
53 event.xclient.data.l[0] =
54 xatom->getAtom(XAtom::blackbox_notify_workspace_count);
55 event.xclient.data.l[1] = screen->getWorkspaceCount();
56
57 XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
58 }
59
60
61 void Netizen::sendCurrentWorkspace(void) {
62 event.xclient.data.l[0] =
63 xatom->getAtom(XAtom::blackbox_notify_current_workspace);
64 event.xclient.data.l[1] = screen->getCurrentWorkspaceID();
65
66 XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
67 }
68
69
70 void Netizen::sendWindowFocus(Window w) {
71 event.xclient.data.l[0] = xatom->getAtom(XAtom::blackbox_notify_window_focus);
72 event.xclient.data.l[1] = w;
73
74 XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
75 }
76
77
78 void Netizen::sendWindowAdd(Window w, unsigned long p) {
79 event.xclient.data.l[0] = xatom->getAtom(XAtom::blackbox_notify_window_add);
80 event.xclient.data.l[1] = w;
81 event.xclient.data.l[2] = p;
82
83 XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
84
85 event.xclient.data.l[2] = 0l;
86 }
87
88
89 void Netizen::sendWindowDel(Window w) {
90 event.xclient.data.l[0] = xatom->getAtom(XAtom::blackbox_notify_window_del);
91 event.xclient.data.l[1] = w;
92
93 XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
94 }
95
96
97 void Netizen::sendWindowRaise(Window w) {
98 event.xclient.data.l[0] = xatom->getAtom(XAtom::blackbox_notify_window_raise);
99 event.xclient.data.l[1] = w;
100
101 XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
102 }
103
104
105 void Netizen::sendWindowLower(Window w) {
106 event.xclient.data.l[0] =
107 xatom->getAtom(XAtom::blackbox_notify_window_lower);
108 event.xclient.data.l[1] = w;
109
110 XSendEvent(blackbox->getXDisplay(), window, False, NoEventMask, &event);
111 }
112
113
114 void Netizen::sendConfigNotify(XEvent *e) {
115 XSendEvent(blackbox->getXDisplay(), window, False,
116 StructureNotifyMask, e);
117 }
This page took 0.036372 seconds and 4 git commands to generate.