put in hack to keep Pango from mangling our server grab and locking up on

2002-02-19  Havoc Pennington  <hp@pobox.com>

	* src/ui.c (meta_ui_init): put in hack to keep Pango from mangling
	our server grab and locking up on startup. (hack doesn't work
	but I want to fix it on my real computer not this laptop)

	* src/window.c: Implement _NET_WM_STATE_FULLSCREEN

	* src/display.c (meta_display_open): add atoms for
	_NET_WM_STATE_FULLSCREEN
This commit is contained in:
Havoc Pennington 2002-02-23 22:58:02 +00:00 committed by Havoc Pennington
parent 214ac20a69
commit 20218dac92
7 changed files with 118 additions and 19 deletions

View File

@ -1,3 +1,14 @@
2002-02-19 Havoc Pennington <hp@pobox.com>
* src/ui.c (meta_ui_init): put in hack to keep Pango from mangling
our server grab and locking up on startup. (hack doesn't work
but I want to fix it on my real computer not this laptop)
* src/window.c: Implement _NET_WM_STATE_FULLSCREEN
* src/display.c (meta_display_open): add atoms for
_NET_WM_STATE_FULLSCREEN
2002-02-16 Kjartan Maraas <kmaraas@gnome.org>
* src/main.c: Use bind_textdomain_codeset etc.

View File

@ -146,7 +146,8 @@ meta_display_open (const char *name)
"_METACITY_SET_KEYBINDINGS_MESSAGE",
"_NET_WM_STATE_HIDDEN",
"_NET_WM_WINDOW_TYPE_UTILITY",
"_NET_WM_WINDOW_TYPE_SPLASHSCREEN"
"_NET_WM_WINDOW_TYPE_SPLASHSCREEN",
"_NET_WM_STATE_FULLSCREEN"
};
Atom atoms[G_N_ELEMENTS(atom_names)];
@ -247,6 +248,7 @@ meta_display_open (const char *name)
display->atom_net_wm_state_hidden = atoms[49];
display->atom_net_wm_window_type_utility = atoms[50];
display->atom_net_wm_window_type_splashscreen = atoms[51];
display->atom_net_wm_state_fullscreen = atoms[52];
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK,
* created in screen_new

View File

@ -111,6 +111,7 @@ struct _MetaDisplay
Atom atom_net_wm_state_hidden;
Atom atom_net_wm_window_type_utility;
Atom atom_net_wm_window_type_splashscreen;
Atom atom_net_wm_state_fullscreen;
/* This is the actual window from focus events,
* not the one we last set

View File

@ -78,7 +78,7 @@ set_wm_check_hint (MetaScreen *screen)
static int
set_supported_hint (MetaScreen *screen)
{
#define N_SUPPORTED 26
#define N_SUPPORTED 27
#define N_WIN_SUPPORTED 1
Atom atoms[N_SUPPORTED];
@ -108,6 +108,7 @@ set_supported_hint (MetaScreen *screen)
atoms[23] = screen->display->atom_net_wm_state_hidden;
atoms[24] = screen->display->atom_net_wm_window_type_utility;
atoms[25] = screen->display->atom_net_wm_window_type_splashscreen;
atoms[26] = screen->display->atom_net_wm_state_fullscreen;
XChangeProperty (screen->display->xdisplay, screen->xroot,
screen->display->atom_net_supported,

View File

@ -29,6 +29,8 @@
#include "inlinepixbufs.h"
#include <pango/pangox.h>
struct _MetaUI
{
Display *xdisplay;
@ -42,14 +44,13 @@ meta_ui_init (int *argc, char ***argv)
if (!gtk_init_check (argc, argv))
meta_fatal ("Unable to open X display %s\n", XDisplayName (NULL));
{
/* FIXME this is a hackaround for a GTK bug with using menus without
* menubars. we have to use the get_type value since it's G_GNUC_CONST
/* FIXME hackaround for Pango opening a separate display
* connection and doing a server grab while we have a grab
* on the primary display connection. This forces Pango to
* go ahead and do its font cache before we try to grab
* the server.
*/
volatile GType t;
t = gtk_menu_bar_get_type ();
t += 5;
}
pango_x_font_map_for_display (gdk_display);
}
Display*

View File

@ -309,6 +309,7 @@ meta_window_new (MetaDisplay *display, Window xwindow,
window->user_has_move_resized = FALSE;
window->maximized = FALSE;
window->fullscreen = FALSE;
window->on_all_workspaces = FALSE;
window->shaded = FALSE;
window->initially_iconic = FALSE;
@ -349,6 +350,8 @@ meta_window_new (MetaDisplay *display, Window xwindow,
window->has_shade_func = TRUE;
window->has_fullscreen_func = TRUE;
window->wm_state_modal = FALSE;
window->wm_state_skip_taskbar = FALSE;
window->wm_state_skip_pager = FALSE;
@ -839,6 +842,11 @@ set_net_wm_state (MetaWindow *window)
data[i] = window->display->atom_net_wm_state_maximized_vert;
++i;
}
if (window->fullscreen)
{
data[i] = window->display->atom_net_wm_state_fullscreen;
++i;
}
if (window->shaded || window->minimized)
{
data[i] = window->display->atom_net_wm_state_hidden;
@ -1289,6 +1297,7 @@ meta_window_maximize (MetaWindow *window)
window->maximized = TRUE;
/* FIXME why did I put this here? */
meta_window_raise (window);
/* save size/pos as appropriate args for move_resize */
@ -1328,6 +1337,57 @@ meta_window_unmaximize (MetaWindow *window)
}
}
void
meta_window_make_fullscreen (MetaWindow *window)
{
if (!window->fullscreen)
{
meta_topic (META_DEBUG_WINDOW_OPS,
"Fullscreening %s\n", window->desc);
window->fullscreen = TRUE;
/* FIXME why did I put this here? */
meta_window_raise (window);
/* save size/pos as appropriate args for move_resize */
window->saved_rect = window->rect;
if (window->frame)
{
window->saved_rect.x += window->frame->rect.x;
window->saved_rect.y += window->frame->rect.y;
}
/* move_resize with new constraints
*/
meta_window_queue_move_resize (window);
set_net_wm_state (window);
}
}
void
meta_window_unmake_fullscreen (MetaWindow *window)
{
if (window->fullscreen)
{
meta_topic (META_DEBUG_WINDOW_OPS,
"Unfullscreening %s\n", window->desc);
window->fullscreen = FALSE;
meta_window_move_resize (window,
TRUE,
window->saved_rect.x,
window->saved_rect.y,
window->saved_rect.width,
window->saved_rect.height);
set_net_wm_state (window);
}
}
void
meta_window_shade (MetaWindow *window)
{
@ -2825,6 +2885,19 @@ meta_window_client_message (MetaWindow *window,
meta_window_unshade (window);
}
if (first == display->atom_net_wm_state_fullscreen ||
second == display->atom_net_wm_state_fullscreen)
{
gboolean make_fullscreen;
make_fullscreen = (action == _NET_WM_STATE_ADD ||
(action == _NET_WM_STATE_TOGGLE && !window->fullscreen));
if (make_fullscreen && window->has_fullscreen_func)
meta_window_make_fullscreen (window);
else
meta_window_unmake_fullscreen (window);
}
if (first == display->atom_net_wm_state_maximized_horz ||
second == display->atom_net_wm_state_maximized_horz ||
first == display->atom_net_wm_state_maximized_vert ||
@ -4517,6 +4590,7 @@ recalc_window_features (MetaWindow *window)
window->has_resize_func = window->mwm_has_resize_func;
window->has_shade_func = TRUE;
window->has_fullscreen_func = TRUE;
/* Semantic category overrides the MWM hints */
@ -4535,6 +4609,7 @@ recalc_window_features (MetaWindow *window)
{
window->has_minimize_func = FALSE;
window->has_maximize_func = FALSE;
window->has_fullscreen_func = FALSE;
}
/* If min_size == max_size, then don't allow resize */
@ -4542,9 +4617,12 @@ recalc_window_features (MetaWindow *window)
window->size_hints.min_height == window->size_hints.max_height)
window->has_resize_func = FALSE;
/* don't allow maximize if we can't resize */
/* don't allow fullscreen if we can't resize */
if (!window->has_resize_func)
{
window->has_maximize_func = FALSE;
window->has_fullscreen_func = FALSE;
}
/* no shading if not decorated */
if (!window->decorated)
@ -4582,7 +4660,8 @@ constrain_size (MetaWindow *window,
meta_window_get_work_area (window, &work_area);
/* Get the allowed size ranges, considering maximized, etc. */
if (window->type == META_WINDOW_DESKTOP ||
if (window->fullscreen ||
window->type == META_WINDOW_DESKTOP ||
window->type == META_WINDOW_DOCK)
{
fullw = window->screen->width;
@ -4594,7 +4673,7 @@ constrain_size (MetaWindow *window,
fullh = work_area.height;
}
if (window->frame)
if (window->frame && !window->fullscreen)
{
fullw -= (fgeom->left_width + fgeom->right_width);
fullh -= (fgeom->top_height + fgeom->bottom_height);
@ -4708,14 +4787,12 @@ constrain_position (MetaWindow *window,
if (!window->placed && window->calc_placement)
meta_window_place (window, fgeom, x, y, &x, &y);
#if 0
if (window->fullscreen)
{
x = 0;
y = 0;
}
#endif
if (window->type != META_WINDOW_DESKTOP &&
else if (window->type != META_WINDOW_DESKTOP &&
window->type != META_WINDOW_DOCK)
{
int nw_x, nw_y;

View File

@ -87,6 +87,9 @@ struct _MetaWindow
/* Whether we're shaded */
guint shaded : 1;
/* Whether we're fullscreen */
guint fullscreen : 1;
/* Whether we're sticky in the multi-workspace sense
* (vs. the not-scroll-with-viewport sense, we don't
* have no stupid viewports)
@ -135,6 +138,7 @@ struct _MetaWindow
guint has_shade_func : 1;
guint has_move_func : 1;
guint has_resize_func : 1;
guint has_fullscreen_func : 1;
/* Weird "_NET_WM_STATE_MODAL" flag */
guint wm_state_modal : 1;
@ -253,6 +257,8 @@ void meta_window_unstick (MetaWindow *window);
void meta_window_activate (MetaWindow *window,
guint32 current_time);
void meta_window_make_fullscreen (MetaWindow *window);
void meta_window_unmake_fullscreen (MetaWindow *window);
/* args to move are window pos, not frame pos */
void meta_window_move (MetaWindow *window,