summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-01-27 08:21:53 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-01-27 08:21:53 +0000
commitb52ee424e4eb16632496c22a160dfa024ace47e2 (patch)
tree74446960efaacf21bb02481bf481860be09b1307
parent5b4e9c01cc612395e56b608ad5923c5c84523f5a (diff)
downloadmetacity-b52ee424e4eb16632496c22a160dfa024ace47e2.tar.gz
metacity-b52ee424e4eb16632496c22a160dfa024ace47e2.tar.bz2
Only consider the bottom of the titlebar a resize control; I keep
2002-01-27 Havoc Pennington <hp@pobox.com> * src/frames.c (get_control): Only consider the bottom of the titlebar a resize control; I keep accidentally resizing windows instead of activating them. Also, give south resizing priority over north, if the window is so small the active regions overlap * src/theme.c: add MetaTheme, get MetaFrameStyleSet into a usable state * src/common.h: move window type back to window.h, decided not to use it on frame side (MetaFrameType): add this instead
-rw-r--r--ChangeLog14
-rw-r--r--src/common.h19
-rw-r--r--src/frames.c57
-rw-r--r--src/theme.c32
-rw-r--r--src/theme.h70
-rw-r--r--src/window.h13
6 files changed, 138 insertions, 67 deletions
diff --git a/ChangeLog b/ChangeLog
index ebd116d..99a865c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2002-01-27 Havoc Pennington <hp@pobox.com>
+ * src/frames.c (get_control): Only consider the bottom of the
+ titlebar a resize control; I keep accidentally resizing windows
+ instead of activating them. Also, give south resizing priority
+ over north, if the window is so small the active regions overlap
+
+ * src/theme.c: add MetaTheme, get MetaFrameStyleSet into
+ a usable state
+
+ * src/common.h: move window type back to window.h, decided
+ not to use it on frame side
+ (MetaFrameType): add this instead
+
+2002-01-27 Havoc Pennington <hp@pobox.com>
+
* src/theme.h, src/theme.c: implement all kinds of crazy
compositing-one-texture-onto-another BS.
diff --git a/src/common.h b/src/common.h
index b3a3480..62369c4 100644
--- a/src/common.h
+++ b/src/common.h
@@ -121,7 +121,6 @@ typedef enum
} MetaCursor;
-
typedef enum
{
META_FOCUS_MODE_CLICK,
@@ -131,16 +130,14 @@ typedef enum
typedef enum
{
- META_WINDOW_NORMAL,
- META_WINDOW_DESKTOP,
- META_WINDOW_DOCK,
- META_WINDOW_DIALOG,
- META_WINDOW_MODAL_DIALOG,
- META_WINDOW_TOOLBAR,
- META_WINDOW_MENU,
- META_WINDOW_TYPE_LAST
-} MetaWindowType;
-
+ META_FRAME_TYPE_NORMAL,
+ META_FRAME_TYPE_DIALOG,
+ META_FRAME_TYPE_MODAL_DIALOG,
+ META_FRAME_TYPE_UTILITY,
+ META_FRAME_TYPE_MENU,
+ META_FRAME_TYPE_TOOLBAR,
+ META_FRAME_TYPE_LAST
+} MetaFrameType;
/* should investigate changing these to whatever most apps use */
#define META_ICON_WIDTH 32
diff --git a/src/frames.c b/src/frames.c
index be49496..e2c6f5f 100644
--- a/src/frames.c
+++ b/src/frames.c
@@ -2101,28 +2101,19 @@ get_control (MetaFrames *frames,
if (has_vert || has_horiz)
{
- if (y < fgeom.top_height && x < RESIZE_EXTENDS)
- {
- if (has_vert && has_horiz)
- return META_FRAME_CONTROL_RESIZE_NW;
- else if (has_vert)
- return META_FRAME_CONTROL_RESIZE_N;
- else
- return META_FRAME_CONTROL_RESIZE_W;
+ int bottom_of_titlebar;
- }
- else if (y < fgeom.top_height && x >= (fgeom.width - RESIZE_EXTENDS))
- {
- if (has_vert && has_horiz)
- return META_FRAME_CONTROL_RESIZE_NE;
- else if (has_vert)
- return META_FRAME_CONTROL_RESIZE_N;
- else
- return META_FRAME_CONTROL_RESIZE_E;
+ bottom_of_titlebar = fgeom.title_rect.y + fgeom.title_rect.height;
- }
- else if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS) &&
- x >= (fgeom.width - fgeom.right_width - RESIZE_EXTENDS))
+ if (y < bottom_of_titlebar)
+ goto noresize;
+
+ /* South resize always has priority over north resize,
+ * in case of overlap.
+ */
+
+ if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS) &&
+ x >= (fgeom.width - fgeom.right_width - RESIZE_EXTENDS))
{
if (has_vert && has_horiz)
return META_FRAME_CONTROL_RESIZE_SE;
@@ -2141,16 +2132,36 @@ get_control (MetaFrames *frames,
else
return META_FRAME_CONTROL_RESIZE_W;
}
- else if (y < fgeom.top_height)
+ else if (y < (fgeom.top_height + RESIZE_EXTENDS) &&
+ x < RESIZE_EXTENDS)
{
- if (has_vert)
+ if (has_vert && has_horiz)
+ return META_FRAME_CONTROL_RESIZE_NW;
+ else if (has_vert)
return META_FRAME_CONTROL_RESIZE_N;
+ else
+ return META_FRAME_CONTROL_RESIZE_W;
+ }
+ else if (y < (fgeom.top_height + RESIZE_EXTENDS) &&
+ x >= (fgeom.width - RESIZE_EXTENDS))
+ {
+ if (has_vert && has_horiz)
+ return META_FRAME_CONTROL_RESIZE_NE;
+ else if (has_vert)
+ return META_FRAME_CONTROL_RESIZE_N;
+ else
+ return META_FRAME_CONTROL_RESIZE_E;
}
else if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS))
{
if (has_vert)
return META_FRAME_CONTROL_RESIZE_S;
}
+ else if (y >= bottom_of_titlebar && y < fgeom.top_height)
+ {
+ if (has_vert)
+ return META_FRAME_CONTROL_RESIZE_N;
+ }
else if (x <= fgeom.left_width)
{
if (has_horiz)
@@ -2162,6 +2173,8 @@ get_control (MetaFrames *frames,
return META_FRAME_CONTROL_RESIZE_E;
}
}
+
+ noresize:
return META_FRAME_CONTROL_NONE;
}
diff --git a/src/theme.c b/src/theme.c
index 2e85f57..cade72e 100644
--- a/src/theme.c
+++ b/src/theme.c
@@ -1267,25 +1267,37 @@ meta_frame_style_set_new (void)
return style_set;
}
+static void
+free_focus_styles (MetaFrameStyle *focus_styles[META_WINDOW_FOCUS_LAST])
+{
+ int i;
+
+ i = 0;
+ while (i < META_WINDOW_FOCUS_LAST)
+ {
+ if (focus_styles[i])
+ meta_frame_style_unref (focus_styles[i]);
+
+ ++i;
+ }
+}
+
void
meta_frame_style_set_free (MetaFrameStyleSet *style_set)
{
- int i, j;
+ int i;
i = 0;
- while (i < META_WINDOW_TYPE_LAST)
+ while (i < META_WINDOW_RESIZE_LAST)
{
- j = 0;
- while (j < META_WINDOW_STATE_LAST)
- {
- if (style_set->styles[i][j])
- meta_frame_style_unref (style_set->styles[i][j]);
-
- ++j;
- }
+ free_focus_styles (style_set->normal_styles[i]);
++i;
}
+ free_focus_styles (style_set->maximized_styles);
+ free_focus_styles (style_set->shaded_styles);
+ free_focus_styles (style_set->maximized_and_shaded_styles);
+
g_free (style_set);
}
diff --git a/src/theme.h b/src/theme.h
index 176c75a..f289a01 100644
--- a/src/theme.h
+++ b/src/theme.h
@@ -33,6 +33,7 @@ typedef struct _MetaGradientSpec MetaGradientSpec;
typedef struct _MetaColorSpec MetaColorSpec;
typedef struct _MetaFrameLayout MetaFrameLayout;
typedef struct _MetaFrameGeometry MetaFrameGeometry;
+typedef struct _MetaTheme MetaTheme;
/* Parameters used to calculate the geometry of the frame */
struct _MetaFrameLayout
@@ -265,40 +266,61 @@ struct _MetaFrameStyle
};
+/* FIXME dammit, these are not mutually exclusive; how to handle
+ * the mess...
+ *
+ * normal -> noresize / vert only / horz only / both
+ * focused / unfocused
+ * max -> focused / unfocused
+ * shaded -> focused / unfocused
+ * max/shaded -> focused / unfocused
+ *
+ * so 4 states with 8 sub-states in one, 2 sub-states in the other 3,
+ * meaning 14 total
+ *
+ * 14 window states times 7 or 8 window types. Except some
+ * window types never get a frame so that narrows it down a bit.
+ *
+ */
typedef enum
{
- /* FIXME dammit, these are not mutually exclusive; how to handle
- * the mess...
- *
- * normal -> noresize / vert only / horz only / both
- focused / unfocused
- * max -> focused / unfocused
- * shaded -> focused / unfocused
- * max/shaded -> focused / unfocused
- *
- * so 4 states with 8 sub-states in one, 2 sub-states in the other 3,
- * meaning 14 total
- *
- * 14 window states times 7 or 8 window types.
- *
- *
- * MetaFrameStyleSet needs rearranging to think of it this way.
- *
- */
+ META_WINDOW_STATE_NORMAL,
META_WINDOW_STATE_MAXIMIZED,
META_WINDOW_STATE_SHADED,
META_WINDOW_STATE_MAXIMIZED_AND_SHADED,
- META_WINDOW_STATE_RESIZE_VERTICAL,
- META_WINDOW_STATE_RESIZE_HORIZONTAL,
- META_WINDOW_STATE_RESIZE_BOTH,
- META_WINDOW_STATE_UNFOCUSED,
- META_WINDOW_STATE_FOCUSED,
META_WINDOW_STATE_LAST
} MetaWindowState;
+typedef enum
+{
+ META_WINDOW_RESIZE_NONE,
+ META_WINDOW_RESIZE_VERTICAL,
+ META_WINDOW_RESIZE_HORIZONTAL,
+ META_WINDOW_RESIZE_BOTH,
+ META_WINDOW_RESIZE_LAST
+} MetaWindowResize;
+
+typedef enum
+{
+ META_WINDOW_FOCUS_NO,
+ META_WINDOW_FOCUS_YES,
+ META_WINDOW_FOCUS_LAST
+} MetaWindowFocus;
+
+/* One StyleSet per window type (for window types that get a frame) */
struct _MetaFrameStyleSet
{
- MetaFrameStyle *styles[META_WINDOW_TYPE_LAST][META_WINDOW_STATE_LAST];
+ MetaFrameStyle *normal_styles[META_WINDOW_RESIZE_LAST][META_WINDOW_FOCUS_LAST];
+ MetaFrameStyle *maximized_styles[META_WINDOW_FOCUS_LAST];
+ MetaFrameStyle *shaded_styles[META_WINDOW_FOCUS_LAST];
+ MetaFrameStyle *maximized_and_shaded_styles[META_WINDOW_FOCUS_LAST];
+};
+
+struct _MetaTheme
+{
+ char *name;
+ char *filename;
+ MetaFrameStyleSet *style_sets[META_FRAME_TYPE_LAST];
};
MetaFrameLayout* meta_frame_layout_new (void);
diff --git a/src/window.h b/src/window.h
index 4ecc457..18a3ca9 100644
--- a/src/window.h
+++ b/src/window.h
@@ -28,6 +28,19 @@
#include <X11/Xutil.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
+
+typedef enum
+{
+ META_WINDOW_NORMAL,
+ META_WINDOW_DESKTOP,
+ META_WINDOW_DOCK,
+ META_WINDOW_DIALOG,
+ META_WINDOW_MODAL_DIALOG,
+ META_WINDOW_TOOLBAR,
+ META_WINDOW_MENU
+ /* FIXME add UTILITY, SPLASHSCREEN */
+} MetaWindowType;
+
struct _MetaWindow
{
MetaDisplay *display;