force fullscreen windows to be at 0,0

2001-08-24  Havoc Pennington  <hp@pobox.com>

	* src/window.c (constrain_position): force fullscreen windows to
	be at 0,0

	* src/ui.c: use NULL colormap to get bitmaps, requires
	very latest GTK from CVS or it will spew warnings
	and not work.

	* src/window.c (constrain_size): disallow larger than screen in
	all cases, even if user has performed a resize operation.
	(constrain_position): keep window boxed onscreen.

	* src/keybindings.c (meta_display_process_key_event): revert an
	earlier change that disabled global keybindings when a grab is in
	effect; instead, only disable global keybindings if a _keyboard_
	grab is in effect. The earlier change was just a broken
	workaround, the problems it fixed should have been solved by the
	addition of XGrabKeyboard() on the metacity keyboard grabs.

	This should fix the problem with
	pick-up-window-and-move-to-another-desktop.
This commit is contained in:
Havoc Pennington 2001-08-26 02:09:53 +00:00 committed by Havoc Pennington
parent 5eb43d34ff
commit 4d2f018ddb
4 changed files with 77 additions and 24 deletions

View File

@ -1,3 +1,26 @@
2001-08-24 Havoc Pennington <hp@pobox.com>
* src/window.c (constrain_position): force fullscreen windows to
be at 0,0
* src/ui.c: use NULL colormap to get bitmaps, requires
very latest GTK from CVS or it will spew warnings
and not work.
* src/window.c (constrain_size): disallow larger than screen in
all cases, even if user has performed a resize operation.
(constrain_position): keep window boxed onscreen.
* src/keybindings.c (meta_display_process_key_event): revert an
earlier change that disabled global keybindings when a grab is in
effect; instead, only disable global keybindings if a _keyboard_
grab is in effect. The earlier change was just a broken
workaround, the problems it fixed should have been solved by the
addition of XGrabKeyboard() on the metacity keyboard grabs.
This should fix the problem with
pick-up-window-and-move-to-another-desktop.
2001-08-23 Havoc Pennington <hp@pobox.com> 2001-08-23 Havoc Pennington <hp@pobox.com>
* src/window.c (update_icon): attempt to use the mask as well as * src/window.c (update_icon): attempt to use the mask as well as

View File

@ -448,8 +448,7 @@ meta_display_process_key_event (MetaDisplay *display,
XKeysymToString (keysym), event->xkey.state, XKeysymToString (keysym), event->xkey.state,
window ? window->desc : "(no window)"); window ? window->desc : "(no window)");
if (display->grab_op == META_GRAB_OP_NONE && if (window == NULL || !window->all_keys_grabbed)
(window == NULL || !window->all_keys_grabbed))
{ {
/* Do the normal keybindings */ /* Do the normal keybindings */
process_event (screen_bindings, display, NULL, event, keysym); process_event (screen_bindings, display, NULL, event, keysym);

View File

@ -311,10 +311,8 @@ get_cmap (GdkPixmap *pixmap)
{ {
if (gdk_drawable_get_depth (pixmap) == 1) if (gdk_drawable_get_depth (pixmap) == 1)
{ {
/* hell if I know */ meta_verbose ("Using NULL colormap for snapshotting bitmap\n");
meta_verbose ("Making up some sort of colormap to get 1-bit pixmap\n"); cmap = NULL;
cmap = gdk_colormap_get_system ();
g_object_ref (G_OBJECT (cmap));
} }
else else
{ {
@ -359,7 +357,8 @@ meta_gdk_pixbuf_get_from_window (GdkPixbuf *dest,
dest_x, dest_y, dest_x, dest_y,
width, height); width, height);
g_object_unref (G_OBJECT (cmap)); if (cmap)
g_object_unref (G_OBJECT (cmap));
g_object_unref (G_OBJECT (drawable)); g_object_unref (G_OBJECT (drawable));
return retval; return retval;
@ -397,7 +396,8 @@ meta_gdk_pixbuf_get_from_pixmap (GdkPixbuf *dest,
dest_x, dest_y, dest_x, dest_y,
width, height); width, height);
g_object_unref (G_OBJECT (cmap)); if (cmap)
g_object_unref (G_OBJECT (cmap));
g_object_unref (G_OBJECT (drawable)); g_object_unref (G_OBJECT (drawable));
return retval; return retval;

View File

@ -465,6 +465,12 @@ meta_window_new (MetaDisplay *display, Window xwindow,
} }
} }
if (window->type == META_WINDOW_FULLSCREEN)
{
meta_verbose ("Won't place fullscreen window\n");
window->placed = TRUE;
}
if (window->type == META_WINDOW_DESKTOP || if (window->type == META_WINDOW_DESKTOP ||
window->type == META_WINDOW_DOCK) window->type == META_WINDOW_DOCK)
{ {
@ -3810,8 +3816,10 @@ apply_mask (GdkPixbuf *pixbuf,
guchar *s = src + i * src_stride + j * 3; guchar *s = src + i * src_stride + j * 3;
guchar *d = dest + i * dest_stride + j * 4; guchar *d = dest + i * dest_stride + j * 4;
/* I have no idea if this is reliable. */ /* s[0] == s[1] == s[2], they are 255 if the bit was set, 0
if ((s[0] + s[1] + s[2]) == 0) * otherwise
*/
if (s[0] == 0)
d[3] = 0; /* transparent */ d[3] = 0; /* transparent */
else else
d[3] = 255; /* opaque */ d[3] = 255; /* opaque */
@ -4166,12 +4174,11 @@ constrain_size (MetaWindow *window,
maxw = window->size_hints.max_width; maxw = window->size_hints.max_width;
maxh = window->size_hints.max_height; maxh = window->size_hints.max_height;
/* If user hasn't resized or moved, then try to shrink the window to if (window->maximized)
* fit onscreen, while not violating the min size, just as /* we used to only constrain to fit inside screen for these cases,
* we do for maximize * but now I don't remember why I did that.
*/ */
if (window->maximized || /* !(window->user_has_resized || window->user_has_moved) */
!(window->user_has_resized || window->user_has_moved))
{ {
maxw = MIN (maxw, fullw); maxw = MIN (maxw, fullw);
maxh = MIN (maxh, fullh); maxh = MIN (maxh, fullh);
@ -4272,8 +4279,13 @@ constrain_position (MetaWindow *window,
if (!window->placed && window->calc_placement) if (!window->placed && window->calc_placement)
meta_window_place (window, fgeom, x, y, &x, &y); meta_window_place (window, fgeom, x, y, &x, &y);
if (window->type != META_WINDOW_DESKTOP && if (window->type == META_WINDOW_FULLSCREEN)
window->type != META_WINDOW_DOCK) {
x = 0;
y = 0;
}
else if (window->type != META_WINDOW_DESKTOP &&
window->type != META_WINDOW_DOCK)
{ {
int nw_x, nw_y; int nw_x, nw_y;
int se_x, se_y; int se_x, se_y;
@ -4318,14 +4330,33 @@ constrain_position (MetaWindow *window,
nw_y -= offscreen_h; nw_y -= offscreen_h;
/* Convert se_x, se_y to the most bottom-right position /* Convert se_x, se_y to the most bottom-right position
* the window can occupy * the window can occupy - don't allow offscreen
*/ */
se_x -= window->rect.width;
se_y -= window->rect.height;
if (window->frame)
{
se_x -= fgeom->right_width;
se_y -= fgeom->bottom_height;
}
/* If the window is larger than screen, allow it to move, as for
* nw_x nw_y
*/
if (offscreen_w > 0)
se_x += offscreen_w;
if (offscreen_h > 0)
se_y += offscreen_h;
#if 0
/* this is the old allow-offscreen-to-se constraint */
if (window->frame) if (window->frame)
{ {
#define TITLEBAR_LENGTH_ONSCREEN 10 #define TITLEBAR_LENGTH_ONSCREEN 10
se_x -= (fgeom->left_width + TITLEBAR_LENGTH_ONSCREEN); se_x -= (fgeom->left_width + TITLEBAR_LENGTH_ONSCREEN);
se_y -= fgeom->top_height; se_y -= fgeom->top_height;
} }
#endif
/* If we have a micro-screen or huge frames maybe nw/se got /* If we have a micro-screen or huge frames maybe nw/se got
* swapped * swapped