]> Dogcows Code - chaz/openbox/commitdiff
move focus_cycle_indicator into its own file
authorDana Jansens <danakj@orodu.net>
Sat, 19 May 2007 14:36:19 +0000 (14:36 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 19 May 2007 14:36:19 +0000 (14:36 +0000)
Makefile.am
openbox/focus.c
openbox/focus_cycle.c
openbox/focus_cycle.h
openbox/focus_cycle_indicator.c [new file with mode: 0644]
openbox/focus_cycle_indicator.h [new file with mode: 0644]
openbox/frame.c
openbox/openbox.c

index ae23fd67be9880bd00bfb9c8ec451f05cf9cfcea..515c6dc7da7c09352bf21ccffde4cda67fc88d57 100644 (file)
@@ -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 \
index 80f15217da66f58b1735baa920a72ed773f268e1..42241224534e35fc07f021b0c4f86d4d0d1705c3 100644 (file)
@@ -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;
index 48035c3855bcbf35aef849499919406d5b102c14..47306d53c1e0a0076b10d61e4f9ccc317bf46577 100644 (file)
@@ -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
 
 */
 
 #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 <X11/Xlib.h>
 #include <glib.h>
 
-#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;
index a90cb67fc8377cf02cf7cf0bfb2e26991f8c49b8..1147a29268a437b7baec590d7ca9a67f7d9861c3 100644 (file)
@@ -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 (file)
index 0000000..a8e0c2d
--- /dev/null
@@ -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 <X11/Xlib.h>
+#include <glib.h>
+
+#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 (file)
index 0000000..8c84f71
--- /dev/null
@@ -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
index e1607f4ec85392fd1e6496a41952e0bc19c81c69..f9c7e607f1c82b08d04ed3d58568ae7c1a09d291 100644 (file)
@@ -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,
index 0acb486d0284f182b842d556b43598b1344e17a1..7d6a59a24ab7b8d1ec04d16e8139ecba4154c61c 100644 (file)
@@ -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);
This page took 0.047939 seconds and 4 git commands to generate.