mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 01:50:42 -05:00
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
This commit is contained in:
parent
5b4e9c01cc
commit
b52ee424e4
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
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>
|
2002-01-27 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* src/theme.h, src/theme.c: implement all kinds of crazy
|
* src/theme.h, src/theme.c: implement all kinds of crazy
|
||||||
|
19
src/common.h
19
src/common.h
@ -121,7 +121,6 @@ typedef enum
|
|||||||
|
|
||||||
} MetaCursor;
|
} MetaCursor;
|
||||||
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
META_FOCUS_MODE_CLICK,
|
META_FOCUS_MODE_CLICK,
|
||||||
@ -131,16 +130,14 @@ typedef enum
|
|||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
META_WINDOW_NORMAL,
|
META_FRAME_TYPE_NORMAL,
|
||||||
META_WINDOW_DESKTOP,
|
META_FRAME_TYPE_DIALOG,
|
||||||
META_WINDOW_DOCK,
|
META_FRAME_TYPE_MODAL_DIALOG,
|
||||||
META_WINDOW_DIALOG,
|
META_FRAME_TYPE_UTILITY,
|
||||||
META_WINDOW_MODAL_DIALOG,
|
META_FRAME_TYPE_MENU,
|
||||||
META_WINDOW_TOOLBAR,
|
META_FRAME_TYPE_TOOLBAR,
|
||||||
META_WINDOW_MENU,
|
META_FRAME_TYPE_LAST
|
||||||
META_WINDOW_TYPE_LAST
|
} MetaFrameType;
|
||||||
} MetaWindowType;
|
|
||||||
|
|
||||||
|
|
||||||
/* should investigate changing these to whatever most apps use */
|
/* should investigate changing these to whatever most apps use */
|
||||||
#define META_ICON_WIDTH 32
|
#define META_ICON_WIDTH 32
|
||||||
|
55
src/frames.c
55
src/frames.c
@ -2101,27 +2101,18 @@ get_control (MetaFrames *frames,
|
|||||||
|
|
||||||
if (has_vert || has_horiz)
|
if (has_vert || has_horiz)
|
||||||
{
|
{
|
||||||
if (y < fgeom.top_height && x < RESIZE_EXTENDS)
|
int bottom_of_titlebar;
|
||||||
{
|
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
bottom_of_titlebar = fgeom.title_rect.y + fgeom.title_rect.height;
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
if (y < bottom_of_titlebar)
|
||||||
else if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS) &&
|
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))
|
x >= (fgeom.width - fgeom.right_width - RESIZE_EXTENDS))
|
||||||
{
|
{
|
||||||
if (has_vert && has_horiz)
|
if (has_vert && has_horiz)
|
||||||
@ -2141,16 +2132,36 @@ get_control (MetaFrames *frames,
|
|||||||
else
|
else
|
||||||
return META_FRAME_CONTROL_RESIZE_W;
|
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;
|
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))
|
else if (y >= (fgeom.height - fgeom.bottom_height - RESIZE_EXTENDS))
|
||||||
{
|
{
|
||||||
if (has_vert)
|
if (has_vert)
|
||||||
return META_FRAME_CONTROL_RESIZE_S;
|
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)
|
else if (x <= fgeom.left_width)
|
||||||
{
|
{
|
||||||
if (has_horiz)
|
if (has_horiz)
|
||||||
@ -2163,6 +2174,8 @@ get_control (MetaFrames *frames,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
noresize:
|
||||||
|
|
||||||
return META_FRAME_CONTROL_NONE;
|
return META_FRAME_CONTROL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
32
src/theme.c
32
src/theme.c
@ -1267,25 +1267,37 @@ meta_frame_style_set_new (void)
|
|||||||
return style_set;
|
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
|
void
|
||||||
meta_frame_style_set_free (MetaFrameStyleSet *style_set)
|
meta_frame_style_set_free (MetaFrameStyleSet *style_set)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < META_WINDOW_TYPE_LAST)
|
while (i < META_WINDOW_RESIZE_LAST)
|
||||||
{
|
{
|
||||||
j = 0;
|
free_focus_styles (style_set->normal_styles[i]);
|
||||||
while (j < META_WINDOW_STATE_LAST)
|
|
||||||
{
|
|
||||||
if (style_set->styles[i][j])
|
|
||||||
meta_frame_style_unref (style_set->styles[i][j]);
|
|
||||||
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
|
|
||||||
++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);
|
g_free (style_set);
|
||||||
}
|
}
|
||||||
|
50
src/theme.h
50
src/theme.h
@ -33,6 +33,7 @@ typedef struct _MetaGradientSpec MetaGradientSpec;
|
|||||||
typedef struct _MetaColorSpec MetaColorSpec;
|
typedef struct _MetaColorSpec MetaColorSpec;
|
||||||
typedef struct _MetaFrameLayout MetaFrameLayout;
|
typedef struct _MetaFrameLayout MetaFrameLayout;
|
||||||
typedef struct _MetaFrameGeometry MetaFrameGeometry;
|
typedef struct _MetaFrameGeometry MetaFrameGeometry;
|
||||||
|
typedef struct _MetaTheme MetaTheme;
|
||||||
|
|
||||||
/* Parameters used to calculate the geometry of the frame */
|
/* Parameters used to calculate the geometry of the frame */
|
||||||
struct _MetaFrameLayout
|
struct _MetaFrameLayout
|
||||||
@ -265,13 +266,11 @@ struct _MetaFrameStyle
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef enum
|
/* FIXME dammit, these are not mutually exclusive; how to handle
|
||||||
{
|
|
||||||
/* FIXME dammit, these are not mutually exclusive; how to handle
|
|
||||||
* the mess...
|
* the mess...
|
||||||
*
|
*
|
||||||
* normal -> noresize / vert only / horz only / both
|
* normal -> noresize / vert only / horz only / both
|
||||||
focused / unfocused
|
* focused / unfocused
|
||||||
* max -> focused / unfocused
|
* max -> focused / unfocused
|
||||||
* shaded -> focused / unfocused
|
* shaded -> focused / unfocused
|
||||||
* max/shaded -> focused / unfocused
|
* max/shaded -> focused / unfocused
|
||||||
@ -279,26 +278,49 @@ typedef enum
|
|||||||
* so 4 states with 8 sub-states in one, 2 sub-states in the other 3,
|
* so 4 states with 8 sub-states in one, 2 sub-states in the other 3,
|
||||||
* meaning 14 total
|
* meaning 14 total
|
||||||
*
|
*
|
||||||
* 14 window states times 7 or 8 window types.
|
* 14 window states times 7 or 8 window types. Except some
|
||||||
*
|
* window types never get a frame so that narrows it down a bit.
|
||||||
*
|
|
||||||
* MetaFrameStyleSet needs rearranging to think of it this way.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
META_WINDOW_STATE_NORMAL,
|
||||||
META_WINDOW_STATE_MAXIMIZED,
|
META_WINDOW_STATE_MAXIMIZED,
|
||||||
META_WINDOW_STATE_SHADED,
|
META_WINDOW_STATE_SHADED,
|
||||||
META_WINDOW_STATE_MAXIMIZED_AND_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
|
META_WINDOW_STATE_LAST
|
||||||
} MetaWindowState;
|
} 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
|
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);
|
MetaFrameLayout* meta_frame_layout_new (void);
|
||||||
|
13
src/window.h
13
src/window.h
@ -28,6 +28,19 @@
|
|||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.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
|
struct _MetaWindow
|
||||||
{
|
{
|
||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
|
Loading…
Reference in New Issue
Block a user