summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2001-08-26 02:09:53 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-08-26 02:09:53 +0000
commit4d2f018ddb7e643cb56b22ff63b69466df8d1ab6 (patch)
treedcdf530aa0c3542de88251705b08754208343a57
parent5eb43d34ff6ecf392e756ae4873c97afe2c2a593 (diff)
downloadmetacity-4d2f018ddb7e643cb56b22ff63b69466df8d1ab6.tar.gz
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.
-rw-r--r--ChangeLog23
-rw-r--r--src/keybindings.c3
-rw-r--r--src/ui.c12
-rw-r--r--src/window.c63
4 files changed, 77 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b0df573..364e9fff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* src/window.c (update_icon): attempt to use the mask as well as
diff --git a/src/keybindings.c b/src/keybindings.c
index 38fa3bec..0002cfdb 100644
--- a/src/keybindings.c
+++ b/src/keybindings.c
@@ -448,8 +448,7 @@ meta_display_process_key_event (MetaDisplay *display,
XKeysymToString (keysym), event->xkey.state,
window ? window->desc : "(no window)");
- if (display->grab_op == META_GRAB_OP_NONE &&
- (window == NULL || !window->all_keys_grabbed))
+ if (window == NULL || !window->all_keys_grabbed)
{
/* Do the normal keybindings */
process_event (screen_bindings, display, NULL, event, keysym);
diff --git a/src/ui.c b/src/ui.c
index 64f107dc..ff9d1ba8 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -311,10 +311,8 @@ get_cmap (GdkPixmap *pixmap)
{
if (gdk_drawable_get_depth (pixmap) == 1)
{
- /* hell if I know */
- meta_verbose ("Making up some sort of colormap to get 1-bit pixmap\n");
- cmap = gdk_colormap_get_system ();
- g_object_ref (G_OBJECT (cmap));
+ meta_verbose ("Using NULL colormap for snapshotting bitmap\n");
+ cmap = NULL;
}
else
{
@@ -359,7 +357,8 @@ meta_gdk_pixbuf_get_from_window (GdkPixbuf *dest,
dest_x, dest_y,
width, height);
- g_object_unref (G_OBJECT (cmap));
+ if (cmap)
+ g_object_unref (G_OBJECT (cmap));
g_object_unref (G_OBJECT (drawable));
return retval;
@@ -397,7 +396,8 @@ meta_gdk_pixbuf_get_from_pixmap (GdkPixbuf *dest,
dest_x, dest_y,
width, height);
- g_object_unref (G_OBJECT (cmap));
+ if (cmap)
+ g_object_unref (G_OBJECT (cmap));
g_object_unref (G_OBJECT (drawable));
return retval;
diff --git a/src/window.c b/src/window.c
index e1f54599..8ff44a7e 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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 ||
window->type == META_WINDOW_DOCK)
{
@@ -3792,7 +3798,7 @@ apply_mask (GdkPixbuf *pixbuf,
w = MIN (gdk_pixbuf_get_width (mask), gdk_pixbuf_get_width (pixbuf));
h = MIN (gdk_pixbuf_get_height (mask), gdk_pixbuf_get_height (pixbuf));
-
+
with_alpha = gdk_pixbuf_add_alpha (pixbuf, FALSE, 0, 0, 0);
dest = gdk_pixbuf_get_pixels (with_alpha);
@@ -3809,9 +3815,11 @@ apply_mask (GdkPixbuf *pixbuf,
{
guchar *s = src + i * src_stride + j * 3;
guchar *d = dest + i * dest_stride + j * 4;
-
- /* I have no idea if this is reliable. */
- if ((s[0] + s[1] + s[2]) == 0)
+
+ /* s[0] == s[1] == s[2], they are 255 if the bit was set, 0
+ * otherwise
+ */
+ if (s[0] == 0)
d[3] = 0; /* transparent */
else
d[3] = 255; /* opaque */
@@ -4166,12 +4174,11 @@ constrain_size (MetaWindow *window,
maxw = window->size_hints.max_width;
maxh = window->size_hints.max_height;
- /* If user hasn't resized or moved, then try to shrink the window to
- * fit onscreen, while not violating the min size, just as
- * we do for maximize
- */
- if (window->maximized ||
- !(window->user_has_resized || window->user_has_moved))
+ if (window->maximized)
+ /* we used to only constrain to fit inside screen for these cases,
+ * but now I don't remember why I did that.
+ */
+ /* !(window->user_has_resized || window->user_has_moved) */
{
maxw = MIN (maxw, fullw);
maxh = MIN (maxh, fullh);
@@ -4271,9 +4278,14 @@ constrain_position (MetaWindow *window,
if (!window->placed && window->calc_placement)
meta_window_place (window, fgeom, x, y, &x, &y);
-
- if (window->type != META_WINDOW_DESKTOP &&
- window->type != META_WINDOW_DOCK)
+
+ if (window->type == META_WINDOW_FULLSCREEN)
+ {
+ x = 0;
+ y = 0;
+ }
+ else if (window->type != META_WINDOW_DESKTOP &&
+ window->type != META_WINDOW_DOCK)
{
int nw_x, nw_y;
int se_x, se_y;
@@ -4318,15 +4330,34 @@ constrain_position (MetaWindow *window,
nw_y -= offscreen_h;
/* 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)
{
#define TITLEBAR_LENGTH_ONSCREEN 10
se_x -= (fgeom->left_width + TITLEBAR_LENGTH_ONSCREEN);
se_y -= fgeom->top_height;
}
-
+#endif
+
/* If we have a micro-screen or huge frames maybe nw/se got
* swapped
*/
@@ -4364,7 +4395,7 @@ constrain_position (MetaWindow *window,
y = nw_y;
}
}
-
+
*new_x = x;
*new_y = y;
}