merge r6599-6634 from trunk
authorDana Jansens <danakj@orodu.net>
Sat, 19 May 2007 20:55:28 +0000 (20:55 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 19 May 2007 20:55:28 +0000 (20:55 +0000)
25 files changed:
Makefile.am
data/xsession/openbox.desktop.in
debian/changelog.in
doc/openbox.1.in
doc/openbox.1.sgml
makedeb
openbox/action.c
openbox/client.c
openbox/client.h
openbox/client_menu.c
openbox/event.c
openbox/event.h
openbox/focus.c
openbox/focus.h
openbox/frame.c
openbox/openbox.c
openbox/popup.c
openbox/prop.c
openbox/prop.h
openbox/screen.c
openbox/session.c
openbox/session.h
render/obrender-3.0.pc.in
render/render.c
render/render.h

index 0d46f18c51bf5a3c4b0effb884a9af2adde0fbfe..185dd8265d7d38f493ec7978f9dfde59982d0032 100644 (file)
@@ -170,6 +170,12 @@ openbox_openbox_SOURCES = \
        openbox/extensions.h \
        openbox/focus.c \
        openbox/focus.h \
+       openbox/focus_cycle.c \
+       openbox/focus_cycle.h \
+       openbox/focus_cycle_indicator.c \
+       openbox/focus_cycle_indicator.h \
+       openbox/focus_cycle_popup.c \
+       openbox/focus_cycle_popup.h \
        openbox/frame.c \
        openbox/frame.h \
        openbox/framerender.c \
index f8cb9f36fed11053b5e72726fd4662b8fc73b6d2..0914e5b4d9e18abf3b973133601cc5a9a0838d7e 100644 (file)
@@ -3,6 +3,6 @@ Encoding=UTF-8
 Name=Openbox
 Comment=Log in using the Openbox window manager (without a session manager)
 Exec=@bindir@/openbox-session
-TryExec=@bidir@/openbox-session
+TryExec=@bindir@/openbox-session
 Icon=openbox.png
 Type=XSession
index 678b149708ae25859ea634bb3c174b0901bddf23..a217280032375fd540479474b632d69d16ce323b 100644 (file)
@@ -1,4 +1,4 @@
-openbox (@version@-0) unstable; urgency=low
+openbox (@version@) unstable; urgency=low
 
   * Upstream release.
 
index 32acabc7542ca71379219254329867ee6408a651..f419db1495bb4b5cb230dbccc8fde84ccb0789d0 100644 (file)
@@ -48,9 +48,7 @@ above regarding the autostart.sh file.
 .PP 
 You can use the \fBobconf\fR tool to configure Openbox 
 easily with a graphical interface, however more in-depth configuration 
-is possible by editing the configuration files by hand. Please note that 
-\fBobconf\fR older than version 2.0 may not work at all 
-for you. 
+is possible by editing the configuration files by hand. 
 .PP 
 The default configuration and menu files are installed in 
 @configdir@/openbox/, and the user configuration is placed in 
@@ -90,4 +88,4 @@ The program's full documentation is available on the website:
 .PP 
 Please report bugs to: \fBhttp://bugzilla.icculus.org/ 
 \fP 
-.\" created by instant / docbook-to-man, Wed 16 May 2007, 13:08 
+.\" created by instant / docbook-to-man, Sat 19 May 2007, 16:56 
index 6796f22eb439c3759df6c46168f5ba8b24086422..2e0c3c833039a1493685e0aa1ca8b026a33f93cf 100644 (file)
@@ -90,9 +90,7 @@ manpage.1: manpage.sgml
 
     <para>You can use the <command>obconf</command> tool to configure Openbox
       easily with a graphical interface, however more in-depth configuration
-      is possible by editing the configuration files by hand. Please note that
-      <command>obconf</command> older than version 2.0 may not work at all
-      for you.</para>
+      is possible by editing the configuration files by hand.</para>
 
     <para>The default configuration and menu files are installed in
       @configdir@/openbox/, and the user configuration is placed in
diff --git a/makedeb b/makedeb
index ac5f6de71905f5f72e7767e885244531688a7e16..ec0d62066e2eb5481b8a8e58e190d65e02da6d92 100755 (executable)
--- a/makedeb
+++ b/makedeb
@@ -15,7 +15,7 @@ fi
 VERSION=$(grep AC_INIT\(\\\[openbox\\] configure.ac|cut -d [ -f 3-|cut -d ] -f 1)
 
 echo
-echo "Building deb for openbox-$VERSION$APPEND"
+echo "Building deb for openbox-$VERSION-0$APPEND"
 echo
 
 TIME="$(date '+%a, %d %B %Y %T %z')"
@@ -28,6 +28,6 @@ make distclean > /dev/null || rm -f config.status
 
 rm -f $OUT
 
-sed -e "s!@time@!$TIME!" -e "s!@version@!$VERSION$APPEND!" $IN >$OUT && \
+sed -e "s!@time@!$TIME!" -e "s!@version@!$VERSION-0$APPEND!" $IN >$OUT && \
 fakeroot debian/rules binary && \
 make distclean > /dev/null
index 431b88c1de05606512fa29dcf529aee8549d9e92..f106697971ee4c3617821e48cecc2f07dd65ec60 100644 (file)
@@ -20,6 +20,7 @@
 #include "debug.h"
 #include "client.h"
 #include "focus.h"
+#include "focus_cycle.h"
 #include "moveresize.h"
 #include "menu.h"
 #include "prop.h"
 
 #include <glib.h>
 
-inline void client_action_start(union ActionData *data)
+static void client_action_start(union ActionData *data)
 {
 }
 
-inline void client_action_end(union ActionData *data)
+static void client_action_end(union ActionData *data)
 {
     if (config_focus_follow)
         if (data->any.context != OB_FRAME_CONTEXT_CLIENT) {
-            if (!data->any.button) {
-                event_ignore_queued_enters();
+            if (!data->any.button && data->any.c) {
+                event_ignore_all_queued_enters();
             } else {
                 ObClient *c;
 
index addaed44f8c1f14fd531bb1570c6766446c3d1ae..0dd122148b948caf1b0305a99c6af0283fe9a463 100644 (file)
@@ -565,7 +565,7 @@ void client_unmanage(ObClient *self)
 
     /* ignore enter events from the unmap so it doesnt mess with the
        focus */
-    event_ignore_queued_enters();
+    event_ignore_all_queued_enters();
 
     mouse_grab_for_client(self, FALSE);
 
@@ -1721,7 +1721,7 @@ void client_setup_decor_and_functions(ObClient *self)
 
 static void client_change_allowed_actions(ObClient *self)
 {
-    gulong actions[11];
+    gulong actions[12];
     gint num = 0;
 
     /* desktop windows are kept on all desktops */
@@ -1748,6 +1748,8 @@ static void client_change_allowed_actions(ObClient *self)
         actions[num++] = prop_atoms.net_wm_action_above;
     if (self->functions & OB_CLIENT_FUNC_BELOW)
         actions[num++] = prop_atoms.net_wm_action_below;
+    if (self->functions & OB_CLIENT_FUNC_UNDECORATE)
+        actions[num++] = prop_atoms.ob_wm_action_undecorate;
 
     PROP_SETA32(self->window, net_wm_allowed_actions, atom, actions, num);
 
index 05153eb0008fa14dc0523a1d431c97382bf537c4..1467ecd1d537a0973f0dde23e2ea5cd88ead73b1 100644 (file)
@@ -80,7 +80,6 @@ typedef enum
 struct _ObClient
 {
     ObWindow obwin;
-
     Window  window;
 
     /*! The window's decorations. NULL while the window is being managed! */
index 6fa744c41b8545790886c873251a921e4b4f7b6a..f538eafd7f36ae263a81e2feecd8bba0f932073a 100644 (file)
@@ -119,19 +119,15 @@ static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
         break;
     case CLIENT_RESTORE:
         client_maximize(c, FALSE, 0);
-        event_ignore_queued_enters();
         break;
     case CLIENT_MAXIMIZE:
         client_maximize(c, TRUE, 0);
-        event_ignore_queued_enters();
         break;
     case CLIENT_SHADE:
         client_shade(c, !c->shaded);
-        event_ignore_queued_enters();
         break;
     case CLIENT_DECORATE:
         client_set_undecorated(c, !c->undecorated);
-        event_ignore_queued_enters();
         break;
     case CLIENT_MOVE:
         /* this needs to grab the keyboard so hide the menu */
@@ -158,6 +154,8 @@ static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
         g_assert_not_reached();
     }
 
+    event_ignore_all_queued_enters();
+
     /* update the menu cuz stuff can have changed */
     if (f) {
         client_menu_update(f, NULL);
@@ -217,7 +215,7 @@ static void layer_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
         g_assert_not_reached();
     }
 
-    event_ignore_queued_enters();
+    event_ignore_all_queued_enters();
 
     /* update the menu cuz stuff can have changed */
     if (f) {
index 7b8793fa8bc0e28aaa0a59e3d3c7bf943a7dc643..8f21120248af2e5d6ee7f8eb0e5e7208990cbd2d 100644 (file)
@@ -38,6 +38,7 @@
 #include "mainloop.h"
 #include "framerender.h"
 #include "focus.h"
+#include "focus_cycle.h"
 #include "moveresize.h"
 #include "group.h"
 #include "stacking.h"
@@ -85,6 +86,7 @@ static void event_handle_dockapp(ObDockApp *app, XEvent *e);
 static void event_handle_client(ObClient *c, XEvent *e);
 static void event_handle_user_time_window_clients(GSList *l, XEvent *e);
 static void event_handle_user_input(ObClient *client, XEvent *e);
+static gboolean is_enter_focus_event_ignored(XEvent *e);
 
 static void focus_delay_dest(gpointer data);
 static gboolean focus_delay_cmp(gconstpointer d1, gconstpointer d2);
@@ -359,7 +361,7 @@ static Bool event_look_for_focusin(Display *d, XEvent *e, XPointer arg)
     return e->type == FocusIn && wanted_focusevent(e, FALSE);
 }
 
-Bool event_look_for_focusin_client(Display *d, XEvent *e, XPointer arg)
+static Bool event_look_for_focusin_client(Display *d, XEvent *e, XPointer arg)
 {
     return e->type == FocusIn && wanted_focusevent(e, TRUE);
 }
@@ -574,7 +576,6 @@ static void event_process(const XEvent *ec, gpointer data)
             frame_adjust_focus(client->frame, FALSE);
             if (client == focus_client)
                 focus_set_client(NULL);
-            /* focus_set_client has already been called for sure */
             client_calc_layer(client);
         }
     } else if (timewinclients)
@@ -884,7 +885,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
                corresponding enter events. Pretend like the animating window
                doesn't even exist..! */
             if (frame_iconify_animating(client->frame))
-                event_ignore_queued_enters();
+                event_ignore_all_queued_enters();
 
             ob_debug_type(OB_DEBUG_FOCUS,
                           "%sNotify mode %d detail %d on %lx\n",
@@ -910,13 +911,6 @@ static void event_handle_client(ObClient *client, XEvent *e)
         break;
     case EnterNotify:
     {
-        gboolean nofocus = FALSE;
-
-        if (ignore_enter_focus) {
-            ignore_enter_focus--;
-            nofocus = TRUE;
-        }
-
         con = frame_context(client, e->xcrossing.window,
                             e->xcrossing.x, e->xcrossing.y);
         switch (con) {
@@ -946,22 +940,23 @@ static void event_handle_client(ObClient *client, XEvent *e)
             if (e->xcrossing.mode == NotifyGrab ||
                 e->xcrossing.mode == NotifyUngrab ||
                 /*ignore enters when we're already in the window */
-                e->xcrossing.detail == NotifyInferior)
+                e->xcrossing.detail == NotifyInferior ||
+                is_enter_focus_event_ignored(e))
             {
                 ob_debug_type(OB_DEBUG_FOCUS,
                               "%sNotify mode %d detail %d on %lx IGNORED\n",
                               (e->type == EnterNotify ? "Enter" : "Leave"),
                               e->xcrossing.mode,
                               e->xcrossing.detail, client?client->window:0);
-            } else {
+            }
+            else {
                 ob_debug_type(OB_DEBUG_FOCUS,
                               "%sNotify mode %d detail %d on %lx, "
-                              "focusing window: %d\n",
+                              "focusing window\n",
                               (e->type == EnterNotify ? "Enter" : "Leave"),
                               e->xcrossing.mode,
-                              e->xcrossing.detail, (client?client->window:0),
-                              !nofocus);
-                if (!nofocus && config_focus_follow)
+                              e->xcrossing.detail, (client?client->window:0));
+                if (config_focus_follow)
                     event_enter_client(client);
             }
             break;
@@ -1085,7 +1080,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
             client_configure(client, x, y, w, h, FALSE, TRUE);
 
             /* ignore enter events caused by these like ob actions do */
-            event_ignore_queued_enters();
+            event_ignore_all_queued_enters();
         }
         break;
     }
@@ -1181,7 +1176,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
                              e->xclient.data.l[1], e->xclient.data.l[2]);
 
             /* ignore enter events caused by these like ob actions do */
-            event_ignore_queued_enters();
+            event_ignore_all_queued_enters();
         } else if (msgtype == prop_atoms.net_close_window) {
             ob_debug("net_close_window for 0x%lx\n", client->window);
             client_close(client);
@@ -1269,7 +1264,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
             client_configure(client, x, y, w, h, FALSE, TRUE);
 
             /* ignore enter events caused by these like ob actions do */
-            event_ignore_queued_enters();
+            event_ignore_all_queued_enters();
         } else if (msgtype == prop_atoms.net_restack_window) {
             if (e->xclient.data.l[0] != 2) {
                 ob_debug_type(OB_DEBUG_APP_BUGS,
@@ -1279,8 +1274,8 @@ static void event_handle_client(ObClient *client, XEvent *e)
             } else {
                 ObClient *sibling = NULL;
                 if (e->xclient.data.l[1]) {
-                    ObWindow *win = g_hash_table_lookup(window_map,
-                                                        &e->xclient.data.l[1]);
+                    ObWindow *win = g_hash_table_lookup
+                        (window_map, &e->xclient.data.l[1]);
                     if (WINDOW_IS_CLIENT(win) &&
                         WINDOW_AS_CLIENT(win) != client)
                     {
@@ -1612,6 +1607,10 @@ static gboolean event_handle_menu(XEvent *ev)
         }
         break;
     case LeaveNotify:
+        /*ignore leaves when we're already in the window */
+        if (ev->xcrossing.detail == NotifyInferior)
+            break;
+
         if ((e = g_hash_table_lookup(menu_frame_map, &ev->xcrossing.window)) &&
             (f = find_active_menu()) && f->selected == e &&
             e->entry->type != OB_MENU_ENTRY_TYPE_SUBMENU)
@@ -1718,35 +1717,51 @@ void event_halt_focus_delay()
     ob_main_loop_timeout_remove(ob_main_loop, focus_delay_func);
 }
 
-void event_ignore_queued_enters()
+static Bool event_look_for_enters(Display *d, XEvent *e, XPointer arg)
 {
-    GSList *saved = NULL, *it;
-    XEvent *e;
-                
-    XSync(ob_display, FALSE);
+    if (e->type == EnterNotify &&
+        /* these types aren't used for focusing */
+        !(e->xcrossing.mode == NotifyGrab ||
+          e->xcrossing.mode == NotifyUngrab ||
+          e->xcrossing.detail == NotifyInferior))
+    {
+        ObWindow *win;
 
-    /* count the events */
-    while (TRUE) {
-        e = g_new(XEvent, 1);
-        if (XCheckTypedEvent(ob_display, EnterNotify, e)) {
-            ObWindow *win;
-            
-            win = g_hash_table_lookup(window_map, &e->xany.window);
-            if (win && WINDOW_IS_CLIENT(win))
-                ++ignore_enter_focus;
-            
-            saved = g_slist_append(saved, e);
-        } else {
-            g_free(e);
-            break;
-        }
+        /* found an enter for that leave, ignore it if it's going to
+           another window */
+        win = g_hash_table_lookup(window_map, &e->xany.window);
+        if (win && WINDOW_IS_CLIENT(win))
+            ++ignore_enter_focus;
     }
-    /* put the events back */
-    for (it = saved; it; it = g_slist_next(it)) {
-        XPutBackEvent(ob_display, it->data);
-        g_free(it->data);
+    return False; /* don't disrupt the queue order, just count them */
+}
+
+void event_ignore_all_queued_enters()
+{
+    XEvent e;
+
+    XSync(ob_display, FALSE);
+
+    /* count the events without disrupting them */
+    ignore_enter_focus = 0;
+    XCheckIfEvent(ob_display, &e, event_look_for_enters, NULL);
+}
+
+static gboolean is_enter_focus_event_ignored(XEvent *e)
+{
+    g_assert(e->type == EnterNotify &&
+             !(e->xcrossing.mode == NotifyGrab ||
+               e->xcrossing.mode == NotifyUngrab ||
+               e->xcrossing.detail == NotifyInferior));
+
+    ob_debug_type(OB_DEBUG_FOCUS, "# enters ignored: %d\n",
+                  ignore_enter_focus);
+
+    if (ignore_enter_focus) {
+        --ignore_enter_focus;
+        return TRUE;
     }
-    g_slist_free(saved);
+    return FALSE;
 }
 
 gboolean event_time_after(Time t1, Time t2)
index 4fdf292e511e3f41c025d11a0c919bcdc0390c21..542115fb6d4b1e9102dc062a8ecbbc5f61abd1fe 100644 (file)
@@ -39,9 +39,9 @@ void event_shutdown(gboolean reconfig);
   follows mouse */
 void event_enter_client(struct _ObClient *client);
 
-/*! Request that any queued EnterNotify events not be used for distributing
-  focus */
-void event_ignore_queued_enters();
+/*! Make mouse focus not move at all from the stuff that has happened up
+  till now. */
+void event_ignore_all_queued_enters();
 
 /* Halts any focus delay in progress, use this when the user is selecting a
    window for focus */
index 301e5ddfa9eaa1e482a73b72a3018d591e753d98..42241224534e35fc07f021b0c4f86d4d0d1705c3 100644 (file)
 #include "event.h"
 #include "openbox.h"
 #include "grab.h"
-#include "framerender.h"
 #include "client.h"
 #include "config.h"
-#include "frame.h"
+#include "focus_cycle.h"
 #include "screen.h"
-#include "group.h"
 #include "prop.h"
 #include "keyboard.h"
 #include "focus.h"
 #include "stacking.h"
-#include "popup.h"
-#include "render/render.h"
 
 #include <X11/Xlib.h>
 #include <glib.h>
-#include <assert.h>
 
 #define FOCUS_INDICATOR_WIDTH 6
 
 ObClient *focus_client = NULL;
 GList *focus_order = NULL;
-ObClient *focus_cycle_target = NULL;
-
-struct {
-    InternalWindow top;
-    InternalWindow left;
-    InternalWindow right;
-    InternalWindow bottom;
-} focus_indicator;
-
-RrAppearance *a_focus_indicator;
-RrColor *color_white;
-
-static ObIconPopup *focus_cycle_popup;
-
-static gboolean valid_focus_target(ObClient *ft,
-                                   gboolean all_desktops,
-                                   gboolean dock_windows,
-                                   gboolean desktop_windows);
-static void focus_cycle_destroy_notify(ObClient *client, gpointer data);
-
-static Window createWindow(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_startup(gboolean reconfig)
 {
-    focus_cycle_popup = icon_popup_new(TRUE);
-
-    if (!reconfig) {
-        XSetWindowAttributes attr;
-
-        client_add_destroy_notify(focus_cycle_destroy_notify, NULL);
-
-        /* start with nothing focused */
-        focus_nothing();
-
-        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 =
-            createWindow(RootWindow(ob_display, ob_screen),
-                         CWOverrideRedirect | CWBackPixel, &attr);
-        focus_indicator.left.win =
-            createWindow(RootWindow(ob_display, ob_screen),
-                         CWOverrideRedirect | CWBackPixel, &attr);
-        focus_indicator.right.win =
-            createWindow(RootWindow(ob_display, ob_screen),
-                         CWOverrideRedirect | CWBackPixel, &attr);
-        focus_indicator.bottom.win =
-            createWindow(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;
-    }
+    if (reconfig) return;
+
+    /* start with nothing focused */
+    focus_nothing();
 }
 
 void focus_shutdown(gboolean reconfig)
 {
-    icon_popup_free(focus_cycle_popup);
-
-    if (!reconfig) {
-        client_remove_destroy_notify(focus_cycle_destroy_notify);
-
-        /* reset focus to root */
-        XSetInputFocus(ob_display, PointerRoot, RevertToNone, CurrentTime);
-
-        RrColorFree(color_white);
-
-        RrAppearanceFree(a_focus_indicator);
+    if (reconfig) return;
 
-        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);
-    }
+    /* reset focus to root */
+    XSetInputFocus(ob_display, PointerRoot, RevertToNone, CurrentTime);
 }
 
 static void push_to_top(ObClient *client)
@@ -167,11 +74,8 @@ 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.
-    */
-    if (focus_cycle_target)
-        focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
+    /* in the middle of cycling..? kill it. */
+    focus_cycle_stop();
 
     focus_client = client;
 
@@ -304,593 +208,6 @@ void focus_nothing()
                    event_curtime);
 }
 
-static gchar *popup_get_name(ObClient *c, ObClient **nametarget)
-{
-    ObClient *p;
-    gchar *title = NULL;
-    const gchar *desk = NULL;
-    gchar *ret;
-
-    /* find our highest direct parent, including non-normal windows */
-    for (p = c; p->transient_for && p->transient_for != OB_TRAN_GROUP;
-         p = p->transient_for);
-
-    if (c->desktop != DESKTOP_ALL && c->desktop != screen_desktop)
-        desk = screen_desktop_names[c->desktop];
-
-    /* use the transient's parent's title/icon if we don't have one */
-    if (p != c && !strcmp("", (c->iconic ? c->icon_title : c->title)))
-        title = g_strdup(p->iconic ? p->icon_title : p->title);
-
-    if (title == NULL)
-        title = g_strdup(c->iconic ? c->icon_title : c->title);
-
-    if (desk)
-        ret = g_strdup_printf("%s [%s]", title, desk);
-    else {
-        ret = title;
-        title = NULL;
-    }
-    g_free(title);
-
-    /* set this only if we're returning true and they asked for it */
-    if (ret && nametarget) *nametarget = p;
-    return ret;
-}
-
-static void popup_cycle(ObClient *c, gboolean show,
-                        gboolean all_desktops, gboolean dock_windows,
-                        gboolean desktop_windows)
-{
-    gchar *showtext = NULL;
-    ObClient *showtarget;
-
-    if (!show) {
-        icon_popup_hide(focus_cycle_popup);
-        return;
-    }
-
-    /* do this stuff only when the dialog is first showing */
-    if (!focus_cycle_popup->popup->mapped &&
-        !focus_cycle_popup->popup->delay_mapped)
-    {
-        Rect *a;
-        gchar **names;
-        GList *targets = NULL, *it;
-        gint n = 0, i;
-
-        /* position the popup */
-        a = screen_physical_area_monitor(0);
-        icon_popup_position(focus_cycle_popup, CenterGravity,
-                            a->x + a->width / 2, a->y + a->height / 2);
-        icon_popup_height(focus_cycle_popup, POPUP_HEIGHT);
-        icon_popup_min_width(focus_cycle_popup, POPUP_WIDTH);
-        icon_popup_max_width(focus_cycle_popup,
-                             MAX(a->width/3, POPUP_WIDTH));
-
-
-        /* make its width to be the width of all the possible titles */
-
-        /* build a list of all the valid focus targets */
-        for (it = focus_order; it; it = g_list_next(it)) {
-            ObClient *ft = it->data;
-            if (valid_focus_target(ft, all_desktops, dock_windows
-                                   , desktop_windows))
-            {
-                targets = g_list_prepend(targets, ft);
-                ++n;
-            }
-        }
-        /* make it null terminated so we can use g_strfreev */
-        names = g_new(char*, n+1);
-        for (it = targets, i = 0; it; it = g_list_next(it), ++i) {
-            ObClient *ft = it->data, *t;
-            names[i] = popup_get_name(ft, &t);
-
-            /* little optimization.. save this text and client, so we dont
-               have to get it again */
-            if (ft == c) {
-                showtext = g_strdup(names[i]);
-                showtarget = t;
-            }
-        }
-        names[n] = NULL;
-
-        icon_popup_text_width_to_strings(focus_cycle_popup, names, n);
-        g_strfreev(names);
-    }
-
-
-    if (!showtext) showtext = popup_get_name(c, &showtarget);
-    icon_popup_show(focus_cycle_popup, showtext,
-                    client_icon(showtarget, 48, 48));
-    g_free(showtext);
-}
-
-static void focus_cycle_destroy_notify(ObClient *client, gpointer data)
-{
-    /* end cycling if the target disappears. CurrentTime is fine, time won't
-       be used
-    */
-    if (focus_cycle_target == client)
-        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_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);
-    }
-}
-
-static gboolean has_valid_group_siblings_on_desktop(ObClient *ft,
-                                                    gboolean all_desktops)
-                                                         
-{
-    GSList *it;
-
-    if (!ft->group) return FALSE;
-
-    for (it = ft->group->members; it; it = g_slist_next(it)) {
-        ObClient *c = it->data;
-        /* check that it's not a helper window to avoid infinite recursion */
-        if (c != ft && !client_helper(c) &&
-            valid_focus_target(c, all_desktops, FALSE, FALSE))
-        {
-            return TRUE;
-        }
-    }
-    return FALSE;
-}
-
-/*! @param allow_helpers This is used for calling itself recursively while
-                         checking helper windows. */
-static gboolean valid_focus_target(ObClient *ft,
-                                   gboolean all_desktops,
-                                   gboolean dock_windows,
-                                   gboolean desktop_windows)
-{
-    gboolean ok = FALSE;
-
-    /* it's on this desktop unless you want all desktops.
-
-       do this check first because it will usually filter out the most
-       windows */
-    ok = (all_desktops || ft->desktop == screen_desktop ||
-          ft->desktop == DESKTOP_ALL);
-
-    /* the window can receive focus somehow */
-    ok = ok && (ft->can_focus || ft->focus_notify);
-
-    /* it's the right type of window */
-    if (dock_windows || desktop_windows)
-        ok = ok && ((dock_windows && ft->type == OB_CLIENT_TYPE_DOCK) ||
-                    (desktop_windows && ft->type == OB_CLIENT_TYPE_DESKTOP));
-    else
-        /* normal non-helper windows are valid targets */
-        ok = ok &&
-            ((client_normal(ft) && !client_helper(ft))
-             ||
-             /* helper windows are valid targets it... */
-             (client_helper(ft) &&
-              /* ...a window in its group already has focus ... */
-              ((focus_client && ft->group == focus_client->group) ||
-               /* ... or if there are no other windows in its group 
-                  that can be cycled to instead */
-               !has_valid_group_siblings_on_desktop(ft, all_desktops))));
-
-    /* it's not set to skip the taskbar (unless it is a type that would be
-       expected to set this hint */
-    ok = ok && ((ft->type == OB_CLIENT_TYPE_DOCK ||
-                 ft->type == OB_CLIENT_TYPE_DESKTOP ||
-                 ft->type == OB_CLIENT_TYPE_TOOLBAR ||
-                 ft->type == OB_CLIENT_TYPE_MENU ||
-                 ft->type == OB_CLIENT_TYPE_UTILITY) ||
-                !ft->skip_taskbar);
-
-    /* it's not going to just send fous off somewhere else (modal window) */
-    ok = ok && ft == client_focus_target(ft);
-
-    return ok;
-}
-
-void focus_cycle(gboolean forward, gboolean all_desktops,
-                 gboolean dock_windows, gboolean desktop_windows,
-                 gboolean linear, gboolean interactive,
-                 gboolean dialog, gboolean done, gboolean cancel)
-{
-    static ObClient *first = NULL;
-    static ObClient *t = NULL;
-    static GList *order = NULL;
-    GList *it, *start, *list;
-    ObClient *ft = NULL;
-
-    if (interactive) {
-        if (cancel) {
-            focus_cycle_target = NULL;
-            goto done_cycle;
-        } else if (done)
-            goto done_cycle;
-
-        if (!focus_order)
-            goto done_cycle;
-
-        if (!first) first = focus_client;
-
-        if (linear) list = client_list;
-        else        list = focus_order;
-    } else {
-        if (!focus_order)
-            goto done_cycle;
-        list = client_list;
-    }
-    if (!focus_cycle_target) focus_cycle_target = focus_client;
-
-    start = it = g_list_find(list, focus_cycle_target);
-    if (!start) /* switched desktops or something? */
-        start = it = forward ? g_list_last(list) : g_list_first(list);
-    if (!start) goto done_cycle;
-
-    do {
-        if (forward) {
-            it = it->next;
-            if (it == NULL) it = g_list_first(list);
-        } else {
-            it = it->prev;
-            if (it == NULL) it = g_list_last(list);
-        }
-        ft = it->data;
-        if (valid_focus_target(ft, all_desktops, dock_windows,
-                               desktop_windows))
-        {
-            if (interactive) {
-                if (ft != focus_cycle_target) { /* prevents flicker */
-                    focus_cycle_target = ft;
-                    focus_cycle_draw_indicator();
-                }
-                /* same arguments as valid_focus_target */
-                popup_cycle(ft, dialog, all_desktops, dock_windows,
-                            desktop_windows);
-                return;
-            } else if (ft != focus_cycle_target) {
-                focus_cycle_target = ft;
-                done = TRUE;
-                break;
-            }
-        }
-    } while (it != start);
-
-done_cycle:
-    if (done && focus_cycle_target)
-        client_activate(focus_cycle_target, FALSE, TRUE);
-
-    t = NULL;
-    first = NULL;
-    focus_cycle_target = NULL;
-    g_list_free(order);
-    order = NULL;
-
-    if (interactive) {
-        focus_cycle_draw_indicator();
-        popup_cycle(ft, FALSE, FALSE, FALSE, FALSE);
-    }
-
-    return;
-}
-
-/* this be mostly ripped from fvwm */
-static ObClient *focus_find_directional(ObClient *c, ObDirection dir,
-                                        gboolean dock_windows,
-                                        gboolean desktop_windows) 
-{
-    gint my_cx, my_cy, his_cx, his_cy;
-    gint offset = 0;
-    gint distance = 0;
-    gint score, best_score;
-    ObClient *best_client, *cur;
-    GList *it;
-
-    if(!client_list)
-        return NULL;
-
-    /* first, find the centre coords of the currently focused window */
-    my_cx = c->frame->area.x + c->frame->area.width / 2;
-    my_cy = c->frame->area.y + c->frame->area.height / 2;
-
-    best_score = -1;
-    best_client = NULL;
-
-    for(it = g_list_first(client_list); it; it = g_list_next(it)) {
-        cur = it->data;
-
-        /* the currently selected window isn't interesting */
-        if(cur == c)
-            continue;
-        if (cur->type == OB_CLIENT_TYPE_DOCK && !dock_windows)
-            continue;
-        if (cur->type == OB_CLIENT_TYPE_DESKTOP && !desktop_windows)
-            continue;
-        if (!client_normal(cur) &&
-            cur->type != OB_CLIENT_TYPE_DOCK &&
-            cur->type != OB_CLIENT_TYPE_DESKTOP)
-            continue;
-        /* using c->desktop instead of screen_desktop doesn't work if the
-         * current window was omnipresent, hope this doesn't have any other
-         * side effects */
-        if(screen_desktop != cur->desktop && cur->desktop != DESKTOP_ALL)
-            continue;
-        if(cur->iconic)
-            continue;
-        if(!(client_focus_target(cur) == cur &&
-             client_can_focus(cur)))
-            continue;
-
-        /* find the centre coords of this window, from the
-         * currently focused window's point of view */
-        his_cx = (cur->frame->area.x - my_cx)
-            + cur->frame->area.width / 2;
-        his_cy = (cur->frame->area.y - my_cy)
-            + cur->frame->area.height / 2;
-
-        if(dir == OB_DIRECTION_NORTHEAST || dir == OB_DIRECTION_SOUTHEAST ||
-           dir == OB_DIRECTION_SOUTHWEST || dir == OB_DIRECTION_NORTHWEST) {
-            gint tx;
-            /* Rotate the diagonals 45 degrees counterclockwise.
-             * To do this, multiply the matrix /+h +h\ with the
-             * vector (x y).                   \-h +h/
-             * h = sqrt(0.5). We can set h := 1 since absolute
-             * distance doesn't matter here. */
-            tx = his_cx + his_cy;
-            his_cy = -his_cx + his_cy;
-            his_cx = tx;
-        }
-
-        switch(dir) {
-        case OB_DIRECTION_NORTH:
-        case OB_DIRECTION_SOUTH:
-        case OB_DIRECTION_NORTHEAST:
-        case OB_DIRECTION_SOUTHWEST:
-            offset = (his_cx < 0) ? -his_cx : his_cx;
-            distance = ((dir == OB_DIRECTION_NORTH ||
-                         dir == OB_DIRECTION_NORTHEAST) ?
-                        -his_cy : his_cy);
-            break;
-        case OB_DIRECTION_EAST:
-        case OB_DIRECTION_WEST:
-        case OB_DIRECTION_SOUTHEAST:
-        case OB_DIRECTION_NORTHWEST:
-            offset = (his_cy < 0) ? -his_cy : his_cy;
-            distance = ((dir == OB_DIRECTION_WEST ||
-                         dir == OB_DIRECTION_NORTHWEST) ?
-                        -his_cx : his_cx);
-            break;
-        }
-
-        /* the target must be in the requested direction */
-        if(distance <= 0)
-            continue;
-
-        /* Calculate score for this window.  The smaller the better. */
-        score = distance + offset;
-
-        /* windows more than 45 degrees off the direction are
-         * heavily penalized and will only be chosen if nothing
-         * else within a million pixels */
-        if(offset > distance)
-            score += 1000000;
-
-        if(best_score == -1 || score < best_score)
-            best_client = cur,
-                best_score = score;
-    }
-
-    return best_client;
-}
-
-void focus_directional_cycle(ObDirection dir, gboolean dock_windows,
-                             gboolean desktop_windows, gboolean interactive,
-                             gboolean dialog, gboolean done, gboolean cancel)
-{
-    static ObClient *first = NULL;
-    ObClient *ft = NULL;
-
-    if (!interactive)
-        return;
-
-    if (cancel) {
-        focus_cycle_target = NULL;
-        goto done_cycle;
-    } else if (done)
-        goto done_cycle;
-
-    if (!focus_order)
-        goto done_cycle;
-
-    if (!first) first = focus_client;
-    if (!focus_cycle_target) focus_cycle_target = focus_client;
-
-    if (focus_cycle_target)
-        ft = focus_find_directional(focus_cycle_target, dir, dock_windows,
-                                    desktop_windows);
-    else {
-        GList *it;
-
-        for (it = focus_order; it; it = g_list_next(it))
-            if (valid_focus_target(it->data, FALSE, dock_windows,
-                                   desktop_windows))
-                ft = it->data;
-    }
-        
-    if (ft) {
-        if (ft != focus_cycle_target) {/* prevents flicker */
-            focus_cycle_target = ft;
-            focus_cycle_draw_indicator();
-        }
-    }
-    if (focus_cycle_target) {
-        /* same arguments as valid_focus_target */
-        popup_cycle(focus_cycle_target, dialog, FALSE, dock_windows,
-                    desktop_windows);
-        if (dialog)
-            return;
-    }
-
-
-done_cycle:
-    if (done && focus_cycle_target)
-        client_activate(focus_cycle_target, FALSE, TRUE);
-
-    first = NULL;
-    focus_cycle_target = NULL;
-
-    focus_cycle_draw_indicator();
-    popup_cycle(ft, FALSE, FALSE, FALSE, FALSE);
-
-    return;
-}
-
-void focus_order_add_new(ObClient *c)
-{
-    if (c->iconic)
-        focus_order_to_top(c);
-    else {
-        g_assert(!g_list_find(focus_order, c));
-        /* if there are any iconic windows, put this above them in the order,
-           but if there are not, then put it under the currently focused one */
-        if (focus_order && ((ObClient*)focus_order->data)->iconic)
-            focus_order = g_list_insert(focus_order, c, 0);
-        else
-            focus_order = g_list_insert(focus_order, c, 1);
-    }
-}
-
 void focus_order_remove(ObClient *c)
 {
     focus_order = g_list_remove(focus_order, c);
index 451cc162950c6e3fe9f6bcd19d0957233288973c..9bd4f206e90a900611191b01fbcad2ec06a45358 100644 (file)
@@ -29,8 +29,6 @@ struct _ObClient;
 
 /*! The client which is currently focused */
 extern struct _ObClient *focus_client;
-/*! The client which appears focused during a focus cycle operation */
-extern struct _ObClient *focus_cycle_target;
 
 /*! The recent focus order on each desktop */
 extern GList *focus_order;
@@ -48,16 +46,6 @@ void focus_nothing();
 /*! Call this when you need to focus something! */
 struct _ObClient* focus_fallback(gboolean allow_refocus);
 
-/*! Cycle focus amongst windows. */
-void focus_cycle(gboolean forward, gboolean all_desktops,
-                 gboolean dock_windows, gboolean desktop_windows,
-                 gboolean linear, gboolean interactive,
-                 gboolean dialog, gboolean done, gboolean cancel);
-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();
-
 /*! Add a new client into the focus order */
 void focus_order_add_new(struct _ObClient *c);
 
index 16c879e9f3f8515457f8a57bfd4d07cd45beee80..a0784d23505e7b0850d0d348bac0edaefdeb0896 100644 (file)
@@ -25,7 +25,8 @@
 #include "config.h"
 #include "framerender.h"
 #include "mainloop.h"
-#include "focus.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,
@@ -1171,6 +1172,10 @@ void frame_end_iconify_animation(ObFrame *self)
 
     if (!self->visible)
         XUnmapWindow(ob_display, self->window);
+    else
+        /* Send a ConfigureNotify when the animation is done, this fixes
+           KDE's pager showing the window in the wrong place. */
+        client_reconfigure(self->client);
 
     /* we're not animating any more ! */
     self->iconify_animation_going = 0;
index 78b5322373021c7e6267be94059a133c15089dda..996cb227febcd9394d2f9e36b2011662a2ae7e6e 100644 (file)
@@ -30,6 +30,9 @@
 #include "screen.h"
 #include "startupnotify.h"
 #include "focus.h"
+#include "focus_cycle.h"
+#include "focus_cycle_indicator.h"
+#include "focus_cycle_popup.h"
 #include "moveresize.h"
 #include "frame.h"
 #include "keyboard.h"
@@ -283,6 +286,9 @@ gint main(gint argc, gchar **argv)
             /* focus_backup is used for stacking, so this needs to come before
                anything that calls stacking_add */
             focus_startup(reconfigure);
+            focus_cycle_startup(reconfigure);
+            focus_cycle_indicator_startup(reconfigure);
+            focus_cycle_popup_startup(reconfigure);
             window_startup(reconfigure);
             sn_startup(reconfigure);
             screen_startup(reconfigure);
@@ -348,6 +354,9 @@ gint main(gint argc, gchar **argv)
             propwin_shutdown(reconfigure);
             grab_shutdown(reconfigure);
             screen_shutdown(reconfigure);
+            focus_cycle_popup_shutdown(reconfigure);
+            focus_cycle_indicator_shutdown(reconfigure);
+            focus_cycle_shutdown(reconfigure);
             focus_shutdown(reconfigure);
             sn_shutdown(reconfigure);
             window_shutdown(reconfigure);
index 91c1849c659315e26bfe148d5405cb079d8e628a..2768ee2b44fe7663d460dd7398216d40ac62e4a1 100644 (file)
@@ -269,7 +269,7 @@ void popup_hide(ObPopup *self)
         self->mapped = FALSE;
 
         /* kill enter events cause by this unmapping */
-        event_ignore_queued_enters();
+        event_ignore_all_queued_enters();
     } else if (self->delay_mapped) {
         ob_main_loop_timeout_remove(ob_main_loop, popup_show_timeout);
         self->delay_mapped = FALSE;
index 36e520171d061a1558482317e34587fa312e4e79..1412752a50296986fb41211fdf6ee55a04960c38 100644 (file)
@@ -172,6 +172,7 @@ void prop_startup()
 
     CREATE(openbox_pid, "_OPENBOX_PID");
     CREATE(ob_config, "_OB_CONFIG");
+    CREATE(ob_wm_action_undecorate, "_OB_WM_ACTION_UNDECORATE");
     CREATE(ob_wm_state_undecorated, "_OB_WM_STATE_UNDECORATED");
     CREATE(ob_control, "_OB_CONTROL");
 }
index 35eb1979211c3a1bde3e84764408edf4df03d17a..3f18a363398e52a6a43abe8df22fca3f7de0e046 100644 (file)
@@ -190,6 +190,7 @@ typedef struct Atoms {
 
     /* Openbox specific atoms */
      
+    Atom ob_wm_action_undecorate;
     Atom ob_wm_state_undecorated;
     Atom openbox_pid; /* this is depreecated in favour of ob_control */
     Atom ob_config;
index 452462979c663e868e5b85981908fc344b17c48f..6551da81f0405fd333145405ae4b57aa4cdccd0d 100644 (file)
@@ -288,6 +288,7 @@ gboolean screen_annex()
     supported[i++] = prop_atoms.kde_net_wm_frame_strut;
     supported[i++] = prop_atoms.kde_net_wm_window_type_override;
 
+    supported[i++] = prop_atoms.ob_wm_action_undecorate;
     supported[i++] = prop_atoms.ob_wm_state_undecorated;
     supported[i++] = prop_atoms.openbox_pid;
     supported[i++] = prop_atoms.ob_config;
@@ -522,7 +523,7 @@ void screen_set_desktop(guint num, gboolean dofocus)
         }
     }
 
-    event_ignore_queued_enters();
+    event_ignore_all_queued_enters();
 
     if (event_curtime != CurrentTime)
         screen_desktop_user_time = event_curtime;
index b07f16942418cbbbc56f2e71a9571d288a516d63..d0db0717ffeaf2bf467c8232a090b4d30a12a0fa 100644 (file)
@@ -513,6 +513,8 @@ static gboolean session_save_to_file(const ObSMSaveData *savedata)
             fprintf(f, "\t<role>%s</role>\n", t);
             g_free(t);
 
+            fprintf(f, "\t<windowtype>%d</windowtype>\n", c->type);
+
             fprintf(f, "\t<desktop>%d</desktop>\n", c->desktop);
             fprintf(f, "\t<x>%d</x>\n", prex);
             fprintf(f, "\t<y>%d</y>\n", prey);
@@ -576,12 +578,14 @@ static gboolean session_state_cmp(ObSessionState *s, ObClient *c)
     ob_debug_type(OB_DEBUG_SM, "  client name: %s \n", c->name);
     ob_debug_type(OB_DEBUG_SM, "  client class: %s \n", c->class);
     ob_debug_type(OB_DEBUG_SM, "  client role: %s \n", c->role);
+    ob_debug_type(OB_DEBUG_SM, "  client type: %s \n", c->type);
     ob_debug_type(OB_DEBUG_SM, "  client command: %s \n",
                   c->wm_command ? c->wm_command : "(null)");
     ob_debug_type(OB_DEBUG_SM, "  state id: %s \n", s->id);
     ob_debug_type(OB_DEBUG_SM, "  state name: %s \n", s->name);
     ob_debug_type(OB_DEBUG_SM, "  state class: %s \n", s->class);
     ob_debug_type(OB_DEBUG_SM, "  state role: %s \n", s->role);
+    ob_debug_type(OB_DEBUG_SM, "  state type: %s \n", s->type);
     ob_debug_type(OB_DEBUG_SM, "  state command: %s \n",
                   s->command ? s->command : "(null)");
 
@@ -590,7 +594,13 @@ static gboolean session_state_cmp(ObSessionState *s, ObClient *c)
     {
         return (!strcmp(s->name, c->name) &&
                 !strcmp(s->class, c->class) &&
-                !strcmp(s->role, c->role));
+                !strcmp(s->role, c->role) &&
+                /* the check for type is to catch broken clients, like
+                   firefox, which open a different window on startup
+                   with the same info as the one we saved. only do this
+                   check for old windows that dont use xsmp, others should
+                   know better ! */
+                (!s->command || c->type == s->type));
     }
     return FALSE;
 }
@@ -639,6 +649,9 @@ static void session_load_file(const gchar *path)
         if (!(n = parse_find_node("role", node->children)))
             goto session_load_bail;
         state->role = parse_string(doc, n);
+        if (!(n = parse_find_node("windowtype", node->children)))
+            goto session_load_bail;
+        state->type = parse_int(doc, n);
         if (!(n = parse_find_node("desktop", node->children)))
             goto session_load_bail;
         state->desktop = parse_int(doc, n);
index 8663fce2973110d34688312ac1c5529b03d1307c..97e55a3b1fe8301b04b8eb709a42c72756c518d0 100644 (file)
 #ifndef __ob__session_h
 #define __ob__session_h
 
-#include <glib.h>
+#include "client.h"
 
-struct _ObClient;
+#include <glib.h>
 
 typedef struct _ObSessionState ObSessionState;
 
 struct _ObSessionState {
     gchar *id, *command, *name, *class, *role;
+    ObClientType type;
     guint desktop;
     gint x, y, w, h;
     gboolean shaded, iconic, skip_pager, skip_taskbar, fullscreen;
index 12fc70125a52e1233877c9b846fe23bb9acbdfef..81c37218572abaa8e205e0143afc0e6f0b974085 100644 (file)
@@ -6,9 +6,12 @@ includedir=@includedir@
 xcflags=@X_CFLAGS@
 xlibs=@X_LIBS@
 
+pangocflags=@PANGO_CFLAGS@
+pangolibs=@PANGO_LIBS@
+
 Name: ObRender
 Description: Openbox Render Library
 Version: @VERSION@
-Requires: obparser-3.0 glib-2.0 xft
-Libs: -L${libdir} -lobrender ${xlibs}
-Cflags: -I${includedir}/openbox/@OB_VERSION@ ${xcflags}
+Requires: obparser-3.4 glib-2.0 xft pangoxft
+Libs: -L${libdir} -lobrender ${xlibs} ${pangolibs}
+Cflags: -I${includedir}/openbox/@OB_VERSION@ ${xcflags} ${pangocflags}
index ecb07ada2b6ab200c27eed69ddaafc9541790e87..82e6f96e3d155d1a0830eca6a7742ded5a0f9a8e 100644 (file)
@@ -42,7 +42,7 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h)
 {
     gint i, transferred = 0, sw, sh, partial_w, partial_h;
     RrPixel32 *source, *dest;
-    Pixmap oldp;
+    Pixmap oldp = None;
     RrRect tarea; /* area in which to draw textures */
     gboolean resized;
 
@@ -77,8 +77,10 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h)
                                RrVisual(a->inst), RrColormap(a->inst));
     g_assert(a->xftdraw != NULL);
 
-    g_free(a->surface.pixel_data);
-    a->surface.pixel_data = g_new(RrPixel32, w * h);
+    if (resized) {
+        g_free(a->surface.pixel_data);
+        a->surface.pixel_data = g_new(RrPixel32, w * h);
+    }
 
     if (a->surface.grad == RR_SURFACE_PARENTREL) {
         g_assert (a->surface.parent);
@@ -194,6 +196,14 @@ RrAppearance *RrAppearanceNew(const RrInstance *inst, gint numtex)
   return out;
 }
 
+void RrAppearanceAddTextures(RrAppearance *a, gint numtex)
+{
+    g_assert(a->textures == 0);
+
+    a->textures = numtex;
+    if (numtex) a->texture = g_new0(RrTexture, numtex);
+}
+
 RrAppearance *RrAppearanceCopy(RrAppearance *orig)
 {
     RrSurface *spo, *spc;
index ad638ae8b3705d9c3709fd78fa52c4f4f097c1f2..ac1deb4b0bf3ab8e32ce8e21b4a02c27ba2424dd 100644 (file)
@@ -230,6 +230,7 @@ GC       RrColorGC    (RrColor *c);
 RrAppearance *RrAppearanceNew  (const RrInstance *inst, gint numtex);
 RrAppearance *RrAppearanceCopy (RrAppearance *a);
 void          RrAppearanceFree (RrAppearance *a);
+void          RrAppearanceAddTextures(RrAppearance *a, gint numtex);
 
 RrFont *RrFontOpen          (const RrInstance *inst, const gchar *name, gint size,
                              RrFontWeight weight, RrFontSlant slant);