metacity r3619 - in trunk: . src src/core src/include src/ui



Author: tthurman
Date: Mon Mar  3 01:58:54 2008
New Revision: 3619
URL: http://svn.gnome.org/viewvc/metacity?rev=3619&view=rev

Log:
2008-03-03  Cosimo Cecchi  <anarki lilik it>

	Add ability to vertically and horizontally maximise
	using the mouse, by clicking the titlebar in various
	ways.  A very similar patch was received from Jason Ribero.
	Thanks also go to Tony Houghton and Carlo Wood, who
	both submitted patches which solved this differently.
	Closes #358674.

        * src/include/common.h (MetaActionTitlebar): new values
	for the new actions
        * src/core/core.c (meta_core_maximize_{vertic|horizont}ally):
	new functions.
        * src/ui/frames.c (meta_frame_titlebar_event): handle the
	new action values
        * src/core/window.h: new macros (for regularity, not really
	necessary)
        * src/core/prefs.c (symtab_titlebar_action): new string
	representations of the action values
        * src/metacity.schemas.in: documentation



Modified:
   trunk/ChangeLog
   trunk/src/core/core.c
   trunk/src/core/prefs.c
   trunk/src/core/window.h
   trunk/src/include/common.h
   trunk/src/include/core.h
   trunk/src/metacity.schemas.in
   trunk/src/ui/frames.c

Modified: trunk/src/core/core.c
==============================================================================
--- trunk/src/core/core.c	(original)
+++ trunk/src/core/core.c	Mon Mar  3 01:58:54 2008
@@ -329,6 +329,40 @@
 }
 
 void
+meta_core_toggle_maximize_vertically (Display *xdisplay,
+				      Window   frame_xwindow)
+{
+  MetaWindow *window = get_window (xdisplay, frame_xwindow);
+
+  if (meta_prefs_get_raise_on_click ())
+    meta_window_raise (window);
+
+  if (META_WINDOW_MAXIMIZED_VERTICALLY (window))
+    meta_window_unmaximize (window, 
+                            META_MAXIMIZE_VERTICAL);
+  else
+    meta_window_maximize (window,
+    			    META_MAXIMIZE_VERTICAL);
+}
+
+void
+meta_core_toggle_maximize_horizontally (Display *xdisplay,
+				        Window   frame_xwindow)
+{
+  MetaWindow *window = get_window (xdisplay, frame_xwindow);
+
+  if (meta_prefs_get_raise_on_click ())
+    meta_window_raise (window);
+
+  if (META_WINDOW_MAXIMIZED_HORIZONTALLY (window))
+    meta_window_unmaximize (window, 
+                            META_MAXIMIZE_HORIZONTAL);
+  else
+    meta_window_maximize (window,
+    			    META_MAXIMIZE_HORIZONTAL);
+}
+
+void
 meta_core_toggle_maximize (Display *xdisplay,
                            Window   frame_xwindow)
 {

Modified: trunk/src/core/prefs.c
==============================================================================
--- trunk/src/core/prefs.c	(original)
+++ trunk/src/core/prefs.c	Mon Mar  3 01:58:54 2008
@@ -200,6 +200,10 @@
   {
     { META_ACTION_TITLEBAR_TOGGLE_SHADE,    "toggle_shade" },
     { META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE, "toggle_maximize" },
+    { META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZONTALLY,
+                                "toggle_maximize_horizontally" },
+    { META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERTICALLY,
+                                "toggle_maximize_vertically" },
     { META_ACTION_TITLEBAR_MINIMIZE,        "minimize" },
     { META_ACTION_TITLEBAR_NONE,            "none" },
     { META_ACTION_TITLEBAR_LOWER,           "lower" },

Modified: trunk/src/core/window.h
==============================================================================
--- trunk/src/core/window.h	(original)
+++ trunk/src/core/window.h	Mon Mar  3 01:58:54 2008
@@ -362,6 +362,8 @@
  */
 #define META_WINDOW_MAXIMIZED(w)       ((w)->maximized_horizontally && \
                                         (w)->maximized_vertically)
+#define META_WINDOW_MAXIMIZED_VERTICALLY(w)    ((w)->maximized_vertically)
+#define META_WINDOW_MAXIMIZED_HORIZONTALLY(w)  ((w)->maximized_horizontally)
 #define META_WINDOW_ALLOWS_MOVE(w)     ((w)->has_move_func && !(w)->fullscreen)
 #define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w)   ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !(w)->fullscreen && !(w)->shaded)
 #define META_WINDOW_ALLOWS_RESIZE(w)   (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) &&                \

Modified: trunk/src/include/common.h
==============================================================================
--- trunk/src/include/common.h	(original)
+++ trunk/src/include/common.h	Mon Mar  3 01:58:54 2008
@@ -174,6 +174,8 @@
 {
   META_ACTION_TITLEBAR_TOGGLE_SHADE,
   META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE,
+  META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZONTALLY,
+  META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERTICALLY,
   META_ACTION_TITLEBAR_MINIMIZE,
   META_ACTION_TITLEBAR_NONE,
   META_ACTION_TITLEBAR_LOWER,

Modified: trunk/src/include/core.h
==============================================================================
--- trunk/src/include/core.h	(original)
+++ trunk/src/include/core.h	Mon Mar  3 01:58:54 2008
@@ -120,6 +120,10 @@
                                  Window   frame_xwindow);
 void meta_core_toggle_maximize  (Display *xdisplay,
                                  Window   frame_xwindow);
+void meta_core_toggle_maximize_horizontally  (Display *xdisplay,
+                                              Window   frame_xwindow);
+void meta_core_toggle_maximize_vertically    (Display *xdisplay,
+                                              Window   frame_xwindow);
 void meta_core_unmaximize       (Display *xdisplay,
                                  Window   frame_xwindow);
 void meta_core_maximize         (Display *xdisplay,

Modified: trunk/src/metacity.schemas.in
==============================================================================
--- trunk/src/metacity.schemas.in	(original)
+++ trunk/src/metacity.schemas.in	Mon Mar  3 01:58:54 2008
@@ -114,10 +114,16 @@
          <short>Action on title bar double-click</short>
          <long>
            This option determines the effects of double-clicking on the
-           title bar.  Current valid options are 'toggle_shade', which will
-           shade/unshade the window, 'toggle_maximize' which will
-           maximize/unmaximize the window, 'minimize' which will minimize
-           the window, and 'none' which will not do anything.
+           title bar.  Current valid options are
+	   'toggle_shade', which will shade/unshade the window,
+	   'toggle_maximize' which will maximize/unmaximize the window,
+	   'toggle_maximize_horizontally' and 'toggle_maximize_vertically'
+	   which will maximize/unmaximize the window in that direction only,
+	   'minimize' which will minimize the window,
+	   'shade' which will roll the window up,
+	   'menu' which will display the window menu,
+	   'lower' which will put the window behind all the others,
+	   and 'none' which will not do anything.
          </long>
       </locale>
     </schema>
@@ -132,10 +138,16 @@
          <short>Action on title bar middle-click</short>
          <long>
            This option determines the effects of middle-clicking on the
-           title bar.  Current valid options are 'toggle_shade', which will
-           shade/unshade the window, 'toggle_maximize' which will
-           maximize/unmaximize the window, 'minimize' which will minimize
-           the window, and 'none' which will not do anything.
+           title bar.  Current valid options are
+	   'toggle_shade', which will shade/unshade the window,
+	   'toggle_maximize' which will maximize/unmaximize the window,
+	   'toggle_maximize_horizontally' and 'toggle_maximize_vertically'
+	   which will maximize/unmaximize the window in that direction only,
+	   'minimize' which will minimize the window,
+	   'shade' which will roll the window up,
+	   'menu' which will display the window menu,
+	   'lower' which will put the window behind all the others,
+	   and 'none' which will not do anything.
          </long>
       </locale>
     </schema>
@@ -150,10 +162,16 @@
          <short>Action on title bar right-click</short>
          <long>
            This option determines the effects of right-clicking on the
-           title bar.  Current valid options are 'toggle_shade', which will
-           shade/unshade the window, 'toggle_maximize' which will
-           maximize/unmaximize the window, 'minimize' which will minimize
-           the window, and 'none' which will not do anything.
+           title bar.  Current valid options are
+	   'toggle_shade', which will shade/unshade the window,
+	   'toggle_maximize' which will maximize/unmaximize the window,
+	   'toggle_maximize_horizontally' and 'toggle_maximize_vertically'
+	   which will maximize/unmaximize the window in that direction only,
+	   'minimize' which will minimize the window,
+	   'shade' which will roll the window up,
+	   'menu' which will display the window menu,
+	   'lower' which will put the window behind all the others,
+	   and 'none' which will not do anything.
          </long>
       </locale>
     </schema>

Modified: trunk/src/ui/frames.c
==============================================================================
--- trunk/src/ui/frames.c	(original)
+++ trunk/src/ui/frames.c	Mon Mar  3 01:58:54 2008
@@ -1249,6 +1249,32 @@
       }
       break;
 
+    case META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZONTALLY:
+      {
+        meta_core_get (gdk_display, frame->xwindow,
+                       META_CORE_GET_FRAME_FLAGS, &flags,
+                       META_CORE_GET_END);
+        
+        if (flags & META_FRAME_ALLOWS_MAXIMIZE)
+          {
+            meta_core_toggle_maximize_horizontally (gdk_display, frame->xwindow);
+          }
+      }
+      break;
+
+    case META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERTICALLY:
+      {
+        meta_core_get (gdk_display, frame->xwindow,
+                       META_CORE_GET_FRAME_FLAGS, &flags,
+                       META_CORE_GET_END);
+        
+        if (flags & META_FRAME_ALLOWS_MAXIMIZE)
+          {
+            meta_core_toggle_maximize_vertically (gdk_display, frame->xwindow);
+          }
+      }
+      break;
+
     case META_ACTION_TITLEBAR_MINIMIZE:
       {
         meta_core_get (gdk_display, frame->xwindow,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]