Browse Source

Imported Upstream version 3.0.0

upstream upstream/3.0.0
Maximiliano Curia 6 years ago
parent
commit
5f87759af7
  1. 6
      configure.ac
  2. 11
      po/Makefile.in.in
  3. 29
      src/compositor/compositor.c
  4. 100
      src/compositor/meta-window-actor.c
  5. 337
      src/core/bell.c
  6. 23
      src/core/bell.h
  7. 2
      src/core/constraints.c
  8. 1
      src/core/display-private.h
  9. 83
      src/core/display.c
  10. 10
      src/core/edge-resistance.c
  11. 8
      src/core/frame.c
  12. 1
      src/core/frame.h
  13. 4
      src/core/keybindings-private.h
  14. 134
      src/core/keybindings.c
  15. 2
      src/core/muffin.c
  16. 123
      src/core/prefs.c
  17. 3
      src/core/screen-private.h
  18. 200
      src/core/screen.c
  19. 2
      src/core/stack-tracker.c
  20. 6
      src/core/stack.c
  21. 3
      src/core/util.c
  22. 1
      src/core/window-private.h
  23. 694
      src/core/window.c
  24. 4
      src/core/workspace-private.h
  25. 144
      src/core/workspace.c
  26. 13
      src/meta/common.h
  27. 13
      src/meta/compositor.h
  28. 7
      src/meta/prefs.h
  29. 3
      src/meta/screen.h
  30. 6
      src/meta/util.h
  31. 3
      src/meta/window.h
  32. 7
      src/meta/workspace.h
  33. 16
      src/org.cinnamon.muffin.gschema.xml.in
  34. 40
      src/ui/frames.c
  35. 2
      src/ui/theme.c
  36. 9
      src/ui/ui.c

6
configure.ac

@ -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])

11
po/Makefile.in.in

@ -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

29
src/compositor/compositor.c

@ -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,

100
src/compositor/meta-window-actor.c

@ -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),

337
src/core/bell.c

@ -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);
}

23
src/core/bell.h

@ -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);

2
src/core/constraints.c

@ -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
src/core/display-private.h

@ -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);

83
src/core/display.c

@ -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
src/core/edge-resistance.c

@ -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);

8
src/core/frame.c

@ -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.
*/

1
src/core/frame.h

@ -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
src/core/keybindings-private.h

@ -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);

134
src/core/keybindings.c

@ -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
src/core/muffin.c

@ -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 ();

123
src/core/prefs.c

@ -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: