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