merge r6636-6644 from trunk
authorDana Jansens <danakj@orodu.net>
Sat, 19 May 2007 23:02:32 +0000 (23:02 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 19 May 2007 23:02:32 +0000 (23:02 +0000)
15 files changed:
data/rc.xml
data/rc.xsd
doc/rc-mouse-focus.xml
openbox/event.c
openbox/frame.c
openbox/frame.h
openbox/framerender.c
openbox/keyboard.c
openbox/menuframe.c
openbox/menuframe.h
openbox/misc.h
openbox/mouse.c
openbox/mouse.h
openbox/openbox.c
openbox/screen.c

index efe9337630375064d94fab40954bdfd6a8cf6d6e..94cc7edf41fbf5ba36858bc2b34c033c6f211913 100644 (file)
     </mousebind>
   </context>
 
-  <context name="Handle">
+  <context name="Left">
+    <mousebind button="Left" action="Press">
+      <action name="Activate"/>
+    </mousebind>
+    <mousebind button="Left" action="Drag">
+      <action name="Resize"><edge>left</edge></action>
+    </mousebind>
+  </context>
+
+  <context name="Right">
+    <mousebind button="Left" action="Press">
+      <action name="Activate"/>
+    </mousebind>
+    <mousebind button="Left" action="Drag">
+      <action name="Resize"><edge>right</edge></action>
+    </mousebind>
+  </context>
+
+  <context name="Bottom">
     <mousebind button="Left" action="Press">
       <action name="Activate"/>
     </mousebind>
     <mousebind button="Left" action="Press">
       <action name="Activate"/>
     </mousebind>
+  </context>
 
+  <context name="Root">
     <!-- Menus -->
     <mousebind button="Middle" action="Press">
       <action name="ShowMenu"><menu>client-list-combined-menu</menu></action>
index d883e8bf9c10752f0b34a60188ea9f71f7f714ef..6244bd8b7c35b280ae347b364942c17d2e121a8e 100644 (file)
     <xsd:simpleType name="contextname">
         <xsd:restriction base="xsd:string">
             <xsd:enumeration value="Desktop"/>
+            <xsd:enumeration value="Root"/>
             <xsd:enumeration value="Client"/>
             <xsd:enumeration value="Titlebar"/>
             <xsd:enumeration value="Frame"/>
index ce8ca2a01993233f3d76683e85830ab61cd364fb..c1351cac57a24acd15c6ab4c7e58d00b1e0accbc 100644 (file)
     </mousebind>
   </context>
 
+  <context name="Left">
+    <mousebind button="Left" action="Press">
+      <action name="Focus"/>
+    </mousebind>
+    <mousebind button="Left" action="Click">
+      <action name="Raise"/>
+    </mousebind>
+    <mousebind button="Left" action="Drag">
+      <action name="Resize"><edge>top</edge></action>
+    </mousebind>
+  </context>
+
+  <context name="Right">
+    <mousebind button="Left" action="Press">
+      <action name="Focus"/>
+    </mousebind>
+    <mousebind button="Left" action="Click">
+      <action name="Raise"/>
+    </mousebind>
+    <mousebind button="Left" action="Drag">
+      <action name="Resize"><edge>top</edge></action>
+    </mousebind>
+  </context>
+
   <context name="Handle">
     <mousebind button="Left" action="Press">
       <action name="Focus"/>
index 8f21120248af2e5d6ee7f8eb0e5e7208990cbd2d..bf2fd932cf1f68e2ab90888cb627743641560b73 100644 (file)
@@ -772,7 +772,8 @@ static void event_handle_client(ObClient *client, XEvent *e)
         {
             /* use where the press occured */
             con = frame_context(client, e->xbutton.window, px, py);
-            con = mouse_button_frame_context(con, e->xbutton.button);
+            con = mouse_button_frame_context(con, e->xbutton.button,
+                                             e->xbutton.state);
 
             if (e->type == ButtonRelease && e->xbutton.button == pb)
                 pb = 0, px = py = -1;
@@ -1482,8 +1483,11 @@ static gboolean event_handle_menu_keyboard(XEvent *ev)
         ret = FALSE;
 
     else if (keycode == ob_keycode(OB_KEY_ESCAPE) && state == 0) {
-        /* Escape closes the active menu */
-        menu_frame_hide(frame);
+        /* Escape goes to the parent menu or closes the last one */
+        if (frame->parent)
+            menu_frame_select(frame, NULL, TRUE);
+        else
+            menu_frame_hide_all();
     }
 
     else if (keycode == ob_keycode(OB_KEY_RETURN) && (state == 0 ||
index a0784d23505e7b0850d0d348bac0edaefdeb0896..e042c4fcba75b6a4f751c2c0e751abc21fbe62da 100644 (file)
@@ -138,6 +138,11 @@ ObFrame *frame_new(ObClient *client)
     self->trtresize = createWindow(self->title, NULL, mask, &attrib);
     self->trrresize = createWindow(self->title, NULL, mask, &attrib);
 
+    attrib.cursor = ob_cursor(OB_CURSOR_WEST);
+    self->leftresize = createWindow(self->inner, NULL, mask, &attrib);
+    attrib.cursor = ob_cursor(OB_CURSOR_EAST);
+    self->rightresize = createWindow(self->inner, NULL, mask, &attrib);
+
     mask &= ~CWCursor;
     self->label = createWindow(self->title, NULL, mask, &attrib);
     self->max = createWindow(self->title, NULL, mask, &attrib);
@@ -176,6 +181,14 @@ ObFrame *frame_new(ObClient *client)
 
 static void set_theme_statics(ObFrame *self)
 {
+    gint handle_height;
+
+    if (ob_rr_theme->handle_height > 0)
+        handle_height = ob_rr_theme->handle_height;
+    else
+        handle_height = 1;
+        
+
     /* set colors/appearance/sizes for stuff that doesn't change */
     XResizeWindow(ob_display, self->max,
                   ob_rr_theme->button_size, ob_rr_theme->button_size);
@@ -189,12 +202,10 @@ static void set_theme_statics(ObFrame *self)
                   ob_rr_theme->button_size, ob_rr_theme->button_size);
     XResizeWindow(ob_display, self->shade,
                   ob_rr_theme->button_size, ob_rr_theme->button_size);
-    if (ob_rr_theme->handle_height > 0) {
-        XResizeWindow(ob_display, self->lgrip,
-                      ob_rr_theme->grip_width, ob_rr_theme->handle_height);
-        XResizeWindow(ob_display, self->rgrip,
-                      ob_rr_theme->grip_width, ob_rr_theme->handle_height);
-    }
+    XResizeWindow(ob_display, self->lgrip,
+                  ob_rr_theme->grip_width, handle_height);
+    XResizeWindow(ob_display, self->rgrip,
+                  ob_rr_theme->grip_width, handle_height);
     XResizeWindow(ob_display, self->tltresize,
                   ob_rr_theme->grip_width, ob_rr_theme->paddingy + 1);
     XResizeWindow(ob_display, self->trtresize,
@@ -351,6 +362,8 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
             XSetWindowBorderWidth(ob_display, self->handle, self->rbwidth);
             XSetWindowBorderWidth(ob_display, self->lgrip,  self->rbwidth);
             XSetWindowBorderWidth(ob_display, self->rgrip,  self->rbwidth);
+            XSetWindowBorderWidth(ob_display, self->leftresize, self->bwidth);
+            XSetWindowBorderWidth(ob_display, self->rightresize, self->bwidth);
         }
 
         if (self->decorations & OB_FRAME_DECOR_TITLEBAR)
@@ -385,17 +398,35 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
                     XMoveWindow(ob_display, self->trrresize,
                                 self->width - ob_rr_theme->paddingx - 1, 0);
 
+                    XMoveResizeWindow(ob_display, self->leftresize,
+                                      -(ob_rr_theme->fbwidth * 2) - 1,
+                                      0,
+                                      1,
+                                      self->client->area.height +
+                                      self->cbwidth_y * 2);
+                    XMoveResizeWindow(ob_display, self->rightresize,
+                                      self->client->area.width +
+                                      self->cbwidth_x * 2,
+                                      0,
+                                      1,
+                                      self->client->area.height +
+                                      self->cbwidth_y * 2);
+
                     XMapWindow(ob_display, self->topresize);
                     XMapWindow(ob_display, self->tltresize);
                     XMapWindow(ob_display, self->tllresize);
                     XMapWindow(ob_display, self->trtresize);
                     XMapWindow(ob_display, self->trrresize);
+                    XMapWindow(ob_display, self->leftresize);
+                    XMapWindow(ob_display, self->rightresize);
                 } else {
                     XUnmapWindow(ob_display, self->topresize);
                     XUnmapWindow(ob_display, self->tltresize);
                     XUnmapWindow(ob_display, self->tllresize);
                     XUnmapWindow(ob_display, self->trtresize);
                     XUnmapWindow(ob_display, self->trrresize);
+                    XUnmapWindow(ob_display, self->leftresize);
+                    XUnmapWindow(ob_display, self->rightresize);
                 }
             } else
                 XUnmapWindow(ob_display, self->title);
@@ -406,12 +437,18 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
             layout_title(self);
 
         if (!fake) {
-            if (self->decorations & OB_FRAME_DECOR_HANDLE &&
-                ob_rr_theme->handle_height > 0)
+            if (self->decorations & OB_FRAME_DECOR_HANDLE)
             {
+                gint handle_height;
+
+                if (ob_rr_theme->handle_height > 0)
+                    handle_height = ob_rr_theme->handle_height;
+                else
+                    handle_height = 1;
+
                 XMoveResizeWindow(ob_display, self->handle,
                                   -self->bwidth, FRAME_HANDLE_Y(self),
-                                  self->width, ob_rr_theme->handle_height);
+                                  self->width, handle_height);
                 XMapWindow(ob_display, self->handle);
 
                 if (self->decorations & OB_FRAME_DECOR_GRIPS) {
@@ -548,6 +585,7 @@ void frame_grab_client(ObFrame *self)
 {
     /* reparent the client to the frame */
     XReparentWindow(ob_display, self->client->window, self->plate, 0, 0);
+
     /*
       When reparenting the client window, it is usually not mapped yet, since
       this occurs from a MapRequest. However, in the case where Openbox is
@@ -586,6 +624,8 @@ void frame_grab_client(ObFrame *self)
     g_hash_table_insert(window_map, &self->tllresize, self->client);
     g_hash_table_insert(window_map, &self->trtresize, self->client);
     g_hash_table_insert(window_map, &self->trrresize, self->client);
+    g_hash_table_insert(window_map, &self->leftresize, self->client);
+    g_hash_table_insert(window_map, &self->rightresize, self->client);
 }
 
 void frame_release_client(ObFrame *self)
@@ -644,6 +684,8 @@ void frame_release_client(ObFrame *self)
     g_hash_table_remove(window_map, &self->tllresize);
     g_hash_table_remove(window_map, &self->trtresize);
     g_hash_table_remove(window_map, &self->trrresize);
+    g_hash_table_remove(window_map, &self->leftresize);
+    g_hash_table_remove(window_map, &self->rightresize);
 
     ob_main_loop_timeout_remove_data(ob_main_loop, flash_timeout, self, TRUE);
 }
@@ -819,6 +861,8 @@ ObFrameContext frame_context_from_string(const gchar *name)
 {
     if (!g_ascii_strcasecmp("Desktop", name))
         return OB_FRAME_CONTEXT_DESKTOP;
+    else if (!g_ascii_strcasecmp("Root", name))
+        return OB_FRAME_CONTEXT_ROOT;
     else if (!g_ascii_strcasecmp("Client", name))
         return OB_FRAME_CONTEXT_CLIENT;
     else if (!g_ascii_strcasecmp("Titlebar", name))
@@ -839,6 +883,10 @@ ObFrameContext frame_context_from_string(const gchar *name)
         return OB_FRAME_CONTEXT_BOTTOM;
     else if (!g_ascii_strcasecmp("Bottom", name))
         return OB_FRAME_CONTEXT_BOTTOM;
+    else if (!g_ascii_strcasecmp("Left", name))
+        return OB_FRAME_CONTEXT_LEFT;
+    else if (!g_ascii_strcasecmp("Right", name))
+        return OB_FRAME_CONTEXT_RIGHT;
     else if (!g_ascii_strcasecmp("Maximize", name))
         return OB_FRAME_CONTEXT_MAXIMIZE;
     else if (!g_ascii_strcasecmp("AllDesktops", name))
@@ -864,7 +912,7 @@ ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y)
         return OB_FRAME_CONTEXT_MOVE_RESIZE;
 
     if (win == RootWindow(ob_display, ob_screen))
-        return OB_FRAME_CONTEXT_DESKTOP;
+        return OB_FRAME_CONTEXT_ROOT ;
     if (client == NULL) return OB_FRAME_CONTEXT_NONE;
     if (win == client->window) {
         /* conceptually, this is the desktop, as far as users are
@@ -916,6 +964,8 @@ ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y)
     if (win == self->tllresize) return OB_FRAME_CONTEXT_TLCORNER;
     if (win == self->trtresize) return OB_FRAME_CONTEXT_TRCORNER;
     if (win == self->trrresize) return OB_FRAME_CONTEXT_TRCORNER;
+    if (win == self->leftresize) return OB_FRAME_CONTEXT_LEFT;
+    if (win == self->rightresize) return OB_FRAME_CONTEXT_RIGHT;
     if (win == self->max)       return OB_FRAME_CONTEXT_MAXIMIZE;
     if (win == self->iconify)   return OB_FRAME_CONTEXT_ICONIFY;
     if (win == self->close)     return OB_FRAME_CONTEXT_CLOSE;
index 0f5634323acc9f21dcee72573104d7681cadb1b4..13e49564eabe8da9c8f0a5180b797c3003f79649 100644 (file)
@@ -32,6 +32,7 @@ typedef void (*ObFrameIconifyAnimateFunc)(gpointer data);
 typedef enum {
     OB_FRAME_CONTEXT_NONE,
     OB_FRAME_CONTEXT_DESKTOP,
+    OB_FRAME_CONTEXT_ROOT,
     OB_FRAME_CONTEXT_CLIENT,
     OB_FRAME_CONTEXT_TITLEBAR,
     OB_FRAME_CONTEXT_FRAME,
@@ -41,6 +42,8 @@ typedef enum {
     OB_FRAME_CONTEXT_TRCORNER,
     OB_FRAME_CONTEXT_TOP,
     OB_FRAME_CONTEXT_BOTTOM,
+    OB_FRAME_CONTEXT_LEFT,
+    OB_FRAME_CONTEXT_RIGHT,
     OB_FRAME_CONTEXT_MAXIMIZE,
     OB_FRAME_CONTEXT_ALLDESKTOPS,
     OB_FRAME_CONTEXT_SHADE,
@@ -101,6 +104,8 @@ struct _ObFrame
     Window    tllresize;
     Window    trtresize;
     Window    trrresize;
+    Window    leftresize;
+    Window    rightresize;
 
     Colormap  colormap;
 
index 82a98a8e5659c0824ca85132c2f1d438e5a6d7d3..78c1d02feb85a55c3d5d625f6f5c86058d814a7d 100644 (file)
@@ -47,11 +47,12 @@ void framerender_frame(ObFrame *self)
               RrColorPixel(ob_rr_theme->frame_focused_border_color) :
               RrColorPixel(ob_rr_theme->frame_unfocused_border_color));
         XSetWindowBorder(ob_display, self->window, px);
-        XSetWindowBorder(ob_display, self->inner, px);
         XSetWindowBorder(ob_display, self->title, px);
         XSetWindowBorder(ob_display, self->handle, px);
         XSetWindowBorder(ob_display, self->rgrip, px);
         XSetWindowBorder(ob_display, self->lgrip, px);
+        XSetWindowBorder(ob_display, self->leftresize, px);
+        XSetWindowBorder(ob_display, self->rightresize, px);
     }
 
     if (self->decorations & OB_FRAME_DECOR_TITLEBAR) {
index ab9d05b09859c631b026bbf31d307adeba1b0c83..432599e8245ba68e968664e8e419d3f87a0443a7 100644 (file)
@@ -31,7 +31,6 @@
 #include "config.h"
 #include "keytree.h"
 #include "keyboard.h"
-#include "translate.h"
 #include "moveresize.h"
 #include "popup.h"
 #include "gettext.h"
@@ -293,7 +292,16 @@ void keyboard_event(ObClient *client, const XEvent *e)
         p = curpos->first_child;
     while (p) {
         if (p->key == e->xkey.keycode &&
-            p->state == e->xkey.state)
+            /* tricksy.
+               if you have Super_L and Super_R bound to different modXmasks,
+               this makes either mod mask count as Super
+
+               e.g. Super_L is mod1 and Super_R is mod2, so..
+               p->state = 00011
+               key state is just Super_L so 00001
+               00011 | 00001 == 00011 == p->state
+            */
+            (p->state | e->xkey.state) == p->state)
         {
             /* if we hit a key binding, then close any open menus and run it */
             if (menu_frame_visible)
index 68ea49496a992b29750b70665f79b2dff84abaf8..b908ad4ff0a6be146562d62a0265c0c6ef24d26f 100644 (file)
@@ -45,6 +45,7 @@ static ObMenuEntryFrame* menu_entry_frame_new(ObMenuEntry *entry,
 static void menu_entry_frame_free(ObMenuEntryFrame *self);
 static void menu_frame_update(ObMenuFrame *self);
 static gboolean menu_entry_frame_submenu_timeout(gpointer data);
+static void menu_frame_hide(ObMenuFrame *self);
 
 static Window createWindow(Window parent, gulong mask,
                            XSetWindowAttributes *attrib)
@@ -1013,7 +1014,7 @@ gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent,
     return TRUE;
 }
 
-void menu_frame_hide(ObMenuFrame *self)
+static void menu_frame_hide(ObMenuFrame *self)
 {
     GList *it = g_list_find(menu_frame_visible, self);
 
index 4f896ec88fbf965cf057ab35400f5479c9473a50..e1f4b15bfe03b4ddd3b355f883731e5b1ffcbf99 100644 (file)
@@ -128,7 +128,6 @@ gboolean menu_frame_show_topmenu(ObMenuFrame *self, gint x, gint y,
                                  gint button);
 gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent,
                                  ObMenuEntryFrame *parent_entry);
-void menu_frame_hide(ObMenuFrame *self);
 
 void menu_frame_hide_all();
 void menu_frame_hide_all_client(struct _ObClient *client);
index 1da94b3411a3a815f1f3244d28094ea4846d61f1..f55feed94e47799bb0fbdc6c6361e5f58dfbd672 100644 (file)
@@ -23,6 +23,7 @@ typedef enum
 {
     OB_CURSOR_NONE,
     OB_CURSOR_POINTER,
+    OB_CURSOR_BUSYPOINTER,
     OB_CURSOR_BUSY,
     OB_CURSOR_MOVE,
     OB_CURSOR_NORTH,
index 78e25d8966275c23d9d8f1b384fa86328ce798ca..850fb337cb99e964ae9144bf3525aad97652cc6f 100644 (file)
@@ -48,7 +48,8 @@ typedef struct {
 static GSList *bound_contexts[OB_FRAME_NUM_CONTEXTS];
 
 ObFrameContext mouse_button_frame_context(ObFrameContext context,
-                                          guint button)
+                                          guint button,
+                                          guint state)
 {
     GSList *it;
     ObFrameContext x = context;
@@ -56,7 +57,7 @@ ObFrameContext mouse_button_frame_context(ObFrameContext context,
     for (it = bound_contexts[context]; it; it = g_slist_next(it)) {
         ObMouseBinding *b = it->data;
 
-        if (b->button == button)
+        if (b->button == button && b->state == state)
             return context;
     }
 
@@ -67,6 +68,11 @@ ObFrameContext mouse_button_frame_context(ObFrameContext context,
     case OB_FRAME_CONTEXT_TITLEBAR:
     case OB_FRAME_CONTEXT_FRAME:
     case OB_FRAME_CONTEXT_MOVE_RESIZE:
+    case OB_FRAME_CONTEXT_LEFT:
+    case OB_FRAME_CONTEXT_RIGHT:
+        break;
+    case OB_FRAME_CONTEXT_ROOT:
+        x = OB_FRAME_CONTEXT_DESKTOP;
         break;
     case OB_FRAME_CONTEXT_BOTTOM:
     case OB_FRAME_CONTEXT_BLCORNER:
@@ -88,7 +94,11 @@ ObFrameContext mouse_button_frame_context(ObFrameContext context,
         g_assert_not_reached();
     }
 
-    return x;
+    /* allow for multiple levels of fall-through */
+    if (x != context)
+        return mouse_button_frame_context(x, button, state);
+    else
+        return x;
 }
 
 void mouse_grab_for_client(ObClient *client, gboolean grab)
@@ -190,7 +200,8 @@ void mouse_event(ObClient *client, XEvent *e)
     case ButtonPress:
         context = frame_context(client, e->xbutton.window,
                                 e->xbutton.x, e->xbutton.y);
-        context = mouse_button_frame_context(context, e->xbutton.button);
+        context = mouse_button_frame_context(context, e->xbutton.button,
+                                             e->xbutton.state);
 
         px = e->xbutton.x_root;
         py = e->xbutton.y_root;
@@ -220,7 +231,8 @@ void mouse_event(ObClient *client, XEvent *e)
     case ButtonRelease:
         /* use where the press occured in the window */
         context = frame_context(client, e->xbutton.window, pwx, pwy);
-        context = mouse_button_frame_context(context, e->xbutton.button);
+        context = mouse_button_frame_context(context, e->xbutton.button,
+                                             e->xbutton.state);
 
         if (e->xbutton.button == button)
             pwx = pwy = -1;
@@ -287,7 +299,7 @@ void mouse_event(ObClient *client, XEvent *e)
     case MotionNotify:
         if (button) {
             context = frame_context(client, e->xmotion.window, pwx, pwy);
-            context = mouse_button_frame_context(context, button);
+            context = mouse_button_frame_context(context, button, state);
 
             if (ABS(e->xmotion.x_root - px) >= config_mouse_threshold ||
                 ABS(e->xmotion.y_root - py) >= config_mouse_threshold) {
index 38e01da893002fbc5156ae4317f4e84fce637a07..befe1296f0b6526124ad02d9c431db86b2ef0dec 100644 (file)
@@ -37,6 +37,6 @@ void mouse_event(struct _ObClient *client, XEvent *e);
 void mouse_grab_for_client(struct _ObClient *client, gboolean grab);
 
 ObFrameContext mouse_button_frame_context(ObFrameContext context,
-                                          guint button);
+                                          guint button, guint state);
 
 #endif
index 996cb227febcd9394d2f9e36b2011662a2ae7e6e..7270379e47923e2be1ec5bcc271fcd43dcf36e36 100644 (file)
@@ -196,7 +196,8 @@ gint main(gint argc, gchar **argv)
     /* create available cursors */
     cursors[OB_CURSOR_NONE] = None;
     cursors[OB_CURSOR_POINTER] = load_cursor("left_ptr", XC_left_ptr);
-    cursors[OB_CURSOR_BUSY] = load_cursor("left_ptr_watch", XC_watch);
+    cursors[OB_CURSOR_BUSYPOINTER] = load_cursor("left_ptr_watch",XC_left_ptr);
+    cursors[OB_CURSOR_BUSY] = load_cursor("watch", XC_watch);
     cursors[OB_CURSOR_MOVE] = load_cursor("fleur", XC_fleur);
     cursors[OB_CURSOR_NORTH] = load_cursor("top_side", XC_top_side);
     cursors[OB_CURSOR_NORTHEAST] = load_cursor("top_right_corner",
index 6551da81f0405fd333145405ae4b57aa4cdccd0d..4ad46af738c79135dd8118b28c633a88ac1b0e2f 100644 (file)
@@ -1270,7 +1270,7 @@ void screen_set_root_cursor()
 {
     if (sn_app_starting())
         XDefineCursor(ob_display, RootWindow(ob_display, ob_screen),
-                      ob_cursor(OB_CURSOR_BUSY));
+                      ob_cursor(OB_CURSOR_BUSYPOINTER));
     else
         XDefineCursor(ob_display, RootWindow(ob_display, ob_screen),
                       ob_cursor(OB_CURSOR_POINTER));