Browse Source

Imported Upstream version 3.0.0

tags/upstream/3.0.0^0
Maximiliano Curia 5 years ago
parent
commit
5f87759af7
36 changed files with 943 additions and 1107 deletions
  1. +3
    -3
      configure.ac
  2. +5
    -6
      po/Makefile.in.in
  3. +3
    -26
      src/compositor/compositor.c
  4. +15
    -85
      src/compositor/meta-window-actor.c
  5. +9
    -328
      src/core/bell.c
  6. +1
    -22
      src/core/bell.h
  7. +1
    -1
      src/core/constraints.c
  8. +1
    -0
      src/core/display-private.h
  9. +67
    -16
      src/core/display.c
  10. +10
    -0
      src/core/edge-resistance.c
  11. +3
    -5
      src/core/frame.c
  12. +0
    -1
      src/core/frame.h
  13. +4
    -0
      src/core/keybindings-private.h
  14. +108
    -26
      src/core/keybindings.c
  15. +2
    -0
      src/core/muffin.c
  16. +22
    -101
      src/core/prefs.c
  17. +3
    -0
      src/core/screen-private.h
  18. +191
    -9
      src/core/screen.c
  19. +1
    -1
      src/core/stack-tracker.c
  20. +6
    -0
      src/core/stack.c
  21. +3
    -0
      src/core/util.c
  22. +0
    -1
      src/core/window-private.h
  23. +323
    -371
      src/core/window.c
  24. +0
    -4
      src/core/workspace-private.h
  25. +105
    -39
      src/core/workspace.c
  26. +9
    -4
      src/meta/common.h
  27. +0
    -13
      src/meta/compositor.h
  28. +2
    -5
      src/meta/prefs.h
  29. +3
    -0
      src/meta/screen.h
  30. +6
    -0
      src/meta/util.h
  31. +1
    -2
      src/meta/window.h
  32. +7
    -0
      src/meta/workspace.h
  33. +6
    -10
      src/org.cinnamon.muffin.gschema.xml.in
  34. +16
    -24
      src/ui/frames.c
  35. +1
    -1
      src/ui/theme.c
  36. +6
    -3
      src/ui/ui.c

+ 3
- 3
configure.ac View File

@@ -1,8 +1,8 @@
AC_PREREQ(2.50)

m4_define([muffin_major_version], [2])
m4_define([muffin_minor_version], [8])
m4_define([muffin_micro_version], [5])
m4_define([muffin_major_version], [3])
m4_define([muffin_minor_version], [0])
m4_define([muffin_micro_version], [0])

m4_define([muffin_version],
[muffin_major_version.muffin_minor_version.muffin_micro_version])


+ 5
- 6
po/Makefile.in.in View File

@@ -33,8 +33,7 @@ exec_prefix = @exec_prefix@
datadir = @datadir@
datarootdir = @datarootdir@
libdir = @libdir@
DATADIRNAME = @DATADIRNAME@
itlocaledir = $(prefix)/$(DATADIRNAME)/locale
localedir = @localedir@
subdir = po
install_sh = @install_sh@
# Automake >= 1.8 provides @mkdir_p@.
@@ -80,7 +79,7 @@ INTLTOOL__v_MSGFMT_0 = @echo " MSGFMT" $@;

.po.pox:
$(MAKE) $(GETTEXT_PACKAGE).pot
$(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
$(MSGMERGE) $* $(GETTEXT_PACKAGE).pot -o $*.pox

.po.mo:
$(INTLTOOL_V_MSGFMT)$(MSGFMT) -o $@ $<
@@ -108,7 +107,7 @@ install-data-no: all
install-data-yes: all
linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
dir=$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES; \
$(mkdir_p) $$dir; \
if test -r $$lang.gmo; then \
$(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
@@ -142,8 +141,8 @@ install-exec installcheck:
uninstall:
linguas="$(USE_LINGUAS)"; \
for lang in $$linguas; do \
rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
done

check: all $(GETTEXT_PACKAGE).pot


+ 3
- 26
src/compositor/compositor.c View File

@@ -669,6 +669,7 @@ meta_compositor_manage_screen (MetaCompositor *compositor,

clutter_container_add (CLUTTER_CONTAINER (info->stage),
info->window_group,
info->top_window_group,
info->overlay_group,
info->hidden_group,
NULL);
@@ -1170,7 +1171,7 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
old_actor = old_stack->data;
old_window = meta_window_actor_get_meta_window (old_actor);

if (old_window->hidden &&
if ((old_window->hidden || old_window->unmanaging) &&
!meta_window_actor_effect_in_progress (old_actor))
{
old_stack = g_list_delete_link (old_stack, old_stack);
@@ -1204,7 +1205,7 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
* filtered out non-animating hidden windows above.
*/
if (old_actor &&
(!stack_actor || old_window->hidden))
(!stack_actor || old_window->hidden || old_window->unmanaging))
{
actor = old_actor;
window = old_window;
@@ -1229,30 +1230,6 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
sync_actor_stacking (info);
}

void
meta_compositor_window_mapped (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
DEBUG_TRACE ("meta_compositor_window_mapped\n");
if (!window_actor)
return;

meta_window_actor_mapped (window_actor);
}

void
meta_compositor_window_unmapped (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
DEBUG_TRACE ("meta_compositor_window_unmapped\n");
if (!window_actor)
return;

meta_window_actor_unmapped (window_actor);
}

void
meta_compositor_sync_window_geometry (MetaCompositor *compositor,
MetaWindow *window,


+ 15
- 85
src/compositor/meta-window-actor.c View File

@@ -104,7 +104,6 @@ struct _MetaWindowActorPrivate
GList *frames;

guint visible : 1;
guint mapped : 1;
guint argb32 : 1;
guint disposed : 1;
guint redecorating : 1;
@@ -1018,7 +1017,7 @@ meta_window_actor_damage_all (MetaWindowActor *self)

texture = meta_shaped_texture_get_texture (META_SHAPED_TEXTURE (priv->actor));

if (!priv->mapped || priv->needs_pixmap)
if (priv->needs_pixmap)
return;

meta_shaped_texture_update_area (META_SHAPED_TEXTURE (priv->actor),
@@ -1087,7 +1086,7 @@ meta_window_actor_queue_frame_drawn (MetaWindowActor *self,
* send a _NET_WM_FRAME_DRAWN. We do a 1-pixel redraw to get
* consistent timing with non-empty frames.
*/
if (priv->mapped && !priv->needs_pixmap)
if (!priv->needs_pixmap)
{
const cairo_rectangle_int_t clip = { 0, 0, 1, 1 };
clutter_actor_queue_redraw_with_clip (priv->actor, &clip);
@@ -1120,9 +1119,6 @@ meta_window_actor_queue_create_pixmap (MetaWindowActor *self)

priv->needs_pixmap = TRUE;

if (!priv->mapped)
return;

if (is_frozen (self))
return;

@@ -1220,9 +1216,6 @@ meta_window_actor_after_effects (MetaWindowActor *self)
meta_window_actor_sync_visibility (self);
meta_window_actor_sync_actor_geometry (self, FALSE);

if (!meta_window_is_mapped (priv->window))
meta_window_actor_detach (self);

if (priv->needs_pixmap)
clutter_actor_queue_redraw (priv->actor);
}
@@ -1403,7 +1396,6 @@ LOCAL_SYMBOL void
meta_window_actor_destroy (MetaWindowActor *self)
{
MetaWindow *window;
MetaCompScreen *info;
MetaWindowActorPrivate *priv;
MetaWindowType window_type;

@@ -1413,13 +1405,6 @@ meta_window_actor_destroy (MetaWindowActor *self)
window_type = meta_window_get_window_type (window);
meta_window_set_compositor_private (window, NULL);

/*
* We remove the window from internal lookup hashes and thus any other
* unmap events etc fail
*/
info = meta_screen_get_compositor_data (priv->screen);
info->windows = g_list_remove (info->windows, (gconstpointer) self);

if (window_type == META_WINDOW_DROPDOWN_MENU ||
window_type == META_WINDOW_POPUP_MENU ||
window_type == META_WINDOW_TOOLTIP ||
@@ -1672,8 +1657,7 @@ meta_window_actor_new (MetaWindow *window)
MetaWindowActorPrivate *priv;
MetaFrame *frame;
Window top_window;
MetaRectangle rectWorkArea[1];
MetaRectangle *rectWindow;
ClutterActor *window_group;

frame = meta_window_get_frame (window);
if (frame)
@@ -1694,9 +1678,7 @@ meta_window_actor_new (MetaWindow *window)
priv->last_width = -1;
priv->last_height = -1;

priv->mapped = meta_window_toplevel_is_mapped (priv->window);
if (priv->mapped)
meta_window_actor_queue_create_pixmap (self);
meta_window_actor_queue_create_pixmap (self);

meta_window_actor_set_updates_frozen (self,
meta_window_updates_are_frozen (priv->window));
@@ -1712,34 +1694,16 @@ meta_window_actor_new (MetaWindow *window)
/* Hang our compositor window state off the MetaWindow for fast retrieval */
meta_window_set_compositor_private (window, G_OBJECT (self));
if (window->type == META_WINDOW_DROPDOWN_MENU ||
window->type == META_WINDOW_POPUP_MENU ||
window->type == META_WINDOW_COMBO) {
clutter_container_add_actor (CLUTTER_CONTAINER (info->top_window_group),
CLUTTER_ACTOR (self));
}
else if (window->type == META_WINDOW_TOOLTIP) {
meta_window_get_work_area_all_monitors(window, rectWorkArea);
rectWindow = meta_window_get_rect(window);
// move tooltip out of top panel if necessary
if (rectWindow->y < rectWorkArea->y) {
meta_window_move(window, FALSE, rectWindow->x, rectWorkArea->y);
}
rectWindow = meta_window_get_rect(window);
// move tooltip out of bottom panel if necessary
if ((rectWindow->y + rectWindow->height) > (rectWorkArea->y + rectWorkArea->height)) {
meta_window_move(window, FALSE, rectWindow->x, rectWorkArea->y + rectWorkArea->height - rectWindow->height);
}
clutter_container_add_actor (CLUTTER_CONTAINER (info->top_window_group),
CLUTTER_ACTOR (self));
}
else if (window->type == META_WINDOW_DESKTOP) {
clutter_container_add_actor (CLUTTER_CONTAINER (info->bottom_window_group),
CLUTTER_ACTOR (self));
}else{
clutter_container_add_actor (CLUTTER_CONTAINER (info->window_group),
CLUTTER_ACTOR (self));
}
if (window->layer == META_LAYER_OVERRIDE_REDIRECT)
window_group = info->top_window_group;
else if (window->type == META_WINDOW_DESKTOP)
window_group = info->bottom_window_group;
else
window_group = info->window_group;

clutter_container_add_actor (CLUTTER_CONTAINER (window_group),
CLUTTER_ACTOR (self));
clutter_actor_hide (CLUTTER_ACTOR (self));

/* Initial position in the stack is arbitrary; stacking will be synced
@@ -1750,34 +1714,6 @@ meta_window_actor_new (MetaWindow *window)
return self;
}

LOCAL_SYMBOL void
meta_window_actor_mapped (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;

g_return_if_fail (!priv->mapped);

priv->mapped = TRUE;

meta_window_actor_queue_create_pixmap (self);
}

LOCAL_SYMBOL void
meta_window_actor_unmapped (MetaWindowActor *self)
{
MetaWindowActorPrivate *priv = self->priv;

g_return_if_fail (priv->mapped);

priv->mapped = FALSE;

if (meta_window_actor_effect_in_progress (self))
return;

meta_window_actor_detach (self);
priv->needs_pixmap = FALSE;
}

static void
meta_window_actor_clear_shape_region (MetaWindowActor *self)
{
@@ -2020,9 +1956,6 @@ check_needs_pixmap (MetaWindowActor *self)
if (!priv->needs_pixmap)
return;

if (!priv->mapped)
return;

if (xwindow == meta_screen_get_xroot (screen) ||
xwindow == clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage)))
return;
@@ -2106,9 +2039,6 @@ check_needs_shadow (MetaWindowActor *self)
gboolean should_have_shadow;
gboolean appears_focused;

if (!priv->mapped)
return;

/* Calling meta_window_actor_has_shadow() here at every pre-paint is cheap
* and avoids the need to explicitly handle window type changes, which
* we would do if tried to keep track of when we might be adding or removing
@@ -2219,7 +2149,7 @@ meta_window_actor_process_damage (MetaWindowActor *self,
return;
}

if (!priv->mapped || priv->needs_pixmap)
if (priv->needs_pixmap)
return;

meta_shaped_texture_update_area (META_SHAPED_TEXTURE (priv->actor),


+ 9
- 328
src/core/bell.c View File

@@ -51,312 +51,6 @@

#include <config.h>
#include "bell.h"
#include "screen-private.h"
#include <meta/prefs.h>
#ifdef HAVE_LIBCANBERRA
#include <canberra-gtk.h>
#endif

/*
* Flashes one entire screen. This is done by making a window the size of the
* whole screen (or reusing the old one, if it's still around), mapping it,
* painting it white and then black, and then unmapping it. We set saveunder so
* that all the windows behind it come back immediately.
*
* Unlike frame flashes, we don't do fullscreen flashes with a timeout; rather,
* we do them in one go, because we don't have to rely on the theme code
* redrawing the frame for us in order to do the flash.
*
* \param display The display which owns the screen (rather redundant)
* \param screen The screen to flash
*
* \bug The way I read it, this appears not to do the flash
* the first time we flash a particular display. Am I wrong?
*
* \bug This appears to destroy our current XSync status.
*/
static void
bell_flash_screen (MetaDisplay *display,
MetaScreen *screen)
{
Window root = screen->xroot;
int width = screen->rect.width;
int height = screen->rect.height;
if (screen->flash_window == None)
{
Visual *visual = (Visual *)CopyFromParent;
XSetWindowAttributes xswa;
int depth = CopyFromParent;
xswa.save_under = True;
xswa.override_redirect = True;
/*
* TODO: use XGetVisualInfo and determine which is an
* overlay, if one is present, and use the Overlay visual
* for this window (for performance reasons).
* Not sure how to tell this yet...
*/
screen->flash_window = XCreateWindow (display->xdisplay, root,
0, 0, width, height,
0, depth,
InputOutput,
visual,
/* note: XSun doesn't like SaveUnder here */
CWSaveUnder | CWOverrideRedirect,
&xswa);
XSelectInput (display->xdisplay, screen->flash_window, ExposureMask);
XMapWindow (display->xdisplay, screen->flash_window);
XSync (display->xdisplay, False);
XFlush (display->xdisplay);
XUnmapWindow (display->xdisplay, screen->flash_window);
}
else
{
/* just draw something in the window */
GC gc = XCreateGC (display->xdisplay, screen->flash_window, 0, NULL);
XMapWindow (display->xdisplay, screen->flash_window);
XSetForeground (display->xdisplay, gc,
WhitePixel (display->xdisplay,
XScreenNumberOfScreen (screen->xscreen)));
XFillRectangle (display->xdisplay, screen->flash_window, gc,
0, 0, width, height);
XSetForeground (display->xdisplay, gc,
BlackPixel (display->xdisplay,
XScreenNumberOfScreen (screen->xscreen)));
XFillRectangle (display->xdisplay, screen->flash_window, gc,
0, 0, width, height);
XFlush (display->xdisplay);
XSync (display->xdisplay, False);
XUnmapWindow (display->xdisplay, screen->flash_window);
XFreeGC (display->xdisplay, gc);
}

if (meta_prefs_get_focus_mode () != C_DESKTOP_FOCUS_MODE_CLICK &&
!display->mouse_mode)
meta_display_increment_focus_sentinel (display);
XFlush (display->xdisplay);
}

/*
* Flashes one screen, or all screens, in response to a bell event.
* If the event is on a particular window, flash the screen that
* window is on. Otherwise, flash every screen on this display.
*
* If the configure script found we had no XKB, this does not exist.
*
* \param display The display the event came in on
* \param xkb_ev The bell event
*/
#ifdef HAVE_XKB
static void
bell_flash_fullscreen (MetaDisplay *display,
XkbAnyEvent *xkb_ev)
{
XkbBellNotifyEvent *xkb_bell_ev = (XkbBellNotifyEvent *) xkb_ev;
MetaScreen *screen;

g_assert (xkb_ev->xkb_type == XkbBellNotify);
if (xkb_bell_ev->window != None)
{
screen = meta_display_screen_for_xwindow (display, xkb_bell_ev->window);
if (screen)
{
if (display->compositor)
meta_compositor_flash_screen (display->compositor, screen);
else
bell_flash_screen (display, screen);
}
}
else
{
GSList *screen_list = display->screens;
while (screen_list)
{
screen = (MetaScreen *) screen_list->data;
if (display->compositor)
meta_compositor_flash_screen (display->compositor, screen);
else
bell_flash_screen (display, screen);
screen_list = screen_list->next;
}
}
}

/*
* Makes a frame be not flashed; this is the timeout half of
* bell_flash_window_frame(). This is done simply by clearing the
* flash flag and queuing a redraw of the frame.
*
* If the configure script found we had no XKB, this does not exist.
*
* \param data The frame to unflash, cast to a gpointer so it can go into
* a callback function.
* \return Always FALSE, so we don't get called again.
*
* \bug This is the parallel to bell_flash_window_frame(), so it should
* really be called meta_bell_unflash_window_frame().
*/
static gboolean
bell_unflash_frame (gpointer data)
{
MetaFrame *frame = (MetaFrame *) data;
frame->is_flashing = 0;
meta_frame_queue_draw (frame);
return FALSE;
}

/*
* Makes a frame flash and then return to normal shortly afterwards.
* This is done by setting a flag so that the theme
* code will temporarily draw the frame as focussed if it's unfocussed and
* vice versa, and then queueing a redraw. Lastly, we create a timeout so
* that the flag can be unset and the frame re-redrawn.
*
* If the configure script found we had no XKB, this does not exist.
*
* \param window The window to flash
*/
static void
bell_flash_window_frame (MetaWindow *window)
{
g_assert (window->frame != NULL);
window->frame->is_flashing = 1;
meta_frame_queue_draw (window->frame);
/* Since this idle is added after the Clutter clock source, with
* the same priority, it will be executed after it as well, so
* we are guaranteed to get at least one frame drawn in the
* flashed state, no matter how loaded we are.
*/
g_timeout_add_full (META_PRIORITY_REDRAW, 100,
bell_unflash_frame, window->frame, NULL);
}

/*
* Flashes the frame of the focussed window. If there is no focussed window,
* flashes the screen.
*
* \param display The display the bell event came in on
* \param xkb_ev The bell event we just received
*/
static void
bell_flash_frame (MetaDisplay *display,
XkbAnyEvent *xkb_ev)
{
XkbBellNotifyEvent *xkb_bell_event = (XkbBellNotifyEvent *) xkb_ev;
MetaWindow *window;
g_assert (xkb_ev->xkb_type == XkbBellNotify);
window = meta_display_lookup_x_window (display, xkb_bell_event->window);
if (!window && (display->focus_window))
{
window = display->focus_window;
}
if (window && window->frame)
{
bell_flash_window_frame (window);
}
else /* revert to fullscreen flash if there's no focussed window */
{
bell_flash_fullscreen (display, xkb_ev);
}
}

/*
* Gives the user some kind of visual bell substitute, in response to a
* bell event. What this is depends on the "visual bell type" pref.
*
* If the configure script found we had no XKB, this does not exist.
*
* \param display The display the bell event came in on
* \param xkb_ev The bell event we just received
*
* \bug This should be merged with meta_bell_notify().
*/
static void
bell_visual_notify (MetaDisplay *display,
XkbAnyEvent *xkb_ev)
{
switch (meta_prefs_get_visual_bell_type ())
{
case C_DESKTOP_VISUAL_BELL_FULLSCREEN_FLASH:
bell_flash_fullscreen (display, xkb_ev);
break;
case C_DESKTOP_VISUAL_BELL_FRAME_FLASH:
bell_flash_frame (display, xkb_ev); /* does nothing yet */
break;
}
}

LOCAL_SYMBOL void
meta_bell_notify (MetaDisplay *display,
XkbAnyEvent *xkb_ev)
{
/* flash something */
if (meta_prefs_get_visual_bell ())
bell_visual_notify (display, xkb_ev);

#ifdef HAVE_LIBCANBERRA
if (meta_prefs_bell_is_audible ())
{
ca_proplist *p;
XkbBellNotifyEvent *xkb_bell_event = (XkbBellNotifyEvent*) xkb_ev;
MetaWindow *window;
int res;

ca_proplist_create (&p);
ca_proplist_sets (p, CA_PROP_EVENT_ID, "bell-window-system");
ca_proplist_sets (p, CA_PROP_EVENT_DESCRIPTION, _("Bell event"));
ca_proplist_sets (p, CA_PROP_CANBERRA_CACHE_CONTROL, "permanent");

window = meta_display_lookup_x_window (display, xkb_bell_event->window);
if (!window && (display->focus_window) && (display->focus_window->frame))
window = display->focus_window;

if (window)
{
ca_proplist_sets (p, CA_PROP_WINDOW_NAME, window->title);
ca_proplist_setf (p, CA_PROP_WINDOW_X11_XID, "%lu", (unsigned long)window->xwindow);
ca_proplist_sets (p, CA_PROP_APPLICATION_NAME, window->res_name);
ca_proplist_setf (p, CA_PROP_APPLICATION_PROCESS_ID, "%d", window->net_wm_pid);
}

/* First, we try to play a real sound ... */
res = ca_context_play_full (ca_gtk_context_get (), 1, p, NULL, NULL);

ca_proplist_destroy (p);

if (res != CA_SUCCESS && res != CA_ERROR_DISABLED)
{
/* ...and in case that failed we use the classic X11 bell. */
XkbForceDeviceBell (display->xdisplay,
xkb_bell_event->device,
xkb_bell_event->bell_class,
xkb_bell_event->bell_id,
xkb_bell_event->percent);
}
}
#endif /* HAVE_LIBCANBERRA */
}
#endif /* HAVE_XKB */

LOCAL_SYMBOL void
meta_bell_set_audible (MetaDisplay *display, gboolean audible)
{
#ifdef HAVE_XKB
#ifdef HAVE_LIBCANBERRA
/* When we are playing sounds using libcanberra support, we handle the
* bell whether its an audible bell or a visible bell */
gboolean enable_system_bell = FALSE;
#else
gboolean enable_system_bell = audible;
#endif /* HAVE_LIBCANBERRA */

XkbChangeEnabledControls (display->xdisplay,
XkbUseCoreKbd,
XkbAudibleBellMask,
enable_system_bell ? XkbAudibleBellMask : 0);
#endif /* HAVE_XKB */
}

LOCAL_SYMBOL gboolean
meta_bell_init (MetaDisplay *display)
@@ -375,20 +69,10 @@ meta_bell_init (MetaDisplay *display)
}
else
{
unsigned int mask = XkbBellNotifyMask;
gboolean visual_bell_auto_reset = FALSE;
/* TRUE if and when non-broken version is available */
XkbSelectEvents (display->xdisplay,
XkbUseCoreKbd,
XkbBellNotifyMask,
XkbBellNotifyMask);
meta_bell_set_audible (display, meta_prefs_bell_is_audible ());
if (visual_bell_auto_reset) {
XkbSetAutoResetControls (display->xdisplay,
XkbAudibleBellMask,
&mask,
&mask);
}
return TRUE;
}
#endif
@@ -407,17 +91,14 @@ meta_bell_shutdown (MetaDisplay *display)
#endif
}

/*
* Deals with a frame being destroyed. This is important because if we're
* using a visual bell, we might be flashing the edges of the frame, and
* so we'd have a timeout function waiting ready to un-flash them. If the
* frame's going away, we can tell the timeout not to bother.
*
* \param frame The frame which is being destroyed
*/
LOCAL_SYMBOL void
meta_bell_notify_frame_destroy (MetaFrame *frame)
meta_bell_notify (MetaDisplay *display,
XkbAnyEvent *xkb_ev)
{
if (frame->is_flashing)
g_source_remove_by_funcs_user_data (&g_timeout_funcs, frame);
}
XkbBellNotifyEvent *xkb_bell_event = (XkbBellNotifyEvent *) xkb_ev;
MetaWindow *bell_window = NULL;
bell_window = meta_display_lookup_x_window (display, xkb_bell_event->window);

g_signal_emit_by_name (display, "bell", bell_window);
}

+ 1
- 22
src/core/bell.h View File

@@ -36,7 +36,7 @@
#include <X11/XKBlib.h>
#endif
#include "display-private.h"
#include "frame.h"
#include "window-private.h"

#ifdef HAVE_XKB
/**
@@ -52,17 +52,6 @@
void meta_bell_notify (MetaDisplay *display, XkbAnyEvent *xkb_ev);
#endif

/**
* Turns the bell to audible or visual. This tells X what to do, but
* not Muffin; you will need to set the "visual bell" pref for that.
*
* If the configure script found we had no XKB, this is a no-op.
*
* \param display The display we're configuring
* \param audible True for an audible bell, false for a visual bell
*/
void meta_bell_set_audible (MetaDisplay *display, gboolean audible);

/**
* Initialises the bell subsystem. This involves intialising
* XKB (which, despite being a keyboard extension, is the
@@ -96,13 +85,3 @@ gboolean meta_bell_init (MetaDisplay *display);
* we don't.
*/
void meta_bell_shutdown (MetaDisplay *display);

/**
* Deals with a frame being destroyed. This is important because if we're
* using a visual bell, we might be flashing the edges of the frame, and
* so we'd have a timeout function waiting ready to un-flash them. If the
* frame's going away, we can tell the timeout not to bother.
*
* \param frame The frame which is being destroyed
*/
void meta_bell_notify_frame_destroy (MetaFrame *frame);

+ 1
- 1
src/core/constraints.c View File

@@ -935,7 +935,7 @@ constrain_tiling (MetaWindow *window,
return TRUE;

/* Determine whether constraint applies; exit if it doesn't */
if (!META_WINDOW_TILED_OR_SNAPPED (window))
if (!META_WINDOW_TILED_OR_SNAPPED (window) || window->resizing_tile_type != META_WINDOW_TILE_TYPE_NONE)
return TRUE;

/* Calculate target_size - as the tile previews need this as well, we


+ 1
- 0
src/core/display-private.h View File

@@ -417,6 +417,7 @@ gboolean meta_display_window_has_pending_pings (MetaDisplay *display,
MetaWindow *window);

int meta_resize_gravity_from_grab_op (MetaGrabOp op);
int meta_resize_gravity_from_tile_mode (MetaTileMode mode);

gboolean meta_grab_op_is_moving (MetaGrabOp op);
gboolean meta_grab_op_is_resizing (MetaGrabOp op);


+ 67
- 16
src/core/display.c View File

@@ -142,6 +142,7 @@ enum
GRAB_OP_END,
ZOOM_SCROLL_IN,
ZOOM_SCROLL_OUT,
BELL,
LAST_SIGNAL
};

@@ -296,6 +297,14 @@ meta_display_class_init (MetaDisplayClass *klass)
NULL, NULL, NULL,
G_TYPE_NONE, 0);

display_signals[BELL] =
g_signal_new ("bell",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1, META_TYPE_WINDOW);

g_object_class_install_property (object_class,
PROP_FOCUS_WINDOW,
g_param_spec_object ("focus-window",
@@ -1769,9 +1778,8 @@ event_callback (XEvent *event,
window->desc);
}

if (display->compositor)
meta_compositor_window_shape_changed (display->compositor,
window);
meta_compositor_window_shape_changed (display->compositor,
window);
}
}
else
@@ -1868,8 +1876,10 @@ event_callback (XEvent *event,
meta_stack_set_positions (screen->stack,
display->grab_old_window_stacking);
}
meta_display_end_grab_op (display,
event->xbutton.time);

if (display->grab_window->tile_mode == META_TILE_NONE)
meta_display_end_grab_op (display,
event->xbutton.time);
}
else if (window && display->grab_op == META_GRAB_OP_NONE)
{
@@ -2298,7 +2308,7 @@ event_callback (XEvent *event,

if (display->grab_op != META_GRAB_OP_NONE &&
display->grab_window == window &&
((window->frame == NULL) || !window->frame->mapped))
window->frame == NULL)
meta_display_end_grab_op (display, timestamp);
if (!frame_was_receiver)
@@ -2335,8 +2345,7 @@ event_callback (XEvent *event,
/* NB: override redirect windows wont cause a map request so we
* watch out for map notifies against any root windows too if a
* compositor is enabled: */
if (display->compositor && window == NULL
&& meta_display_screen_for_root (display, event->xmap.event))
if (window == NULL && meta_display_screen_for_root (display, event->xmap.event))
{
window = meta_window_new (display, event->xmap.window,
FALSE);
@@ -2711,7 +2720,7 @@ event_callback (XEvent *event,
break;
}

if (display->compositor && !bypass_compositor)
if (!bypass_compositor)
{
if (meta_compositor_process_event (display->compositor,
event,
@@ -3852,7 +3861,16 @@ meta_display_end_grab_op (MetaDisplay *display,
meta_screen_ungrab_all_keys (display->grab_screen, timestamp);
}

if (display->grab_window &&
display->grab_window->resizing_tile_type != META_WINDOW_TILE_TYPE_NONE) {
display->grab_window->snap_queued = display->grab_window->resizing_tile_type == META_WINDOW_TILE_TYPE_SNAPPED;
display->grab_window->tile_mode = display->grab_window->resize_tile_mode;
display->grab_window->custom_snap_size = TRUE;
meta_window_real_tile (display->grab_window, TRUE);
}

meta_screen_hide_hud_and_preview (display->grab_screen);

display->grab_window = NULL;
display->grab_screen = NULL;
display->grab_xwindow = None;
@@ -4887,6 +4905,45 @@ meta_resize_gravity_from_grab_op (MetaGrabOp op)
return gravity;
}

LOCAL_SYMBOL int
meta_resize_gravity_from_tile_mode (MetaTileMode mode)
{
int gravity;
gravity = -1;
switch (mode)
{
case META_TILE_LEFT:
gravity = WestGravity;
break;
case META_TILE_RIGHT:
gravity = EastGravity;
break;
case META_TILE_TOP:
gravity = NorthGravity;
break;
case META_TILE_BOTTOM:
gravity = SouthGravity;
break;
case META_TILE_ULC:
gravity = NorthWestGravity;
break;
case META_TILE_LLC:
gravity = SouthWestGravity;
break;
case META_TILE_URC:
gravity = NorthEastGravity;
break;
case META_TILE_LRC:
gravity = SouthEastGravity;
break;
default:
break;
}

return gravity;
}

static MetaScreen*
find_screen_for_selection (MetaDisplay *display,
Window owner,
@@ -5258,8 +5315,6 @@ static void
prefs_changed_callback (MetaPreference pref,
void *data)
{
MetaDisplay *display = data;
/* It may not be obvious why we regrab on focus mode
* change; it's because we handle focus clicks a
* bit differently for the different focus modes.
@@ -5309,10 +5364,6 @@ prefs_changed_callback (MetaPreference pref,

g_slist_free (windows);
}
else if (pref == META_PREF_AUDIBLE_BELL)
{
meta_bell_set_audible (display, meta_prefs_bell_is_audible ());
}
}

LOCAL_SYMBOL void


+ 10
- 0
src/core/edge-resistance.c View File

@@ -377,6 +377,9 @@ apply_edge_resistance (MetaWindow *window,
begin = CLAMP (begin, 0, last_edge);
end = CLAMP (end, 0, last_edge);

/* Edge resistance between windows can be disabled in gettings. */
gboolean window_edge_enabled = meta_prefs_get_edge_resistance_window ();

/* Loop over all these edges we're moving past/to. */
i = begin;
while ((increasing && i <= end) ||
@@ -386,6 +389,13 @@ apply_edge_resistance (MetaWindow *window,
MetaEdge *edge = g_array_index (edges, MetaEdge*, i);
int compare = xdir ? edge->rect.x : edge->rect.y;

/* Pass window edge resistance if disabled. */
if (edge->edge_type == META_EDGE_WINDOW && !window_edge_enabled)
{
i += increment;
continue;
}

/* Find out if this edge is relevant */
edges_align = meta_rectangle_edge_aligns (new_rect, edge) ||
meta_rectangle_edge_aligns (old_rect, edge);


+ 3
- 5
src/core/frame.c View File

@@ -25,7 +25,6 @@

#include <config.h>
#include "frame.h"
#include "bell.h"
#include <meta/errors.h>
#include "keybindings-private.h"

@@ -66,7 +65,6 @@ meta_window_ensure_frame (MetaWindow *window)
frame->right_width = 0;
frame->current_cursor = 0;

frame->mapped = FALSE;
frame->is_flashing = FALSE;
meta_verbose ("Framing window %s: visual %s default, depth %d default depth %d\n",
@@ -166,6 +164,8 @@ meta_window_ensure_frame (MetaWindow *window)
/* Move keybindings to frame instead of window */
meta_window_grab_keys (window);

meta_ui_map_frame (frame->window->screen->ui, frame->xwindow);

meta_display_ungrab (window->display);
}

@@ -183,9 +183,7 @@ meta_window_destroy_frame (MetaWindow *window)
frame = window->frame;

meta_frame_calc_borders (frame, &borders);
meta_bell_notify_frame_destroy (frame);

/* Unparent the client window; it may be destroyed,
* thus the error trap.
*/


+ 0
- 1
src/core/frame.h View File

@@ -48,7 +48,6 @@ struct _MetaFrame
int right_width;
int bottom_height;

guint mapped : 1;
guint need_reapply_frame_shape : 1;
guint is_flashing : 1; /* used by the visual bell flash */
};


+ 4
- 0
src/core/keybindings-private.h View File

@@ -65,6 +65,10 @@ gboolean meta_window_grab_all_keys (MetaWindow *window,
guint32 timestamp);
void meta_window_ungrab_all_keys (MetaWindow *window,
guint32 timestamp);

gboolean meta_window_resize_or_move_allowed (MetaWindow *window,
MetaDirection dir);

gboolean meta_display_process_key_event (MetaDisplay *display,
MetaWindow *window,
XEvent *event);


+ 108
- 26
src/core/keybindings.c View File

@@ -1321,6 +1321,47 @@ meta_window_ungrab_all_keys (MetaWindow *window, guint32 timestamp)
}
}

LOCAL_SYMBOL gboolean
meta_window_resize_or_move_allowed (MetaWindow *window,
MetaDirection dir)
{
if (!META_WINDOW_MAXIMIZED (window) && !META_WINDOW_TILED_OR_SNAPPED (window))
return TRUE;

switch (dir)
{
case META_DIRECTION_LEFT:
if (window->tile_mode == META_TILE_RIGHT ||
window->tile_mode == META_TILE_URC ||
window->tile_mode == META_TILE_LRC)
return TRUE;
break;
case META_DIRECTION_RIGHT:
if (window->tile_mode == META_TILE_LEFT ||
window->tile_mode == META_TILE_ULC ||
window->tile_mode == META_TILE_LLC)
return TRUE;
break;
case META_DIRECTION_UP:
if (window->tile_mode == META_TILE_BOTTOM ||
window->tile_mode == META_TILE_LLC ||
window->tile_mode == META_TILE_LRC)
return TRUE;
break;
case META_DIRECTION_DOWN:
if (window->tile_mode == META_TILE_TOP ||
window->tile_mode == META_TILE_ULC ||
window->tile_mode == META_TILE_URC)
return TRUE;
break;
default:
return FALSE;
}

return FALSE;
}


static gboolean
is_modifier (MetaDisplay *display,
unsigned int keycode)
@@ -1843,17 +1884,26 @@ process_keyboard_move_grab (MetaDisplay *display,
* remaximize it. In normal cases, we need to do a moveresize
* now to get the position back to the original.
*/
if (window->shaken_loose)
meta_window_maximize (window,
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
if (window->shaken_loose)
{
meta_window_maximize (window,
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
}
else if (window->tile_mode != META_TILE_NONE)
{
window->custom_snap_size = FALSE;
meta_window_real_tile (window, FALSE);
}
else
meta_window_move_resize (display->grab_window,
TRUE,
display->grab_initial_window_pos.x,
display->grab_initial_window_pos.y,
display->grab_initial_window_pos.width,
display->grab_initial_window_pos.height);
{
meta_window_move_resize (display->grab_window,
TRUE,
display->grab_initial_window_pos.x,
display->grab_initial_window_pos.y,
display->grab_initial_window_pos.width,
display->grab_initial_window_pos.height);
}
}
/* When moving by increments, we still snap to edges if the move
@@ -1904,6 +1954,8 @@ process_keyboard_move_grab (MetaDisplay *display,
"Computed new window location %d,%d due to keypress\n",
x, y);

meta_window_tile (window, META_TILE_NONE, FALSE);

meta_window_get_client_root_coords (window, &old_rect);

meta_window_edge_resistance_for_move (window,
@@ -1939,22 +1991,30 @@ process_keyboard_resize_grab_op_change (MetaDisplay *display,
{
case XK_Up:
case XK_KP_Up:
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
if (meta_window_resize_or_move_allowed (window, META_DIRECTION_UP)) {
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
}
handled = TRUE;
break;
case XK_Down:
case XK_KP_Down:
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
if (meta_window_resize_or_move_allowed (window, META_DIRECTION_DOWN)) {
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
}
handled = TRUE;
break;
case XK_Left:
case XK_KP_Left:
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
if (meta_window_resize_or_move_allowed (window, META_DIRECTION_LEFT)) {
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
}
handled = TRUE;
break;
case XK_Right:
case XK_KP_Right:
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
if (meta_window_resize_or_move_allowed (window, META_DIRECTION_RIGHT)) {
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
}
handled = TRUE;
break;
}
@@ -1965,12 +2025,16 @@ process_keyboard_resize_grab_op_change (MetaDisplay *display,
{
case XK_Left:
case XK_KP_Left:
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
if (meta_window_resize_or_move_allowed (window, META_DIRECTION_LEFT)) {
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
}
handled = TRUE;
break;
case XK_Right:
case XK_KP_Right:
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
if (meta_window_resize_or_move_allowed (window, META_DIRECTION_RIGHT)) {
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
}
handled = TRUE;
break;
}
@@ -1981,12 +2045,16 @@ process_keyboard_resize_grab_op_change (MetaDisplay *display,
{
case XK_Left:
case XK_KP_Left:
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
if (meta_window_resize_or_move_allowed (window, META_DIRECTION_LEFT)) {
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_W;
}
handled = TRUE;
break;
case XK_Right:
case XK_KP_Right:
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
if (meta_window_resize_or_move_allowed (window, META_DIRECTION_RIGHT)) {
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_E;
}
handled = TRUE;
break;
}
@@ -1997,12 +2065,16 @@ process_keyboard_resize_grab_op_change (MetaDisplay *display,
{
case XK_Up:
case XK_KP_Up:
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
if (meta_window_resize_or_move_allowed (window, META_DIRECTION_UP)) {
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
}
handled = TRUE;
break;
case XK_Down:
case XK_KP_Down:
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
if (meta_window_resize_or_move_allowed (window, META_DIRECTION_DOWN)) {
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
}
handled = TRUE;
break;
}
@@ -2013,12 +2085,16 @@ process_keyboard_resize_grab_op_change (MetaDisplay *display,
{
case XK_Up:
case XK_KP_Up:
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
if (meta_window_resize_or_move_allowed (window, META_DIRECTION_UP)) {
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_N;
}
handled = TRUE;
break;
case XK_Down:
case XK_KP_Down:
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
if (meta_window_resize_or_move_allowed (window, META_DIRECTION_DOWN)) {
display->grab_op = META_GRAB_OP_KEYBOARD_RESIZING_S;
}
handled = TRUE;
break;
}
@@ -2088,7 +2164,10 @@ process_keyboard_resize_grab (MetaDisplay *display,
width = window->rect.width;
height = window->rect.height;

gravity = meta_resize_gravity_from_grab_op (display->grab_op);
if (window->tile_mode != META_TILE_NONE)
gravity = meta_resize_gravity_from_tile_mode (window->tile_mode);
else
gravity = meta_resize_gravity_from_grab_op (display->grab_op);

smart_snap = (event->xkey.state & ShiftMask) != 0;
@@ -2615,9 +2694,6 @@ handle_tile_action (MetaDisplay *display,
if (new_mode == window->tile_mode)
return;

if (!meta_window_can_tile (window, new_mode))
return;

meta_window_tile (window, new_mode, snap);
}

@@ -2732,6 +2808,12 @@ handle_begin_resize (MetaDisplay *display,
{
if (window->has_resize_func)
{
if (window->tile_mode != META_TILE_NONE)
{
window->resize_tile_mode = window->tile_mode;
window->resizing_tile_type = window->tile_type;
}

meta_window_begin_grab_op (window,
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN,
FALSE,


+ 2
- 0
src/core/muffin.c View File

@@ -69,6 +69,8 @@ main (int argc, char **argv)
GOptionContext *ctx;
GError *error = NULL;

g_setenv ("CLUTTER_BACKEND", "x11", TRUE);

g_type_init ();

ctx = meta_get_option_context ();


+ 22
- 101
src/core/prefs.c View File

@@ -54,14 +54,12 @@
#define KEY_WORKSPACE_CYCLE "workspace-cycle"

/* Keys from "foreign" schemas */
#define KEY_GNOME_ACCESSIBILITY "toolkit-accessibility"
#define KEY_GNOME_ANIMATIONS "enable-animations"
#define KEY_GNOME_CURSOR_THEME "cursor-theme"
#define KEY_GNOME_CURSOR_SIZE "cursor-size"

#define KEY_MIN_WINDOW_OPACITY "min-window-opacity"
#define KEY_WS_NAMES_GNOME "workspace-names"
#define KEY_LIVE_HIDDEN_WINDOWS "live-hidden-windows"
#define KEY_WORKSPACES_ONLY_ON_PRIMARY "workspaces-only-on-primary"

#define KEY_MOUSEWHEEL_ZOOM_ENABLED "screen-magnifier-enabled"
@@ -102,9 +100,6 @@ static gboolean application_based = FALSE;
static gboolean disable_workarounds = FALSE;
static gboolean auto_raise = FALSE;
static gboolean auto_raise_delay = 500;
static gboolean bell_is_visible = FALSE;
static gboolean bell_is_audible = TRUE;
static gboolean gnome_accessibility = FALSE;
static gboolean gnome_animations = TRUE;
static char *cursor_theme = NULL;
static int cursor_size = 24;
@@ -115,16 +110,15 @@ static int ui_scale = 1;
static int min_window_opacity = 0;
static gboolean resize_with_right_button = FALSE;
static gboolean edge_tiling = FALSE;
static gboolean edge_resistance_window = TRUE;
static gboolean force_fullscreen = TRUE;
static unsigned int snap_modifier[2];

static CDesktopVisualBellType visual_bell_type = C_DESKTOP_VISUAL_BELL_FULLSCREEN_FLASH;
static MetaButtonLayout button_layout;

/* NULL-terminated array */
static char **workspace_names = NULL;

static gboolean live_hidden_windows = FALSE;
static gboolean workspaces_only_on_primary = FALSE;

static gboolean legacy_snap = FALSE;
@@ -253,13 +247,6 @@ static MetaEnumPreference preferences_enum[] =
},
&focus_mode,
},
{
{ "visual-bell-type",
SCHEMA_GENERAL,
META_PREF_VISUAL_BELL_TYPE,
},
&visual_bell_type,
},
{
{ "action-double-click-titlebar",
SCHEMA_GENERAL,
@@ -363,27 +350,6 @@ static MetaBoolPreference preferences_bool[] =
},
&auto_raise,
},
{
{ "visual-bell",
SCHEMA_GENERAL,
META_PREF_VISUAL_BELL,
},
&bell_is_visible, /* FIXME: change the name: it's confusing */
},
{
{ "audible-bell",
SCHEMA_GENERAL,
META_PREF_AUDIBLE_BELL,
},
&bell_is_audible, /* FIXME: change the name: it's confusing */
},
{
{ KEY_GNOME_ACCESSIBILITY,
SCHEMA_INTERFACE,
META_PREF_GNOME_ACCESSIBILITY,
},
&gnome_accessibility,
},
{
{ KEY_MOUSEWHEEL_ZOOM_ENABLED,
SCHEMA_A11Y_APPLICATIONS,
@@ -413,11 +379,11 @@ static MetaBoolPreference preferences_bool[] =
&edge_tiling,
},
{
{ KEY_LIVE_HIDDEN_WINDOWS,
{ "edge-resistance-window",
SCHEMA_MUFFIN,
META_PREF_LIVE_HIDDEN_WINDOWS,
META_PREF_EDGE_RESISTANCE_WINDOW,
},
&live_hidden_windows,
&edge_resistance_window,
},
{
{ "workspaces-only-on-primary",
@@ -944,8 +910,6 @@ meta_prefs_init (void)

/* Individual keys we watch outside of our schemas */
settings = g_settings_new (SCHEMA_INTERFACE);
g_signal_connect (settings, "changed::" KEY_GNOME_ACCESSIBILITY,
G_CALLBACK (settings_changed), NULL);
g_signal_connect (settings, "changed::" KEY_GNOME_ANIMATIONS,
G_CALLBACK (settings_changed), NULL);
g_signal_connect (settings, "changed::" KEY_GNOME_CURSOR_THEME,
@@ -1835,18 +1799,6 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_WORKSPACE_NAMES:
return "WORKSPACE_NAMES";

case META_PREF_VISUAL_BELL:
return "VISUAL_BELL";

case META_PREF_AUDIBLE_BELL:
return "AUDIBLE_BELL";

case META_PREF_VISUAL_BELL_TYPE:
return "VISUAL_BELL_TYPE";

case META_PREF_GNOME_ACCESSIBILITY:
return "GNOME_ACCESSIBILTY";

case META_PREF_GNOME_ANIMATIONS:
return "GNOME_ANIMATIONS";

@@ -1862,18 +1814,27 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_EDGE_TILING:
return "EDGE_TILING";

case META_PREF_EDGE_RESISTANCE_WINDOW:
return "EDGE_RESISTANCE_WINDOW";

case META_PREF_FORCE_FULLSCREEN:
return "FORCE_FULLSCREEN";

case META_PREF_LIVE_HIDDEN_WINDOWS:
return "LIVE_HIDDEN_WINDOWS";

case META_PREF_WORKSPACES_ONLY_ON_PRIMARY:
return "WORKSPACES_ONLY_ON_PRIMARY";

case META_PREF_WORKSPACE_CYCLE:
return "WORKSPACE_CYCLE";

case META_PREF_VISUAL_BELL:
return "VISUAL_BELL";

case META_PREF_AUDIBLE_BELL:
return "AUDIBLE_BELL";

case META_PREF_VISUAL_BELL_TYPE:
return "VISUAL_BELL_TYPE";

case META_PREF_DRAGGABLE_BORDER_WIDTH:
return "DRAGGABLE_BORDER_WIDTH";

@@ -1906,7 +1867,6 @@ meta_preference_to_string (MetaPreference pref)

case META_PREF_MIN_WIN_OPACITY:
return "MIN_WIN_OPACITY";

}

return "(unknown)";
@@ -2156,24 +2116,6 @@ meta_prefs_get_button_layout (MetaButtonLayout *button_layout_p)
*button_layout_p = button_layout;
}

gboolean
meta_prefs_get_visual_bell (void)
{
return bell_is_visible;
}

gboolean
meta_prefs_bell_is_audible (void)
{
return bell_is_audible;
}

CDesktopVisualBellType
meta_prefs_get_visual_bell_type (void)
{
return visual_bell_type;
}

LOCAL_SYMBOL gboolean
meta_prefs_add_keybinding (const char *name,
const char *schema,
@@ -2359,12 +2301,6 @@ meta_prefs_get_auto_raise_delay (void)
return auto_raise_delay;
}

gboolean
meta_prefs_get_gnome_accessibility ()
{
return gnome_accessibility;
}

gboolean
meta_prefs_get_gnome_animations ()
{
@@ -2377,6 +2313,12 @@ meta_prefs_get_edge_tiling ()
return edge_tiling;
}

gboolean
meta_prefs_get_edge_resistance_window ()
{
return edge_resistance_window;
}

MetaKeyBindingAction
meta_prefs_get_keybinding_action (const char *name)
{
@@ -2441,27 +2383,6 @@ meta_prefs_get_force_fullscreen (void)
return force_fullscreen;
}

gboolean
meta_prefs_get_live_hidden_windows (void)
{
#if 0
return live_hidden_windows;
#else
return TRUE;
#endif
}

void
meta_prefs_set_live_hidden_windows (gboolean whether)
{
MetaBasePreference *pref = NULL;

find_pref (preferences_bool, sizeof(MetaBoolPreference),
KEY_LIVE_HIDDEN_WINDOWS, &pref);
g_settings_set_boolean (SETTINGS (pref->schema), KEY_LIVE_HIDDEN_WINDOWS,
whether);
}

gboolean
meta_prefs_get_workspaces_only_on_primary (void)
{


+ 3
- 0
src/core/screen-private.h View File

@@ -46,6 +46,7 @@ struct _MetaMonitorInfo
int number;
MetaRectangle rect;
gboolean is_primary;
gboolean in_fullscreen;
XID output; /* The primary or first output for this crtc, None if no xrandr */
};

@@ -119,6 +120,7 @@ struct _MetaScreen
guint32 wm_cm_timestamp;

guint work_area_later;
guint check_fullscreen_later;

int rows_of_workspaces;
int columns_of_workspaces;
@@ -197,6 +199,7 @@ void meta_screen_get_natural_monitor_list (MetaScreen *screen,
void meta_screen_update_workspace_layout (MetaScreen *screen);
void meta_screen_update_workspace_names (MetaScreen *screen);
void meta_screen_queue_workarea_recalc (MetaScreen *screen);
void meta_screen_queue_check_fullscreen (MetaScreen *screen);

Window meta_create_offscreen_window (Display *xdisplay,
Window parent,


+ 191
- 9
src/core/screen.c View File

@@ -109,6 +109,11 @@ enum
SNAP_OSD_SHOW,
SNAP_OSD_HIDE,
WORKSPACE_OSD_SHOW,
WINDOW_ADDED,
WINDOW_REMOVED,
WINDOW_MONITOR_CHANGED,
WINDOW_WORKSPACE_CHANGED,
IN_FULLSCREEN_CHANGED,

LAST_SIGNAL
};
@@ -298,6 +303,53 @@ meta_screen_class_init (MetaScreenClass *klass)
NULL, NULL, NULL,
G_TYPE_NONE, 0);

screen_signals[WINDOW_ADDED] =
g_signal_new ("window-added",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 2,
META_TYPE_WINDOW,
G_TYPE_INT);

screen_signals[WINDOW_REMOVED] =
g_signal_new ("window-removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 1,
META_TYPE_WINDOW);

screen_signals[WINDOW_MONITOR_CHANGED] =
g_signal_new ("window-monitor-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 2,
META_TYPE_WINDOW,
G_TYPE_INT);

screen_signals[WINDOW_WORKSPACE_CHANGED] =
g_signal_new ("window-workspace-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 2,
META_TYPE_WINDOW,
META_TYPE_WORKSPACE);

screen_signals[IN_FULLSCREEN_CHANGED] =
g_signal_new ("in-fullscreen-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);

g_object_class_install_property (object_class,
PROP_N_WORKSPACES,
pspec);
@@ -527,11 +579,13 @@ reload_monitor_infos (MetaScreen *screen)
screen->monitor_infos[0].number = 0;
screen->monitor_infos[0].rect = screen->rect;
screen->monitor_infos[0].rect.width = screen->rect.width / 2;
screen->monitor_infos[0].in_fullscreen = -1;

screen->monitor_infos[1].number = 1;
screen->monitor_infos[1].rect = screen->rect;
screen->monitor_infos[1].rect.x = screen->rect.width / 2;
screen->monitor_infos[1].rect.width = screen->rect.width / 2;
screen->monitor_infos[1].in_fullscreen = -1;
}

#ifdef HAVE_XFREE_XINERAMA
@@ -562,6 +616,7 @@ reload_monitor_infos (MetaScreen *screen)
screen->monitor_infos[i].rect.y = infos[i].y_org;
screen->monitor_infos[i].rect.width = infos[i].width;
screen->monitor_infos[i].rect.height = infos[i].height;
screen->monitor_infos[i].in_fullscreen = -1;

meta_topic (META_DEBUG_XINERAMA,
"Monitor %d is %d,%d %d x %d\n",
@@ -685,6 +740,7 @@ reload_monitor_infos (MetaScreen *screen)
screen->monitor_infos[0].number = 0;
screen->monitor_infos[0].rect = screen->rect;
screen->monitor_infos[0].in_fullscreen = -1;
}

filter_mirrored_monitors (screen);
@@ -904,6 +960,7 @@ meta_screen_new (MetaDisplay *display,
xroot,
NoEventMask);
screen->work_area_later = 0;
screen->check_fullscreen_later = 0;

screen->active_workspace = NULL;
screen->workspaces = NULL;
@@ -1021,12 +1078,9 @@ meta_screen_free (MetaScreen *screen,
meta_display_grab (display);

if (screen->display->compositor)
{
meta_compositor_unmanage_screen (screen->display->compositor,
screen);
}
meta_compositor_unmanage_screen (screen->display->compositor,
screen);

meta_display_unmanage_windows_for_screen (display, screen, timestamp);
meta_prefs_remove_listener (prefs_changed_callback, screen);
@@ -1072,6 +1126,9 @@ meta_screen_free (MetaScreen *screen,
screen->work_area_later = 0;
}

if (screen->check_fullscreen_later != 0)
g_source_remove (screen->check_fullscreen_later);

if (screen->monitor_infos)
g_free (screen->monitor_infos);

@@ -3029,9 +3086,8 @@ meta_screen_resize (MetaScreen *screen,
reload_monitor_infos (screen);
set_desktop_geometry_hint (screen);

if (screen->display->compositor)
meta_compositor_sync_screen_size (screen->display->compositor,
screen, width, height);
meta_compositor_sync_screen_size (screen->display->compositor,
screen, width, height);

/* Queue a resize on all the windows */
meta_screen_foreach_window (screen, meta_screen_resize_func, 0);
@@ -3050,6 +3106,8 @@ meta_screen_resize (MetaScreen *screen,
g_free (old_monitor_infos);
g_slist_free (windows);

meta_screen_queue_check_fullscreen (screen);

g_signal_emit (screen, screen_signals[MONITORS_CHANGED], 0);
}

@@ -3715,3 +3773,127 @@ meta_screen_update_snapped_windows (MetaScreen *screen)
tmp = tmp->next;
}
}

static gboolean
check_fullscreen_func (gpointer data)
{
MetaScreen *screen = data;
MetaWindow *window;
GSList *fullscreen_monitors = NULL;
GSList *obscured_monitors = NULL;
gboolean in_fullscreen_changed = FALSE;
int i;

screen->check_fullscreen_later = 0;

/* We consider a monitor in fullscreen if it contains a fullscreen window;
* however we make an exception for maximized windows above the fullscreen
* one, as in that case window+chrome fully obscure the fullscreen window.
*/
for (window = meta_stack_get_top (screen->stack);
window;
window = meta_stack_get_below (screen->stack, window, FALSE))
{
gboolean covers_monitors = FALSE;

if (window->screen != screen || window->hidden)
continue;

if (window->fullscreen)
{
covers_monitors = TRUE;
}
else if (window->override_redirect)
{
/* We want to handle the case where an application is creating an
* override-redirect window the size of the screen (monitor) and treat
* it similarly to a fullscreen window, though it doesn't have fullscreen
* window management behavior. (Being O-R, it's not managed at all.)
*/
if (meta_window_is_monitor_sized (window))
covers_monitors = TRUE;
}
else if (window->maximized_horizontally &&
window->maximized_vertically)
{
int monitor_index = meta_window_get_monitor (window);
/* + 1 to avoid NULL */
gpointer monitor_p = GINT_TO_POINTER(monitor_index + 1);
if (!g_slist_find (obscured_monitors, monitor_p))
obscured_monitors = g_slist_prepend (obscured_monitors, monitor_p);
}

if (covers_monitors)
{
int *monitors;
gsize n_monitors;
gsize j;

monitors = meta_window_get_all_monitors (window, &n_monitors);
for (j = 0; j < n_monitors; j++)
{
/* + 1 to avoid NULL */
gpointer monitor_p = GINT_TO_POINTER(monitors[j] + 1);
if (!g_slist_find (fullscreen_monitors, monitor_p) &&
!g_slist_find (obscured_monitors, monitor_p))
fullscreen_monitors = g_slist_prepend (fullscreen_monitors, monitor_p);
}

g_free (monitors);
}
}

g_slist_free (obscured_monitors);

for (i = 0; i < screen->n_monitor_infos; i++)
{
MetaMonitorInfo *info = &screen->monitor_infos[i];
gboolean in_fullscreen = g_slist_find (fullscreen_monitors, GINT_TO_POINTER (i + 1)) != NULL;
if (in_fullscreen != info->in_fullscreen)
{
info->in_fullscreen = in_fullscreen;
in_fullscreen_changed = TRUE;
}
}

g_slist_free (fullscreen_monitors);

if (in_fullscreen_changed)
g_signal_emit (screen, screen_signals[IN_FULLSCREEN_CHANGED], 0, NULL);

return FALSE;
}

void
meta_screen_queue_check_fullscreen (MetaScreen *screen)
{
if (!screen->check_fullscreen_later)
screen->check_fullscreen_later = meta_later_add (META_LATER_CHECK_FULLSCREEN,
check_fullscreen_func,
screen, NULL);
}

/**
* meta_screen_get_monitor_in_fullscreen:
* @screen: a #MetaScreen
* @monitor: the monitor number
*
* Determines whether there is a fullscreen window obscuring the specified
* monitor. If there is a fullscreen window, the desktop environment will
* typically hide any controls that might obscure the fullscreen window.
*
* You can get notification when this changes by connecting to
* MetaScreen::in-fullscreen-changed.
*
* Returns: %TRUE if there is a fullscreen window covering the specified monitor.
*/
gboolean
meta_screen_get_monitor_in_fullscreen (MetaScreen *screen,
int monitor)
{
g_return_val_if_fail (META_IS_SCREEN (screen), FALSE);
g_return_val_if_fail (monitor >= 0 && monitor < screen->n_monitor_infos, FALSE);

/* We use -1 as a flag to mean "not known yet" for notification purposes */
return screen->monitor_infos[monitor].in_fullscreen == TRUE;
}

+ 1
- 1
src/core/stack-tracker.c View File

@@ -739,7 +739,7 @@ meta_stack_tracker_queue_sync_stack (MetaStackTracker *tracker)
{
if (tracker->sync_stack_later == 0)
{
tracker->sync_stack_later = meta_later_add (META_LATER_BEFORE_REDRAW,
tracker->sync_stack_later = meta_later_add (META_LATER_SYNC_STACK,
stack_tracker_sync_stack_later,
tracker, NULL);
}


+ 6
- 0
src/core/stack.c View File

@@ -395,6 +395,8 @@ get_maximum_layer_in_group (MetaWindow *window)
static void
compute_layer (MetaWindow *window)
{
MetaStackLayer old_layer = window->layer;

window->layer = get_standalone_layer (window);
/* We can only do promotion-due-to-group for dialogs and other
@@ -430,6 +432,10 @@ compute_layer (MetaWindow *window)
meta_topic (META_DEBUG_STACK, "Window %s on layer %u type = %u has_focus = %d\n",
window->desc, window->layer,
window->type, window->has_focus);

if (window->layer != old_layer &&
(old_layer == META_LAYER_FULLSCREEN || window->layer == META_LAYER_FULLSCREEN))
meta_screen_queue_check_fullscreen (window->screen);
}

/* Front of the layer list is the topmost window,


+ 3
- 0
src/core/util.c View File

@@ -897,6 +897,9 @@ meta_later_add (MetaLaterType when,
later->source = g_idle_add_full (META_PRIORITY_RESIZE, call_idle_later, later, NULL);
ensure_later_repaint_func ();
break;
case META_LATER_CALC_SHOWING:
case META_LATER_CHECK_FULLSCREEN:
case META_LATER_SYNC_STACK:
case META_LATER_BEFORE_REDRAW:
ensure_later_repaint_func ();
break;


+ 0
- 1
src/core/window-private.h View File

@@ -558,7 +558,6 @@ MetaWindow* meta_window_new_with_attrs (MetaDisplay *display,
XWindowAttributes *attrs);
void meta_window_unmanage (MetaWindow *window,
guint32 timestamp);
void meta_window_calc_showing (MetaWindow *window);
void meta_window_queue (MetaWindow *window,
guint queuebits);
void meta_window_real_tile (MetaWindow *window,


+ 323
- 371
src/core/window.c
File diff suppressed because it is too large
View File


+ 0
- 4
src/core/workspace-private.h View File

@@ -98,10 +98,6 @@ GList* meta_workspace_get_onscreen_region (MetaWorkspace *workspace);
GList* meta_workspace_get_onmonitor_region (MetaWorkspace *workspace,
int which_monitor);

void meta_workspace_focus_default_window (MetaWorkspace *workspace,
MetaWindow *not_this_one,
guint32 timestamp);

MetaWorkspace* meta_workspace_get_neighbor (MetaWorkspace *workspace,
MetaMotionDirection direction);



+ 105
- 39
src/core/workspace.c View File

@@ -517,29 +517,64 @@ workspace_switch_sound(MetaWorkspace *from,
#endif /* HAVE_LIBCANBERRA */
}

/**
* meta_workspace_activate_with_focus:
* @workspace: a #MetaWorkspace
* @focus_this: the #MetaWindow to be focused, or %NULL
* @timestamp: timestamp for @focus_this
*
* Switches to @workspace and possibly activates the window @focus_this.
*
* The window @focus_this is activated by calling meta_window_activate()
* which will unminimize it and transient parents, raise it and give it
* the focus.
*
* If a window is currently being moved by the user, it will be
* moved to @workspace.
*
* The advantage of calling this function instead of meta_workspace_activate()
* followed by meta_window_activate() is that it happens as a unit, so
* no other window gets focused first before @focus_this.
*/
void
meta_workspace_activate_with_focus (MetaWorkspace *workspace,
MetaWindow *focus_this,
guint32 timestamp)
static MetaMotionDirection
get_wrapped_horizontal_direction (gint from,
gint to,
MetaMotionDirection suggested_dir,
gint num_workspaces)
{
MetaMotionDirection ret = 0;
gboolean wrap = meta_prefs_get_workspace_cycle();

if (suggested_dir != 0 && wrap)
{
if (meta_ui_get_direction () == META_UI_DIRECTION_RTL)
{
if (suggested_dir == META_MOTION_LEFT)
suggested_dir = META_MOTION_RIGHT;
else
if (suggested_dir == META_MOTION_RIGHT)
suggested_dir = META_MOTION_LEFT;
}

return suggested_dir;
}

if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
{
if (from < to)
if (wrap)
ret = (to - from) <= ((num_workspaces - to) + from) ? META_MOTION_LEFT : META_MOTION_RIGHT;
else
ret = META_MOTION_LEFT;
else
if (wrap)
ret = (from - to) <= ((num_workspaces - from) + to) ? META_MOTION_RIGHT : META_MOTION_LEFT;
else
ret = META_MOTION_RIGHT;
}
else
{
if (from < to)
if (wrap)
ret = (to - from) <= ((num_workspaces - to) + from) ? META_MOTION_RIGHT : META_M