merge r6363-6365 from trunk. but don't change the name of the Handle context to Bottom.
authorDana Jansens <danakj@orodu.net>
Sat, 12 May 2007 17:57:05 +0000 (17:57 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 12 May 2007 17:57:05 +0000 (17:57 +0000)
data/rc.xml
data/rc.xsd
openbox/action.c
openbox/action.h
openbox/config.c
openbox/frame.c
openbox/frame.h
openbox/framerender.c
openbox/mouse.c

index a224f6b1015459c616b0c44418fec652843b2ecd..4af0279c26e80cb4cd0a3a79606ca3b050b9998b 100644 (file)
@@ -5,7 +5,7 @@
 
 <openbox_config xmlns="http://openbox.org/"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://openbox.org/">
+        xsi:schemaLocation="http://openbox.org/3.4">
 
 <resistance>
   <strength>10</strength>
       <action name="ShowMenu"><menu>client-menu</menu></action>
     </mousebind>
   </context>
-  <context name="Handle">
+  <context name="Top">
     <mousebind button="Left" action="Drag">
-      <action name="Move"/>
-    </mousebind>
-    <mousebind button="Left" action="Click">
-      <action name="Raise"/>
+      <action name="Resize"><edge>top</edge></action>
     </mousebind>
     <mousebind button="Left" action="Press">
-      <action name="Focus"/>
+      <action name="Activate"/>
     </mousebind>
-    <mousebind button="Middle" action="Press">
-      <action name="Lower"/>
+  </context>
+  <context name="Handle">
+    <mousebind button="Left" action="Drag">
+      <action name="Resize"><edge>bottom</edge></action>
+    </mousebind>
+    <mousebind button="Left" action="Press">
+      <action name="Activate"/>
     </mousebind>
   </context>
   <context name="BLCorner">
index af4eda4ab9279b7487728eb8e67e2167d14595c3..60787389da431c4c7724690102d502d5d233c0ea 100644 (file)
             <xsd:enumeration value="Desktop"/>
             <xsd:enumeration value="Client"/>
             <xsd:enumeration value="Titlebar"/>
-            <xsd:enumeration value="Handle"/>
             <xsd:enumeration value="Frame"/>
             <xsd:enumeration value="TLCorner"/>
             <xsd:enumeration value="TRCorner"/>
             <xsd:enumeration value="BLCorner"/>
             <xsd:enumeration value="BRCorner"/>
+            <xsd:enumeration value="Top"/>
+            <xsd:enumeration value="Handle"/>
             <xsd:enumeration value="Maximize"/>
             <xsd:enumeration value="AllDesktops"/>
             <xsd:enumeration value="Shade"/>
index cf7b05fa5299d59a26cc7c21fdcdb48a9defe392..8e7b56a341dffe0c14a3636893396d6385201149 100644 (file)
@@ -417,21 +417,21 @@ void setup_action_bottom_layer(ObAction **a, ObUserAction uact)
 void setup_action_move(ObAction **a, ObUserAction uact)
 {
     (*a)->data.moveresize.any.client_action = OB_CLIENT_ACTION_ALWAYS;
-    (*a)->data.moveresize.move = TRUE;
     (*a)->data.moveresize.keyboard =
         (uact == OB_USER_ACTION_NONE ||
          uact == OB_USER_ACTION_KEYBOARD_KEY ||
          uact == OB_USER_ACTION_MENU_SELECTION);
+    (*a)->data.moveresize.corner = 0;
 }
 
 void setup_action_resize(ObAction **a, ObUserAction uact)
 {
     (*a)->data.moveresize.any.client_action = OB_CLIENT_ACTION_ALWAYS;
-    (*a)->data.moveresize.move = FALSE;
     (*a)->data.moveresize.keyboard =
         (uact == OB_USER_ACTION_NONE ||
          uact == OB_USER_ACTION_KEYBOARD_KEY ||
          uact == OB_USER_ACTION_MENU_SELECTION);
+    (*a)->data.moveresize.corner = 0;
 }
 
 void setup_action_showmenu(ObAction **a, ObUserAction uact)
@@ -745,12 +745,12 @@ ActionString actionstrings[] =
     },
     {
         "move",
-        action_moveresize,
+        action_move,
         setup_action_move
     },
     {
         "resize",
-        action_moveresize,
+        action_resize,
         setup_action_resize
     },
     {
@@ -1034,6 +1034,35 @@ ObAction *action_parse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
                 if ((n = parse_find_node("desktop", node->xmlChildrenNode)))
                     act->data.interdiraction.desktop_windows =
                         parse_bool(doc, n);
+            } else if (act->func == action_resize) {
+                if ((n = parse_find_node("edge", node->xmlChildrenNode))) {
+                    gchar *s = parse_string(doc, n);
+                    if (!g_ascii_strcasecmp(s, "top"))
+                        act->data.moveresize.corner =
+                            prop_atoms.net_wm_moveresize_size_top;
+                    else if (!g_ascii_strcasecmp(s, "bottom"))
+                        act->data.moveresize.corner =
+                            prop_atoms.net_wm_moveresize_size_bottom;
+                    else if (!g_ascii_strcasecmp(s, "left"))
+                        act->data.moveresize.corner =
+                            prop_atoms.net_wm_moveresize_size_left;
+                    else if (!g_ascii_strcasecmp(s, "right"))
+                        act->data.moveresize.corner =
+                            prop_atoms.net_wm_moveresize_size_right;
+                    else if (!g_ascii_strcasecmp(s, "topleft"))
+                        act->data.moveresize.corner =
+                            prop_atoms.net_wm_moveresize_size_topleft;
+                    else if (!g_ascii_strcasecmp(s, "topright"))
+                        act->data.moveresize.corner =
+                            prop_atoms.net_wm_moveresize_size_topright;
+                    else if (!g_ascii_strcasecmp(s, "bottomleft"))
+                        act->data.moveresize.corner =
+                            prop_atoms.net_wm_moveresize_size_bottomleft;
+                    else if (!g_ascii_strcasecmp(s, "bottomright"))
+                        act->data.moveresize.corner =
+                            prop_atoms.net_wm_moveresize_size_bottomright;
+                    g_free(s);
+                }
             } else if (act->func == action_raise ||
                        act->func == action_lower ||
                        act->func == action_raiselower ||
@@ -1104,7 +1133,9 @@ void action_run_list(GSList *acts, ObClient *c, ObFrameContext context,
             /* XXX UGLY HACK race with motion event starting a move and the
                button release gettnig processed first. answer: don't queue
                moveresize starts. UGLY HACK XXX */
-            if (a->data.any.interactive || a->func == action_moveresize) {
+            if (a->data.any.interactive || a->func == action_move ||
+                a->func == action_resize)
+            {
                 /* interactive actions are not queued */
                 a->func(&a->data);
             } else if ((context == OB_FRAME_CONTEXT_CLIENT ||
@@ -1713,29 +1744,39 @@ static guint32 pick_corner(gint x, gint y, gint cx, gint cy, gint cw, gint ch,
 #undef d
 }
 
-void action_moveresize(union ActionData *data)
+void action_move(union ActionData *data)
 {
     ObClient *c = data->moveresize.any.c;
     guint32 corner;
 
-    if (data->moveresize.keyboard) {
-        corner = (data->moveresize.move ?
-                  prop_atoms.net_wm_moveresize_move_keyboard :
-                  prop_atoms.net_wm_moveresize_size_keyboard);
-    } else {
-        corner = (data->moveresize.move ?
-                  prop_atoms.net_wm_moveresize_move :
-                  pick_corner(data->any.x, data->any.y,
-                              c->frame->area.x, c->frame->area.y,
-                              /* use the client size because the frame
-                                 can be differently sized (shaded
-                                 windows) and we want this based on the
-                                 clients size */
-                              c->area.width + c->frame->size.left +
-                              c->frame->size.right,
-                              c->area.height + c->frame->size.top +
-                              c->frame->size.bottom, c->shaded));
-    }
+    if (data->moveresize.keyboard)
+        corner = prop_atoms.net_wm_moveresize_move_keyboard;
+    else
+        corner = prop_atoms.net_wm_moveresize_move;
+
+    moveresize_start(c, data->any.x, data->any.y, data->any.button, corner);
+}
+
+void action_resize(union ActionData *data)
+{
+    ObClient *c = data->moveresize.any.c;
+    guint32 corner;
+
+    if (data->moveresize.keyboard)
+        corner = prop_atoms.net_wm_moveresize_size_keyboard;
+    else if (data->moveresize.corner)
+        corner = data->moveresize.corner; /* it was specified in the binding */
+    else
+        corner = pick_corner(data->any.x, data->any.y,
+                             c->frame->area.x, c->frame->area.y,
+                             /* use the client size because the frame
+                                can be differently sized (shaded
+                                windows) and we want this based on the
+                                clients size */
+                             c->area.width + c->frame->size.left +
+                             c->frame->size.right,
+                             c->area.height + c->frame->size.top +
+                             c->frame->size.bottom, c->shaded);
 
     moveresize_start(c, data->any.x, data->any.y, data->any.button, corner);
 }
index ecb199ce11814fd590864af8b03eaf588b7b3edb..8a1726bc5e33e63b2722cd614cd877e668b5219b 100644 (file)
@@ -129,8 +129,8 @@ struct DesktopDirection {
 
 struct MoveResize {
     struct AnyAction any;
-    gboolean move;
     gboolean keyboard;
+    guint32 corner;
 };
 
 struct ShowMenu {
@@ -314,8 +314,10 @@ void action_desktop_dir(union ActionData *data);
 void action_desktop_last(union ActionData *data);
 /* ClientAction */
 void action_toggle_decorations(union ActionData *data);
-/* MoveResize */
-void action_moveresize(union ActionData *data);
+/* Move */
+void action_move(union ActionData *data);
+/* Resize */
+void action_resize(union ActionData *data);
 /* Any */
 void action_reconfigure(union ActionData *data);
 /* Execute */
index 99e35b5ada0d57e92ba2e7d1a3e3cb6fd71dcd50..299c06473cda38a3e6dd082aa009ac558d44a3fb 100644 (file)
@@ -765,7 +765,6 @@ static void bind_default_mouse()
         { "Left", "Client", OB_MOUSE_ACTION_CLICK, "Raise" },
         { "Left", "Titlebar", OB_MOUSE_ACTION_CLICK, "Raise" },
         { "Middle", "Titlebar", OB_MOUSE_ACTION_CLICK, "Lower" },
-        { "Left", "Handle", OB_MOUSE_ACTION_CLICK, "Raise" },
         { "Left", "BLCorner", OB_MOUSE_ACTION_CLICK, "Raise" },
         { "Left", "BRCorner", OB_MOUSE_ACTION_CLICK, "Raise" },
         { "Left", "TLCorner", OB_MOUSE_ACTION_CLICK, "Raise" },
index 6248db7c0639e157fd923fb05618f2bc768a885b..86b2258b781ab5ad0133872621a316024a88826b 100644 (file)
@@ -139,6 +139,8 @@ ObFrame *frame_new(ObClient *client)
     self->title = createWindow(self->window, NULL, mask, &attrib);
 
     mask |= CWCursor;
+    attrib.cursor = ob_cursor(OB_CURSOR_NORTH);
+    self->topresize = createWindow(self->title, NULL, mask, &attrib);
     attrib.cursor = ob_cursor(OB_CURSOR_NORTHWEST);
     self->tltresize = createWindow(self->title, NULL, mask, &attrib);
     self->tllresize = createWindow(self->title, NULL, mask, &attrib);
@@ -154,9 +156,10 @@ ObFrame *frame_new(ObClient *client)
     self->shade = createWindow(self->title, NULL, mask, &attrib);
     self->icon = createWindow(self->title, NULL, mask, &attrib);
     self->iconify = createWindow(self->title, NULL, mask, &attrib);
-    self->handle = createWindow(self->window, NULL, mask, &attrib);
 
     mask |= CWCursor;
+    attrib.cursor = ob_cursor(OB_CURSOR_SOUTH);
+    self->handle = createWindow(self->window, NULL, mask, &attrib);
     attrib.cursor = ob_cursor(OB_CURSOR_SOUTHWEST);
     self->lgrip = createWindow(self->handle, NULL, mask, &attrib);
     attrib.cursor = ob_cursor(OB_CURSOR_SOUTHEAST);
@@ -378,17 +381,27 @@ void frame_adjust_area(ObFrame *self, gboolean moved,
                 XMapWindow(ob_display, self->title);
 
                 if (self->decorations & OB_FRAME_DECOR_GRIPS) {
+                    XMoveResizeWindow(ob_display, self->topresize,
+                                      ob_rr_theme->grip_width + self->bwidth,
+                                      0,
+                                      self->width - (ob_rr_theme->grip_width +
+                                                     self->bwidth) * 2,
+                                      ob_rr_theme->paddingy + 1);
+
                     XMoveWindow(ob_display, self->tltresize, 0, 0);
                     XMoveWindow(ob_display, self->tllresize, 0, 0);
                     XMoveWindow(ob_display, self->trtresize,
                                 self->width - ob_rr_theme->grip_width, 0);
                     XMoveWindow(ob_display, self->trrresize,
                                 self->width - ob_rr_theme->paddingx - 1, 0);
+
+                    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);
                 } else {
+                    XUnmapWindow(ob_display, self->topresize);
                     XUnmapWindow(ob_display, self->tltresize);
                     XUnmapWindow(ob_display, self->tllresize);
                     XUnmapWindow(ob_display, self->trtresize);
@@ -578,6 +591,7 @@ void frame_grab_client(ObFrame *self)
     g_hash_table_insert(window_map, &self->handle, self->client);
     g_hash_table_insert(window_map, &self->lgrip, self->client);
     g_hash_table_insert(window_map, &self->rgrip, self->client);
+    g_hash_table_insert(window_map, &self->topresize, self->client);
     g_hash_table_insert(window_map, &self->tltresize, self->client);
     g_hash_table_insert(window_map, &self->tllresize, self->client);
     g_hash_table_insert(window_map, &self->trtresize, self->client);
@@ -635,6 +649,7 @@ void frame_release_client(ObFrame *self)
     g_hash_table_remove(window_map, &self->handle);
     g_hash_table_remove(window_map, &self->lgrip);
     g_hash_table_remove(window_map, &self->rgrip);
+    g_hash_table_remove(window_map, &self->topresize);
     g_hash_table_remove(window_map, &self->tltresize);
     g_hash_table_remove(window_map, &self->tllresize);
     g_hash_table_remove(window_map, &self->trtresize);
@@ -818,8 +833,6 @@ ObFrameContext frame_context_from_string(const gchar *name)
         return OB_FRAME_CONTEXT_CLIENT;
     else if (!g_ascii_strcasecmp("Titlebar", name))
         return OB_FRAME_CONTEXT_TITLEBAR;
-    else if (!g_ascii_strcasecmp("Handle", name))
-        return OB_FRAME_CONTEXT_HANDLE;
     else if (!g_ascii_strcasecmp("Frame", name))
         return OB_FRAME_CONTEXT_FRAME;
     else if (!g_ascii_strcasecmp("TLCorner", name))
@@ -830,6 +843,10 @@ ObFrameContext frame_context_from_string(const gchar *name)
         return OB_FRAME_CONTEXT_BLCORNER;
     else if (!g_ascii_strcasecmp("BRCorner", name))
         return OB_FRAME_CONTEXT_BRCORNER;
+    else if (!g_ascii_strcasecmp("Top", name))
+        return OB_FRAME_CONTEXT_TOP;
+    else if (!g_ascii_strcasecmp("Handle", name))
+        return OB_FRAME_CONTEXT_BOTTOM;
     else if (!g_ascii_strcasecmp("Maximize", name))
         return OB_FRAME_CONTEXT_MAXIMIZE;
     else if (!g_ascii_strcasecmp("AllDesktops", name))
@@ -899,9 +916,10 @@ ObFrameContext frame_context(ObClient *client, Window win, gint x, gint y)
 
     if (win == self->window)    return OB_FRAME_CONTEXT_FRAME;
     if (win == self->label)     return OB_FRAME_CONTEXT_TITLEBAR;
-    if (win == self->handle)    return OB_FRAME_CONTEXT_HANDLE;
+    if (win == self->handle)    return OB_FRAME_CONTEXT_BOTTOM;
     if (win == self->lgrip)     return OB_FRAME_CONTEXT_BLCORNER;
     if (win == self->rgrip)     return OB_FRAME_CONTEXT_BRCORNER;
+    if (win == self->topresize) return OB_FRAME_CONTEXT_TOP;
     if (win == self->tltresize) return OB_FRAME_CONTEXT_TLCORNER;
     if (win == self->tllresize) return OB_FRAME_CONTEXT_TLCORNER;
     if (win == self->trtresize) return OB_FRAME_CONTEXT_TRCORNER;
index ebd8de982457afb76cf27b2f846ae9a4c450eae2..0f5634323acc9f21dcee72573104d7681cadb1b4 100644 (file)
@@ -34,12 +34,13 @@ typedef enum {
     OB_FRAME_CONTEXT_DESKTOP,
     OB_FRAME_CONTEXT_CLIENT,
     OB_FRAME_CONTEXT_TITLEBAR,
-    OB_FRAME_CONTEXT_HANDLE,
     OB_FRAME_CONTEXT_FRAME,
     OB_FRAME_CONTEXT_BLCORNER,
     OB_FRAME_CONTEXT_BRCORNER,
     OB_FRAME_CONTEXT_TLCORNER,
     OB_FRAME_CONTEXT_TRCORNER,
+    OB_FRAME_CONTEXT_TOP,
+    OB_FRAME_CONTEXT_BOTTOM,
     OB_FRAME_CONTEXT_MAXIMIZE,
     OB_FRAME_CONTEXT_ALLDESKTOPS,
     OB_FRAME_CONTEXT_SHADE,
@@ -95,6 +96,7 @@ struct _ObFrame
     Window    lgrip;
     Window    rgrip;
 
+    Window    topresize;
     Window    tltresize;
     Window    tllresize;
     Window    trtresize;
index 97d5ef53ea4e55c7035fc9cafcf31e28c0c98ec3..82a98a8e5659c0824ca85132c2f1d438e5a6d7d3 100644 (file)
@@ -177,9 +177,16 @@ void framerender_frame(ObFrame *self)
         RrPaint(t, self->title, self->width, ob_rr_theme->title_height);
 
         ob_rr_theme->a_clear->surface.parent = t;
-        ob_rr_theme->a_clear->surface.parentx = 0;
         ob_rr_theme->a_clear->surface.parenty = 0;
 
+        ob_rr_theme->a_clear->surface.parentx = ob_rr_theme->grip_width +
+            self->bwidth;
+        RrPaint(ob_rr_theme->a_clear, self->topresize,
+                self->width - (ob_rr_theme->grip_width + self->bwidth) * 2,
+                ob_rr_theme->paddingy + 1);
+
+        ob_rr_theme->a_clear->surface.parentx = 0;
+
         if (ob_rr_theme->grip_width > 0)
             RrPaint(ob_rr_theme->a_clear, self->tltresize,
                     ob_rr_theme->grip_width, ob_rr_theme->paddingy + 1);
index 9ca7987728fa43044893dc105d488559275fb71c..8b0cfccbd0a0b887e2de95ff2a7d4e449958f92c 100644 (file)
@@ -65,16 +65,17 @@ ObFrameContext mouse_button_frame_context(ObFrameContext context,
     case OB_FRAME_CONTEXT_DESKTOP:
     case OB_FRAME_CONTEXT_CLIENT:
     case OB_FRAME_CONTEXT_TITLEBAR:
-    case OB_FRAME_CONTEXT_HANDLE:
     case OB_FRAME_CONTEXT_FRAME:
     case OB_FRAME_CONTEXT_MOVE_RESIZE:
         break;
+    case OB_FRAME_CONTEXT_BOTTOM:
     case OB_FRAME_CONTEXT_BLCORNER:
     case OB_FRAME_CONTEXT_BRCORNER:
-        x = OB_FRAME_CONTEXT_HANDLE;
+        x = OB_FRAME_CONTEXT_BOTTOM;
         break;
     case OB_FRAME_CONTEXT_TLCORNER:
     case OB_FRAME_CONTEXT_TRCORNER:
+    case OB_FRAME_CONTEXT_TOP:
     case OB_FRAME_CONTEXT_MAXIMIZE:
     case OB_FRAME_CONTEXT_ALLDESKTOPS:
     case OB_FRAME_CONTEXT_SHADE: