make the window.h interface more consistent with the rest of openbox, hide the window_map behind some functions, and make obdockapps not obwindows anymore
This commit is contained in:
parent
ea481338b5
commit
29637976e6
12 changed files with 266 additions and 245 deletions
|
@ -274,7 +274,7 @@ void client_manage(Window window)
|
||||||
/* create the ObClient struct, and populate it from the hints on the
|
/* create the ObClient struct, and populate it from the hints on the
|
||||||
window */
|
window */
|
||||||
self = g_new0(ObClient, 1);
|
self = g_new0(ObClient, 1);
|
||||||
self->obwin.type = Window_Client;
|
self->obwin.type = OB_WINDOW_CLASS_CLIENT;
|
||||||
self->window = window;
|
self->window = window;
|
||||||
|
|
||||||
/* non-zero defaults */
|
/* non-zero defaults */
|
||||||
|
@ -597,7 +597,7 @@ void client_manage(Window window)
|
||||||
|
|
||||||
/* add to client list/map */
|
/* add to client list/map */
|
||||||
client_list = g_list_append(client_list, self);
|
client_list = g_list_append(client_list, self);
|
||||||
g_hash_table_insert(window_map, &self->window, self);
|
window_add(&self->window, CLIENT_AS_WINDOW(self));
|
||||||
|
|
||||||
/* this has to happen after we're in the client_list */
|
/* this has to happen after we're in the client_list */
|
||||||
if (STRUT_EXISTS(self->strut))
|
if (STRUT_EXISTS(self->strut))
|
||||||
|
@ -705,7 +705,7 @@ void client_unmanage(ObClient *self)
|
||||||
|
|
||||||
client_list = g_list_remove(client_list, self);
|
client_list = g_list_remove(client_list, self);
|
||||||
stacking_remove(self);
|
stacking_remove(self);
|
||||||
g_hash_table_remove(window_map, &self->window);
|
window_remove(self->window);
|
||||||
|
|
||||||
/* once the client is out of the list, update the struts to remove its
|
/* once the client is out of the list, update the struts to remove its
|
||||||
influence */
|
influence */
|
||||||
|
@ -1285,13 +1285,13 @@ void client_update_transient_for(ObClient *self)
|
||||||
|
|
||||||
if (XGetTransientForHint(obt_display, self->window, &t)) {
|
if (XGetTransientForHint(obt_display, self->window, &t)) {
|
||||||
if (t != self->window) { /* cant be transient to itself! */
|
if (t != self->window) { /* cant be transient to itself! */
|
||||||
target = g_hash_table_lookup(window_map, &t);
|
ObWindow *tw = window_find(t);
|
||||||
/* if this happens then we need to check for it*/
|
/* if this happens then we need to check for it*/
|
||||||
g_assert(target != self);
|
g_assert(tw != CLIENT_AS_WINDOW(self));
|
||||||
if (target && !WINDOW_IS_CLIENT(target)) {
|
if (target && WINDOW_IS_CLIENT(tw)) {
|
||||||
/* this can happen when a dialog is a child of
|
/* watch out for windows with a parent that is something
|
||||||
a dockapp, for example */
|
different, like a dockapp for example */
|
||||||
target = NULL;
|
target = WINDOW_AS_CLIENT(tw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ void dock_startup(gboolean reconfig)
|
||||||
0, 0, 0, 0, 0, 0, 0, 0);
|
0, 0, 0, 0, 0, 0, 0, 0);
|
||||||
|
|
||||||
dock = g_new0(ObDock, 1);
|
dock = g_new0(ObDock, 1);
|
||||||
dock->obwin.type = Window_Dock;
|
dock->obwin.type = OB_WINDOW_CLASS_DOCK;
|
||||||
|
|
||||||
dock->hidden = TRUE;
|
dock->hidden = TRUE;
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ void dock_startup(gboolean reconfig)
|
||||||
OBT_PROP_SET32(dock->frame, NET_WM_WINDOW_TYPE, ATOM,
|
OBT_PROP_SET32(dock->frame, NET_WM_WINDOW_TYPE, ATOM,
|
||||||
OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_DOCK));
|
OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_DOCK));
|
||||||
|
|
||||||
g_hash_table_insert(window_map, &dock->frame, dock);
|
window_add(&dock->frame, DOCK_AS_WINDOW(dock));
|
||||||
stacking_add(DOCK_AS_WINDOW(dock));
|
stacking_add(DOCK_AS_WINDOW(dock));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ void dock_shutdown(gboolean reconfig)
|
||||||
|
|
||||||
XDestroyWindow(obt_display, dock->frame);
|
XDestroyWindow(obt_display, dock->frame);
|
||||||
RrAppearanceFree(dock->a_frame);
|
RrAppearanceFree(dock->a_frame);
|
||||||
g_hash_table_remove(window_map, &dock->frame);
|
window_remove(dock->frame);
|
||||||
stacking_remove(dock);
|
stacking_remove(dock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,6 @@ void dock_add(Window win, XWMHints *wmhints)
|
||||||
gchar **data;
|
gchar **data;
|
||||||
|
|
||||||
app = g_new0(ObDockApp, 1);
|
app = g_new0(ObDockApp, 1);
|
||||||
app->obwin.type = Window_DockApp;
|
|
||||||
app->win = win;
|
app->win = win;
|
||||||
app->icon_win = (wmhints->flags & IconWindowHint) ?
|
app->icon_win = (wmhints->flags & IconWindowHint) ?
|
||||||
wmhints->icon_window : win;
|
wmhints->icon_window : win;
|
||||||
|
@ -184,8 +183,6 @@ void dock_add(Window win, XWMHints *wmhints)
|
||||||
|
|
||||||
dock_app_grab_button(app, TRUE);
|
dock_app_grab_button(app, TRUE);
|
||||||
|
|
||||||
g_hash_table_insert(window_map, &app->icon_win, app);
|
|
||||||
|
|
||||||
ob_debug("Managed Dock App: 0x%lx (%s)\n", app->icon_win, app->class);
|
ob_debug("Managed Dock App: 0x%lx (%s)\n", app->icon_win, app->class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,8 +200,6 @@ void dock_remove(ObDockApp *app, gboolean reparent)
|
||||||
XChangeSaveSet(obt_display, app->icon_win, SetModeDelete);
|
XChangeSaveSet(obt_display, app->icon_win, SetModeDelete);
|
||||||
XSync(obt_display, False);
|
XSync(obt_display, False);
|
||||||
|
|
||||||
g_hash_table_remove(window_map, &app->icon_win);
|
|
||||||
|
|
||||||
if (reparent)
|
if (reparent)
|
||||||
XReparentWindow(obt_display, app->icon_win,
|
XReparentWindow(obt_display, app->icon_win,
|
||||||
RootWindow(obt_display, ob_screen), app->x, app->y);
|
RootWindow(obt_display, ob_screen), app->x, app->y);
|
||||||
|
@ -654,3 +649,17 @@ void dock_get_area(Rect *a)
|
||||||
RECT_SET(*a, dock->area.x, dock->area.y,
|
RECT_SET(*a, dock->area.x, dock->area.y,
|
||||||
dock->area.width, dock->area.height);
|
dock->area.width, dock->area.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ObDockApp* dock_find_dockapp(Window xwin)
|
||||||
|
{
|
||||||
|
g_assert(xwin != None);
|
||||||
|
GList *it;
|
||||||
|
/* there are never that many dock apps, so we can use a list here instead
|
||||||
|
of a hash table */
|
||||||
|
for (it = dock->dock_apps; it; it = g_list_next(it)) {
|
||||||
|
ObDockApp *app = it->data;
|
||||||
|
if (app->icon_win == xwin)
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -47,8 +47,6 @@ struct _ObDock
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _ObDockApp {
|
struct _ObDockApp {
|
||||||
ObWindow obwin;
|
|
||||||
|
|
||||||
gint ignore_unmaps;
|
gint ignore_unmaps;
|
||||||
|
|
||||||
Window icon_win;
|
Window icon_win;
|
||||||
|
@ -81,4 +79,6 @@ void dock_app_configure(ObDockApp *app, gint w, gint h);
|
||||||
|
|
||||||
void dock_get_area(Rect *a);
|
void dock_get_area(Rect *a);
|
||||||
|
|
||||||
|
ObDockApp* dock_find_dockapp(Window xwin);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -335,7 +335,7 @@ static gboolean wanted_focusevent(XEvent *e, gboolean in_client_only)
|
||||||
but has disappeared.
|
but has disappeared.
|
||||||
*/
|
*/
|
||||||
if (in_client_only) {
|
if (in_client_only) {
|
||||||
ObWindow *w = g_hash_table_lookup(window_map, &e->xfocus.window);
|
ObWindow *w = window_find(e->xfocus.window);
|
||||||
if (!w || !WINDOW_IS_CLIENT(w))
|
if (!w || !WINDOW_IS_CLIENT(w))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -463,26 +463,24 @@ static void event_process(const XEvent *ec, gpointer data)
|
||||||
e = ⅇ
|
e = ⅇ
|
||||||
|
|
||||||
window = event_get_window(e);
|
window = event_get_window(e);
|
||||||
if ((obwin = g_hash_table_lookup(window_map, &window))) {
|
if ((obwin = window_find(window))) {
|
||||||
switch (obwin->type) {
|
switch (obwin->type) {
|
||||||
case Window_Dock:
|
case OB_WINDOW_CLASS_DOCK:
|
||||||
dock = WINDOW_AS_DOCK(obwin);
|
dock = WINDOW_AS_DOCK(obwin);
|
||||||
break;
|
break;
|
||||||
case Window_DockApp:
|
case OB_WINDOW_CLASS_CLIENT:
|
||||||
dockapp = WINDOW_AS_DOCKAPP(obwin);
|
|
||||||
break;
|
|
||||||
case Window_Client:
|
|
||||||
client = WINDOW_AS_CLIENT(obwin);
|
client = WINDOW_AS_CLIENT(obwin);
|
||||||
break;
|
break;
|
||||||
case Window_Menu:
|
case OB_WINDOW_CLASS_MENUFRAME:
|
||||||
/* not to be used for events */
|
/* XXX use this to handle events more uniformly */
|
||||||
g_assert_not_reached();
|
|
||||||
break;
|
break;
|
||||||
case Window_Internal:
|
case OB_WINDOW_CLASS_INTERNALWINDOW:
|
||||||
/* we don't do anything with events directly on these windows */
|
/* we don't do anything with events directly on these windows */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
dockapp = dock_find_dockapp(window);
|
||||||
|
|
||||||
event_set_curtime(e);
|
event_set_curtime(e);
|
||||||
event_curserial = e->xany.serial;
|
event_curserial = e->xany.serial;
|
||||||
|
@ -713,8 +711,8 @@ static void event_process(const XEvent *ec, gpointer data)
|
||||||
else {
|
else {
|
||||||
ObWindow *w;
|
ObWindow *w;
|
||||||
|
|
||||||
if ((w = g_hash_table_lookup(window_map, &e->xbutton.subwindow)) &&
|
if ((w = window_find(e->xbutton.subwindow)) &&
|
||||||
WINDOW_IS_INTERNAL(w))
|
WINDOW_IS_INTERNALWINDOW(w))
|
||||||
{
|
{
|
||||||
event_handle_user_input(client, e);
|
event_handle_user_input(client, e);
|
||||||
}
|
}
|
||||||
|
@ -1113,8 +1111,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
||||||
/* get the sibling */
|
/* get the sibling */
|
||||||
if (e->xconfigurerequest.value_mask & CWSibling) {
|
if (e->xconfigurerequest.value_mask & CWSibling) {
|
||||||
ObWindow *win;
|
ObWindow *win;
|
||||||
win = g_hash_table_lookup(window_map,
|
win = window_find(e->xconfigurerequest.above);
|
||||||
&e->xconfigurerequest.above);
|
|
||||||
if (win && WINDOW_IS_CLIENT(win) &&
|
if (win && WINDOW_IS_CLIENT(win) &&
|
||||||
WINDOW_AS_CLIENT(win) != client)
|
WINDOW_AS_CLIENT(win) != client)
|
||||||
{
|
{
|
||||||
|
@ -1447,8 +1444,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
||||||
} else {
|
} else {
|
||||||
ObClient *sibling = NULL;
|
ObClient *sibling = NULL;
|
||||||
if (e->xclient.data.l[1]) {
|
if (e->xclient.data.l[1]) {
|
||||||
ObWindow *win = g_hash_table_lookup
|
ObWindow *win = window_find(e->xclient.data.l[1]);
|
||||||
(window_map, &e->xclient.data.l[1]);
|
|
||||||
if (WINDOW_IS_CLIENT(win) &&
|
if (WINDOW_IS_CLIENT(win) &&
|
||||||
WINDOW_AS_CLIENT(win) != client)
|
WINDOW_AS_CLIENT(win) != client)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,10 +32,10 @@
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
InternalWindow top;
|
ObInternalWindow top;
|
||||||
InternalWindow left;
|
ObInternalWindow left;
|
||||||
InternalWindow right;
|
ObInternalWindow right;
|
||||||
InternalWindow bottom;
|
ObInternalWindow bottom;
|
||||||
} focus_indicator;
|
} focus_indicator;
|
||||||
|
|
||||||
static RrAppearance *a_focus_indicator;
|
static RrAppearance *a_focus_indicator;
|
||||||
|
@ -59,38 +59,38 @@ void focus_cycle_indicator_startup(gboolean reconfig)
|
||||||
|
|
||||||
if (reconfig) return;
|
if (reconfig) return;
|
||||||
|
|
||||||
focus_indicator.top.obwin.type = Window_Internal;
|
focus_indicator.top.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW;
|
||||||
focus_indicator.left.obwin.type = Window_Internal;
|
focus_indicator.left.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW;
|
||||||
focus_indicator.right.obwin.type = Window_Internal;
|
focus_indicator.right.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW;
|
||||||
focus_indicator.bottom.obwin.type = Window_Internal;
|
focus_indicator.bottom.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW;
|
||||||
|
|
||||||
attr.override_redirect = True;
|
attr.override_redirect = True;
|
||||||
attr.background_pixel = BlackPixel(obt_display, ob_screen);
|
attr.background_pixel = BlackPixel(obt_display, ob_screen);
|
||||||
focus_indicator.top.win =
|
focus_indicator.top.window =
|
||||||
create_window(RootWindow(obt_display, ob_screen),
|
create_window(RootWindow(obt_display, ob_screen),
|
||||||
CWOverrideRedirect | CWBackPixel, &attr);
|
CWOverrideRedirect | CWBackPixel, &attr);
|
||||||
focus_indicator.left.win =
|
focus_indicator.left.window =
|
||||||
create_window(RootWindow(obt_display, ob_screen),
|
create_window(RootWindow(obt_display, ob_screen),
|
||||||
CWOverrideRedirect | CWBackPixel, &attr);
|
CWOverrideRedirect | CWBackPixel, &attr);
|
||||||
focus_indicator.right.win =
|
focus_indicator.right.window =
|
||||||
create_window(RootWindow(obt_display, ob_screen),
|
create_window(RootWindow(obt_display, ob_screen),
|
||||||
CWOverrideRedirect | CWBackPixel, &attr);
|
CWOverrideRedirect | CWBackPixel, &attr);
|
||||||
focus_indicator.bottom.win =
|
focus_indicator.bottom.window =
|
||||||
create_window(RootWindow(obt_display, ob_screen),
|
create_window(RootWindow(obt_display, ob_screen),
|
||||||
CWOverrideRedirect | CWBackPixel, &attr);
|
CWOverrideRedirect | CWBackPixel, &attr);
|
||||||
|
|
||||||
stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.top));
|
stacking_add(INTERNALWINDOW_AS_WINDOW(&focus_indicator.top));
|
||||||
stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.left));
|
stacking_add(INTERNALWINDOW_AS_WINDOW(&focus_indicator.left));
|
||||||
stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.right));
|
stacking_add(INTERNALWINDOW_AS_WINDOW(&focus_indicator.right));
|
||||||
stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.bottom));
|
stacking_add(INTERNALWINDOW_AS_WINDOW(&focus_indicator.bottom));
|
||||||
g_hash_table_insert(window_map, &focus_indicator.top.win,
|
window_add(&focus_indicator.top.window,
|
||||||
&focus_indicator.top);
|
INTERNALWINDOW_AS_WINDOW(&focus_indicator.top));
|
||||||
g_hash_table_insert(window_map, &focus_indicator.left.win,
|
window_add(&focus_indicator.left.window,
|
||||||
&focus_indicator.left);
|
INTERNALWINDOW_AS_WINDOW(&focus_indicator.left));
|
||||||
g_hash_table_insert(window_map, &focus_indicator.right.win,
|
window_add(&focus_indicator.right.window,
|
||||||
&focus_indicator.right);
|
INTERNALWINDOW_AS_WINDOW(&focus_indicator.right));
|
||||||
g_hash_table_insert(window_map, &focus_indicator.bottom.win,
|
window_add(&focus_indicator.bottom.window,
|
||||||
&focus_indicator.bottom);
|
INTERNALWINDOW_AS_WINDOW(&focus_indicator.bottom));
|
||||||
|
|
||||||
color_white = RrColorNew(ob_rr_inst, 0xff, 0xff, 0xff);
|
color_white = RrColorNew(ob_rr_inst, 0xff, 0xff, 0xff);
|
||||||
|
|
||||||
|
@ -117,20 +117,20 @@ void focus_cycle_indicator_shutdown(gboolean reconfig)
|
||||||
|
|
||||||
RrAppearanceFree(a_focus_indicator);
|
RrAppearanceFree(a_focus_indicator);
|
||||||
|
|
||||||
g_hash_table_remove(window_map, &focus_indicator.top.win);
|
window_remove(focus_indicator.top.window);
|
||||||
g_hash_table_remove(window_map, &focus_indicator.left.win);
|
window_remove(focus_indicator.left.window);
|
||||||
g_hash_table_remove(window_map, &focus_indicator.right.win);
|
window_remove(focus_indicator.right.window);
|
||||||
g_hash_table_remove(window_map, &focus_indicator.bottom.win);
|
window_remove(focus_indicator.bottom.window);
|
||||||
|
|
||||||
stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.top));
|
stacking_remove(INTERNALWINDOW_AS_WINDOW(&focus_indicator.top));
|
||||||
stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.left));
|
stacking_remove(INTERNALWINDOW_AS_WINDOW(&focus_indicator.left));
|
||||||
stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.right));
|
stacking_remove(INTERNALWINDOW_AS_WINDOW(&focus_indicator.right));
|
||||||
stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.bottom));
|
stacking_remove(INTERNALWINDOW_AS_WINDOW(&focus_indicator.bottom));
|
||||||
|
|
||||||
XDestroyWindow(obt_display, focus_indicator.top.win);
|
XDestroyWindow(obt_display, focus_indicator.top.window);
|
||||||
XDestroyWindow(obt_display, focus_indicator.left.win);
|
XDestroyWindow(obt_display, focus_indicator.left.window);
|
||||||
XDestroyWindow(obt_display, focus_indicator.right.win);
|
XDestroyWindow(obt_display, focus_indicator.right.window);
|
||||||
XDestroyWindow(obt_display, focus_indicator.bottom.win);
|
XDestroyWindow(obt_display, focus_indicator.bottom.window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void focus_cycle_draw_indicator(ObClient *c)
|
void focus_cycle_draw_indicator(ObClient *c)
|
||||||
|
@ -141,10 +141,10 @@ void focus_cycle_draw_indicator(ObClient *c)
|
||||||
/* kill enter events cause by this unmapping */
|
/* kill enter events cause by this unmapping */
|
||||||
ignore_start = event_start_ignore_all_enters();
|
ignore_start = event_start_ignore_all_enters();
|
||||||
|
|
||||||
XUnmapWindow(obt_display, focus_indicator.top.win);
|
XUnmapWindow(obt_display, focus_indicator.top.window);
|
||||||
XUnmapWindow(obt_display, focus_indicator.left.win);
|
XUnmapWindow(obt_display, focus_indicator.left.window);
|
||||||
XUnmapWindow(obt_display, focus_indicator.right.win);
|
XUnmapWindow(obt_display, focus_indicator.right.window);
|
||||||
XUnmapWindow(obt_display, focus_indicator.bottom.win);
|
XUnmapWindow(obt_display, focus_indicator.bottom.window);
|
||||||
|
|
||||||
event_end_ignore_all_enters(ignore_start);
|
event_end_ignore_all_enters(ignore_start);
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ void focus_cycle_draw_indicator(ObClient *c)
|
||||||
w = c->frame->area.width;
|
w = c->frame->area.width;
|
||||||
h = wt;
|
h = wt;
|
||||||
|
|
||||||
XMoveResizeWindow(obt_display, focus_indicator.top.win,
|
XMoveResizeWindow(obt_display, focus_indicator.top.window,
|
||||||
x, y, w, h);
|
x, y, w, h);
|
||||||
a_focus_indicator->texture[0].data.lineart.x1 = 0;
|
a_focus_indicator->texture[0].data.lineart.x1 = 0;
|
||||||
a_focus_indicator->texture[0].data.lineart.y1 = h-1;
|
a_focus_indicator->texture[0].data.lineart.y1 = h-1;
|
||||||
|
@ -184,7 +184,7 @@ void focus_cycle_draw_indicator(ObClient *c)
|
||||||
a_focus_indicator->texture[3].data.lineart.y1 = h-1;
|
a_focus_indicator->texture[3].data.lineart.y1 = h-1;
|
||||||
a_focus_indicator->texture[3].data.lineart.x2 = w - wr;
|
a_focus_indicator->texture[3].data.lineart.x2 = w - wr;
|
||||||
a_focus_indicator->texture[3].data.lineart.y2 = h-1;
|
a_focus_indicator->texture[3].data.lineart.y2 = h-1;
|
||||||
RrPaint(a_focus_indicator, focus_indicator.top.win,
|
RrPaint(a_focus_indicator, focus_indicator.top.window,
|
||||||
w, h);
|
w, h);
|
||||||
|
|
||||||
x = c->frame->area.x;
|
x = c->frame->area.x;
|
||||||
|
@ -192,7 +192,7 @@ void focus_cycle_draw_indicator(ObClient *c)
|
||||||
w = wl;
|
w = wl;
|
||||||
h = c->frame->area.height;
|
h = c->frame->area.height;
|
||||||
|
|
||||||
XMoveResizeWindow(obt_display, focus_indicator.left.win,
|
XMoveResizeWindow(obt_display, focus_indicator.left.window,
|
||||||
x, y, w, h);
|
x, y, w, h);
|
||||||
a_focus_indicator->texture[0].data.lineart.x1 = w-1;
|
a_focus_indicator->texture[0].data.lineart.x1 = w-1;
|
||||||
a_focus_indicator->texture[0].data.lineart.y1 = 0;
|
a_focus_indicator->texture[0].data.lineart.y1 = 0;
|
||||||
|
@ -210,7 +210,7 @@ void focus_cycle_draw_indicator(ObClient *c)
|
||||||
a_focus_indicator->texture[3].data.lineart.y1 = wt-1;
|
a_focus_indicator->texture[3].data.lineart.y1 = wt-1;
|
||||||
a_focus_indicator->texture[3].data.lineart.x2 = w-1;
|
a_focus_indicator->texture[3].data.lineart.x2 = w-1;
|
||||||
a_focus_indicator->texture[3].data.lineart.y2 = h - wb;
|
a_focus_indicator->texture[3].data.lineart.y2 = h - wb;
|
||||||
RrPaint(a_focus_indicator, focus_indicator.left.win,
|
RrPaint(a_focus_indicator, focus_indicator.left.window,
|
||||||
w, h);
|
w, h);
|
||||||
|
|
||||||
x = c->frame->area.x + c->frame->area.width - wr;
|
x = c->frame->area.x + c->frame->area.width - wr;
|
||||||
|
@ -218,7 +218,7 @@ void focus_cycle_draw_indicator(ObClient *c)
|
||||||
w = wr;
|
w = wr;
|
||||||
h = c->frame->area.height ;
|
h = c->frame->area.height ;
|
||||||
|
|
||||||
XMoveResizeWindow(obt_display, focus_indicator.right.win,
|
XMoveResizeWindow(obt_display, focus_indicator.right.window,
|
||||||
x, y, w, h);
|
x, y, w, h);
|
||||||
a_focus_indicator->texture[0].data.lineart.x1 = 0;
|
a_focus_indicator->texture[0].data.lineart.x1 = 0;
|
||||||
a_focus_indicator->texture[0].data.lineart.y1 = 0;
|
a_focus_indicator->texture[0].data.lineart.y1 = 0;
|
||||||
|
@ -236,7 +236,7 @@ void focus_cycle_draw_indicator(ObClient *c)
|
||||||
a_focus_indicator->texture[3].data.lineart.y1 = wt-1;
|
a_focus_indicator->texture[3].data.lineart.y1 = wt-1;
|
||||||
a_focus_indicator->texture[3].data.lineart.x2 = 0;
|
a_focus_indicator->texture[3].data.lineart.x2 = 0;
|
||||||
a_focus_indicator->texture[3].data.lineart.y2 = h - wb;
|
a_focus_indicator->texture[3].data.lineart.y2 = h - wb;
|
||||||
RrPaint(a_focus_indicator, focus_indicator.right.win,
|
RrPaint(a_focus_indicator, focus_indicator.right.window,
|
||||||
w, h);
|
w, h);
|
||||||
|
|
||||||
x = c->frame->area.x;
|
x = c->frame->area.x;
|
||||||
|
@ -244,7 +244,7 @@ void focus_cycle_draw_indicator(ObClient *c)
|
||||||
w = c->frame->area.width;
|
w = c->frame->area.width;
|
||||||
h = wb;
|
h = wb;
|
||||||
|
|
||||||
XMoveResizeWindow(obt_display, focus_indicator.bottom.win,
|
XMoveResizeWindow(obt_display, focus_indicator.bottom.window,
|
||||||
x, y, w, h);
|
x, y, w, h);
|
||||||
a_focus_indicator->texture[0].data.lineart.x1 = 0;
|
a_focus_indicator->texture[0].data.lineart.x1 = 0;
|
||||||
a_focus_indicator->texture[0].data.lineart.y1 = 0;
|
a_focus_indicator->texture[0].data.lineart.y1 = 0;
|
||||||
|
@ -262,13 +262,13 @@ void focus_cycle_draw_indicator(ObClient *c)
|
||||||
a_focus_indicator->texture[3].data.lineart.y1 = 0;
|
a_focus_indicator->texture[3].data.lineart.y1 = 0;
|
||||||
a_focus_indicator->texture[3].data.lineart.x2 = w - wr;
|
a_focus_indicator->texture[3].data.lineart.x2 = w - wr;
|
||||||
a_focus_indicator->texture[3].data.lineart.y2 = 0;
|
a_focus_indicator->texture[3].data.lineart.y2 = 0;
|
||||||
RrPaint(a_focus_indicator, focus_indicator.bottom.win,
|
RrPaint(a_focus_indicator, focus_indicator.bottom.window,
|
||||||
w, h);
|
w, h);
|
||||||
|
|
||||||
XMapWindow(obt_display, focus_indicator.top.win);
|
XMapWindow(obt_display, focus_indicator.top.window);
|
||||||
XMapWindow(obt_display, focus_indicator.left.win);
|
XMapWindow(obt_display, focus_indicator.left.window);
|
||||||
XMapWindow(obt_display, focus_indicator.right.win);
|
XMapWindow(obt_display, focus_indicator.right.window);
|
||||||
XMapWindow(obt_display, focus_indicator.bottom.win);
|
XMapWindow(obt_display, focus_indicator.bottom.window);
|
||||||
|
|
||||||
visible = TRUE;
|
visible = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ void focus_cycle_popup_startup(gboolean reconfig)
|
||||||
|
|
||||||
single_popup = icon_popup_new();
|
single_popup = icon_popup_new();
|
||||||
|
|
||||||
popup.obwin.type = Window_Internal;
|
popup.obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW;
|
||||||
popup.a_bg = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg);
|
popup.a_bg = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg);
|
||||||
popup.a_text = RrAppearanceCopy(ob_rr_theme->osd_hilite_label);
|
popup.a_text = RrAppearanceCopy(ob_rr_theme->osd_hilite_label);
|
||||||
popup.a_icon = RrAppearanceCopy(ob_rr_theme->a_clear_tex);
|
popup.a_icon = RrAppearanceCopy(ob_rr_theme->a_clear_tex);
|
||||||
|
@ -127,16 +127,16 @@ void focus_cycle_popup_startup(gboolean reconfig)
|
||||||
|
|
||||||
XMapWindow(obt_display, popup.text);
|
XMapWindow(obt_display, popup.text);
|
||||||
|
|
||||||
stacking_add(INTERNAL_AS_WINDOW(&popup));
|
stacking_add(INTERNALWINDOW_AS_WINDOW(&popup));
|
||||||
g_hash_table_insert(window_map, &popup.bg, &popup);
|
window_add(&popup.bg, INTERNALWINDOW_AS_WINDOW(&popup));
|
||||||
}
|
}
|
||||||
|
|
||||||
void focus_cycle_popup_shutdown(gboolean reconfig)
|
void focus_cycle_popup_shutdown(gboolean reconfig)
|
||||||
{
|
{
|
||||||
icon_popup_free(single_popup);
|
icon_popup_free(single_popup);
|
||||||
|
|
||||||
g_hash_table_remove(window_map, &popup.bg);
|
window_remove(popup.bg);
|
||||||
stacking_remove(INTERNAL_AS_WINDOW(&popup));
|
stacking_remove(INTERNALWINDOW_AS_WINDOW(&popup));
|
||||||
|
|
||||||
while(popup.targets) {
|
while(popup.targets) {
|
||||||
ObFocusCyclePopupTarget *t = popup.targets->data;
|
ObFocusCyclePopupTarget *t = popup.targets->data;
|
||||||
|
|
180
openbox/frame.c
180
openbox/frame.c
|
@ -999,51 +999,51 @@ void frame_grab_client(ObFrame *self)
|
||||||
XSelectInput(obt_display, self->window, FRAME_EVENTMASK);
|
XSelectInput(obt_display, self->window, FRAME_EVENTMASK);
|
||||||
|
|
||||||
/* set all the windows for the frame in the window_map */
|
/* set all the windows for the frame in the window_map */
|
||||||
g_hash_table_insert(window_map, &self->window, self->client);
|
window_add(&self->window, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->backback, self->client);
|
window_add(&self->backback, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->backfront, self->client);
|
window_add(&self->backfront, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->innerleft, self->client);
|
window_add(&self->innerleft, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->innertop, self->client);
|
window_add(&self->innertop, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->innerright, self->client);
|
window_add(&self->innerright, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->innerbottom, self->client);
|
window_add(&self->innerbottom, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->innerblb, self->client);
|
window_add(&self->innerblb, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->innerbll, self->client);
|
window_add(&self->innerbll, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->innerbrb, self->client);
|
window_add(&self->innerbrb, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->innerbrr, self->client);
|
window_add(&self->innerbrr, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->title, self->client);
|
window_add(&self->title, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->label, self->client);
|
window_add(&self->label, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->max, self->client);
|
window_add(&self->max, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->close, self->client);
|
window_add(&self->close, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->desk, self->client);
|
window_add(&self->desk, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->shade, self->client);
|
window_add(&self->shade, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->icon, self->client);
|
window_add(&self->icon, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->iconify, self->client);
|
window_add(&self->iconify, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->handle, self->client);
|
window_add(&self->handle, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->lgrip, self->client);
|
window_add(&self->lgrip, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->rgrip, self->client);
|
window_add(&self->rgrip, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->topresize, self->client);
|
window_add(&self->topresize, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->tltresize, self->client);
|
window_add(&self->tltresize, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->tllresize, self->client);
|
window_add(&self->tllresize, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->trtresize, self->client);
|
window_add(&self->trtresize, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->trrresize, self->client);
|
window_add(&self->trrresize, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->left, self->client);
|
window_add(&self->left, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->right, self->client);
|
window_add(&self->right, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->titleleft, self->client);
|
window_add(&self->titleleft, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->titletop, self->client);
|
window_add(&self->titletop, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->titletopleft, self->client);
|
window_add(&self->titletopleft, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->titletopright, self->client);
|
window_add(&self->titletopright, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->titleright, self->client);
|
window_add(&self->titleright, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->titlebottom, self->client);
|
window_add(&self->titlebottom, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->handleleft, self->client);
|
window_add(&self->handleleft, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->handletop, self->client);
|
window_add(&self->handletop, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->handleright, self->client);
|
window_add(&self->handleright, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->handlebottom, self->client);
|
window_add(&self->handlebottom, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->lgripleft, self->client);
|
window_add(&self->lgripleft, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->lgriptop, self->client);
|
window_add(&self->lgriptop, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->lgripbottom, self->client);
|
window_add(&self->lgripbottom, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->rgripright, self->client);
|
window_add(&self->rgripright, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->rgriptop, self->client);
|
window_add(&self->rgriptop, CLIENT_AS_WINDOW(self->client));
|
||||||
g_hash_table_insert(window_map, &self->rgripbottom, self->client);
|
window_add(&self->rgripbottom, CLIENT_AS_WINDOW(self->client));
|
||||||
}
|
}
|
||||||
|
|
||||||
void frame_release_client(ObFrame *self)
|
void frame_release_client(ObFrame *self)
|
||||||
|
@ -1083,51 +1083,51 @@ void frame_release_client(ObFrame *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove all the windows for the frame from the window_map */
|
/* remove all the windows for the frame from the window_map */
|
||||||
g_hash_table_remove(window_map, &self->window);
|
window_remove(self->window);
|
||||||
g_hash_table_remove(window_map, &self->backback);
|
window_remove(self->backback);
|
||||||
g_hash_table_remove(window_map, &self->backfront);
|
window_remove(self->backfront);
|
||||||
g_hash_table_remove(window_map, &self->innerleft);
|
window_remove(self->innerleft);
|
||||||
g_hash_table_remove(window_map, &self->innertop);
|
window_remove(self->innertop);
|
||||||
g_hash_table_remove(window_map, &self->innerright);
|
window_remove(self->innerright);
|
||||||
g_hash_table_remove(window_map, &self->innerbottom);
|
window_remove(self->innerbottom);
|
||||||
g_hash_table_remove(window_map, &self->innerblb);
|
window_remove(self->innerblb);
|
||||||
g_hash_table_remove(window_map, &self->innerbll);
|
window_remove(self->innerbll);
|
||||||
g_hash_table_remove(window_map, &self->innerbrb);
|
window_remove(self->innerbrb);
|
||||||
g_hash_table_remove(window_map, &self->innerbrr);
|
window_remove(self->innerbrr);
|
||||||
g_hash_table_remove(window_map, &self->title);
|
window_remove(self->title);
|
||||||
g_hash_table_remove(window_map, &self->label);
|
window_remove(self->label);
|
||||||
g_hash_table_remove(window_map, &self->max);
|
window_remove(self->max);
|
||||||
g_hash_table_remove(window_map, &self->close);
|
window_remove(self->close);
|
||||||
g_hash_table_remove(window_map, &self->desk);
|
window_remove(self->desk);
|
||||||
g_hash_table_remove(window_map, &self->shade);
|
window_remove(self->shade);
|
||||||
g_hash_table_remove(window_map, &self->icon);
|
window_remove(self->icon);
|
||||||
g_hash_table_remove(window_map, &self->iconify);
|
window_remove(self->iconify);
|
||||||
g_hash_table_remove(window_map, &self->handle);
|
window_remove(self->handle);
|
||||||
g_hash_table_remove(window_map, &self->lgrip);
|
window_remove(self->lgrip);
|
||||||
g_hash_table_remove(window_map, &self->rgrip);
|
window_remove(self->rgrip);
|
||||||
g_hash_table_remove(window_map, &self->topresize);
|
window_remove(self->topresize);
|
||||||
g_hash_table_remove(window_map, &self->tltresize);
|
window_remove(self->tltresize);
|
||||||
g_hash_table_remove(window_map, &self->tllresize);
|
window_remove(self->tllresize);
|
||||||
g_hash_table_remove(window_map, &self->trtresize);
|
window_remove(self->trtresize);
|
||||||
g_hash_table_remove(window_map, &self->trrresize);
|
window_remove(self->trrresize);
|
||||||
g_hash_table_remove(window_map, &self->left);
|
window_remove(self->left);
|
||||||
g_hash_table_remove(window_map, &self->right);
|
window_remove(self->right);
|
||||||
g_hash_table_remove(window_map, &self->titleleft);
|
window_remove(self->titleleft);
|
||||||
g_hash_table_remove(window_map, &self->titletop);
|
window_remove(self->titletop);
|
||||||
g_hash_table_remove(window_map, &self->titletopleft);
|
window_remove(self->titletopleft);
|
||||||
g_hash_table_remove(window_map, &self->titletopright);
|
window_remove(self->titletopright);
|
||||||
g_hash_table_remove(window_map, &self->titleright);
|
window_remove(self->titleright);
|
||||||
g_hash_table_remove(window_map, &self->titlebottom);
|
window_remove(self->titlebottom);
|
||||||
g_hash_table_remove(window_map, &self->handleleft);
|
window_remove(self->handleleft);
|
||||||
g_hash_table_remove(window_map, &self->handletop);
|
window_remove(self->handletop);
|
||||||
g_hash_table_remove(window_map, &self->handleright);
|
window_remove(self->handleright);
|
||||||
g_hash_table_remove(window_map, &self->handlebottom);
|
window_remove(self->handlebottom);
|
||||||
g_hash_table_remove(window_map, &self->lgripleft);
|
window_remove(self->lgripleft);
|
||||||
g_hash_table_remove(window_map, &self->lgriptop);
|
window_remove(self->lgriptop);
|
||||||
g_hash_table_remove(window_map, &self->lgripbottom);
|
window_remove(self->lgripbottom);
|
||||||
g_hash_table_remove(window_map, &self->rgripright);
|
window_remove(self->rgripright);
|
||||||
g_hash_table_remove(window_map, &self->rgriptop);
|
window_remove(self->rgriptop);
|
||||||
g_hash_table_remove(window_map, &self->rgripbottom);
|
window_remove(self->rgripbottom);
|
||||||
|
|
||||||
obt_main_loop_timeout_remove_data(ob_main_loop, flash_timeout, self, TRUE);
|
obt_main_loop_timeout_remove_data(ob_main_loop, flash_timeout, self, TRUE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ ObMenuFrame* menu_frame_new(ObMenu *menu, guint show_from, ObClient *client)
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
|
|
||||||
self = g_new0(ObMenuFrame, 1);
|
self = g_new0(ObMenuFrame, 1);
|
||||||
self->type = Window_Menu;
|
self->type = OB_WINDOW_CLASS_MENUFRAME;
|
||||||
self->menu = menu;
|
self->menu = menu;
|
||||||
self->selected = NULL;
|
self->selected = NULL;
|
||||||
self->client = client;
|
self->client = client;
|
||||||
|
@ -95,7 +95,8 @@ ObMenuFrame* menu_frame_new(ObMenu *menu, guint show_from, ObClient *client)
|
||||||
self->a_title = RrAppearanceCopy(ob_rr_theme->a_menu_title);
|
self->a_title = RrAppearanceCopy(ob_rr_theme->a_menu_title);
|
||||||
self->a_items = RrAppearanceCopy(ob_rr_theme->a_menu);
|
self->a_items = RrAppearanceCopy(ob_rr_theme->a_menu);
|
||||||
|
|
||||||
stacking_add(MENU_AS_WINDOW(self));
|
window_add(&self->window, MENUFRAME_AS_WINDOW(self));
|
||||||
|
stacking_add(MENUFRAME_AS_WINDOW(self));
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +109,8 @@ void menu_frame_free(ObMenuFrame *self)
|
||||||
self->entries = g_list_delete_link(self->entries, self->entries);
|
self->entries = g_list_delete_link(self->entries, self->entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
stacking_remove(MENU_AS_WINDOW(self));
|
stacking_remove(MENUFRAME_AS_WINDOW(self));
|
||||||
|
window_remove(self->window);
|
||||||
|
|
||||||
XDestroyWindow(obt_display, self->window);
|
XDestroyWindow(obt_display, self->window);
|
||||||
|
|
||||||
|
@ -179,6 +181,8 @@ static ObMenuEntryFrame* menu_entry_frame_new(ObMenuEntry *entry,
|
||||||
self->a_text_title =
|
self->a_text_title =
|
||||||
RrAppearanceCopy(ob_rr_theme->a_menu_text_title);
|
RrAppearanceCopy(ob_rr_theme->a_menu_text_title);
|
||||||
|
|
||||||
|
window_add(&self->window, MENUFRAME_AS_WINDOW(self->frame));
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,6 +191,8 @@ static void menu_entry_frame_free(ObMenuEntryFrame *self)
|
||||||
if (self) {
|
if (self) {
|
||||||
menu_entry_unref(self->entry);
|
menu_entry_unref(self->entry);
|
||||||
|
|
||||||
|
window_remove(self->window);
|
||||||
|
|
||||||
XDestroyWindow(obt_display, self->text);
|
XDestroyWindow(obt_display, self->text);
|
||||||
XDestroyWindow(obt_display, self->window);
|
XDestroyWindow(obt_display, self->window);
|
||||||
g_hash_table_remove(menu_frame_map, &self->text);
|
g_hash_table_remove(menu_frame_map, &self->text);
|
||||||
|
|
|
@ -302,8 +302,7 @@ gint main(gint argc, gchar **argv)
|
||||||
/* focus what was focused if a wm was already running */
|
/* focus what was focused if a wm was already running */
|
||||||
if (OBT_PROP_GET32(RootWindow(obt_display, ob_screen),
|
if (OBT_PROP_GET32(RootWindow(obt_display, ob_screen),
|
||||||
NET_ACTIVE_WINDOW, WINDOW, &xid) &&
|
NET_ACTIVE_WINDOW, WINDOW, &xid) &&
|
||||||
(w = g_hash_table_lookup(window_map, &xid)) &&
|
(w = window_find(xid)) && WINDOW_IS_CLIENT(w))
|
||||||
WINDOW_IS_CLIENT(w))
|
|
||||||
{
|
{
|
||||||
client_focus(WINDOW_AS_CLIENT(w));
|
client_focus(WINDOW_AS_CLIENT(w));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ ObPopup *popup_new(void)
|
||||||
XSetWindowAttributes attrib;
|
XSetWindowAttributes attrib;
|
||||||
ObPopup *self = g_new0(ObPopup, 1);
|
ObPopup *self = g_new0(ObPopup, 1);
|
||||||
|
|
||||||
self->obwin.type = Window_Internal;
|
self->obwin.type = OB_WINDOW_CLASS_INTERNALWINDOW;
|
||||||
self->gravity = NorthWestGravity;
|
self->gravity = NorthWestGravity;
|
||||||
self->x = self->y = self->textw = self->h = 0;
|
self->x = self->y = self->textw = self->h = 0;
|
||||||
self->a_bg = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg);
|
self->a_bg = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg);
|
||||||
|
@ -56,8 +56,8 @@ ObPopup *popup_new(void)
|
||||||
|
|
||||||
XMapWindow(obt_display, self->text);
|
XMapWindow(obt_display, self->text);
|
||||||
|
|
||||||
stacking_add(INTERNAL_AS_WINDOW(self));
|
stacking_add(INTERNALWINDOW_AS_WINDOW(self));
|
||||||
g_hash_table_insert(window_map, &self->bg, self);
|
window_add(&self->bg, INTERNALWINDOW_AS_WINDOW(self));
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void popup_free(ObPopup *self)
|
||||||
XDestroyWindow(obt_display, self->text);
|
XDestroyWindow(obt_display, self->text);
|
||||||
RrAppearanceFree(self->a_bg);
|
RrAppearanceFree(self->a_bg);
|
||||||
RrAppearanceFree(self->a_text);
|
RrAppearanceFree(self->a_text);
|
||||||
g_hash_table_remove(window_map, &self->bg);
|
window_remove(self->bg);
|
||||||
stacking_remove(self);
|
stacking_remove(self);
|
||||||
g_free(self);
|
g_free(self);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ static gboolean popup_show_timeout(gpointer data)
|
||||||
ObPopup *self = data;
|
ObPopup *self = data;
|
||||||
|
|
||||||
XMapWindow(obt_display, self->bg);
|
XMapWindow(obt_display, self->bg);
|
||||||
stacking_raise(INTERNAL_AS_WINDOW(self));
|
stacking_raise(INTERNALWINDOW_AS_WINDOW(self));
|
||||||
self->mapped = TRUE;
|
self->mapped = TRUE;
|
||||||
self->delay_mapped = FALSE;
|
self->delay_mapped = FALSE;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
|
|
||||||
GHashTable *window_map;
|
static GHashTable *window_map;
|
||||||
|
|
||||||
static guint window_hash(Window *w) { return *w; }
|
static guint window_hash(Window *w) { return *w; }
|
||||||
static gboolean window_comp(Window *w1, Window *w2) { return *w1 == *w2; }
|
static gboolean window_comp(Window *w1, Window *w2) { return *w1 == *w2; }
|
||||||
|
@ -46,18 +46,14 @@ void window_shutdown(gboolean reconfig)
|
||||||
Window window_top(ObWindow *self)
|
Window window_top(ObWindow *self)
|
||||||
{
|
{
|
||||||
switch (self->type) {
|
switch (self->type) {
|
||||||
case Window_Menu:
|
case OB_WINDOW_CLASS_MENUFRAME:
|
||||||
return ((ObMenuFrame*)self)->window;
|
return WINDOW_AS_MENUFRAME(self)->window;
|
||||||
case Window_Dock:
|
case OB_WINDOW_CLASS_DOCK:
|
||||||
return ((ObDock*)self)->frame;
|
return WINDOW_AS_DOCK(self)->frame;
|
||||||
case Window_DockApp:
|
case OB_WINDOW_CLASS_CLIENT:
|
||||||
/* not to be used for stacking */
|
return WINDOW_AS_CLIENT(self)->frame->window;
|
||||||
g_assert_not_reached();
|
case OB_WINDOW_CLASS_INTERNALWINDOW:
|
||||||
break;
|
return WINDOW_AS_INTERNALWINDOW(self)->window;
|
||||||
case Window_Client:
|
|
||||||
return ((ObClient*)self)->frame->window;
|
|
||||||
case Window_Internal:
|
|
||||||
return ((InternalWindow*)self)->win;
|
|
||||||
}
|
}
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
return None;
|
return None;
|
||||||
|
@ -66,19 +62,33 @@ Window window_top(ObWindow *self)
|
||||||
ObStackingLayer window_layer(ObWindow *self)
|
ObStackingLayer window_layer(ObWindow *self)
|
||||||
{
|
{
|
||||||
switch (self->type) {
|
switch (self->type) {
|
||||||
case Window_Menu:
|
case OB_WINDOW_CLASS_DOCK:
|
||||||
return OB_STACKING_LAYER_INTERNAL;
|
|
||||||
case Window_Dock:
|
|
||||||
return config_dock_layer;
|
return config_dock_layer;
|
||||||
case Window_DockApp:
|
case OB_WINDOW_CLASS_CLIENT:
|
||||||
/* not to be used for stacking */
|
|
||||||
g_assert_not_reached();
|
|
||||||
break;
|
|
||||||
case Window_Client:
|
|
||||||
return ((ObClient*)self)->layer;
|
return ((ObClient*)self)->layer;
|
||||||
case Window_Internal:
|
case OB_WINDOW_CLASS_MENUFRAME:
|
||||||
|
case OB_WINDOW_CLASS_INTERNALWINDOW:
|
||||||
return OB_STACKING_LAYER_INTERNAL;
|
return OB_STACKING_LAYER_INTERNAL;
|
||||||
}
|
}
|
||||||
g_assert_not_reached();
|
g_assert_not_reached();
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ObWindow* window_find(Window xwin)
|
||||||
|
{
|
||||||
|
g_assert(xwin != None);
|
||||||
|
return g_hash_table_lookup(window_map, &xwin);
|
||||||
|
}
|
||||||
|
|
||||||
|
void window_add(Window *xwin, ObWindow *win)
|
||||||
|
{
|
||||||
|
g_assert(xwin != NULL);
|
||||||
|
g_assert(win != NULL);
|
||||||
|
g_hash_table_insert(window_map, xwin, win);
|
||||||
|
}
|
||||||
|
|
||||||
|
void window_remove(Window xwin)
|
||||||
|
{
|
||||||
|
g_assert(xwin != None);
|
||||||
|
g_hash_table_remove(window_map, &xwin);
|
||||||
|
}
|
||||||
|
|
|
@ -28,55 +28,56 @@ typedef struct _ObWindow ObWindow;
|
||||||
typedef struct _ObInternalWindow ObInternalWindow;
|
typedef struct _ObInternalWindow ObInternalWindow;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
Window_Menu,
|
OB_WINDOW_CLASS_MENUFRAME,
|
||||||
Window_Dock,
|
OB_WINDOW_CLASS_DOCK,
|
||||||
Window_DockApp, /* used for events but not stacking */
|
OB_WINDOW_CLASS_CLIENT,
|
||||||
Window_Client,
|
OB_WINDOW_CLASS_INTERNALWINDOW
|
||||||
Window_Internal /* used for stacking but not events (except to filter
|
|
||||||
events on the root window) */
|
|
||||||
} Window_InternalType;
|
} Window_InternalType;
|
||||||
|
|
||||||
struct _ObWindow
|
/* In order to be an ObWindow, you need to make this struct the top of your
|
||||||
{
|
struct */
|
||||||
|
struct _ObWindow {
|
||||||
Window_InternalType type;
|
Window_InternalType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Wrapper for internal stuff. If its struct matches this then it can be used
|
#define WINDOW_IS_MENUFRAME(win) \
|
||||||
as an ObWindow */
|
(((ObWindow*)win)->type == OB_WINDOW_CLASS_MENUFRAME)
|
||||||
typedef struct InternalWindow {
|
#define WINDOW_IS_DOCK(win) \
|
||||||
ObWindow obwin;
|
(((ObWindow*)win)->type == OB_WINDOW_CLASS_DOCK)
|
||||||
Window win;
|
#define WINDOW_IS_CLIENT(win) \
|
||||||
} InternalWindow;
|
(((ObWindow*)win)->type == OB_WINDOW_CLASS_CLIENT)
|
||||||
|
#define WINDOW_IS_INTERNALWINDOW(win) \
|
||||||
#define WINDOW_IS_MENU(win) (((ObWindow*)win)->type == Window_Menu)
|
(((ObWindow*)win)->type == OB_WINDOW_CLASS_INTERNALWINDOW)
|
||||||
#define WINDOW_IS_DOCK(win) (((ObWindow*)win)->type == Window_Dock)
|
|
||||||
#define WINDOW_IS_DOCKAPP(win) (((ObWindow*)win)->type == Window_DockApp)
|
|
||||||
#define WINDOW_IS_CLIENT(win) (((ObWindow*)win)->type == Window_Client)
|
|
||||||
#define WINDOW_IS_INTERNAL(win) (((ObWindow*)win)->type == Window_Internal)
|
|
||||||
|
|
||||||
struct _ObMenu;
|
struct _ObMenu;
|
||||||
struct _ObDock;
|
struct _ObDock;
|
||||||
struct _ObDockApp;
|
struct _ObDockApp;
|
||||||
struct _ObClient;
|
struct _ObClient;
|
||||||
|
|
||||||
#define WINDOW_AS_MENU(win) ((struct _ObMenuFrame*)win)
|
#define WINDOW_AS_MENUFRAME(win) ((struct _ObMenuFrame*)win)
|
||||||
#define WINDOW_AS_DOCK(win) ((struct _ObDock*)win)
|
#define WINDOW_AS_DOCK(win) ((struct _ObDock*)win)
|
||||||
#define WINDOW_AS_DOCKAPP(win) ((struct _ObDockApp*)win)
|
|
||||||
#define WINDOW_AS_CLIENT(win) ((struct _ObClient*)win)
|
#define WINDOW_AS_CLIENT(win) ((struct _ObClient*)win)
|
||||||
#define WINDOW_AS_INTERNAL(win) ((struct InternalWindow*)win)
|
#define WINDOW_AS_INTERNALWINDOW(win) ((struct _ObInternalWindow*)win)
|
||||||
|
|
||||||
#define MENU_AS_WINDOW(menu) ((ObWindow*)menu)
|
#define MENUFRAME_AS_WINDOW(menu) ((ObWindow*)menu)
|
||||||
#define DOCK_AS_WINDOW(dock) ((ObWindow*)dock)
|
#define DOCK_AS_WINDOW(dock) ((ObWindow*)dock)
|
||||||
#define DOCKAPP_AS_WINDOW(dockapp) ((ObWindow*)dockapp)
|
|
||||||
#define CLIENT_AS_WINDOW(client) ((ObWindow*)client)
|
#define CLIENT_AS_WINDOW(client) ((ObWindow*)client)
|
||||||
#define INTERNAL_AS_WINDOW(intern) ((ObWindow*)intern)
|
#define INTERNALWINDOW_AS_WINDOW(intern) ((ObWindow*)intern)
|
||||||
|
|
||||||
extern GHashTable *window_map;
|
void window_startup (gboolean reconfig);
|
||||||
|
|
||||||
void window_startup(gboolean reconfig);
|
|
||||||
void window_shutdown(gboolean reconfig);
|
void window_shutdown(gboolean reconfig);
|
||||||
|
|
||||||
Window window_top(ObWindow *self);
|
Window window_top (ObWindow *self);
|
||||||
ObStackingLayer window_layer(ObWindow *self);
|
ObStackingLayer window_layer(ObWindow *self);
|
||||||
|
|
||||||
|
ObWindow* window_find (Window xwin);
|
||||||
|
void window_add (Window *xwin, ObWindow *win);
|
||||||
|
void window_remove(Window xwin);
|
||||||
|
|
||||||
|
/* Internal openbox-owned windows like the alt-tab popup */
|
||||||
|
struct _ObInternalWindow {
|
||||||
|
ObWindow obwin;
|
||||||
|
Window window;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue