]> Dogcows Code - chaz/openbox/blob - otk/appwidget.cc
Add the "obsetroot" tool. Use it to set the root background.
[chaz/openbox] / otk / appwidget.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 #include "config.h"
4
5 #include "appwidget.hh"
6 #include "application.hh"
7 #include "property.hh"
8 #include "renderstyle.hh"
9 #include "display.hh"
10
11 extern "C" {
12 #include <X11/Xlib.h>
13 }
14
15 namespace otk {
16
17 AppWidget::AppWidget(Application *app, Direction direction, int bevel)
18 : Widget(app->screen(), app, direction, bevel),
19 _application(app)
20 {
21 assert(app);
22
23 // set WM Protocols on the window
24 Atom protocols[2];
25 protocols[0] = Property::atoms.wm_protocols;
26 protocols[1] = Property::atoms.wm_delete_window;
27 XSetWMProtocols(**display, window(), protocols, 2);
28 }
29
30 AppWidget::~AppWidget()
31 {
32 }
33
34 void AppWidget::show()
35 {
36 if (!visible())
37 _application->_appwidget_count++;
38 Widget::show(true);
39 }
40
41 void AppWidget::hide()
42 {
43 if (visible())
44 _application->_appwidget_count--;
45 Widget::hide();
46 }
47
48 void AppWidget::clientMessageHandler(const XClientMessageEvent &e)
49 {
50 EventHandler::clientMessageHandler(e);
51 if (e.message_type == Property::atoms.wm_protocols &&
52 static_cast<Atom>(e.data.l[0]) == Property::atoms.wm_delete_window)
53 hide();
54 }
55
56 }
This page took 0.039486 seconds and 4 git commands to generate.