aboutsummaryrefslogtreecommitdiff
path: root/src/SlitClient.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/SlitClient.cc')
-rw-r--r--src/SlitClient.cc81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/SlitClient.cc b/src/SlitClient.cc
new file mode 100644
index 0000000..fe2567f
--- /dev/null
+++ b/src/SlitClient.cc
@@ -0,0 +1,81 @@
1// SlitClient.cc for fluxbox
2// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22// $Id: SlitClient.cc,v 1.2 2003/06/22 12:30:59 fluxgen Exp $
23
24#include "SlitClient.hh"
25
26#include "Screen.hh"
27#include "App.hh"
28#include "Xutil.hh"
29
30#include <X11/Xutil.h>
31#include <X11/Xatom.h>
32
33SlitClient::SlitClient(BScreen *screen, Window win) {
34 initialize(screen, win);
35}
36
37SlitClient::SlitClient(const char *name):m_match_name(name == 0 ? "" : name) {
38 initialize();
39}
40
41
42void SlitClient::initialize(BScreen *screen, Window win) {
43 // Now we pre-initialize a list of slit clients with names for
44 // comparison with incoming client windows. This allows the slit
45 // to maintain a sorted order based on a saved window name list.
46 // Incoming windows not found in the list are appended. Matching
47 // duplicates are inserted after the last found instance of the
48 // matching name.
49
50 m_client_window = win;
51 m_window = m_icon_window = None;
52 move(0, 0);
53 resize(0, 0);
54
55 if (matchName().empty())
56 m_match_name = Xutil::getWMName(clientWindow());
57 m_visible = true;
58}
59
60void SlitClient::disableEvents() {
61 if (window() == 0)
62 return;
63 Display *disp = FbTk::App::instance()->display();
64 XSelectInput(disp, window(), NoEventMask);
65}
66
67void SlitClient::enableEvents() {
68 if (window() == 0)
69 return;
70 Display *disp = FbTk::App::instance()->display();
71 XSelectInput(disp, window(), StructureNotifyMask |
72 SubstructureNotifyMask | EnterWindowMask);
73}
74
75void SlitClient::hide() {
76 XUnmapWindow(FbTk::App::instance()->display(), window());
77}
78
79void SlitClient::show() {
80 XMapWindow(FbTk::App::instance()->display(), window());
81}