From 8dc886b358ceb72a6bc649d6ebc8d9b51ddd53a8 Mon Sep 17 00:00:00 2001 From: Benoit Gschwind Date: Fri, 22 Feb 2008 22:36:52 +0100 Subject: [PATCH] The focus_cycle is now in obclient --- engines/default/plugin.c | 5 ----- openbox/client.c | 39 +++++++++++++++++++++++++++++++++++++++ openbox/event.c | 12 ++++++++++++ openbox/focus_cycle.c | 2 +- openbox/focus_cycle.h | 2 +- openbox/openbox.c | 4 ++++ openbox/screen.c | 9 +++++++++ 7 files changed, 66 insertions(+), 7 deletions(-) diff --git a/engines/default/plugin.c b/engines/default/plugin.c index faf30820..26d00ef4 100644 --- a/engines/default/plugin.c +++ b/engines/default/plugin.c @@ -1082,11 +1082,6 @@ void frame_update_layout(gpointer _self, Rect area, gboolean is_resize, gboolean OBT_PROP_SETA32(self->client->w_client, KDE_NET_WM_FRAME_STRUT, CARDINAL, vals, 4); } - - /* if this occurs while we are focus cycling, the indicator needs to - match the changes */ - if (plugin.focus_cycle_target == self->client) - focus_cycle_draw_indicator(self->client); } if (is_resize && (self->decorations & OB_FRAME_DECOR_TITLEBAR)) XResizeWindow(obp_display, self->label, self->label_width, diff --git a/openbox/client.c b/openbox/client.c index 03ce9cc6..10f33615 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -31,6 +31,7 @@ #include "grab.h" #include "prompt.h" #include "focus.h" +#include "focus_cycle.h" #include "stacking.h" #include "openbox.h" #include "group.h" @@ -663,6 +664,10 @@ ObClient *client_fake_manage(Window window) frame_engine->frame_set_decorations (self->frame, self->decorations); frame_engine->frame_update_title (self->frame, self->title); frame_engine->frame_update_layout (self->frame, self->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == self) + focus_cycle_draw_indicator(self); frame_engine->frame_update_skin (self->frame); Strut size; @@ -2482,7 +2487,13 @@ static void client_change_state(ObClient *self) OBT_PROP_SETA32(self->w_client, NET_WM_STATE, ATOM, netstate, num); if (self->frame) + { frame_engine->frame_update_layout (self->frame, self->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == self) + focus_cycle_draw_indicator(self); + } } ObClient *client_search_focus_tree(ObClient *self) @@ -2825,6 +2836,10 @@ static void client_apply_startup_state(ObClient *self, self->area = oldarea; frame_engine->frame_set_decorations (self->frame, self->decorations); frame_engine->frame_update_layout (self->frame, self->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == self) + focus_cycle_draw_indicator(self); client_configure(self, x, y, w, h, FALSE, TRUE, FALSE); /* set the desktop hint, to make sure that it always exists */ @@ -3116,6 +3131,10 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, if (send_resize_client && (w > oldw || h > oldh)) { frame_engine->frame_set_decorations (self->frame, self->decorations); frame_engine->frame_update_layout (self->frame, self->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == self) + focus_cycle_draw_indicator(self); } /* find the frame's dimensions and move/resize it */ @@ -3141,6 +3160,10 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, frame_engine->frame_set_decorations (self->frame, self->decorations); frame_engine->frame_update_layout (self->frame, self->area, TRUE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == self) + focus_cycle_draw_indicator(self); if (!user) event_end_ignore_all_enters(ignore_start); @@ -3206,6 +3229,10 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, if (send_resize_client && (w <= oldw || h <= oldh)) { frame_engine->frame_set_decorations (self->frame, self->decorations); frame_engine->frame_update_layout (self->frame, self->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == self) + focus_cycle_draw_indicator(self); } XFlush(obt_display); @@ -3427,6 +3454,10 @@ void client_shade(ObClient *self, gboolean shade) /* resize the frame to just the titlebar */ frame_engine->frame_set_is_shaded (self->frame, self->shaded); frame_engine->frame_update_layout(self->frame, self->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == self) + focus_cycle_draw_indicator(self); } static void client_ping_event(ObClient *self, gboolean dead) @@ -3580,6 +3611,10 @@ static void client_set_desktop_recursive(ObClient *self, /* the frame can display the current desktop state */ frame_engine->frame_set_decorations (self->frame, self->decorations); frame_engine->frame_update_layout(self->frame, self->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == self) + focus_cycle_draw_indicator(self); /* 'move' the window to the new desktop */ if (!donthide) client_hide(self); @@ -4536,6 +4571,10 @@ void client_show_frame(ObClient * self) { frame_engine->frame_set_is_visible(self->frame, TRUE); frame_engine->frame_update_layout(self->frame, self->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == self) + focus_cycle_draw_indicator(self); frame_engine->frame_update_skin(self->frame); /* Grab the server to make sure that the frame window is mapped before the client gets its MapNotify, i.e. to make sure the client is diff --git a/openbox/event.c b/openbox/event.c index a9f526b2..980141de 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -529,6 +529,10 @@ static void event_process(const XEvent *ec, gpointer data) window with RevertToParent focus */ frame_engine->frame_set_is_focus(client->frame, FALSE); frame_engine->frame_update_layout (client->frame, client->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == client) + focus_cycle_draw_indicator(client); frame_engine->frame_update_skin(client->frame); /* focus_set_client(NULL) has already been called */ } @@ -594,6 +598,10 @@ static void event_process(const XEvent *ec, gpointer data) focus_left_screen = FALSE; frame_engine->frame_set_is_focus(client->frame, TRUE); frame_engine->frame_update_layout (client->frame, client->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == client) + focus_cycle_draw_indicator(client); frame_engine->frame_update_skin (client->frame); focus_set_client(client); client_calc_layer(client); @@ -641,6 +649,10 @@ static void event_process(const XEvent *ec, gpointer data) if (client && client != focus_client) { frame_engine->frame_set_is_focus(client->frame, FALSE); frame_engine->frame_update_layout (client->frame, client->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == client) + focus_cycle_draw_indicator(client); frame_engine->frame_update_skin(client->frame); /* focus_set_client(NULL) has already been called in this section or by focus_fallback */ diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c index f2146e7b..35f46f25 100644 --- a/openbox/focus_cycle.c +++ b/openbox/focus_cycle.c @@ -29,7 +29,7 @@ #include #include -//ObClient *focus_cycle_target = NULL; +ObClient *focus_cycle_target = NULL; static gboolean focus_cycle_iconic_windows; static gboolean focus_cycle_all_desktops; static gboolean focus_cycle_dock_windows; diff --git a/openbox/focus_cycle.h b/openbox/focus_cycle.h index 97ac8467..c31abc81 100644 --- a/openbox/focus_cycle.h +++ b/openbox/focus_cycle.h @@ -29,7 +29,7 @@ struct _ObClient; /*! The client which appears focused during a focus cycle operation */ -//extern struct _ObClient *focus_cycle_target; +extern struct _ObClient *focus_cycle_target; void focus_cycle_startup(gboolean reconfig); void focus_cycle_shutdown(gboolean reconfig); diff --git a/openbox/openbox.c b/openbox/openbox.c index d1bb0f47..3bbb9687 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -338,6 +338,10 @@ gint main(gint argc, gchar **argv) client_setup_decor_and_functions(c, FALSE); /* redraw the frames */ frame_engine->frame_update_layout (c->frame, c->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == c) + focus_cycle_draw_indicator(c); /* the decor sizes may have changed, so the windows may end up in new positions */ client_reconfigure(c, FALSE); diff --git a/openbox/screen.c b/openbox/screen.c index 617923b0..64421e17 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -30,6 +30,7 @@ #include "engine_interface.h" #include "event.h" #include "focus.h" +#include "focus_cycle.h" #include "popup.h" #include "render/render.h" #include "gettext.h" @@ -573,6 +574,10 @@ static void screen_fallback_focus(void) server FocusIn event */ frame_engine->frame_set_is_focus (c->frame, TRUE); frame_engine->frame_update_layout (c->frame, c->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == c) + focus_cycle_draw_indicator(c); frame_engine->frame_update_skin (c->frame); /* do this here so that if you switch desktops to a window with helper windows then the helper windows won't flash */ @@ -1230,6 +1235,10 @@ void screen_show_desktop(gboolean show, ObClient *show_only) server FocusIn event */ frame_engine->frame_set_is_focus(c->frame, TRUE); frame_engine->frame_update_layout (c->frame, c->area, FALSE, FALSE); + /* if this occurs while we are focus cycling, the indicator needs to + match the changes */ + if (focus_cycle_target == c) + focus_cycle_draw_indicator(c); frame_engine->frame_update_skin (c->frame); } } -- 2.39.2