This commit is contained in:
rhp 2001-07-05 05:22:00 +00:00
parent 90829a15cc
commit 482640b831
4 changed files with 74 additions and 22 deletions

View File

@ -182,7 +182,8 @@ meta_frame_get_flags (MetaFrame *frame)
if (frame->window->has_move_func) if (frame->window->has_move_func)
flags |= META_FRAME_ALLOWS_MOVE; 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 < if (frame->window->size_hints.min_width <
frame->window->size_hints.max_width) frame->window->size_hints.max_width)

View File

@ -719,29 +719,35 @@ meta_frames_manage_window (MetaFrames *frames,
while (i < 4) while (i < 4)
{ {
int result; int result;
result = XGrabButton (gdk_display, i, Mod1Mask, gdk_error_trap_push ();
xwindow, False, XGrabButton (gdk_display, i, Mod1Mask,
ButtonPressMask | ButtonReleaseMask | xwindow, False,
PointerMotionMask | PointerMotionHintMask, ButtonPressMask | ButtonReleaseMask |
GrabModeAsync, GrabModeAsync, PointerMotionMask | PointerMotionHintMask,
False, None); GrabModeAsync, GrabModeAsync,
False, None);
XSync (gdk_display, False);
result = gdk_error_trap_pop ();
if (result != Success) if (result != Success)
meta_warning ("Failed to grab button %d with Mod1Mask for frame 0x%lx error code %d\n", meta_warning ("Failed to grab button %d with Mod1Mask for frame 0x%lx error code %d\n",
i, xwindow, result); i, xwindow, result);
#if 0 #if 1
/* This is just for debugging, since I end up moving /* This is just for debugging, since I end up moving
* the Xnest otherwise ;-) * the Xnest otherwise ;-)
*/ */
gdk_error_trap_push ();
result = XGrabButton (gdk_display, i, ControlMask, result = XGrabButton (gdk_display, i, ControlMask,
xwindow, False, xwindow, False,
ButtonPressMask | ButtonReleaseMask | ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | PointerMotionHintMask, PointerMotionMask | PointerMotionHintMask,
GrabModeAsync, GrabModeAsync, GrabModeAsync, GrabModeAsync,
False, None); False, None);
XSync (gdk_display, False);
result = gdk_error_trap_pop ();
if (result != Success) if (result != Success)
meta_warning ("Failed to grab button %d with ControlMask for frame 0x%lx error code %d\n", meta_warning ("Failed to grab button %d with ControlMask for frame 0x%lx error code %d\n",
i, xwindow, result); i, xwindow, result);

View File

@ -16,7 +16,7 @@ fi
if test -z "$ONLY_WM"; then if test -z "$ONLY_WM"; then
Xnest -ac :1 -scrns $SCREENS -geometry 640x400 -bw 15 & Xnest -ac :1 -scrns $SCREENS -geometry 640x400 -bw 15 &
usleep 100000 usleep 500000
if test $CLIENTS != 0; then if test $CLIENTS != 0; then
for I in `seq 1 $CLIENTS`; do for I in `seq 1 $CLIENTS`; do

View File

@ -3300,8 +3300,11 @@ constrain_position (MetaWindow *window,
{ {
int nw_x, nw_y; int nw_x, nw_y;
int se_x, se_y; int se_x, se_y;
int offscreen_w, offscreen_h;
/* find furthest northwest corner */
/* 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_x = window->screen->active_workspace->workarea.x;
nw_y = window->screen->active_workspace->workarea.y; nw_y = window->screen->active_workspace->workarea.y;
if (window->frame) if (window->frame)
@ -3310,18 +3313,36 @@ constrain_position (MetaWindow *window,
nw_y += fgeom->top_height; nw_y += fgeom->top_height;
} }
/* don't allow moving titlebar off the top or left */ /* find bottom-right corner of workarea */
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) */
se_x = window->screen->active_workspace->workarea.x + se_x = window->screen->active_workspace->workarea.x +
window->screen->active_workspace->workarea.width; window->screen->active_workspace->workarea.width;
se_y = window->screen->active_workspace->workarea.y + se_y = window->screen->active_workspace->workarea.y +
window->screen->active_workspace->workarea.height; 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) if (window->frame)
{ {
#define TITLEBAR_LENGTH_ONSCREEN 10 #define TITLEBAR_LENGTH_ONSCREEN 10
@ -3329,11 +3350,35 @@ constrain_position (MetaWindow *window,
se_y -= fgeom->top_height; 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) if (x > se_x)
x = se_x; x = se_x;
if (y > se_y) if (y > se_y)
y = se_y; y = se_y;
/* If maximized, force the exact position */
if (window->maximized) if (window->maximized)
{ {
if (x != nw_x) if (x != nw_x)