1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
4 # include "../config.h"
7 #include "appwidget.hh"
8 #include "application.hh"
16 OtkAppWidget::OtkAppWidget(OtkApplication *app, Direction direction,
17 Cursor cursor, int bevel_width)
18 : OtkWidget(app, app->getStyle(), direction, cursor, bevel_width),
23 _wm_protocols = XInternAtom(OBDisplay::display, "WM_PROTOCOLS", false);
24 _wm_delete = XInternAtom(OBDisplay::display, "WM_DELETE_WINDOW", false);
26 // set WM Protocols on the window
28 protocols[0] = _wm_protocols;
29 protocols[1] = _wm_delete;
30 XSetWMProtocols(OBDisplay::display, window(), protocols, 2);
33 OtkAppWidget::~OtkAppWidget()
37 void OtkAppWidget::show(void)
39 OtkWidget::show(true);
41 _application->_appwidget_count++;
44 void OtkAppWidget::hide(void)
48 _application->_appwidget_count--;
51 void OtkAppWidget::clientMessageHandler(const XClientMessageEvent &e)
53 OtkEventHandler::clientMessageHandler(e);
54 if (e.message_type == _wm_protocols &&
55 static_cast<Atom>(e.data.l[0]) == _wm_delete)