summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/frame.c3
-rw-r--r--src/frames.c26
-rwxr-xr-xsrc/run-metacity.sh2
-rw-r--r--src/window.c65
4 files changed, 74 insertions, 22 deletions
diff --git a/src/frame.c b/src/frame.c
index c76983e5..a326d2ae 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -182,7 +182,8 @@ meta_frame_get_flags (MetaFrame *frame)
if (frame->window->has_move_func)
flags |= META_FRAME_ALLOWS_MOVE;
- if (frame->window->has_resize_func)
+ if (frame->window->has_resize_func &&
+ !frame->window->maximized)
{
if (frame->window->size_hints.min_width <
frame->window->size_hints.max_width)
diff --git a/src/frames.c b/src/frames.c
index 8d23ccf2..6cefbd8f 100644
--- a/src/frames.c
+++ b/src/frames.c
@@ -719,29 +719,35 @@ meta_frames_manage_window (MetaFrames *frames,
while (i < 4)
{
int result;
-
- result = XGrabButton (gdk_display, i, Mod1Mask,
- xwindow, False,
- ButtonPressMask | ButtonReleaseMask |
- PointerMotionMask | PointerMotionHintMask,
- GrabModeAsync, GrabModeAsync,
- False, None);
+
+ gdk_error_trap_push ();
+ XGrabButton (gdk_display, i, Mod1Mask,
+ xwindow, False,
+ ButtonPressMask | ButtonReleaseMask |
+ PointerMotionMask | PointerMotionHintMask,
+ GrabModeAsync, GrabModeAsync,
+ False, None);
+ XSync (gdk_display, False);
+ result = gdk_error_trap_pop ();
if (result != Success)
meta_warning ("Failed to grab button %d with Mod1Mask for frame 0x%lx error code %d\n",
i, xwindow, result);
-
-#if 0
+
+#if 1
/* This is just for debugging, since I end up moving
* the Xnest otherwise ;-)
*/
+ gdk_error_trap_push ();
result = XGrabButton (gdk_display, i, ControlMask,
xwindow, False,
ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | PointerMotionHintMask,
GrabModeAsync, GrabModeAsync,
False, None);
-
+ XSync (gdk_display, False);
+ result = gdk_error_trap_pop ();
+
if (result != Success)
meta_warning ("Failed to grab button %d with ControlMask for frame 0x%lx error code %d\n",
i, xwindow, result);
diff --git a/src/run-metacity.sh b/src/run-metacity.sh
index a05c8e10..7aa123a7 100755
--- a/src/run-metacity.sh
+++ b/src/run-metacity.sh
@@ -16,7 +16,7 @@ fi
if test -z "$ONLY_WM"; then
Xnest -ac :1 -scrns $SCREENS -geometry 640x400 -bw 15 &
- usleep 100000
+ usleep 500000
if test $CLIENTS != 0; then
for I in `seq 1 $CLIENTS`; do
diff --git a/src/window.c b/src/window.c
index 801226c8..66c93031 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3300,8 +3300,11 @@ constrain_position (MetaWindow *window,
{
int nw_x, nw_y;
int se_x, se_y;
-
- /* find furthest northwest corner */
+ int offscreen_w, offscreen_h;
+
+ /* find furthest northwest point the window can occupy,
+ * to disallow moving titlebar off the top or left
+ */
nw_x = window->screen->active_workspace->workarea.x;
nw_y = window->screen->active_workspace->workarea.y;
if (window->frame)
@@ -3310,18 +3313,36 @@ constrain_position (MetaWindow *window,
nw_y += fgeom->top_height;
}
- /* don't allow moving titlebar off the top or left */
- if (x < nw_x)
- x = nw_x;
- if (y < nw_y)
- y = nw_y;
-
- /* keep titlebar on bottom right as well (but not entire window) */
+ /* find bottom-right corner of workarea */
se_x = window->screen->active_workspace->workarea.x +
window->screen->active_workspace->workarea.width;
se_y = window->screen->active_workspace->workarea.y +
window->screen->active_workspace->workarea.height;
+ /* if the window's size exceeds the screen size,
+ * we allow it to go off the top/left far enough
+ * to get the right/bottom edges onscreen.
+ */
+ offscreen_w = nw_x + window->rect.width;
+ offscreen_h = nw_y + window->rect.height;
+ if (window->frame)
+ {
+ offscreen_w += fgeom->right_width;
+ offscreen_h += fgeom->bottom_height;
+ }
+
+ offscreen_w = offscreen_w - se_x;
+ offscreen_h = offscreen_h - se_y;
+
+ /* Now change NW limit to reflect amount offscreen in SE direction */
+ if (offscreen_w > 0)
+ nw_x -= offscreen_w;
+ if (offscreen_h > 0)
+ nw_y -= offscreen_h;
+
+ /* Convert se_x, se_y to the most bottom-right position
+ * the window can occupy
+ */
if (window->frame)
{
#define TITLEBAR_LENGTH_ONSCREEN 10
@@ -3329,11 +3350,35 @@ constrain_position (MetaWindow *window,
se_y -= fgeom->top_height;
}
+ /* If we have a micro-screen or huge frames maybe nw/se got
+ * swapped
+ */
+ if (nw_x > se_x)
+ {
+ int tmp = nw_x;
+ nw_x = se_x;
+ se_x = tmp;
+ }
+
+ if (nw_y > se_y)
+ {
+ int tmp = nw_y;
+ nw_y = se_y;
+ se_y = tmp;
+ }
+
+ /* Clamp window to the given positions */
+ if (x < nw_x)
+ x = nw_x;
+ if (y < nw_y)
+ y = nw_y;
+
if (x > se_x)
x = se_x;
if (y > se_y)
y = se_y;
-
+
+ /* If maximized, force the exact position */
if (window->maximized)
{
if (x != nw_x)