#include "frame.hh"
#include "screen.hh"
#include "openbox.hh"
+#include "bindings.hh"
#include "otk/display.hh"
#include "otk/property.hh"
_transient_for = 0;
// pick a layer to start from
_layer = Layer_Normal;
+ // default to not urgent
+ _urgent = false;
getArea();
getDesktop();
updateStrut();
// this makes sure that these windows appear on all desktops
- if (_type == Type_Dock || _type == Type_Desktop)
+ if (/*_type == Type_Dock ||*/ _type == Type_Desktop)
_desktop = 0xffffffff;
// set the desktop hint, to make sure that it always exists, and to reflect
// defaults to the current desktop
_desktop = openbox->screen(_screen)->desktop();
- otk::Property::get(_window, otk::Property::atoms.net_wm_desktop,
- otk::Property::atoms.cardinal,
- (long unsigned*)&_desktop);
+ if (otk::Property::get(_window, otk::Property::atoms.net_wm_desktop,
+ otk::Property::atoms.cardinal,
+ (long unsigned*)&_desktop)) {
+#ifdef DEBUG
+// printf("Window requested desktop: %ld\n", _desktop);
+#endif
+ }
}
// assume a window takes input if it doesnt specify
_can_focus = true;
- _urgent = false;
+ bool ur = false;
if ((hints = XGetWMHints(**otk::display, _window)) != NULL) {
if (hints->flags & InputHint)
_iconic = hints->initial_state == IconicState;
if (hints->flags & XUrgencyHint)
- _urgent = true;
+ ur = true;
if (hints->flags & WindowGroupHint) {
if (hints->window_group != _group) {
XFree(hints);
}
+
+ if (ur != _urgent) {
+ _urgent = ur;
+#ifdef DEBUG
+ printf("DEBUG: Urgent Hint for 0x%lx: %s\n",
+ (long)_window, _urgent ? "ON" : "OFF");
+#endif
+ // fire the urgent callback if we're mapped, otherwise, wait until after
+ // we're mapped
+ if (_urgent && frame)
+ fireUrgent();
+ }
}
// these are in a carefully crafted order..
if (_iconic) {
- printf("MAP ICONIC\n");
_iconic = false;
setDesktop(ICONIC_DESKTOP);
}
_shaded = false;
shade(true);
}
+ if (_urgent)
+ fireUrgent();
if (_max_vert); // XXX: incomplete
if (_max_horz); // XXX: incomplete
}
+void Client::fireUrgent()
+{
+ // call the python UrgentWindow callbacks
+ EventData data(_screen, this, EventAction::UrgentWindow, 0);
+ openbox->bindings()->fireEvent(&data);
+}
+
+
void Client::shade(bool shade)
{
if (!(_functions & Func_Shade) || // can't
{
if (ignore_unmaps) {
#ifdef DEBUG
- printf("Ignored UnmapNotify for 0x%lx (event 0x%lx)\n", e.window, e.event);
+// printf("Ignored UnmapNotify for 0x%lx (event 0x%lx)\n", e.window, e.event);
#endif // DEBUG
ignore_unmaps--;
return;