From 02355a54cf25c63a65c2d81369562c32a6b58bf3 Mon Sep 17 00:00:00 2001 From: Benoit Gschwind Date: Sat, 23 Feb 2008 14:35:42 +0100 Subject: [PATCH] Small perfomance improvement, misc clean up --- engines/default/plugin.c | 2 - openbox/actions/moveresizeto.c | 4 +- openbox/actions/resize.c | 4 +- openbox/client.c | 167 ++++++++++++++++---------------- openbox/client_menu.c | 4 +- openbox/engine_interface.c | 46 +++------ openbox/engine_interface.h | 8 +- openbox/event.c | 74 +++++++------- openbox/focus_cycle.c | 48 ++++----- openbox/focus_cycle_indicator.c | 2 +- openbox/moveresize.c | 18 ++-- openbox/openbox.c | 13 +-- openbox/openbox.h | 2 +- openbox/place.c | 16 +-- openbox/resist.c | 16 +-- openbox/screen.c | 12 +-- openbox/stacking.c | 8 +- 17 files changed, 205 insertions(+), 239 deletions(-) diff --git a/engines/default/plugin.c b/engines/default/plugin.c index ee1cea3f..27d00044 100644 --- a/engines/default/plugin.c +++ b/engines/default/plugin.c @@ -1563,8 +1563,6 @@ ObFrameEngine engine = { frame_set_is_max_vert, /* */ frame_set_is_max_horz, /* */ frame_set_is_shaded, /* */ - 0, //frame_flash_start, /* */ - 0, //frame_flash_stop, /* */ frame_set_decorations, /* */ frame_update_title, /* */ /* This give the window area */ diff --git a/openbox/actions/moveresizeto.c b/openbox/actions/moveresizeto.c index 02e1c255..5048279d 100644 --- a/openbox/actions/moveresizeto.c +++ b/openbox/actions/moveresizeto.c @@ -127,9 +127,9 @@ static gboolean run_func(ObActionsData *data, gpointer options) client_try_configure(c, &x, &y, &w, &h, &lw, &lh, TRUE); Strut c_size; - frame_engine->frame_get_size(c->frame, &c_size); + frame_engine.frame_get_size(c->frame, &c_size); Rect c_area; - frame_engine->frame_get_window_area(c->frame, &c_area); + frame_engine.frame_get_window_area(c->frame, &c_area); /* get the frame's size */ w += c_size.left + c_size.right; h += c_size.top + c_size.bottom; diff --git a/openbox/actions/resize.c b/openbox/actions/resize.c index e6166c83..e8dcf628 100644 --- a/openbox/actions/resize.c +++ b/openbox/actions/resize.c @@ -68,9 +68,9 @@ static gboolean run_func(ObActionsData *data, gpointer options) guint32 corner; Strut c_size; - frame_engine->frame_get_size(c->frame, &c_size); + frame_engine.frame_get_size(c->frame, &c_size); Rect c_area; - frame_engine->frame_get_window_area(c->frame, &c_area); + frame_engine.frame_get_window_area(c->frame, &c_area); if (!data->button) corner = OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_KEYBOARD); else if (o->corner_specified) diff --git a/openbox/client.c b/openbox/client.c index 675b7790..15c430d7 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -276,7 +276,7 @@ void client_manage(Window window, ObPrompt *prompt) } self->w_frame = createWindow(RootWindow(obt_display, ob_screen), visual, mask, &attrib); - self->frame = frame_engine->frame_new(self, self->w_client, self->w_frame); + self->frame = frame_engine.frame_new(self, self->w_client, self->w_frame); /* reparent the client to the frame */ XReparentWindow(obt_display, self->w_client, self->w_frame, 0, 0); @@ -293,7 +293,7 @@ void client_manage(Window window, ObPrompt *prompt) req's) the ButtonPress is to catch clicks on the client border */ XSelectInput(obt_display, self->w_frame, FRAME_EVENTMASK); - frame_engine->frame_grab(self->frame, window_map); + frame_engine.frame_grab(self->frame, window_map); /* we've grabbed everything and set everything that we need to at mapping time now */ @@ -337,13 +337,13 @@ void client_manage(Window window, ObPrompt *prompt) /* adjust the frame to the client's size before showing or placing the window */ - frame_engine->frame_set_hover_flag (self->frame, OB_BUTTON_NONE); - frame_engine->frame_set_press_flag (self->frame, OB_BUTTON_NONE); - frame_engine->frame_set_is_focus (self->frame, FALSE); - 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, TRUE); - frame_engine->frame_update_skin (self->frame); + frame_engine.frame_set_hover_flag (self->frame, OB_BUTTON_NONE); + frame_engine.frame_set_press_flag (self->frame, OB_BUTTON_NONE); + frame_engine.frame_set_is_focus (self->frame, FALSE); + 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, TRUE); + //frame_engine->frame_update_skin (self->frame); /* where the frame was placed is where the window was originally */ place = self->area; @@ -424,7 +424,7 @@ void client_manage(Window window, ObPrompt *prompt) Rect *a = screen_area(self->desktop, SCREEN_AREA_ONE_MONITOR, &place); Strut size; - frame_engine->frame_get_size(self->frame, &size); + frame_engine.frame_get_size(self->frame, &size); /* get the size of the frame */ place.width += size.left + size.right; place.height += size.top + size.bottom; @@ -474,7 +474,7 @@ void client_manage(Window window, ObPrompt *prompt) self->w_client, map_time, launch_time, event_last_user_time); - if (menu_frame_visible || frame_engine->moveresize_in_progress) { + if (menu_frame_visible || frame_engine.moveresize_in_progress) { activate = FALSE; raise = TRUE; ob_debug_type(OB_DEBUG_FOCUS, @@ -660,18 +660,18 @@ ObClient *client_fake_manage(Window window) } self->w_frame = createWindow(RootWindow(obt_display, ob_screen), visual, mask, &attrib); - self->frame = frame_engine->frame_new(self, self->w_client, self->w_frame); - 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); + self->frame = frame_engine.frame_new(self, self->w_client, self->w_frame); + 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); + frame_engine.frame_update_skin (self->frame); Strut size; - frame_engine->frame_get_size(self->frame, &size); + frame_engine.frame_get_size(self->frame, &size); ob_debug("gave extents left %d right %d top %d bottom %d", size.left, size.right, size.top, size.bottom); @@ -783,8 +783,8 @@ void client_unmanage(ObClient *self) } self->fullscreen = self->max_horz = self->max_vert = FALSE; - frame_engine->frame_trigger(self, OB_TRIGGER_UNMAX_VERT); - frame_engine->frame_trigger(self, OB_TRIGGER_UNMAX_HORZ); + frame_engine.frame_trigger(self, OB_TRIGGER_UNMAX_VERT); + frame_engine.frame_trigger(self, OB_TRIGGER_UNMAX_HORZ); /* let it be moved and resized no matter what */ self->functions = OB_CLIENT_FUNC_MOVE | OB_CLIENT_FUNC_RESIZE; self->decorations = 0; /* unmanaged windows have no decor */ @@ -822,9 +822,9 @@ void client_unmanage(ObClient *self) obt_display, ob_screen), self->area.x, self->area.y); } - frame_engine->frame_ungrab(self->frame, window_map); + frame_engine.frame_ungrab(self->frame, window_map); obt_main_loop_timeout_remove_data(ob_main_loop, client_flash_timeout, self, TRUE); - frame_engine->frame_free(self->frame); + frame_engine.frame_free(self->frame); self->frame = NULL; if (ob_state() != OB_STATE_EXITING) { @@ -873,7 +873,7 @@ void client_fake_unmanage(ObClient *self) { /* this is all that got allocated to get the decorations */ - frame_engine->frame_free(self->frame); + frame_engine.frame_free(self->frame); g_free(self); } @@ -1002,17 +1002,17 @@ static void client_restore_session_state(ObClient *self) self->undecorated = self->session->undecorated; if (self->session->max_horz) { - frame_engine->frame_trigger(self->frame, OB_TRIGGER_MAX_HORZ); + frame_engine.frame_trigger(self->frame, OB_TRIGGER_MAX_HORZ); } else { - frame_engine->frame_trigger(self->frame, OB_TRIGGER_UNMAX_HORZ); + frame_engine.frame_trigger(self->frame, OB_TRIGGER_UNMAX_HORZ); } if (self->session->max_vert) { - frame_engine->frame_trigger(self->frame, OB_TRIGGER_MAX_VERT); + frame_engine.frame_trigger(self->frame, OB_TRIGGER_MAX_VERT); } else { - frame_engine->frame_trigger(self->frame, OB_TRIGGER_UNMAX_VERT); + frame_engine.frame_trigger(self->frame, OB_TRIGGER_UNMAX_VERT); } } @@ -1070,7 +1070,7 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h, frame_client_gravity(self, x, y); Strut size; - frame_engine->frame_get_size(self->frame, &size); + frame_engine.frame_get_size(self->frame, &size); /* get the requested size of the window with decorations */ fw = size.left + w + size.right; @@ -1084,7 +1084,7 @@ gboolean client_find_onscreen(ObClient *self, gint *x, gint *y, gint w, gint h, gboolean stationary_l, stationary_r, stationary_t, stationary_b; Rect area; - frame_engine->frame_get_window_area(self->frame, &area); + frame_engine.frame_get_window_area(self->frame, &area); POINT_SET(oldtl, area.x, area.y); POINT_SET(oldbr, area.x + area.width - 1, area.y + area.height - 1); @@ -1331,11 +1331,11 @@ static void client_get_state(ObClient *self) self->fullscreen = TRUE; else if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_VERT)) { self->max_vert = TRUE; - frame_engine->frame_trigger(self->frame, OB_TRIGGER_MAX_VERT); + frame_engine.frame_trigger(self->frame, OB_TRIGGER_MAX_VERT); } else if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_MAXIMIZED_HORZ)) { self->max_horz = TRUE; - frame_engine->frame_trigger(self->frame, OB_TRIGGER_MAX_HORZ); + frame_engine.frame_trigger(self->frame, OB_TRIGGER_MAX_HORZ); } else if (state[i] == OBT_PROP_ATOM(NET_WM_STATE_ABOVE)) self->above = TRUE; @@ -1944,8 +1944,8 @@ static void client_change_allowed_actions(ObClient *self) if (self->frame) client_maximize(self, FALSE, 0); else { self->max_vert = self->max_horz = FALSE; - frame_engine->frame_trigger (self->frame, OB_TRIGGER_UNMAX_VERT); - frame_engine->frame_trigger (self->frame, OB_TRIGGER_UNMAX_HORZ); + frame_engine.frame_trigger (self->frame, OB_TRIGGER_UNMAX_VERT); + frame_engine.frame_trigger (self->frame, OB_TRIGGER_UNMAX_HORZ); } } @@ -2083,8 +2083,8 @@ void client_update_title(ObClient *self) if (self->frame) { /* update title render */ - frame_engine->frame_update_title (self->frame, self->title); - frame_engine->frame_update_skin (self->frame); + frame_engine.frame_update_title (self->frame, self->title); + frame_engine.frame_update_skin (self->frame); } /* update the icon title */ @@ -2306,7 +2306,7 @@ void client_update_icons(ObClient *self) OBT_PROP_SETA32(self->w_client, NET_WM_ICON, CARDINAL, data, 48*48+2); g_free(data); } else if (self->frame) - frame_engine->frame_update_skin (self->frame); + frame_engine.frame_update_skin (self->frame); /* don't draw the icon empty if we're just setting one now anyways, we'll get the property change any second */ //frame_adjust_icon(self->frame); @@ -2488,7 +2488,7 @@ static void client_change_state(ObClient *self) if (self->frame) { - frame_engine->frame_update_layout (self->frame, self->area, FALSE, FALSE); + 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) @@ -2801,7 +2801,7 @@ static void client_apply_startup_state(ObClient *self, /* save the area, and make it where it should be for the premax stuff */ oldarea = self->area; RECT_SET(self->area, x, y, w, h); - frame_engine->frame_set_client_area (self->frame, self->area); + frame_engine.frame_set_client_area (self->frame, self->area); /* apply the states. these are in a carefully crafted order.. */ @@ -2834,14 +2834,14 @@ static void client_apply_startup_state(ObClient *self, not, so this needs to be called even if we have fullscreened/maxed */ self->area = oldarea; - frame_engine->frame_set_decorations (self->frame, self->decorations); - frame_engine->frame_update_layout (self->frame, self->area, FALSE, FALSE); + frame_engine.frame_set_decorations (self->frame, self->decorations); + frame_engine.frame_update_layout (self->frame, self->area, FALSE, FALSE); /* when the client has StaticGravity, it likes to move around. also this correctly positions the client when it maps. this also needs to be run when the frame's decorations sizes change! */ Strut size; - frame_engine->frame_get_size (self->frame, &size); + frame_engine.frame_get_size (self->frame, &size); XMoveResizeWindow(obt_display, self->w_client, size.left, size.top, self->area.width, self->area.height); @@ -2931,8 +2931,8 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, /* make the frame recalculate its dimentions n shit without changing anything visible for real, this way the constraints below can work with the updated frame dimensions. */ - frame_engine->frame_set_decorations (self->frame, self->decorations); - frame_engine->frame_update_layout (self->frame, self->area, FALSE, TRUE); + frame_engine.frame_set_decorations (self->frame, self->decorations); + frame_engine.frame_update_layout (self->frame, self->area, FALSE, TRUE); /* gets the frame's position */ frame_client_gravity(self, x, y); @@ -2966,7 +2966,7 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, (self->max_horz && self->max_vert ? NULL : &desired)); Strut size; - frame_engine->frame_get_size(self->frame, &size); + frame_engine.frame_get_size(self->frame, &size); /* set the size and position if maximized */ if (self->max_horz) { *x = a->x; @@ -3101,15 +3101,15 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, gboolean send_resize_client; gboolean moved = FALSE, resized = FALSE, rootmoved = FALSE; gboolean fmoved, fresized; - guint fdecor = frame_engine->frame_get_decorations(self->frame); - gboolean fhorz = frame_engine->frame_is_max_horz(self->frame); - gboolean fvert = frame_engine->frame_is_max_vert(self->frame); + guint fdecor = frame_engine.frame_get_decorations(self->frame); + gboolean fhorz = frame_engine.frame_is_max_horz(self->frame); + gboolean fvert = frame_engine.frame_is_max_vert(self->frame); gint logicalw, logicalh; Strut size; - frame_engine->frame_get_size(self->frame, &size); + frame_engine.frame_get_size(self->frame, &size); Rect area; - frame_engine->frame_get_window_area(self->frame, &area); + frame_engine.frame_get_window_area(self->frame, &area); /* find the new x, y, width, and height (and logical size) */ client_try_configure(self, &x, &y, &w, &h, &logicalw, &logicalh, user); @@ -3124,10 +3124,10 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, oldw = self->area.width; oldh = self->area.height; - frame_engine->frame_get_window_area(self->frame, &oldframe); + frame_engine.frame_get_window_area(self->frame, &oldframe); RECT_SET(self->area, x, y, w, h); - frame_engine->frame_set_client_area (self->frame, self->area); + frame_engine.frame_set_client_area (self->frame, self->area); /* for app-requested resizes, always resize if 'resized' is true. for user-requested ones, only resize if final is true, or when @@ -3138,8 +3138,8 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, /* if the client is enlarging, then resize the client before the frame */ 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); + 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) @@ -3167,8 +3167,8 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, would change what window gets the event */ mouse_replay_pointer(); - frame_engine->frame_set_decorations (self->frame, self->decorations); - frame_engine->frame_update_layout (self->frame, self->area, TRUE, FALSE); + 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 */ @@ -3237,8 +3237,8 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, in the direction that is growing */ 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); + 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) @@ -3251,9 +3251,10 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, this also needs to be run when the frame's decorations sizes change! */ Strut size; - frame_engine->frame_get_size(self->frame, &size); + frame_engine.frame_get_size(self->frame, &size); XMoveResizeWindow(obt_display, self->w_client, size.left, size.top, self->area.width, self->area.height); + frame_engine.frame_update_skin (self->frame); } XFlush(obt_display); @@ -3261,7 +3262,7 @@ void client_configure(ObClient *self, gint x, gint y, gint w, gint h, /* if it moved between monitors, then this can affect the stacking layer of this window or others - for fullscreen windows */ Rect current_frame; - frame_engine->frame_get_window_area(self->frame, ¤t_frame); + frame_engine.frame_get_window_area(self->frame, ¤t_frame); if (screen_find_monitor(¤t_frame) != screen_find_monitor(&oldframe)) { @@ -3449,12 +3450,12 @@ void client_maximize(ObClient *self, gboolean max, gint dir) if (dir == 0 || dir == 1) { self->max_horz = max; /* horz */ - frame_engine->frame_trigger(self->frame, max? OB_TRIGGER_MAX_HORZ : OB_TRIGGER_UNMAX_HORZ); + frame_engine.frame_trigger(self->frame, max? OB_TRIGGER_MAX_HORZ : OB_TRIGGER_UNMAX_HORZ); } if (dir == 0 || dir == 2){ self->max_vert = max; /* vert */ - frame_engine->frame_trigger(self->frame, max? OB_TRIGGER_MAX_VERT : OB_TRIGGER_UNMAX_VERT); + frame_engine.frame_trigger(self->frame, max? OB_TRIGGER_MAX_VERT : OB_TRIGGER_UNMAX_VERT); } client_change_state(self); /* change the state hints on the client */ @@ -3473,8 +3474,8 @@ void client_shade(ObClient *self, gboolean shade) client_change_state(self); client_change_wm_state(self); /* the window is being hidden/shown */ /* 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); + 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) @@ -3630,8 +3631,8 @@ static void client_set_desktop_recursive(ObClient *self, self->desktop = target; OBT_PROP_SET32(self->w_client, NET_WM_DESKTOP, CARDINAL, target); /* 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); + 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) @@ -3909,7 +3910,7 @@ gboolean client_can_focus(ObClient *self) /* choose the correct target */ self = client_focus_target(self); - if (!frame_engine->frame_is_visible(self->frame)) + if (!frame_engine.frame_is_visible(self->frame)) return FALSE; if (!(self->can_focus || self->focus_notify)) @@ -3995,7 +3996,7 @@ static void client_present(ObClient *self, gboolean here, gboolean raise, client_set_desktop(self, screen_desktop, FALSE, TRUE); else screen_set_desktop(self->desktop, FALSE); - } else if (!frame_engine->frame_is_visible(self->frame)) + } else if (!frame_engine.frame_is_visible(self->frame)) /* if its not visible for other reasons, then don't mess with it */ return; @@ -4133,7 +4134,7 @@ void client_set_undecorated(ObClient *self, gboolean undecorated) guint client_monitor(ObClient *self) { Rect area; - frame_engine->frame_get_window_area(self->frame, &area); + frame_engine.frame_get_window_area(self->frame, &area); return screen_find_monitor(&area); } @@ -4330,9 +4331,9 @@ void client_find_edge_directional(ObClient *self, ObDirection dir, gint edge; Strut size; - frame_engine->frame_get_size(self->frame, &size); + frame_engine.frame_get_size(self->frame, &size); Rect area; - frame_engine->frame_get_window_area(self->frame, &area); + frame_engine.frame_get_window_area(self->frame, &area); a = screen_area(self->desktop, SCREEN_AREA_ALL_MONITORS, &area); @@ -4386,7 +4387,7 @@ void client_find_edge_directional(ObClient *self, ObDirection dir, ob_debug("trying window %s", cur->title); Rect area; - frame_engine->frame_get_window_area(self->frame, &area); + frame_engine.frame_get_window_area(self->frame, &area); detect_edge(area, dir, my_head, my_size, my_edge_start, my_edge_size, dest, near_edge); } @@ -4406,7 +4407,7 @@ void client_find_move_directional(ObClient *self, ObDirection dir, Rect area; - frame_engine->frame_get_window_area(self->frame, &area); + frame_engine.frame_get_window_area(self->frame, &area); switch (dir) { case OB_DIRECTION_EAST: @@ -4478,9 +4479,9 @@ void client_find_resize_directional(ObClient *self, ObDirection side, ObDirection dir; Rect area; - frame_engine->frame_get_window_area(self->frame, &area); + frame_engine.frame_get_window_area(self->frame, &area); Strut size; - frame_engine->frame_get_size(self->frame, &size); + frame_engine.frame_get_size(self->frame, &size); switch (side) { case OB_DIRECTION_EAST: @@ -4565,8 +4566,8 @@ ObClient* client_under_pointer(void) if (WINDOW_IS_CLIENT(it->data)) { ObClient *c = WINDOW_AS_CLIENT(it->data); Rect area; - frame_engine->frame_get_window_area(c->frame, &area); - if (frame_engine->frame_is_visible(c->frame) && + frame_engine.frame_get_window_area(c->frame, &area); + if (frame_engine.frame_is_visible(c->frame) && /* check the desktop, this is done during desktop switching and windows are shown/hidden status is not reliable */ @@ -4590,13 +4591,13 @@ gboolean client_has_group_siblings(ObClient *self) 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); + 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); + 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 _visible_ when it gets MapNotify. */ @@ -4608,7 +4609,7 @@ void client_show_frame(ObClient * self) void client_hide_frame(ObClient * self) { - frame_engine->frame_set_is_visible(self->frame, FALSE); + frame_engine.frame_set_is_visible(self->frame, FALSE); XUnmapWindow(obt_display, self->w_frame); /* we unmap the client itself so that we can get MapRequest events, and because the ICCCM tells us to! */ @@ -4632,8 +4633,8 @@ gboolean client_flash_timeout(gpointer data) self->flash_on = !self->flash_on; if (!self->focused) { - frame_engine->frame_set_is_focus(self->frame, self->flash_on); - frame_engine->frame_update_skin (self->frame); + frame_engine.frame_set_is_focus(self->frame, self->flash_on); + frame_engine.frame_update_skin (self->frame); self->focused = FALSE; } return TRUE; /* go again */ @@ -4661,7 +4662,7 @@ void client_flash_done(gpointer data) ObClient * self = (ObClient *) data; if (self->focused != self->flash_on) { - frame_engine->frame_set_is_focus(self->frame, self->focused); - frame_engine->frame_update_skin (self->frame); + frame_engine.frame_set_is_focus(self->frame, self->focused); + frame_engine.frame_update_skin (self->frame); } } diff --git a/openbox/client_menu.c b/openbox/client_menu.c index f629e54b..5d6134cc 100644 --- a/openbox/client_menu.c +++ b/openbox/client_menu.c @@ -298,9 +298,9 @@ static void client_menu_place(ObMenuFrame *frame, gint *x, gint *y, if (!mouse && frame->client) { Strut size; - frame_engine->frame_get_size(frame->client->frame, &size); + frame_engine.frame_get_size(frame->client->frame, &size); Rect area; - frame_engine->frame_get_window_area(frame->client->frame, &area); + frame_engine.frame_get_window_area(frame->client->frame, &area); *x = area.x; diff --git a/openbox/engine_interface.c b/openbox/engine_interface.c index f43e7fd2..7c1c9e9e 100644 --- a/openbox/engine_interface.c +++ b/openbox/engine_interface.c @@ -24,7 +24,6 @@ #include "obt/paths.h" #define SHARED_SUFFIX ".la" -#define PLUGIN_PATH "/.config/openbox/engines/" gchar *create_class_name(const gchar *rname); @@ -34,7 +33,7 @@ XrmDatabase loaddb(const gchar *name, gchar **path); /* Read string in XrmDatabase */ gboolean read_string(XrmDatabase db, const gchar *rname, gchar **value); -ObFrameEngine * init_frame_engine(const gchar *name, gboolean allow_fallback, +void init_frame_engine(ObFrameEngine * p_engine, const gchar *name, gboolean allow_fallback, RrFont *active_window_font, RrFont *inactive_window_font, RrFont *menu_title_font, RrFont *menu_item_font, RrFont *osd_font) { @@ -45,24 +44,8 @@ ObFrameEngine * init_frame_engine(const gchar *name, gboolean allow_fallback, db = loaddb(name, &path); if (db == NULL) { g_message("Unable to load the theme '%s'", name); - if (allow_fallback) - //g_message("Falling back to the default theme '%s'", DEFAULT_THEME); - /* fallback to the default theme */ - name = NULL; } } - if (name == NULL) { - if (allow_fallback) { - //db = loaddb(DEFAULT_THEME, &path); - db = NULL; - if (db == NULL) { - //g_message("Unable to load the theme '%s'", DEFAULT_THEME); - return 0; - } - } - else - return 0; - } gchar * engine_filename; if (!read_string(db, "frame.theme.engine", &engine_filename)) { @@ -74,26 +57,19 @@ ObFrameEngine * init_frame_engine(const gchar *name, gboolean allow_fallback, ObFrameEngine * p = load_frame_engine(absolute_engine_filename); g_free(absolute_engine_filename); - update_frame_engine(p); + memcpy(p_engine, p, sizeof(ObFrameEngine)); + update_frame_engine(); (p->load_theme_config)(ob_rr_inst, name, path, db, active_window_font, inactive_window_font, menu_title_font, menu_item_font, osd_font); g_free(path); XrmDestroyDatabase(db); - - return p; } -void update_frame_engine(ObFrameEngine * self) +void update_frame_engine() { - self->init (obt_display, ob_screen); - //self->ob_display = obt_display; - //self->ob_screen = ob_screen; - //self->ob_rr_inst = ob_rr_inst; - //self->config_theme_keepborder = config_theme_keepborder; - //self->config_title_layout = config_title_layout; - //self->ob_main_loop = ob_main_loop; + frame_engine.init (obt_display, ob_screen); } ObFrameEngine * load_frame_engine(const gchar * filename) @@ -249,7 +225,7 @@ ObFrameContext frame_context_from_string(const gchar *name) ObFrameContext engine_frame_context(ObClient *client, Window win, gint x, gint y) { /* this part is commun to all engine */ - if (frame_engine->moveresize_in_progress) + if (frame_engine.moveresize_in_progress) return OB_FRAME_CONTEXT_MOVE_RESIZE; if (win == obt_root(ob_screen)) return OB_FRAME_CONTEXT_ROOT; @@ -263,14 +239,14 @@ ObFrameContext engine_frame_context(ObClient *client, Window win, gint x, gint y return OB_FRAME_CONTEXT_CLIENT; } /* this part is specific to the plugin */ - return frame_engine->frame_context(client->frame, win, x, y); + return frame_engine.frame_context(client->frame, win, x, y); } void frame_client_gravity(ObClient *self, gint *x, gint *y) { Strut size; - frame_engine->frame_get_size(self->frame, &size); + frame_engine.frame_get_size(self->frame, &size); /* horizontal */ switch (self->gravity) { default: @@ -333,7 +309,7 @@ void frame_client_gravity(ObClient *self, gint *x, gint *y) void frame_frame_gravity(ObClient *self, gint *x, gint *y) { Strut size; - frame_engine->frame_get_size(self->frame, &size); + frame_engine.frame_get_size(self->frame, &size); /* horizontal */ switch (self->gravity) { default: @@ -390,7 +366,7 @@ void frame_frame_gravity(ObClient *self, gint *x, gint *y) void frame_rect_to_frame(ObClient * self, Rect *r) { Strut size; - frame_engine->frame_get_size(self->frame, &size); + frame_engine.frame_get_size(self->frame, &size); r->width += size.left + size.right; r->height += size.top + size.bottom; frame_client_gravity(self, &r->x, &r->y); @@ -399,7 +375,7 @@ void frame_rect_to_frame(ObClient * self, Rect *r) void frame_rect_to_client(ObClient * self, Rect *r) { Strut size; - frame_engine->frame_get_size(self, &size); + frame_engine.frame_get_size(self, &size); r->width -= size.left + size.right; r->height -= size.top + size.bottom; frame_frame_gravity(self, &r->x, &r->y); diff --git a/openbox/engine_interface.h b/openbox/engine_interface.h index 0e6522b7..7be7eae5 100644 --- a/openbox/engine_interface.h +++ b/openbox/engine_interface.h @@ -151,9 +151,6 @@ struct _ObFrameEngine void (*frame_set_is_max_horz)(gpointer, gboolean); void (*frame_set_is_shaded)(gpointer, gboolean); - void (*frame_flash_start)(gpointer self); - void (*frame_flash_stop)(gpointer self); - /* Set the layout wanted by client */ void (*frame_set_decorations)(gpointer, ObFrameDecorations); @@ -190,7 +187,6 @@ struct _ObFrameEngine /* Filled by openbox-core */ struct _ObClient *focus_cycle_target; gboolean moveresize_in_progress; - //struct _ObtMainLoop *ob_main_loop; }; /* Define how to draw the current windows */ enum _ObStyle @@ -212,12 +208,12 @@ typedef ObFrameEngine * (*ObFrameEngineFunc)(void); /* initialize theme plugin, it read themerc and load * the plugin needed */ -ObFrameEngine * init_frame_engine(const gchar *name, gboolean allow_fallback, +void init_frame_engine(ObFrameEngine * engine_ptr, const gchar * name, gboolean allow_fallback, RrFont *active_window_font, RrFont *inactive_window_font, RrFont *menu_title_font, RrFont *menu_item_font, RrFont *osd_font); /* Update plugin data */ -void update_frame_engine(ObFrameEngine *); +void update_frame_engine(); /* Load modules specified in filename */ ObFrameEngine * load_frame_engine(const gchar * filename); diff --git a/openbox/event.c b/openbox/event.c index b41a0cf5..acbf671c 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -527,13 +527,13 @@ static void event_process(const XEvent *ec, gpointer data) /* We don't get a FocusOut for this case, because it's just moving from our Inferior up to us. This happens when iconifying a window with RevertToParent focus */ - frame_engine->frame_set_is_focus(client->frame, FALSE); - frame_engine->frame_update_layout (client->frame, client->area, FALSE, FALSE); + 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); + frame_engine.frame_update_skin(client->frame); /* focus_set_client(NULL) has already been called */ } else if (e->xfocus.detail == NotifyPointerRoot || @@ -596,13 +596,13 @@ static void event_process(const XEvent *ec, gpointer data) } else if (client != focus_client) { focus_left_screen = FALSE; - frame_engine->frame_set_is_focus(client->frame, TRUE); - frame_engine->frame_update_layout (client->frame, client->area, FALSE, 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); + frame_engine.frame_update_skin (client->frame); focus_set_client(client); client_calc_layer(client); client_bring_helper_windows(client); @@ -647,13 +647,13 @@ 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); + 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); + frame_engine.frame_update_skin(client->frame); /* focus_set_client(NULL) has already been called in this section or by focus_fallback */ } @@ -690,7 +690,7 @@ static void event_process(const XEvent *ec, gpointer data) /* set the frame extents on the window */ Strut size; - frame_engine->frame_get_size(c->frame, &size); + frame_engine.frame_get_size(c->frame, &size); vals[0] = size.left; vals[1] = size.right; vals[2] = size.top; @@ -727,7 +727,7 @@ static void event_process(const XEvent *ec, gpointer data) e->type == obt_display_extension_sync_basep + XSyncAlarmNotify) { XSyncAlarmNotifyEvent *se = (XSyncAlarmNotifyEvent*)e; - if (se->alarm == moveresize_alarm && frame_engine->moveresize_in_progress) + if (se->alarm == moveresize_alarm && frame_engine.moveresize_in_progress) moveresize_event(e); } #endif @@ -919,7 +919,7 @@ static void event_handle_client(ObClient *client, XEvent *e) } if (current_button) - frame_engine->frame_set_hover_flag (client->frame, current_button); + frame_engine.frame_set_hover_flag (client->frame, current_button); } break; case MotionNotify: @@ -934,22 +934,22 @@ static void event_handle_client(ObClient *client, XEvent *e) case OB_FRAME_CONTEXT_TLCORNER: case OB_FRAME_CONTEXT_TRCORNER: /* we've left the button area inside the titlebar */ - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_NONE); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_NONE); break; case OB_FRAME_CONTEXT_MAXIMIZE: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_MAX); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_MAX); break; case OB_FRAME_CONTEXT_ALLDESKTOPS: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_DESK); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_DESK); break; case OB_FRAME_CONTEXT_SHADE: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_SHADE); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_SHADE); break; case OB_FRAME_CONTEXT_ICONIFY: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_ICONIFY); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_ICONIFY); break; case OB_FRAME_CONTEXT_CLOSE: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_CLOSE); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_CLOSE); break; default: break; @@ -963,22 +963,22 @@ static void event_handle_client(ObClient *client, XEvent *e) case OB_FRAME_CONTEXT_TLCORNER: case OB_FRAME_CONTEXT_TRCORNER: /* we've left the button area inside the titlebar */ - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_NONE); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_NONE); break; case OB_FRAME_CONTEXT_MAXIMIZE: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_NONE); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_NONE); break; case OB_FRAME_CONTEXT_ALLDESKTOPS: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_NONE); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_NONE); break; case OB_FRAME_CONTEXT_SHADE: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_NONE); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_NONE); break; case OB_FRAME_CONTEXT_ICONIFY: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_NONE); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_NONE); break; case OB_FRAME_CONTEXT_CLOSE: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_NONE); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_NONE); break; case OB_FRAME_CONTEXT_FRAME: @@ -1010,19 +1010,19 @@ static void event_handle_client(ObClient *client, XEvent *e) e->xcrossing.x, e->xcrossing.y); switch (con) { case OB_FRAME_CONTEXT_MAXIMIZE: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_MAX); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_MAX); break; case OB_FRAME_CONTEXT_ALLDESKTOPS: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_DESK); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_DESK); break; case OB_FRAME_CONTEXT_SHADE: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_SHADE); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_SHADE); break; case OB_FRAME_CONTEXT_ICONIFY: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_ICONIFY); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_ICONIFY); break; case OB_FRAME_CONTEXT_CLOSE: - frame_engine->frame_set_hover_flag(client->frame, OB_BUTTON_CLOSE); + frame_engine.frame_set_hover_flag(client->frame, OB_BUTTON_CLOSE); break; case OB_FRAME_CONTEXT_FRAME: if (grab_on_keyboard()) @@ -1077,7 +1077,7 @@ static void event_handle_client(ObClient *client, XEvent *e) ob_debug("ConfigureRequest for \"%s\" desktop %d wmstate %d " "visibile %d", client->title, - screen_desktop, client->wmstate, frame_engine->frame_is_visible(client->frame), + screen_desktop, client->wmstate, frame_engine.frame_is_visible(client->frame), x, y, w, h, client->border_width); if (e->xconfigurerequest.value_mask & CWBorderWidth) @@ -1172,9 +1172,9 @@ static void event_handle_client(ObClient *client, XEvent *e) 2, click amarok tray icon. it will move by its decoration size. */ Strut size; - frame_engine->frame_get_size(client->frame, &size); + frame_engine.frame_get_size(client->frame, &size); Rect area; - frame_engine->frame_get_window_area(client->frame, &area); + frame_engine.frame_get_window_area(client->frame, &area); if (x != client->area.x && x == (area.x + size.left - (gint)client->border_width) && @@ -1580,7 +1580,7 @@ static void event_handle_client(ObClient *client, XEvent *e) e->type == obt_display_extension_shape_basep) { client->shaped = ((XShapeEvent*)e)->shaped; - frame_engine->frame_adjust_shape(client->frame); + frame_engine.frame_adjust_shape(client->frame); } #endif } @@ -1879,7 +1879,7 @@ static void event_handle_user_input(ObClient *client, XEvent *e) /* if the keyboard interactive action uses the event then dont use it for bindings. likewise is moveresize uses the event. */ if (!actions_interactive_input_event(e) && !moveresize_event(e)) { - if (frame_engine->moveresize_in_progress) + if (frame_engine.moveresize_in_progress) /* make further actions work on the client being moved/resized */ client = moveresize_client; @@ -1892,7 +1892,7 @@ static void event_handle_user_input(ObClient *client, XEvent *e) in the case where it is animating before disappearing */ mouse_event(client, e); } else - keyboard_event((frame_engine->focus_cycle_target ? frame_engine->focus_cycle_target : + keyboard_event((frame_engine.focus_cycle_target ? frame_engine.focus_cycle_target : (client ? client : focus_client)), e); } } @@ -1914,7 +1914,7 @@ static gboolean focus_delay_func(gpointer data) Time old = event_curtime; /* don't move focus and kill the menu or the move/resize */ - if (menu_frame_visible || frame_engine->moveresize_in_progress) return FALSE; + if (menu_frame_visible || frame_engine.moveresize_in_progress) return FALSE; event_curtime = d->time; event_curserial = d->serial; @@ -2002,7 +2002,7 @@ void event_cancel_all_key_grabs(void) menu_frame_hide_all(); ob_debug("KILLED open menus"); } - else if (frame_engine->moveresize_in_progress) { + else if (frame_engine.moveresize_in_progress) { moveresize_end(TRUE); ob_debug("KILLED interactive moveresize"); } diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c index 35f46f25..d8e73b98 100644 --- a/openbox/focus_cycle.c +++ b/openbox/focus_cycle.c @@ -54,7 +54,7 @@ void focus_cycle_stop(ObClient *ifclient) { /* stop focus cycling if the given client is a valid focus target, and so the cycling is being disrupted */ - if (frame_engine->focus_cycle_target && ifclient && + if (frame_engine.focus_cycle_target && ifclient && focus_valid_target(ifclient, TRUE, focus_cycle_iconic_windows, focus_cycle_all_desktops, @@ -80,7 +80,7 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops, if (interactive) { if (cancel) { - frame_engine->focus_cycle_target = NULL; + frame_engine.focus_cycle_target = NULL; goto done_cycle; } else if (done) goto done_cycle; @@ -97,14 +97,14 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops, } - if (frame_engine->focus_cycle_target == NULL) { + if (frame_engine.focus_cycle_target == NULL) { focus_cycle_iconic_windows = TRUE; focus_cycle_all_desktops = all_desktops; focus_cycle_dock_windows = dock_windows; focus_cycle_desktop_windows = desktop_windows; start = it = g_list_find(list, focus_client); } else - start = it = g_list_find(list, frame_engine->focus_cycle_target); + start = it = g_list_find(list, frame_engine.focus_cycle_target); if (!start) /* switched desktops or something? */ start = it = forward ? g_list_last(list) : g_list_first(list); @@ -126,8 +126,8 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops, focus_cycle_desktop_windows)) { if (interactive) { - if (ft != frame_engine->focus_cycle_target) { /* prevents flicker */ - frame_engine->focus_cycle_target = ft; + if (ft != frame_engine.focus_cycle_target) { /* prevents flicker */ + frame_engine.focus_cycle_target = ft; focus_cycle_draw_indicator(showbar ? ft : NULL); } /* same arguments as focus_target_valid */ @@ -137,9 +137,9 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops, focus_cycle_dock_windows, focus_cycle_desktop_windows, mode); - return frame_engine->focus_cycle_target; - } else if (ft != frame_engine->focus_cycle_target) { - frame_engine->focus_cycle_target = ft; + return frame_engine.focus_cycle_target; + } else if (ft != frame_engine.focus_cycle_target) { + frame_engine.focus_cycle_target = ft; done = TRUE; break; } @@ -147,10 +147,10 @@ ObClient* focus_cycle(gboolean forward, gboolean all_desktops, } while (it != start); done_cycle: - if (done && !cancel) ret = frame_engine->focus_cycle_target; + if (done && !cancel) ret = frame_engine.focus_cycle_target; t = NULL; - frame_engine->focus_cycle_target = NULL; + frame_engine.focus_cycle_target = NULL; g_list_free(order); order = NULL; @@ -178,7 +178,7 @@ static ObClient *focus_find_directional(ObClient *c, ObDirection dir, return NULL; Rect area; - frame_engine->frame_get_window_area(c->frame, &area); + frame_engine.frame_get_window_area(c->frame, &area); /* first, find the centre coords of the currently focused window */ my_cx = area.x + area.width / 2; my_cy = area.y + area.height / 2; @@ -197,7 +197,7 @@ static ObClient *focus_find_directional(ObClient *c, ObDirection dir, continue; Rect cur_area; - frame_engine->frame_get_window_area(cur->frame, &cur_area); + frame_engine.frame_get_window_area(cur->frame, &cur_area); /* find the centre coords of this window, from the * currently focused window's point of view */ his_cx = (cur_area.x - my_cx) @@ -273,7 +273,7 @@ ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows, ObClient *ret = NULL; if (cancel) { - frame_engine->focus_cycle_target = NULL; + frame_engine.focus_cycle_target = NULL; goto done_cycle; } else if (done && interactive) goto done_cycle; @@ -281,7 +281,7 @@ ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows, if (!focus_order) goto done_cycle; - if (frame_engine->focus_cycle_target == NULL) { + if (frame_engine.focus_cycle_target == NULL) { focus_cycle_iconic_windows = FALSE; focus_cycle_all_desktops = FALSE; focus_cycle_dock_windows = dock_windows; @@ -290,8 +290,8 @@ ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows, if (!first) first = focus_client; - if (frame_engine->focus_cycle_target) - ft = focus_find_directional(frame_engine->focus_cycle_target, dir, dock_windows, + if (frame_engine.focus_cycle_target) + ft = focus_find_directional(frame_engine.focus_cycle_target, dir, dock_windows, desktop_windows); else if (first) ft = focus_find_directional(first, dir, dock_windows, desktop_windows); @@ -307,26 +307,26 @@ ObClient* focus_directional_cycle(ObDirection dir, gboolean dock_windows, ft = it->data; } - if (ft && ft != frame_engine->focus_cycle_target) {/* prevents flicker */ - frame_engine->focus_cycle_target = ft; + if (ft && ft != frame_engine.focus_cycle_target) {/* prevents flicker */ + frame_engine.focus_cycle_target = ft; if (!interactive) goto done_cycle; focus_cycle_draw_indicator(showbar ? ft : NULL); } - if (frame_engine->focus_cycle_target && dialog) + if (frame_engine.focus_cycle_target && dialog) /* same arguments as focus_target_valid */ - focus_cycle_popup_single_show(frame_engine->focus_cycle_target, + focus_cycle_popup_single_show(frame_engine.focus_cycle_target, focus_cycle_iconic_windows, focus_cycle_all_desktops, focus_cycle_dock_windows, focus_cycle_desktop_windows); - return frame_engine->focus_cycle_target; + return frame_engine.focus_cycle_target; done_cycle: - if (done && !cancel) ret = frame_engine->focus_cycle_target; + if (done && !cancel) ret = frame_engine.focus_cycle_target; first = NULL; - frame_engine->focus_cycle_target = NULL; + frame_engine.focus_cycle_target = NULL; focus_cycle_draw_indicator(NULL); focus_cycle_popup_single_hide(); diff --git a/openbox/focus_cycle_indicator.c b/openbox/focus_cycle_indicator.c index 8e63d1ef..86adfa4d 100644 --- a/openbox/focus_cycle_indicator.c +++ b/openbox/focus_cycle_indicator.c @@ -152,7 +152,7 @@ void focus_cycle_draw_indicator(ObClient *c) } else if (c) { Rect area; - frame_engine->frame_get_window_area(c->frame, &area); + frame_engine.frame_get_window_area(c->frame, &area); /* if (c) frame_adjust_focus(c->frame, FALSE); diff --git a/openbox/moveresize.c b/openbox/moveresize.c index 6209a815..fbf865ae 100644 --- a/openbox/moveresize.c +++ b/openbox/moveresize.c @@ -85,7 +85,7 @@ void moveresize_startup(gboolean reconfig) void moveresize_shutdown(gboolean reconfig) { if (!reconfig) { - if (frame_engine->moveresize_in_progress) + if (frame_engine.moveresize_in_progress) moveresize_end(FALSE); client_remove_destroy_notify(client_dest); } @@ -99,9 +99,9 @@ static void popup_coords(ObClient *c, const gchar *format, gint a, gint b) gchar *text; Strut size; - frame_engine->frame_get_size(c->frame, &size); + frame_engine.frame_get_size(c->frame, &size); Rect area; - frame_engine->frame_get_window_area(c->frame, &area); + frame_engine.frame_get_window_area(c->frame, &area); text = g_strdup_printf(format, a, b); if (config_resize_popup_pos == OB_RESIZE_POS_TOP) popup_position(popup, SouthGravity, @@ -175,7 +175,7 @@ void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr) gint up = 1; gint left = 1; - if (frame_engine->moveresize_in_progress || !frame_engine->frame_is_visible(c->frame) || + if (frame_engine.moveresize_in_progress || !frame_engine.frame_is_visible(c->frame) || !(mv ? (c->functions & OB_CLIENT_FUNC_MOVE) : (c->functions & OB_CLIENT_FUNC_RESIZE))) @@ -253,7 +253,7 @@ void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr) cur_w = start_cw; cur_h = start_ch; - frame_engine->moveresize_in_progress = TRUE; + frame_engine.moveresize_in_progress = TRUE; #ifdef SYNC if (config_resize_redraw && !moving && obt_display_extension_sync && @@ -331,7 +331,7 @@ void moveresize_end(gboolean cancel) /* dont edge warp after its ended */ cancel_edge_warp(); - frame_engine->moveresize_in_progress = FALSE; + frame_engine.moveresize_in_progress = FALSE; moveresize_client = NULL; } @@ -350,7 +350,7 @@ static void do_move(gboolean keyboard, gint keydist) if (config_resize_popup_show == 2) /* == "Always" */ { Rect area; - frame_engine->frame_get_window_area(moveresize_client->frame, &area); + frame_engine.frame_get_window_area(moveresize_client->frame, &area); popup_coords(moveresize_client, "%d x %d", area.x, area.y); @@ -487,7 +487,7 @@ static void calc_resize(gboolean keyboard, gint keydist, gint *dw, gint *dh, Strut size; - frame_engine->frame_get_size(moveresize_client->frame, &size); + frame_engine.frame_get_size(moveresize_client->frame, &size); /* resist_size_* needs the frame size */ nw += size.left + size.right; @@ -835,7 +835,7 @@ gboolean moveresize_event(XEvent *e) { gboolean used = FALSE; - if (!frame_engine->moveresize_in_progress) return FALSE; + if (!frame_engine.moveresize_in_progress) return FALSE; if (e->type == ButtonPress) { if (!button) { diff --git a/openbox/openbox.c b/openbox/openbox.c index 505f4417..79b4da89 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -92,7 +92,7 @@ gchar *ob_sm_id = NULL; gchar *ob_sm_save_file = NULL; gboolean ob_sm_restore = TRUE; gboolean ob_debug_xinerama = FALSE; -ObFrameEngine * frame_engine = NULL; +ObFrameEngine frame_engine; static ObState state; static gboolean xsync = FALSE; @@ -257,7 +257,7 @@ gint main(gint argc, gchar **argv) /* load the theme specified in the rc file */ { ob_debug("Entering LoadThemeConfig"); - frame_engine = init_frame_engine ( + init_frame_engine (&frame_engine, config_theme, TRUE, config_font_activewindow, config_font_inactivewindow, config_font_menutitle, config_font_menuitem, config_font_osd); @@ -287,7 +287,7 @@ gint main(gint argc, gchar **argv) /* update all existing windows for the new theme */ for (it = client_list; it; it = g_list_next(it)) { ObClient *c = it->data; - frame_engine->frame_adjust_theme(c->frame); + frame_engine.frame_adjust_theme(c->frame); } } event_startup(reconfigure); @@ -337,7 +337,7 @@ gint main(gint argc, gchar **argv) /* the new config can change the window's decorations */ client_setup_decor_and_functions(c, FALSE); /* redraw the frames */ - frame_engine->frame_update_layout (c->frame, c->area, FALSE, FALSE); + 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) @@ -383,11 +383,6 @@ gint main(gint argc, gchar **argv) XSync(obt_display, FALSE); - if (frame_engine) - { - //RrThemeFree(render_plugin->ob_rr_theme); - //RrInstanceFree(render_plugin->ob_rr_inst); - } session_shutdown(being_replaced); obt_display_close(obt_display); diff --git a/openbox/openbox.h b/openbox/openbox.h index f25875a5..a16788e2 100644 --- a/openbox/openbox.h +++ b/openbox/openbox.h @@ -48,7 +48,7 @@ extern gboolean ob_replace_wm; extern gboolean ob_debug_xinerama; /* render function */ -extern ObFrameEngine * frame_engine; +extern ObFrameEngine frame_engine; /* The state of execution of the window manager */ ObState ob_state(); diff --git a/openbox/place.c b/openbox/place.c index fe0aa5ab..435f503e 100644 --- a/openbox/place.c +++ b/openbox/place.c @@ -150,7 +150,7 @@ static gboolean place_random(ObClient *client, gint *x, gint *y) guint i; Rect area; - frame_engine->frame_get_window_area(client->frame, &area); + frame_engine.frame_get_window_area(client->frame, &area); areas = pick_head(client); i = (config_place_monitor != OB_PLACE_MONITOR_ANY) ? @@ -315,7 +315,7 @@ static gboolean place_nooverlap(ObClient *c, gint *x, gint *y) /* don't ignore this window, so remove it from the available area */ Rect test_area; - frame_engine->frame_get_window_area(test->frame, &test_area); + frame_engine.frame_get_window_area(test->frame, &test_area); spaces = area_remove(spaces, &test_area); } @@ -326,7 +326,7 @@ static gboolean place_nooverlap(ObClient *c, gint *x, gint *y) } Rect c_area; - frame_engine->frame_get_window_area(c->frame, &c_area); + frame_engine.frame_get_window_area(c->frame, &c_area); for (sit = spaces; sit; sit = g_slist_next(sit)) { Rect *r = sit->data; @@ -372,9 +372,9 @@ static gboolean place_under_mouse(ObClient *client, gint *x, gint *y) Rect *area; Strut fsize; - frame_engine->frame_get_size(client->frame, &fsize); + frame_engine.frame_get_size(client->frame, &fsize); Rect farea; - frame_engine->frame_get_window_area(client->frame, &farea); + frame_engine.frame_get_window_area(client->frame, &farea); if (!screen_pointer_pos(&px, &py)) return FALSE; @@ -425,7 +425,7 @@ static gboolean place_per_app_setting(ObClient *client, gint *x, gint *y, } Rect farea; - frame_engine->frame_get_window_area(client->frame, &farea); + frame_engine.frame_get_window_area(client->frame, &farea); if (settings->position.x.center) *x = screen->x + screen->width / 2 - client->area.width / 2; else if (settings->position.x.opposite) @@ -455,7 +455,7 @@ static gboolean place_transient_splash(ObClient *client, gint *x, gint *y) for (it = client->parents; it; it = g_slist_next(it)) { ObClient *m = it->data; Rect area; - frame_engine->frame_get_window_area(m->frame, &area); + frame_engine.frame_get_window_area(m->frame, &area); if (!m->iconic) { if (first) { l = RECT_LEFT(area); @@ -483,7 +483,7 @@ static gboolean place_transient_splash(ObClient *client, gint *x, gint *y) { Rect **areas; Rect area; - frame_engine->frame_get_window_area(client->frame, &area); + frame_engine.frame_get_window_area(client->frame, &area); guint i; areas = pick_head(client); diff --git a/openbox/resist.c b/openbox/resist.c index 2daa646b..57975ce7 100644 --- a/openbox/resist.c +++ b/openbox/resist.c @@ -106,7 +106,7 @@ void resist_move_windows(ObClient *c, gint resist, gint *x, gint *y) Rect dock_area; Rect c_area; - frame_engine->frame_get_window_area(c->frame, &c_area); + frame_engine.frame_get_window_area(c->frame, &c_area); if (!resist) return; @@ -120,14 +120,14 @@ void resist_move_windows(ObClient *c, gint resist, gint *x, gint *y) target = it->data; /* don't snap to self or non-visibles */ - if (!frame_engine->frame_is_visible(target->frame) || target == c) + if (!frame_engine.frame_is_visible(target->frame) || target == c) continue; /* don't snap to windows set to below and skip_taskbar (desklets) */ if (target->below && !c->below && target->skip_taskbar) continue; Rect target_area; - frame_engine->frame_get_window_area(target->frame, &target_area); + frame_engine.frame_get_window_area(target->frame, &target_area); if (resist_move_window(c_area, target_area, resist, x, y)) break; @@ -150,7 +150,7 @@ void resist_move_monitors(ObClient *c, gint resist, gint *x, gint *y) Rect desired_area; Rect c_area; - frame_engine->frame_get_window_area(c->frame, &c_area); + frame_engine.frame_get_window_area(c->frame, &c_area); if (!resist) return; @@ -306,7 +306,7 @@ void resist_size_windows(ObClient *c, gint resist, gint *w, gint *h, Rect dock_area; Rect c_area; - frame_engine->frame_get_window_area(c->frame, &c_area); + frame_engine.frame_get_window_area(c->frame, &c_area); if (!resist) return; for (it = stacking_list; it; it = g_list_next(it)) { @@ -315,14 +315,14 @@ void resist_size_windows(ObClient *c, gint resist, gint *w, gint *h, target = it->data; /* don't snap to invisibles or ourself */ - if (!frame_engine->frame_is_visible(target->frame) || target == c) + if (!frame_engine.frame_is_visible(target->frame) || target == c) continue; /* don't snap to windows set to below and skip_taskbar (desklets) */ if (target->below && !c->below && target->skip_taskbar) continue; Rect target_area; - frame_engine->frame_get_window_area(target->frame, &target_area); + frame_engine.frame_get_window_area(target->frame, &target_area); if (resist_size_window(c_area, target_area, resist, w, h, dir)) break; @@ -345,7 +345,7 @@ void resist_size_monitors(ObClient *c, gint resist, gint *w, gint *h, Rect desired_area; Rect c_area; - frame_engine->frame_get_window_area(c->frame, &c_area); + frame_engine.frame_get_window_area(c->frame, &c_area); if (!resist) return; diff --git a/openbox/screen.c b/openbox/screen.c index 64421e17..a679bfbf 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -572,13 +572,13 @@ static void screen_fallback_focus(void) if (c->can_focus) { /* reduce flicker by hiliting now rather than waiting for the server FocusIn event */ - frame_engine->frame_set_is_focus (c->frame, TRUE); - frame_engine->frame_update_layout (c->frame, c->area, FALSE, FALSE); + 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); + 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 */ client_bring_helper_windows(c); @@ -1233,13 +1233,13 @@ void screen_show_desktop(gboolean show, ObClient *show_only) if (c->can_focus) { /* reduce flicker by hiliting now rather than waiting for the server FocusIn event */ - frame_engine->frame_set_is_focus(c->frame, TRUE); - frame_engine->frame_update_layout (c->frame, c->area, FALSE, FALSE); + 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); + frame_engine.frame_update_skin (c->frame); } } } diff --git a/openbox/stacking.c b/openbox/stacking.c index 96be4aa9..69717431 100644 --- a/openbox/stacking.c +++ b/openbox/stacking.c @@ -545,7 +545,7 @@ static gboolean stacking_occluded(ObClient *client, ObClient *sibling) gboolean found = FALSE; Rect client_area; - frame_engine->frame_get_window_area(client->frame, &client_area); + frame_engine.frame_get_window_area(client->frame, &client_area); /* no need for any looping in this case */ if (sibling && client->layer != sibling->layer) return occluded; @@ -560,7 +560,7 @@ static gboolean stacking_occluded(ObClient *client, ObClient *sibling) !client_search_transient(client, c)) { Rect c_area; - frame_engine->frame_get_window_area(c->frame, &c_area); + frame_engine.frame_get_window_area(c->frame, &c_area); if (RECT_INTERSECTS_RECT(c_area, client_area)) { if (sibling != NULL) { @@ -593,7 +593,7 @@ static gboolean stacking_occludes(ObClient *client, ObClient *sibling) gboolean found = FALSE; Rect client_area; - frame_engine->frame_get_window_area(client->frame, &client_area); + frame_engine.frame_get_window_area(client->frame, &client_area); /* no need for any looping in this case */ if (sibling && client->layer != sibling->layer) @@ -608,7 +608,7 @@ static gboolean stacking_occludes(ObClient *client, ObClient *sibling) !client_search_transient(c, client)) { Rect c_area; - frame_engine->frame_get_window_area(c->frame, &c_area); + frame_engine.frame_get_window_area(c->frame, &c_area); if (RECT_INTERSECTS_RECT(c_area, client_area)) { if (sibling != NULL) { -- 2.39.2