]> Dogcows Code - chaz/openbox/blob - otk/appwidget.cc
use bevel width on the top/bottom too
[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 // set WM Protocols on the window
25 Atom protocols[2];
26 protocols[0] = Property::atoms.wm_protocols;
27 protocols[1] = Property::atoms.wm_delete_window;
28 XSetWMProtocols(**display, window(), protocols, 2);
29
30 setStyle(_style);
31 }
32
33 AppWidget::~AppWidget()
34 {
35 }
36
37 void AppWidget::setStyle(RenderStyle *style)
38 {
39 Widget::setStyle(style);
40
41 setTexture(style->titlebarUnfocusBackground());
42 }
43
44 void AppWidget::show(void)
45 {
46 Widget::show(true);
47
48 _application->_appwidget_count++;
49 }
50
51 void AppWidget::hide(void)
52 {
53 Widget::hide();
54
55 _application->_appwidget_count--;
56 }
57
58 void AppWidget::clientMessageHandler(const XClientMessageEvent &e)
59 {
60 EventHandler::clientMessageHandler(e);
61 if (e.message_type == Property::atoms.wm_protocols &&
62 static_cast<Atom>(e.data.l[0]) == Property::atoms.wm_delete_window)
63 hide();
64 }
65
66 }
This page took 0.034093 seconds and 4 git commands to generate.