add an UrgentNotify callback type. fire it when a window becomes "urgent"
Dana Jansens danakj@orodu.net
5 files changed,
30 insertions(+),
2 deletions(-)
M
src/client.cc
→
src/client.cc
@@ -8,6 +8,7 @@ #include "client.hh"
#include "frame.hh" #include "screen.hh" #include "openbox.hh" +#include "bindings.hh" #include "otk/display.hh" #include "otk/property.hh"@@ -44,6 +45,8 @@ // not a transient by default of course
_transient_for = 0; // pick a layer to start from _layer = Layer_Normal; + // default to not urgent + _urgent = false; getArea(); getDesktop();@@ -457,7 +460,7 @@ XWMHints *hints;
// 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)@@ -468,7 +471,7 @@ if (initstate && (hints->flags & StateHint))
_iconic = hints->initial_state == IconicState; if (hints->flags & XUrgencyHint) - _urgent = true; + ur = true; if (hints->flags & WindowGroupHint) { if (hints->window_group != _group) {@@ -480,6 +483,14 @@ } else // no group!
_group = None; XFree(hints); + } + + if (ur != _urgent) { + _urgent = ur; + // fire the urgent callback if we're mapped, otherwise, wait until after + // we're mapped + if (_urgent && frame) + fireUrgent(); } }@@ -1174,6 +1185,8 @@ if (_shaded) {
_shaded = false; shade(true); } + if (_urgent) + fireUrgent(); if (_max_vert); // XXX: incomplete if (_max_horz); // XXX: incomplete@@ -1183,6 +1196,14 @@ if (_skip_pager); // nothing to do for this
if (_modal); // nothing to do for this if (_above); // nothing to do for this if (_below); // nothing to do for this +} + + +void Client::fireUrgent() +{ + // call the python UrgentNotify callbacks + EventData data(_screen, this, EventUrgentNotify, 0); + openbox->bindings()->fireEvent(&data); }
M
src/client.hh
→
src/client.hh
@@ -406,6 +406,10 @@ unshaded.
*/ void shade(bool shade); + //! Fires the urgent callbacks which lets the user do what they want with + //! urgent windows + void fireUrgent(); + //! Fullscreen's or unfullscreen's the client window /*! @param fs true if the window should be made fullscreen; false if it should
M
src/openbox.py
→
src/openbox.py
@@ -914,6 +914,7 @@ EventShutdown = _openbox.EventShutdown
EventKey = _openbox.EventKey EventFocus = _openbox.EventFocus EventBell = _openbox.EventBell +EventUrgentNotify = _openbox.EventUrgentNotify NUM_EVENTS = _openbox.NUM_EVENTS class MouseData(_object): __swig_setmethods__ = {}
M
src/openbox_wrap.cc
→
src/openbox_wrap.cc
@@ -12095,6 +12095,7 @@ { SWIG_PY_INT, (char *)"EventShutdown", (long) ob::EventShutdown, 0, 0, 0},
{ SWIG_PY_INT, (char *)"EventKey", (long) ob::EventKey, 0, 0, 0}, { SWIG_PY_INT, (char *)"EventFocus", (long) ob::EventFocus, 0, 0, 0}, { SWIG_PY_INT, (char *)"EventBell", (long) ob::EventBell, 0, 0, 0}, +{ SWIG_PY_INT, (char *)"EventUrgentNotify", (long) ob::EventUrgentNotify, 0, 0, 0}, { SWIG_PY_INT, (char *)"NUM_EVENTS", (long) ob::NUM_EVENTS, 0, 0, 0}, { SWIG_PY_INT, (char *)"X_PROTOCOL", (long) 11, 0, 0, 0}, { SWIG_PY_INT, (char *)"X_PROTOCOL_REVISION", (long) 0, 0, 0, 0},
M
src/python.hh
→
src/python.hh
@@ -64,6 +64,7 @@ EventShutdown,
EventKey, EventFocus, EventBell, + EventUrgentNotify, NUM_EVENTS };