From eb09b1873d731a0e7290334a832a76cb233f34a7 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sat, 19 May 2007 14:36:19 +0000 Subject: [PATCH] move focus_cycle_indicator into its own file --- Makefile.am | 2 + openbox/focus.c | 4 +- openbox/focus_cycle.c | 243 ++++--------------------------- openbox/focus_cycle.h | 1 - openbox/focus_cycle_indicator.c | 244 ++++++++++++++++++++++++++++++++ openbox/focus_cycle_indicator.h | 32 +++++ openbox/frame.c | 3 +- openbox/openbox.c | 3 + 8 files changed, 309 insertions(+), 223 deletions(-) create mode 100644 openbox/focus_cycle_indicator.c create mode 100644 openbox/focus_cycle_indicator.h diff --git a/Makefile.am b/Makefile.am index ae23fd67..515c6dc7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -175,6 +175,8 @@ openbox_openbox_SOURCES = \ openbox/focus.h \ openbox/focus_cycle.c \ openbox/focus_cycle.h \ + openbox/focus_cycle_indicator.c \ + openbox/focus_cycle_indicator.h \ openbox/frame.c \ openbox/frame.h \ openbox/framerender.c \ diff --git a/openbox/focus.c b/openbox/focus.c index 80f15217..42241224 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -74,9 +74,7 @@ void focus_set_client(ObClient *client) screen_install_colormap(focus_client, FALSE); screen_install_colormap(client, TRUE); - /* in the middle of cycling..? kill it. CurrentTime is fine, time won't - be used. - */ + /* in the middle of cycling..? kill it. */ focus_cycle_stop(); focus_client = client; diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c index 48035c38..47306d53 100644 --- a/openbox/focus_cycle.c +++ b/openbox/focus_cycle.c @@ -1,6 +1,6 @@ /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- - focus.c for the Openbox window manager + focus_cycle.c for the Openbox window manager Copyright (c) 2006 Mikael Magnusson Copyright (c) 2003-2007 Dana Jansens @@ -18,38 +18,42 @@ */ #include "focus_cycle.h" +#include "focus_cycle_indicator.h" #include "client.h" +#include "frame.h" #include "focus.h" #include "screen.h" #include "openbox.h" -#include "frame.h" #include "popup.h" #include "debug.h" #include "group.h" -#include "event.h" -#include "render/render.h" #include #include -#define FOCUS_INDICATOR_WIDTH 6 +#define FOCUS_CYCLE_ICON_SIZE 48 + +struct _ObFocusCyclePopup +{ + ObWindow obwin; + Window bg; + + Window text; -struct { - InternalWindow top; - InternalWindow left; - InternalWindow right; - InternalWindow bottom; -} focus_indicator; + RrAppearance *a_bg; + RrAppearance *a_text; + gint textw; + gint h; + gint minw; + gint maxw; + gboolean mapped; +}; ObClient *focus_cycle_target = NULL; -static RrAppearance *a_focus_indicator; -static RrColor *color_white; static ObIconPopup *focus_cycle_popup; static void focus_cycle_destroy_notify (ObClient *client, gpointer data); -static Window create_window (Window parent, gulong mask, - XSetWindowAttributes *attrib); static gboolean focus_target_valid (ObClient *ft, gboolean all_desktops, gboolean dock_windows, @@ -76,70 +80,16 @@ void focus_cycle_startup(gboolean reconfig) { focus_cycle_popup = icon_popup_new(TRUE); - if (!reconfig) { - XSetWindowAttributes attr; - + if (!reconfig) client_add_destroy_notify(focus_cycle_destroy_notify, NULL); - - focus_indicator.top.obwin.type = Window_Internal; - focus_indicator.left.obwin.type = Window_Internal; - focus_indicator.right.obwin.type = Window_Internal; - focus_indicator.bottom.obwin.type = Window_Internal; - - attr.override_redirect = True; - attr.background_pixel = BlackPixel(ob_display, ob_screen); - focus_indicator.top.win = - create_window(RootWindow(ob_display, ob_screen), - CWOverrideRedirect | CWBackPixel, &attr); - focus_indicator.left.win = - create_window(RootWindow(ob_display, ob_screen), - CWOverrideRedirect | CWBackPixel, &attr); - focus_indicator.right.win = - create_window(RootWindow(ob_display, ob_screen), - CWOverrideRedirect | CWBackPixel, &attr); - focus_indicator.bottom.win = - create_window(RootWindow(ob_display, ob_screen), - CWOverrideRedirect | CWBackPixel, &attr); - - stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.top)); - stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.left)); - stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.right)); - stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.bottom)); - - color_white = RrColorNew(ob_rr_inst, 0xff, 0xff, 0xff); - - a_focus_indicator = RrAppearanceNew(ob_rr_inst, 4); - a_focus_indicator->surface.grad = RR_SURFACE_SOLID; - a_focus_indicator->surface.relief = RR_RELIEF_FLAT; - a_focus_indicator->surface.primary = RrColorNew(ob_rr_inst, - 0, 0, 0); - a_focus_indicator->texture[0].type = RR_TEXTURE_LINE_ART; - a_focus_indicator->texture[0].data.lineart.color = color_white; - a_focus_indicator->texture[1].type = RR_TEXTURE_LINE_ART; - a_focus_indicator->texture[1].data.lineart.color = color_white; - a_focus_indicator->texture[2].type = RR_TEXTURE_LINE_ART; - a_focus_indicator->texture[2].data.lineart.color = color_white; - a_focus_indicator->texture[3].type = RR_TEXTURE_LINE_ART; - a_focus_indicator->texture[3].data.lineart.color = color_white; - } } void focus_cycle_shutdown(gboolean reconfig) { icon_popup_free(focus_cycle_popup); - if (!reconfig) { + if (!reconfig) client_remove_destroy_notify(focus_cycle_destroy_notify); - - RrColorFree(color_white); - - RrAppearanceFree(a_focus_indicator); - - XDestroyWindow(ob_display, focus_indicator.top.win); - XDestroyWindow(ob_display, focus_indicator.left.win); - XDestroyWindow(ob_display, focus_indicator.right.win); - XDestroyWindow(ob_display, focus_indicator.bottom.win); - } } void focus_cycle_stop() @@ -149,15 +99,6 @@ void focus_cycle_stop() } -static Window create_window(Window parent, gulong mask, - XSetWindowAttributes *attrib) -{ - return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0, - RrDepth(ob_rr_inst), InputOutput, - RrVisual(ob_rr_inst), mask, attrib); - -} - static gchar *popup_get_name(ObClient *c, ObClient **nametarget) { ObClient *p; @@ -270,140 +211,6 @@ static void focus_cycle_destroy_notify(ObClient *client, gpointer data) focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE); } -void focus_cycle_draw_indicator() -{ - if (!focus_cycle_target) { - XUnmapWindow(ob_display, focus_indicator.top.win); - XUnmapWindow(ob_display, focus_indicator.left.win); - XUnmapWindow(ob_display, focus_indicator.right.win); - XUnmapWindow(ob_display, focus_indicator.bottom.win); - - /* kill enter events cause by this unmapping */ - event_ignore_all_queued_enters(); - } else { - /* - if (focus_cycle_target) - frame_adjust_focus(focus_cycle_target->frame, FALSE); - frame_adjust_focus(focus_cycle_target->frame, TRUE); - */ - gint x, y, w, h; - gint wt, wl, wr, wb; - - wt = wl = wr = wb = FOCUS_INDICATOR_WIDTH; - - x = focus_cycle_target->frame->area.x; - y = focus_cycle_target->frame->area.y; - w = focus_cycle_target->frame->area.width; - h = wt; - - XMoveResizeWindow(ob_display, focus_indicator.top.win, - x, y, w, h); - 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.x2 = 0; - a_focus_indicator->texture[0].data.lineart.y2 = 0; - a_focus_indicator->texture[1].data.lineart.x1 = 0; - a_focus_indicator->texture[1].data.lineart.y1 = 0; - a_focus_indicator->texture[1].data.lineart.x2 = w-1; - a_focus_indicator->texture[1].data.lineart.y2 = 0; - a_focus_indicator->texture[2].data.lineart.x1 = w-1; - a_focus_indicator->texture[2].data.lineart.y1 = 0; - a_focus_indicator->texture[2].data.lineart.x2 = w-1; - a_focus_indicator->texture[2].data.lineart.y2 = h-1; - a_focus_indicator->texture[3].data.lineart.x1 = (wl-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.y2 = h-1; - RrPaint(a_focus_indicator, focus_indicator.top.win, - w, h); - - x = focus_cycle_target->frame->area.x; - y = focus_cycle_target->frame->area.y; - w = wl; - h = focus_cycle_target->frame->area.height; - - XMoveResizeWindow(ob_display, focus_indicator.left.win, - x, y, w, h); - 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.x2 = 0; - a_focus_indicator->texture[0].data.lineart.y2 = 0; - a_focus_indicator->texture[1].data.lineart.x1 = 0; - a_focus_indicator->texture[1].data.lineart.y1 = 0; - a_focus_indicator->texture[1].data.lineart.x2 = 0; - a_focus_indicator->texture[1].data.lineart.y2 = h-1; - a_focus_indicator->texture[2].data.lineart.x1 = 0; - a_focus_indicator->texture[2].data.lineart.y1 = h-1; - a_focus_indicator->texture[2].data.lineart.x2 = w-1; - a_focus_indicator->texture[2].data.lineart.y2 = h-1; - a_focus_indicator->texture[3].data.lineart.x1 = w-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.y2 = h - wb; - RrPaint(a_focus_indicator, focus_indicator.left.win, - w, h); - - x = focus_cycle_target->frame->area.x + - focus_cycle_target->frame->area.width - wr; - y = focus_cycle_target->frame->area.y; - w = wr; - h = focus_cycle_target->frame->area.height ; - - XMoveResizeWindow(ob_display, focus_indicator.right.win, - x, y, w, h); - 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.x2 = w-1; - a_focus_indicator->texture[0].data.lineart.y2 = 0; - a_focus_indicator->texture[1].data.lineart.x1 = w-1; - a_focus_indicator->texture[1].data.lineart.y1 = 0; - a_focus_indicator->texture[1].data.lineart.x2 = w-1; - a_focus_indicator->texture[1].data.lineart.y2 = h-1; - a_focus_indicator->texture[2].data.lineart.x1 = w-1; - a_focus_indicator->texture[2].data.lineart.y1 = h-1; - a_focus_indicator->texture[2].data.lineart.x2 = 0; - a_focus_indicator->texture[2].data.lineart.y2 = h-1; - a_focus_indicator->texture[3].data.lineart.x1 = 0; - 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.y2 = h - wb; - RrPaint(a_focus_indicator, focus_indicator.right.win, - w, h); - - x = focus_cycle_target->frame->area.x; - y = focus_cycle_target->frame->area.y + - focus_cycle_target->frame->area.height - wb; - w = focus_cycle_target->frame->area.width; - h = wb; - - XMoveResizeWindow(ob_display, focus_indicator.bottom.win, - x, y, w, h); - 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.x2 = 0; - a_focus_indicator->texture[0].data.lineart.y2 = h-1; - a_focus_indicator->texture[1].data.lineart.x1 = 0; - a_focus_indicator->texture[1].data.lineart.y1 = h-1; - a_focus_indicator->texture[1].data.lineart.x2 = w-1; - a_focus_indicator->texture[1].data.lineart.y2 = h-1; - a_focus_indicator->texture[2].data.lineart.x1 = w-1; - a_focus_indicator->texture[2].data.lineart.y1 = h-1; - a_focus_indicator->texture[2].data.lineart.x2 = w-1; - a_focus_indicator->texture[2].data.lineart.y2 = 0; - a_focus_indicator->texture[3].data.lineart.x1 = wl-1; - 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.y2 = 0; - RrPaint(a_focus_indicator, focus_indicator.bottom.win, - w, h); - - XMapWindow(ob_display, focus_indicator.top.win); - XMapWindow(ob_display, focus_indicator.left.win); - XMapWindow(ob_display, focus_indicator.right.win); - XMapWindow(ob_display, focus_indicator.bottom.win); - } -} - /*! Returns if a focus target has valid group siblings that can be cycled to in its place */ static gboolean focus_target_has_siblings(ObClient *ft, gboolean all_desktops) @@ -528,7 +335,7 @@ void focus_cycle(gboolean forward, gboolean all_desktops, if (interactive) { if (ft != focus_cycle_target) { /* prevents flicker */ focus_cycle_target = ft; - focus_cycle_draw_indicator(); + focus_cycle_draw_indicator(ft); } /* same arguments as focus_target_valid */ popup_cycle(ft, dialog, all_desktops, dock_windows, @@ -553,7 +360,7 @@ done_cycle: order = NULL; if (interactive) { - focus_cycle_draw_indicator(); + focus_cycle_draw_indicator(NULL); popup_cycle(ft, FALSE, FALSE, FALSE, FALSE); } @@ -706,7 +513,7 @@ void focus_directional_cycle(ObDirection dir, gboolean dock_windows, if (ft) { if (ft != focus_cycle_target) {/* prevents flicker */ focus_cycle_target = ft; - focus_cycle_draw_indicator(); + focus_cycle_draw_indicator(ft); } } if (focus_cycle_target) { @@ -725,7 +532,7 @@ done_cycle: first = NULL; focus_cycle_target = NULL; - focus_cycle_draw_indicator(); + focus_cycle_draw_indicator(NULL); popup_cycle(ft, FALSE, FALSE, FALSE, FALSE); return; diff --git a/openbox/focus_cycle.h b/openbox/focus_cycle.h index a90cb67f..1147a292 100644 --- a/openbox/focus_cycle.h +++ b/openbox/focus_cycle.h @@ -41,7 +41,6 @@ void focus_cycle(gboolean forward, gboolean all_desktops, void focus_directional_cycle(ObDirection dir, gboolean dock_windows, gboolean desktop_windows, gboolean interactive, gboolean dialog, gboolean done, gboolean cancel); -void focus_cycle_draw_indicator(); void focus_cycle_stop(); diff --git a/openbox/focus_cycle_indicator.c b/openbox/focus_cycle_indicator.c new file mode 100644 index 00000000..a8e0c2d6 --- /dev/null +++ b/openbox/focus_cycle_indicator.c @@ -0,0 +1,244 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + focus_cycle_indicator.c for the Openbox window manager + Copyright (c) 2006 Mikael Magnusson + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#include "focus_cycle.h" +#include "client.h" +#include "openbox.h" +#include "frame.h" +#include "event.h" +#include "render/render.h" + +#include +#include + +#define FOCUS_INDICATOR_WIDTH 6 + +struct +{ + InternalWindow top; + InternalWindow left; + InternalWindow right; + InternalWindow bottom; +} focus_indicator; + +static RrAppearance *a_focus_indicator; +static RrColor *color_white; + +static Window create_window(Window parent, gulong mask, + XSetWindowAttributes *attrib) +{ + return XCreateWindow(ob_display, parent, 0, 0, 1, 1, 0, + RrDepth(ob_rr_inst), InputOutput, + RrVisual(ob_rr_inst), mask, attrib); + +} + +void focus_cycle_indicator_startup(gboolean reconfig) +{ + XSetWindowAttributes attr; + + if (reconfig) return; + + focus_indicator.top.obwin.type = Window_Internal; + focus_indicator.left.obwin.type = Window_Internal; + focus_indicator.right.obwin.type = Window_Internal; + focus_indicator.bottom.obwin.type = Window_Internal; + + attr.override_redirect = True; + attr.background_pixel = BlackPixel(ob_display, ob_screen); + focus_indicator.top.win = + create_window(RootWindow(ob_display, ob_screen), + CWOverrideRedirect | CWBackPixel, &attr); + focus_indicator.left.win = + create_window(RootWindow(ob_display, ob_screen), + CWOverrideRedirect | CWBackPixel, &attr); + focus_indicator.right.win = + create_window(RootWindow(ob_display, ob_screen), + CWOverrideRedirect | CWBackPixel, &attr); + focus_indicator.bottom.win = + create_window(RootWindow(ob_display, ob_screen), + CWOverrideRedirect | CWBackPixel, &attr); + + stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.top)); + stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.left)); + stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.right)); + stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.bottom)); + + color_white = RrColorNew(ob_rr_inst, 0xff, 0xff, 0xff); + + a_focus_indicator = RrAppearanceNew(ob_rr_inst, 4); + a_focus_indicator->surface.grad = RR_SURFACE_SOLID; + a_focus_indicator->surface.relief = RR_RELIEF_FLAT; + a_focus_indicator->surface.primary = RrColorNew(ob_rr_inst, + 0, 0, 0); + a_focus_indicator->texture[0].type = RR_TEXTURE_LINE_ART; + a_focus_indicator->texture[0].data.lineart.color = color_white; + a_focus_indicator->texture[1].type = RR_TEXTURE_LINE_ART; + a_focus_indicator->texture[1].data.lineart.color = color_white; + a_focus_indicator->texture[2].type = RR_TEXTURE_LINE_ART; + a_focus_indicator->texture[2].data.lineart.color = color_white; + a_focus_indicator->texture[3].type = RR_TEXTURE_LINE_ART; + a_focus_indicator->texture[3].data.lineart.color = color_white; +} + +void focus_cycle_indicator_shutdown(gboolean reconfig) +{ + if (reconfig) return; + + RrColorFree(color_white); + + RrAppearanceFree(a_focus_indicator); + + XDestroyWindow(ob_display, focus_indicator.top.win); + XDestroyWindow(ob_display, focus_indicator.left.win); + XDestroyWindow(ob_display, focus_indicator.right.win); + XDestroyWindow(ob_display, focus_indicator.bottom.win); +} + +void focus_cycle_draw_indicator(ObClient *c) +{ + if (!c) { + XUnmapWindow(ob_display, focus_indicator.top.win); + XUnmapWindow(ob_display, focus_indicator.left.win); + XUnmapWindow(ob_display, focus_indicator.right.win); + XUnmapWindow(ob_display, focus_indicator.bottom.win); + + /* kill enter events cause by this unmapping */ + event_ignore_all_queued_enters(); + } else { + /* + if (c) + frame_adjust_focus(c->frame, FALSE); + frame_adjust_focus(c->frame, TRUE); + */ + gint x, y, w, h; + gint wt, wl, wr, wb; + + wt = wl = wr = wb = FOCUS_INDICATOR_WIDTH; + + x = c->frame->area.x; + y = c->frame->area.y; + w = c->frame->area.width; + h = wt; + + XMoveResizeWindow(ob_display, focus_indicator.top.win, + x, y, w, h); + 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.x2 = 0; + a_focus_indicator->texture[0].data.lineart.y2 = 0; + a_focus_indicator->texture[1].data.lineart.x1 = 0; + a_focus_indicator->texture[1].data.lineart.y1 = 0; + a_focus_indicator->texture[1].data.lineart.x2 = w-1; + a_focus_indicator->texture[1].data.lineart.y2 = 0; + a_focus_indicator->texture[2].data.lineart.x1 = w-1; + a_focus_indicator->texture[2].data.lineart.y1 = 0; + a_focus_indicator->texture[2].data.lineart.x2 = w-1; + a_focus_indicator->texture[2].data.lineart.y2 = h-1; + a_focus_indicator->texture[3].data.lineart.x1 = (wl-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.y2 = h-1; + RrPaint(a_focus_indicator, focus_indicator.top.win, + w, h); + + x = c->area.x; + y = c->frame->area.y; + w = wl; + h = c->frame->area.height; + + XMoveResizeWindow(ob_display, focus_indicator.left.win, + x, y, w, h); + 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.x2 = 0; + a_focus_indicator->texture[0].data.lineart.y2 = 0; + a_focus_indicator->texture[1].data.lineart.x1 = 0; + a_focus_indicator->texture[1].data.lineart.y1 = 0; + a_focus_indicator->texture[1].data.lineart.x2 = 0; + a_focus_indicator->texture[1].data.lineart.y2 = h-1; + a_focus_indicator->texture[2].data.lineart.x1 = 0; + a_focus_indicator->texture[2].data.lineart.y1 = h-1; + a_focus_indicator->texture[2].data.lineart.x2 = w-1; + a_focus_indicator->texture[2].data.lineart.y2 = h-1; + a_focus_indicator->texture[3].data.lineart.x1 = w-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.y2 = h - wb; + RrPaint(a_focus_indicator, focus_indicator.left.win, + w, h); + + x = c->frame->area.x + c->frame->area.width - wr; + y = c->frame->area.y; + w = wr; + h = c->frame->area.height ; + + XMoveResizeWindow(ob_display, focus_indicator.right.win, + x, y, w, h); + 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.x2 = w-1; + a_focus_indicator->texture[0].data.lineart.y2 = 0; + a_focus_indicator->texture[1].data.lineart.x1 = w-1; + a_focus_indicator->texture[1].data.lineart.y1 = 0; + a_focus_indicator->texture[1].data.lineart.x2 = w-1; + a_focus_indicator->texture[1].data.lineart.y2 = h-1; + a_focus_indicator->texture[2].data.lineart.x1 = w-1; + a_focus_indicator->texture[2].data.lineart.y1 = h-1; + a_focus_indicator->texture[2].data.lineart.x2 = 0; + a_focus_indicator->texture[2].data.lineart.y2 = h-1; + a_focus_indicator->texture[3].data.lineart.x1 = 0; + 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.y2 = h - wb; + RrPaint(a_focus_indicator, focus_indicator.right.win, + w, h); + + x = c->frame->area.x; + y = c->frame->area.y + c->frame->area.height - wb; + w = c->frame->area.width; + h = wb; + + XMoveResizeWindow(ob_display, focus_indicator.bottom.win, + x, y, w, h); + 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.x2 = 0; + a_focus_indicator->texture[0].data.lineart.y2 = h-1; + a_focus_indicator->texture[1].data.lineart.x1 = 0; + a_focus_indicator->texture[1].data.lineart.y1 = h-1; + a_focus_indicator->texture[1].data.lineart.x2 = w-1; + a_focus_indicator->texture[1].data.lineart.y2 = h-1; + a_focus_indicator->texture[2].data.lineart.x1 = w-1; + a_focus_indicator->texture[2].data.lineart.y1 = h-1; + a_focus_indicator->texture[2].data.lineart.x2 = w-1; + a_focus_indicator->texture[2].data.lineart.y2 = 0; + a_focus_indicator->texture[3].data.lineart.x1 = wl-1; + 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.y2 = 0; + RrPaint(a_focus_indicator, focus_indicator.bottom.win, + w, h); + + XMapWindow(ob_display, focus_indicator.top.win); + XMapWindow(ob_display, focus_indicator.left.win); + XMapWindow(ob_display, focus_indicator.right.win); + XMapWindow(ob_display, focus_indicator.bottom.win); + } +} diff --git a/openbox/focus_cycle_indicator.h b/openbox/focus_cycle_indicator.h new file mode 100644 index 00000000..8c84f71a --- /dev/null +++ b/openbox/focus_cycle_indicator.h @@ -0,0 +1,32 @@ +/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- + + focus_cycle_indicator.h for the Openbox window manager + Copyright (c) 2006 Mikael Magnusson + Copyright (c) 2003-2007 Dana Jansens + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + See the COPYING file for a copy of the GNU General Public License. +*/ + +#ifndef __focus_cycle_indicator_h +#define __focus_cycle_indicator_h + +struct _ObClient; + +void focus_cycle_indicator_startup(gboolean reconfig); +void focus_cycle_indicator_shutdown(gboolean reconfig); + +void focus_cycle_draw_indicator(struct _ObClient *c); + +void focus_cycle_stop(); + +#endif diff --git a/openbox/frame.c b/openbox/frame.c index e1607f4e..f9c7e607 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -26,6 +26,7 @@ #include "framerender.h" #include "mainloop.h" #include "focus_cycle.h" +#include "focus_cycle_indicator.h" #include "moveresize.h" #include "screen.h" #include "render/theme.h" @@ -507,7 +508,7 @@ void frame_adjust_area(ObFrame *self, gboolean moved, /* if this occurs while we are focus cycling, the indicator needs to match the changes */ if (focus_cycle_target == self->client) - focus_cycle_draw_indicator(); + focus_cycle_draw_indicator(self->client); } if (resized && (self->decorations & OB_FRAME_DECOR_TITLEBAR)) XResizeWindow(ob_display, self->label, self->label_width, diff --git a/openbox/openbox.c b/openbox/openbox.c index 0acb486d..7d6a59a2 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -31,6 +31,7 @@ #include "startupnotify.h" #include "focus.h" #include "focus_cycle.h" +#include "focus_cycle_indicator.h" #include "moveresize.h" #include "frame.h" #include "keyboard.h" @@ -285,6 +286,7 @@ gint main(gint argc, gchar **argv) anything that calls stacking_add */ focus_startup(reconfigure); focus_cycle_startup(reconfigure); + focus_cycle_indicator_startup(reconfigure); window_startup(reconfigure); sn_startup(reconfigure); screen_startup(reconfigure); @@ -350,6 +352,7 @@ gint main(gint argc, gchar **argv) propwin_shutdown(reconfigure); grab_shutdown(reconfigure); screen_shutdown(reconfigure); + focus_cycle_indicator_shutdown(reconfigure); focus_cycle_shutdown(reconfigure); focus_shutdown(reconfigure); sn_shutdown(reconfigure); -- 2.45.2