1
0
Fork 0
Commit graph

540 commits

Author SHA1 Message Date
Jasper St. Pierre
7615d17293 wayland: Tie activate / deactivate to appears-focused
... rather than actual focus. This makes things behave better.
2014-02-18 23:21:06 -05:00
Jasper St. Pierre
e62fe956fd window: Enable pinging on Wayland windows
I implemented pinging, but never actually enabled the feature
properly on Wayland surfaces by setting the net_wm_ping hint to
TRUE, causing the fallback path to always be hit.

Rename net_wm_ping to can_ping so it doesn't take on an
implementation-specific meaning, and set it for all Wayland windows.
2014-02-18 20:30:52 -05:00
Jasper St. Pierre
2a145262c7 wayland: Rework how surface destruction works
To prevent the MetaSurfaceActor from being destroyed, we normally
unparent it before we unmanage the window. However, this doesn't
work for XWayland windows, which we unmanage when we get UnmapNotify
or DestroyNotify, not when we get the wl_surface_destroy.

To solve this, add an early hook in meta_window_unmanage that
unparents the surface actor if we have one. At the same time, clean
up the destruction code to remove old comments and assumptions about
how wl_shell behaves.
2014-02-18 17:01:33 -05:00
Jasper St. Pierre
a66060e21a Revert "Move window pings to MetaWindow"
This was a bad idea, as ping/pong has moved to a client-specific
request/event pair, rather than a surface-specific one. Revert
the changes we made here and correct the code to make up for it.

This reverts commit aa3643cdde.
2014-02-16 10:21:22 -05:00
Jasper St. Pierre
a0ef7c7142 Move position-changed / size-changed signals to the MetaWindow
They fit more appropriately over here...

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-14 23:44:39 -05:00
Jasper St. Pierre
4efe4483fb compositor: Delay meta_compositor_add_window until the first show
In order for the compositor to properly determine whether a client
is an X11 client or not, we need to wait until XWayland calls
set_window_id to mark the surface as an XWayland client. To prevent
the compositor from getting tripped up over this, make sure that
the window has been fully initialized by the time we call
meta_compositor_add_window.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-14 23:44:38 -05:00
Jasper St. Pierre
aec3edb1cc Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.

However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.

I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.

Remove this now.

The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. In the future, we might want to
show previews of shaded windows in the overview and Alt-Tab. In that
we'd also keep shaded windows mapped, and could remove all unmap logic,
but we'd need a more complex method of showing the shaded titlebar, such
as using a different actor.

At the same time, simplify the compositor interface by removing
meta_compositor_window_[un]mapped API, and instead adding/removing the
window on-demand.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-14 23:19:41 -05:00
Jasper St. Pierre
def5e86673 wayland: Add support for the set_margin request 2014-02-07 19:28:36 -05:00
Jasper St. Pierre
912a0abd26 wayland: Remove edges
This is an upstream change to xdg-shell.
2014-02-07 19:28:36 -05:00
Marek Ch
d6396cf2c4 window: fix coerced value
(int) 0.5 = 0, so there always was 0 instead of 50%
2014-02-02 15:17:29 +01:00
Jasper St. Pierre
8905bd2280 window-x11: Move meta_window_new to window-x11.c and rename 2014-02-01 19:19:22 -05:00
Jasper St. Pierre
b09e1399c0 window: Centralize WM_STATE management 2014-02-01 19:18:01 -05:00
Jasper St. Pierre
59c8b949ad window: Delay the showing of XWayland clients until set_window_id
Use our new "surface_mapped" field to delay the showing of XWayland clients
until we have associated together the window's XID and the Wayland surface ID.

This ensures that when we show this window to the compositor, it will properly
use the Wayland surface for rendering, rather than trying to use COMPOSITE and
crash.

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-02-01 19:18:01 -05:00
Jasper St. Pierre
6dbb3fddce window: Fix build once more
Bad syntax here...
2014-02-01 19:08:27 -05:00
Jasper St. Pierre
f166240225 window: Clean up is_our_xwindow 2014-02-01 18:59:27 -05:00
Jasper St. Pierre
91b789c707 window: Split out logic for determining whether an X window is ours 2014-02-01 18:59:27 -05:00
Jasper St. Pierre
14db280fab window: Fix build
The proper function name is "meta_window_recalc_features"
2014-02-01 18:58:58 -05:00
Jasper St. Pierre
f7097e6f66 Start moving X11-specific code to window-x11.c
The goal here is to make MetaWindow represent a toplevel, managed window,
regardless of if it's X11 or Wayland, and build an abstraction layer up.
Right now, most of the X11 code is in core/ and the wayland code in wayland/,
but in the future, I want to move a lot of the X11 code to a new toplevel, x11/.
2014-02-01 18:39:12 -05:00
Jasper St. Pierre
ff89f1e271 window: Use window-props interface to load role/net_wm_type on init 2014-02-01 18:39:12 -05:00
Jasper St. Pierre
6a8a4bfdcd window: Remove internal recalc_window_type / recalc_window_features
Just use the public symbols for them.
2014-02-01 18:39:12 -05:00
Florian Müllner
cd35982d4e window: Remove duplicated function declaration 2014-02-01 18:38:54 -05:00
Florian Müllner
55b18f9671 window: Add "skip-taskbar" property
We currently only have a method to query the skip-taskbar hint.
Add a corresponding property to allow listening for change
notifications.

https://bugzilla.gnome.org/show_bug.cgi?id=723307
2014-01-31 13:33:38 +01:00
Jasper St. Pierre
20545941fa Revert unintentional merge from wip/surface-content to wayland
This reverts a lot of commits.
2014-01-22 09:18:13 -05:00
Jasper St. Pierre
ac32b9ef95 get xwayland working again 2014-01-21 19:06:06 -05:00
Jasper St. Pierre
7ea537fad7 Move position-changed / size-changed signals to the MetaWindow
They fit more appropriately over here...

https://bugzilla.gnome.org/show_bug.cgi?id=720631
2014-01-21 19:01:34 -05:00
Jasper St. Pierre
bfc906cbc4 compositor: Remove meta_compositor_window_[un]mapped
We no longer unmap the toplevel windows during normal operation. The
toplevel state is tied to the window's lifetime.

Call meta_compositor_add_window / meta_compositor_remove_window instead...
2014-01-21 19:01:34 -05:00
Jasper St. Pierre
8e6f8087e8 Always map the client and frame windows
Traditionally, WMs unmap windows when minimizing them, and map them
when restoring them or wanting to show them for other reasons, like
upon creation.

However, as metacity morphed into mutter, we optionally chose to keep
windows mapped for the lifetime of the window under the user option
"live-window-previews", which makes the code keep windows mapped so it
can show window preview for minimized windows in other places, like
Alt-Tab and Expose.

I removed this preference two years ago mechanically, by removing all
the if statements, but never went through and cleaned up the code so
that windows are simply mapped for the lifetime of the window -- the
"architecture" of the old code that maps and unmaps on show/hide was
still there.

Remove this now.

The one case we still need to be careful of is shaded windows, in which
we do still unmap the client window. Theoretically, we might want to
show previews of shaded windows in the overview and Alt-Tab, so we remove
the complex unmap tracking for this later.
2014-01-21 19:01:18 -05:00
Andika Triwidada
9b21346427 Changed obsolete FSF postal address into generic URL.
Fix https://bugzilla.gnome.org/show_bug.cgi?id=721517 #2
2014-01-13 11:35:47 -05:00
Jasper St. Pierre
7a4adce44f window: Atomically unmaximize both directions from a _NET_WM_STATE ClientMessage
When GDK sends an unmaximize _NET_WM_STATE ClientMessage, it tells us to remove
the _NET_WM_STATE_MAXIMIZED_HORZ and _NET_WM_STATE_MAXIMIZED_VERT states. Before
this time, it would independently call:

  meta_window_unmaximize (window, META_MAXIMIZE_HORIZONTAL);
  meta_window_unmaximize (window, META_MAXIMIZE_VERTICAL);

Which, besides being foolishly inefficient, would also mess up our saved_rect
tracking, causing the window to only look like it was unmaximized vertically.

Make this code more intelligent, so it causes us to unmaximize in one call.

https://bugzilla.gnome.org/show_bug.cgi?id=722108
2014-01-13 11:35:47 -05:00
Daniel Drake
a5f0db5ecb window: don't grab server during calc_showing
This grab was added in commit caf43a123f
https://bugzilla.gnome.org/show_bug.cgi?id=381127
to minimize window flickering when switching workspaces.

While this grab is held, some signals are emitted to the shell,
which can lead to deadlocks (reproduced under Mali binary OpenGLESv2
drivers).

Now that we are a compositing window manager, we do not have to
worry about flickers, this grab should no longer be necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=721709
2014-01-07 14:27:24 -06:00
Daniel Drake
577624adef Reduce server grabs during window creation
Remove some obvious server grabs from the window creation codepath,
also ones that are taken at startup.

During startup, there is no need to grab: we install the event handlers
before querying for the already-existing windows, so there is no danger
that we will 'lose' some window. We might try to create a window twice
(if it comes back in the original query and then we get an event for it)
but the code is already protected against such conditions.

When windows are created later, we also do not need grabs, we just need
appropriate error checking as the window may be destroyed at any time
(or it may have already been destroyed).

The stack tracker is unaffected here - as it listens to CreateNotify and
DestroyNotify events and responds directly, the internal stack
representation will always be consistent even if the window goes away while
we are processing MapRequest or similar.

Now that there are no grabs we don't have to worry about explicitly calling
display_notify_window after grabs have been dropped. Fold that into
meta_window_new_shared().

https://bugzilla.gnome.org/show_bug.cgi?id=721345
2014-01-07 07:53:16 -06:00
Daniel Drake
af46ef3b96 meta_window_new: clean up error handling
The return code of XGetWindowAttributes() indicates whether an error
was encountered or not. There is no need to specifically check the error
trap.

The trap around XAddToSaveSet() was superfluous. We have a global error
trap to ignore any errors here, and there is no need to XSync() as GDK
will later ignore the error asynchronously if one is raised.

Also move common error exit path to an error label.

https://bugzilla.gnome.org/show_bug.cgi?id=721345
2014-01-07 07:44:31 -06:00
Daniel Drake
384a34c27d Remove meta_window_new_with_attrs
The compositor code used to handle X windows that didn't have a
corresponding MetaWindow (see commit d538690b), which is why the
attribute query is separated.

As that doesn't happen any more, we can clean up. No functional changes.

Suggested by Owen Taylor.

https://bugzilla.gnome.org/show_bug.cgi?id=721345
2014-01-07 07:17:06 -06:00
Owen W. Taylor
0caf7381bb display: Don't leave focus on a window we are unmanaging when sending WM_TAKE_FOCUS
When we move focus elsewhere when unmanaging a window, we *need* to move
the focus, so if the target is globally active, move the focus to the
no-focus-window in anticipation that the focus will normally get moved
to the right window when the target window responds to WM_TAKE_FOCUS.

If the window doesn't respond to WM_TAKE_FOCUS, then focus will be left
on the no-focus-window, but there's no way to distinguish whether the
app will respond or not.

https://bugzilla.gnome.org/show_bug.cgi?id=711618
2013-12-24 11:30:14 -05:00
Owen W. Taylor
a42305edab Be willing to unfocus the grab window when we are unmanaging it
When we are unmanaging the grab window, we /need/ to unfocus it,
so we shouldn't bail out early from meta_window_focus().

https://bugzilla.gnome.org/show_bug.cgi?id=711618
2013-12-24 11:30:11 -05:00
Owen W. Taylor
cb33e1942a meta_window_move_resize_internal: handle border size changes
Initial placement during meta_window_constrain() can result in changes
to the borders, so we need to recompute our border sizes after
constraining. This fixes incorrect window borders on
initially maximized windows.

https://bugzilla.gnome.org/show_bug.cgi?id=720417
2013-12-18 09:30:22 -05:00
Jasper St. Pierre
8131f34eb6 Move _NET_WM_WINDOW_OPACITY handling to the standard window-props interface 2013-12-09 15:53:23 -05:00
Jasper St. Pierre
f0fa4d831a window: Add a simple meta_window_get_toplevel_xwindow utility
To replace all the places where we do:

  window->frame ? window->frame->xwindow : window->xwindow

or similar...
2013-12-09 14:05:18 -05:00
Jasper St. Pierre
ee683ff187 window: Fix meta_window_ping some more
Make sure to actually add the pings to the list... and don't
remove it from the list twice.
2013-12-06 20:23:00 -05:00
Jasper St. Pierre
fa65c380db Support X button events again
Do this by duplicating the current code and porting it to use
X again. A better approach would involve our own event structures,
and I really don't want to do that right now. We can clean this up
later.
2013-12-05 17:18:49 -05:00
Owen W. Taylor
8d5ab6b5b3 Use the correct frame size during unmaximize
When unmaximizing, we changed bits of window state, then called out
to code that used the frame extents *before* we cleared old cached
extents. Clear the cache up-front as soon as we change the window
state.

https://bugzilla.gnome.org/show_bug.cgi?id=714707
2013-12-05 11:17:32 -05:00
Lionel Landwerlin
4d2d2f285b core: window: enable create effect for new wayland windows
https://bugzilla.gnome.org/show_bug.cgi?id=719833
2013-12-04 11:14:30 +00:00
Jasper St. Pierre
fe26cb5989 wayland-surface: Unmanage the window when destroying xdg_surface/xdg_popup
Also, unparent the actor when destroying a subsurface, as well, and
don't free the surface when we destroy the MetaWindow.
2013-12-03 11:45:50 -05:00
Rui Matos
3f022ca963 window: Possibly set the pointer focus on newly mapped wayland windows
Windows showing up under the pointer must get the pointer focus.

https://bugzilla.gnome.org/show_bug.cgi?id=719725
2013-12-03 15:56:15 +01:00
Rico Tzschichholz
21d8b8310a window: Proper argument naming for meta_window_client_rect_to_frame_rect
(cherry picked from commit 9b88059e55)
2013-11-29 16:33:37 +01:00
Rico Tzschichholz
c46af91d54 window: Fix deprecated version of get_outer_rect
(cherry picked from commit 59168b2c64)
2013-11-29 16:32:15 +01:00
Jasper St. Pierre
644f3e1275 window: Make setters for shape/input/opaque regions private again
Wayland now pushes these to the surface actor rather than the toplevel
MetaWindow...
2013-11-25 17:25:56 -05:00
Jasper St. Pierre
6d639ac528 window: Support pinging Wayland surfaces as well 2013-11-21 14:24:04 -05:00
Jasper St. Pierre
aa3643cdde Move window pings to MetaWindow
This will make it possible to use on Wayland as well...
2013-11-21 14:24:04 -05:00
Jasper St. Pierre
153d8efcf5 window: Create a backing MetaWindow for unmapped Wayland surfaces
We require a MetaWindow to properly implement some of the requests
for xdg_surface, so add a way to have an unmapped MetaWindow that
we can store properties on, that we later map when the client
attaches a buffer...
2013-11-19 17:48:19 -05:00
Jasper St. Pierre
d945501be6 window: Remove width/height from meta_window_new_for_wayland 2013-11-19 15:37:33 -05:00
Jasper St. Pierre
ca342c4573 window: Remove unused parameter from meta_window_new_shared() 2013-11-19 15:37:33 -05:00
Owen W. Taylor
b9da43b753 Rename meta_window_get_outer_rect() to meta_window_get_frame_rect()
For clarity, rename meta_window_get_outer_rect() to match terminology
we use elsewhere. The old function is left as a deprecated
compatibility wrapper.
2013-11-19 14:04:16 -05:00
Owen W. Taylor
097ee776c7 Stop passing around MetaFrameBorders
Instead of passing around MetaFrameBorders, compute it when we need it.
This also allows us to know that we are using MetaFrameBorders only for windows
with frames (where it is meaningful) and not for frameless windows, which
can have custom borders which we need to interpret differently.

https://bugzilla.gnome.org/show_bug.cgi?id=707194
2013-11-19 14:04:16 -05:00
Owen W. Taylor
a4a8f1f863 MetaFrame: Cache borders
Cache the computed border size so we can fetch the border size at
any time without worrying that we'll be spending too much time in
the theme code (in some cases we might allocate a PangoFontDescription
or do other significant work.)

The main effort here is clearing the cache when various bits of window
state change that could potentially affect the computed borders.

https://bugzilla.gnome.org/show_bug.cgi?id=707194
2013-11-19 14:04:16 -05:00
Owen W. Taylor
f36a627330 Use utility functions to convert between frame and client rectangles
There are extensive places in the code where we convert between the client
rectangle and the frame rectangle. Instead of manually doing it use
new helper functions on MetaWindow and the existing meta_window_get_outer_rect().

This fixes a number of bugs where the computation was being done incorrectly,
most of these bugs are with the recently added custom frame extents, but
some relate to invisible borders or even simply to confusion between the
window and frame rectangle.

Switch the placement code to place the frame rectangle rather
than the client window - this simplifies things considerably.

https://bugzilla.gnome.org/show_bug.cgi?id=707194
2013-11-19 14:04:16 -05:00
Jasper St. Pierre
aad275b9a2 window: Fix signedness warning 2013-11-19 14:03:09 -05:00
Lionel Landwerlin
6867d44573 window: don't ignore resize button release event for move/resize actions
https://bugzilla.gnome.org/show_bug.cgi?id=710251
2013-11-19 13:55:17 -05:00
Jasper St. Pierre
23ba3e527f wayland: Support alternative focus modes like focus-follows-mouse
Use the existing code for MetaWindow focus-follows-mouse to support this.
2013-11-12 16:53:15 -05:00
Jasper St. Pierre
08df9bf559 display: Use MetaWindow for auto-raise callbacks
This allows us to autoraise Wayland windows... well, except for the
XQueryPointer, but we'll replace that soon.
2013-11-12 16:53:15 -05:00
Jasper St. Pierre
e86c53230f display: Move the pointer event handling code to work in terms of Clutter events
There is now a meta_display_handle_event alongside the
meta_display_handle_xevent function which handles events in terms of
Clutter events instead of X events. A Clutter event filter is
registered so that all Clutter events will pass through this function.
The pointer event handling code from the X event version has been moved
into this new function and has been modified to use the details from
the Clutter event instead of the X event. This is a step towards
moving all of the event handling code over to use Clutter events.

Based-heavily-on-a-patch-by: Neil Roberts <neil@linux.intel.com>
2013-11-12 16:53:14 -05:00
Jasper St. Pierre
7186841db0 wayland-surface: Remove initial_state
Just put everything in the double buffered state so it all
arrives at the same time; on commit.
2013-11-12 16:53:13 -05:00
Jasper St. Pierre
d82e24981b window: Remove timestamp argument from change_workspace_by_index
It's unused, since we aren't activating the workspace.

https://bugzilla.gnome.org/show_bug.cgi?id=709776
2013-10-15 15:42:16 -04:00
Lionel Landwerlin
1fa56bd7e0 window: don't process unrelated release events
When processing button events related to moving/resizing the window,
only the first button should be considered.

https://bugzilla.gnome.org/show_bug.cgi?id=704759
2013-10-15 18:33:23 +01:00
Giovanni Campagna
76e2455d1b wayland: implement support for popup surfaces
Popup surfaces are mapped into override_redirect surfaces
of a DROPDOWN_MENU type, with the addition of a special pointer
grab.

https://bugzilla.gnome.org/show_bug.cgi?id=707863
2013-09-16 14:51:12 +02:00
Giovanni Campagna
81d9797544 wayland: implement transient hints for wayland clients
wl_shell supports a set_transient() map request that is equivalent
to setting WM_TRANSIENT_FOR in X11, so implement that.

https://bugzilla.gnome.org/show_bug.cgi?id=707401
2013-09-16 14:48:57 +02:00
Giovanni Campagna
a7eaf43e18 wayland: implement resizing and maximization for wayland clients
To properly resize clients, we need to send them configure events
with the size we computed from the constraint system, and
then check if the new size they ask is compatible with
our expectation.

Note that this does not handle interactive resizing yet, it
merely makes the API calls work for wayland clients.

https://bugzilla.gnome.org/show_bug.cgi?id=707401
2013-09-16 14:46:34 +02:00
Giovanni Campagna
514fec7275 display: include wayland clients in the tab list
Make sure that meta_display_list_windows() returns wayland windows
too, by keeping a separate hash for wayland clients.
This fixes a crash in the alt-tab code of gnome-shell.

Reviewed by drago01 in IRC.
2013-09-16 11:29:36 +02:00
Pavel Vasin
0394b4a82b window: Fix memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=708070
2013-09-14 17:07:32 +02:00
Giovanni Campagna
5ae52473c9 Don't translate debug logs and warnings
Warnings that are going to the journal should be not translated:
they're not user visible, and translating them would just make
bug reporting harder (as now the developers need to understand
what the warning is saying)

https://bugzilla.gnome.org/show_bug.cgi?id=707897
2013-09-11 16:01:09 +02:00
Giovanni Campagna
7b537d6b8f Fix regression in mutter-wayland translations
Switching meta/util.h to gi18n.h was wrong, mutter is a library
and needs gi18n-lib.h, but that cannot be included from a public
header (since it depends on config.h or command line options),
so split util.h into a public and a private part.

https://bugzilla.gnome.org/show_bug.cgi?id=707897
2013-09-11 16:01:07 +02:00
Giovanni Campagna
a26ded47d9 Add a private gtk-mutter protocol
Add a new interface, gtk_shell, than can be used by gtk to
retrieve a surface extension called gtk_surface, which will be
used to communicate with mutter all the GTK extensions to EWMH

https://bugzilla.gnome.org/show_bug.cgi?id=707128

Add support for GTK application menus

To do so, we need to be able to set surface state before creating
the MetaWindow, so we introduce MetaWaylandSurfaceInitialState as
a staging area.
The gtk-shell-surface implementation would either write to the
initial state, or directly to the window.

At the same, implement set_title and set_class too, because it's
easy enough.

https://bugzilla.gnome.org/show_bug.cgi?id=707128
2013-09-03 10:57:28 -04:00
Jasper St. Pierre
2d35e07fae wayland: Add support for set_opaque_region / set_input_region
https://bugzilla.gnome.org/show_bug.cgi?id=707019
2013-08-29 15:31:52 -04:00
Giovanni Campagna
aa15c09d54 Merge tag 'xrandr_branch_point' into wayland-kms-base
Conflicts:
	src/Makefile.am
	src/core/display.c
	src/core/screen-private.h
	src/core/screen.c
2013-08-27 10:07:39 +02:00
Giovanni Campagna
f09b9573f0 window: ignore skip-taskbar hint on parentless dialogs
Dialogs that don't have a parent should not be skip-taskbar,
otherwise they get lost and there is no way to recover them
(because they're not autoraised when activating the parent),
but toolkits and applications set the hint anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=673399
2013-08-27 09:57:06 +02:00
Giovanni Campagna
bd3d5df9ce Remove HAVE_WAYLAND ifdefs
Wayland support is always enabled now.

https://bugzilla.gnome.org/show_bug.cgi?id=705497
2013-08-26 15:00:29 +02:00
Florian Müllner
bbf9358eba window: Fix a compiler warning 2013-08-23 23:09:58 -04:00
Giovanni Campagna
214f31257b Rework and consolidate monitor handling in MetaScreen
Consolidate all places that deal with output configuration in
MetaScreen, which gets it either from XRandR or from a dummy static configuration.
We still need to read the Xinerama config, even when running xwayland,
because we need the indices for _NET_WM_FULLSCREEN_MONITORS, but
now we do it only when needed.

https://bugzilla.gnome.org/show_bug.cgi?id=705670
2013-08-18 00:22:54 +02:00
Jasper St. Pierre
0e098249b1 Merge remote-tracking branch 'origin/master' into wayland 2013-08-13 10:44:09 -04:00
Jasper St. Pierre
12d2e1f600 Support _GTK_FRAME_EXTENTS
https://bugzilla.gnome.org/show_bug.cgi?id=705766
2013-08-13 10:40:15 -04:00
Giovanni Campagna
9a5f243f73 wayland: refactor window destruction and focus
The previous code was leaving focus fields dirty in MetaWaylandPointer
and MetaWaylandKeyboard at time (which could crash the X server
because of invalid object IDs)
The new code is more tighly integrated in the normal X11 code
for handling keyboard focus (meaning that the core idea of input
focus is also correct now), so that meta_window_unmanage() can
do the right thing. As a side benefit, clicking on wayland clients
now unfocus X11 clients.
For the mouse focus, we need to clear the surface pointer when
the metawindowactor is destroyed (even if the actual actor is
kept alive for effects), so that a repick finds a different pointer
focus.

https://bugzilla.gnome.org/show_bug.cgi?id=705859
2013-08-13 09:42:55 +02:00
Robert Bragg
40e820f551 Add support for stacking X and Wayland windows together
This breaks down the assumptions in stack-tracker.c and stack.c that
Mutter is only stacking X windows.

The stack tracker now tracks windows using a MetaStackWindow structure
which is a union with a type member so that X windows can be
distinguished from Wayland windows.

Some notable changes are:

Queued stack tracker operations that affect Wayland windows will not be
associated with an X serial number.

If an operation only affects a Wayland window and there are no queued
stack tracker operations ("unvalidated predictions") then the operation
is applied immediately since there is no server involved with changing
the stacking for Wayland windows.

The stack tracker can no longer respond to X events by turning them into
stack operations and discarding the predicted operations made prior to
that event because operations based on X events don't know anything
about the stacking of Wayland windows.

Instead of discarding old predictions the new approach is to trust the
predictions but whenever we receive an event from the server that
affects stacking we cross-reference with the predicted stack and check
for consistency. So e.g. if we have an event that says ADD window A then
we apply the predictions (up to the serial for that event) and verify
the predicted state includes a window A. Similarly if an event says
RAISE_ABOVE(B, C) we can apply the predictions (up to the serial for
that event) and verify that window B is above C.

If we ever receive spurious stacking events (with a serial older than we
would expect) or find an inconsistency (some things aren't possible to
predict from the compositor) then we hit a re-synchronization code-path
that will query the X server for the full stacking order and then use
that stack to walk through our combined stack and force the X windows to
match the just queried stack but avoiding disrupting the relative
stacking of Wayland windows. This will be relatively expensive but
shouldn't be hit for compositor initiated restacking operations where
our predictions should be accurate.

The code in core/stack.c that deals with synchronizing the window stack
with the X server had to be updated quite heavily. In general the patch
avoids changing the fundamental approach being used but most of the code
did need some amount of re-factoring to consider what re-stacking
operations actually involve X or not and when we need to restack X
windows we sometimes need to search for a suitable X sibling to restack
relative too since the closest siblings may be Wayland windows.
2013-08-10 19:13:49 -04:00
Robert Bragg
f9a11b3b18 wayland: Adds basic hybrid X + Wayland support
This adds support for running mutter as a hybrid X and Wayland
compositor. It runs a headless XWayland server for X applications
that presents wayland surfaces back to mutter which mutter can then
composite.

This aims to not break Mutter's existing support for the traditional X
compositing model which means a single build of Mutter can be
distributed supporting the traditional model and the new Wayland based
compositing model.

TODO: although building with --disable-wayland has at least been tested,
I still haven't actually verified that running as a traditional
compositor isn't broken currently.

Note: At this point no input is supported

Note: multiple authors have contributed to this patch:
Authored-by: Robert Bragg <robert@linux.intel.com>
Authored-by: Neil Roberts <neil@linux.intel.com>
Authored-by: Rico Tzschichholz.
Authored-by: Giovanni Campagna <gcampagna@src.gnome.org>
2013-08-10 19:13:48 -04:00
Robert Bragg
531be6c413 Track the X Shape input region and use it for picking
We now track whether a window has an input shape specified via the X
Shape extension. Intersecting that with the bounding shape (as required
by the X Shape extension) we use the resulting rectangles to paint
window silhouettes when picking. As well as improving the correctness of
picking this should also be much more efficient because typically when
only picking solid rectangles then the need to actually render and issue
a read_pixels request can be optimized away and instead the picking is
done on the cpu.
2013-08-10 19:13:48 -04:00
Florian Müllner
2103ff6a5c window: Don't force attached dialogs to be border-only
Originally attached dialogs did not have a titlebar, which the code
still assumes though it hasn't been true for a while; nowadays, the
actual look of attached dialogs is controlled by the theme.
As GTK+ recently gained the ability to set custom titlebars, we need
to support attached dialogs with either full borders (WM decorations)
or border-only (GTK+ titlebar).
Just remove the left-over assumption to make it work as expected.

https://bugzilla.gnome.org/show_bug.cgi?id=702764
2013-06-24 20:19:33 +02:00
Adel Gadllah
8ab136b7ea window: Make sure override_redirect window have correct monitor info
We need to update window->monitor on override_redirect windows as well, other
wise they may end up with an invalid struct which triggers and assert when
meta_window_is_monitor_sized is called.

https://bugzilla.gnome.org/show_bug.cgi?id=702564
2013-06-24 17:32:22 +02:00
Adel Gadllah
5205821fb9 window: Reuse current pointer position for monitor checks
Avoid a round trip to the xserver we already have the current position
anyway. Querying from the server on every move can cause the compositor to
stall during movement.
2013-06-23 21:24:41 +02:00
Jasper St. Pierre
df8234c5e3 window: Properly handle focusing override redirect windows
If an app pops up an OR window and sets input focus to it, like
Steam does, we'll think the focus window is null, causing us to
think the app is not focused.

OR windows should not be special if they get input focus, where
the input focus would be set to NULL. Instead, the window should
be marked as focused.

https://bugzilla.gnome.org/show_bug.cgi?id=647706
2013-05-22 13:46:15 -04:00
Dan Winship
7a4c808e43 display: clean up focus_window vs expected_focus_window
Mutter previously defined display->focus_window as the window that the
server says is focused, but kept display->expected_focus_window to
indicate the window that we have requested to be focused. But it turns
out that "expected_focus_window" was almost always what we wanted.

Make MetaDisplay do a better job of tracking focus-related requests
and events, and change display->focus_window to be our best guess of
the "currently" focused window (ie, the window that will be focused at
the time when the server processes the next request we send it).

https://bugzilla.gnome.org/show_bug.cgi?id=647706
2013-05-22 13:46:15 -04:00
Jasper St. Pierre
e430e051b7 window: Clean up the set_focused_internal function
Move things out of an indentation layer, and reshuffle
things around.

https://bugzilla.gnome.org/show_bug.cgi?id=647706
2013-05-22 12:35:04 -04:00
Jasper St. Pierre
696d9d2fa9 window: Merge got_focus/lost_focus to a new function
Make it a static function for now, but this will be a private
function soon, replacing meta_window_lost_focus. This should
contain no functional changes, only cosmetic indentation changes,
so best viewed with ignorews=1 or -w or -b, you know the drill.

https://bugzilla.gnome.org/show_bug.cgi?id=647706
2013-05-22 12:35:04 -04:00
Jasper St. Pierre
f6dd081acd window: Refactor "got focus" code
Just move this out to a separate function.

https://bugzilla.gnome.org/show_bug.cgi?id=647706
2013-05-22 12:35:04 -04:00
Jasper St. Pierre
a487d4dd01 window: Eliminate a potential race condition with _NET_WM_MOVERESIZE
Clients using _NET_WM_MOVERESIZE to start a drag operation may encounter
a race condition if the user presses and releases a mouse button very
fast, getting "stuck" in a grab state. While this is easily fixed with
the user pressing the button or hitting Escape as the EWMH spec suggests,
its's still a bit of annoyance for users.

After starting a grab operation, check that the button is actually pressed
by the client, and if not, cancel the grab operation. This prevents the
stuck grab in a race-free way, although it requires an extra round-trip
to the server.

With client-side decorations becoming more popular, the use of
_NET_WM_MOVERESIZE is on the rise, thus this bug is seen more frequently
than before.

https://bugzilla.gnome.org/show_bug.cgi?id=699777
2013-05-14 14:46:20 -04:00
Jasper St. Pierre
50b9042ac2 window: Add an accessor for whether the window can close
The shell will use this to determine whether to show a close
button in the overview.

https://bugzilla.gnome.org/show_bug.cgi?id=699269
2013-05-09 15:34:37 -04:00
Pavel Vasin
970a446bd8 window: Add missing chain-up for finalize()
https://bugzilla.gnome.org/show_bug.cgi?id=698710
2013-04-29 14:58:31 +02:00
Owen W. Taylor
8a33880c00 Don't configure a window before it responds to _NET_WM_SYNC_REQUEST
In 97a4cc8c, we accidentally lost the check that kept us from
sending multiple configures to a window before it responds to
_NET_WM_SYNC_REQUEST. So _NET_WM_SYNC_REQUEST stopped working
properly. Add a check back with the same effect.

https://bugzilla.gnome.org/show_bug.cgi?id=696091
2013-03-18 15:10:18 -04:00
Owen W. Taylor
7a8c45dda8 Handle spontaneous frames during a resize
During a resize, if we don't have a configure pending, then a counter
change shouldn't trigger anything other than the normal drawing:
it's just a spontaneous frame from the application. So don't try
to update the position or remove our timeout ID.

https://bugzilla.gnome.org/show_bug.cgi?id=696091
2013-03-18 15:10:18 -04:00
Owen W. Taylor
5ceffe86ee MetaScreen: Add tracking of whether there are fullscreen windows
Trying to track the fullscreen status outside of Mutter, as GNOME Shell
was doing previously, was very prone to errors, because Mutter has a
very tricky definition of when a window is set to be fullscreen and
*actually* acting like a fullscreen window.

 * Add meta_screen_get_monitor_in_fullscreen() and an
   ::in-fullscreen-changed signal. This allows an application to
   track when there are fullscreen windows on a monitor.

 * Do the computation of fullscreen status in a "later" function that
   runs after showing, so we properly take focus into account.

 * To get ordering of different phases right, add more values
   to MetaLaterType.

 * Add auto-minimization, similar to what was added to GNOME Shell
   earlier in this cycle - if a window is set to be fullscreen, but
   not actually fullscreen, minimize.

https://bugzilla.gnome.org/show_bug.cgi?id=649748
2013-03-18 13:05:22 -04:00
Florian Müllner
49df033b4e window: Remove obsolete code
Since the tile mode is now always reset on maximize(), this code
no longer does anything (not to mention that side-by-side tiled
windows haven't snapped back for a while now).

https://bugzilla.gnome.org/show_bug.cgi?id=682779
2013-03-18 16:43:08 +01:00
Florian Müllner
ac3465ffbb window: Reset tile-mode on maximization
We used to restore side-by-side tiling when unmaximizing, so we
kept the tile-mode during maximization. Since commit 10d53fc7d
there's no longer a good reason to do so, and it can result in
tile previews being shown erroneously on window drag operations
without motion (double-click on titlebar), so reset the tile
mode in maximize().

https://bugzilla.gnome.org/show_bug.cgi?id=682779
2013-03-18 16:43:08 +01:00
Florian Müllner
884ab602cb window: Force NORMAL layer for tile preview
The tile preview is expected to be shown underneath the focus window.
However the code that restacks the preview broke when override-redirect
windows were moved to a separate window group.
To fix, special-case tile previews to put them in the NORMAL layer.

https://bugzilla.gnome.org/show_bug.cgi?id=696053
2013-03-18 16:20:07 +01:00
Tomeu Vizoso
2efed44257 Add a meaningful name and description to all sections/files in the API docs
https://bugzilla.gnome.org/show_bug.cgi?id=695641
2013-03-14 18:11:04 -04:00
Tomeu Vizoso
be46869782 docs: Fix cross-reference generation
https://bugzilla.gnome.org/show_bug.cgi?id=676856
2013-03-14 18:02:43 -04:00
Tomeu Vizoso
e0b698d365 Fix gobs of gtk-doc warnings
https://bugzilla.gnome.org/show_bug.cgi?id=676856
2013-03-14 18:02:43 -04:00
Owen W. Taylor
97a4cc8c9b Make handling of windows that don't respond to _NET_WM_SYNC_REQUEST reliable
Previously, we were handling failure to respond to _NET_WM_SYNC_REQUEST
in the code path for throttling motion events. But this meant that
if a window didn't respond to _NET_WM_SYNC_REQUEST and there were no
motion events - for a keyboard resize, or after the end of the grab
operation - it would end up in a stuck state.

Use a separate per-window timeout to reliably catch the failure to respond
to _NET_WM_SYNC_REQUEST.

https://bugzilla.gnome.org/show_bug.cgi?id=694046
2013-03-14 08:01:28 -04:00
Owen W. Taylor
592374bc62 Fix freezing of windows with keyboard resizing
During resizing we froze window updates when configuring the
window, and unfroze the window updates when processing the
next resize. This wasn't absolutely reliable, because we might
not have a next resize. Instead tie window freezing more
directly to the current sync request value - a window is
frozen until it catches up with the last value we sent it
in _NET_WM_SYNC_REQUEST.

Testing with unresponsive clients showed that there was a bug
where window->disable_sync once set, would not actually disable
sync, but it *would* disable noticing that the client was
unresponsive for the next resize. Fix that by checking for
->disable_sync before sending _NET_WM_SYNC_REQUEST.

https://bugzilla.gnome.org/show_bug.cgi?id=694046
2013-03-14 07:59:57 -04:00
Owen W. Taylor
6e02fb80c4 Always send _NET_WM_FRAME_DRAWN for newly created windows
Send a _NET_WM_FRAME_DRAWN for each newly created window, as required
by the specification. This avoids a race where a window might be created
frozen but already unfrozen by the time we first see fetch the
counter value.

Remove a duplicate call to meta_compositor_set_updates_frozen() which
was called before the MetaWindowActor is created and hence did nothing.

https://bugzilla.gnome.org/show_bug.cgi?id=694771
2013-03-04 15:36:13 -05:00
Pavel Vasin
98b0a37442 Free memory allocated by XIQueryPointer()
https://bugzilla.gnome.org/show_bug.cgi?id=695135
2013-03-04 19:07:23 +01:00
Giovanni Campagna
e6d5e98c9d MetaWindow: fix annotation
caller-allocates makes sense only for structure, and gjs will complain
if used on anything else

https://bugzilla.gnome.org/show_bug.cgi?id=694801
2013-02-27 18:00:01 +01:00
Adel Gadllah
2a773e0c85 window: Add get_all_monitors
Add a method that returns the indices of the monitors a window
is on.

https://bugzilla.gnome.org/show_bug.cgi?id=646861
2013-02-25 22:05:42 +01:00
Ray Strode
2cafb8be2d window: fix meta_window_is_remote across hostname changes
meta_window_is_remote compares a cached copy of the system hostname
with the hostname of the client window
(as presented by the WM_CLIENT_MACHINE property).

Of course, the system hostname can change at any time, so caching
it is wrong. Also, the WM_CLIENT_MACHINE property won't necessarily
change when the system hostname changes, so comparing it with the
new system hostname is wrong, too.

This commit makes the code call gethostname() at the time
WM_CLIENT_MACHINE is set, check whether it's remote then, and cache
that value, rather than comparing potentially out of sync hostnames
later.

https://bugzilla.gnome.org/show_bug.cgi?id=688716
2013-02-20 16:02:10 -05:00
Adel Gadllah
e9709b7ff9 window: Add is_screen_sized method
Add a method that returns whether the window occupies
the whole screen (i.e all montiors).
2013-02-18 14:10:27 +01:00
Adel Gadllah
a6a9d3f448 window: Add meta_window_is_monitor_sized
We duplicate this checks in multiple places so lets add this to
avoid code duplication.
2013-02-17 21:42:01 +01:00
Owen W. Taylor
d900d83522 MetaWindowActor: Go back to freezing affecting actor geometry
We do, in fact, need freezing to affect window geometry, so that
move-resize operations (such as an interactive resize from the
left, or a resize of a popup centered by the application) occur
atomically.

So to make map effects work properly, only exclude the initial
placement of a window from freezing. (In the future, we may want
to consider whether pure moves of a window being done in response
to a user drag should also be excluded from freezing.)

Rename meta_window_sync_actor_position() to
meta_window_sync_actor_geometry() for clarity.

https://bugzilla.gnome.org/show_bug.cgi?id=693922
2013-02-15 21:48:25 -05:00
Owen W. Taylor
5876f2e3e5 Fix corner cases where _NET_WM_FRAME_DRAWN might be missed
The WM spec requires _NET_WM_FRAME_DRAWN to *always* be sent when
there is an appropriate update to the sync counter value. We were
potentially missing _NET_WM_FRAME_DRAWN when an application did a
spontaneous update during an interactive resize and during effects.
Refactor the code to always send _NET_WM_FRAME_DRAWN, even when
a window is frozen.

https://bugzilla.gnome.org/show_bug.cgi?id=693833
2013-02-14 16:21:26 -05:00
Owen W. Taylor
aeb589c176 MetaWindow: fix detecting the response to an extended _NET_WM_SYNC_REQUEST
During resizing, An odd counter value (indicating the beginning of a frame)
shouldn't cause us to redraw and start a new frame, only an even counter
value. This was causing the frozen state for the window frame counter to
overlap the frozen state for the resize, causing the window not to be
updated.

https://bugzilla.gnome.org/show_bug.cgi?id=693833
2013-02-14 16:21:14 -05:00
Owen W. Taylor
0503f6bb9a Consistently use meta_grab_op_is_resizing() for _NET_WM_SYNC_REQUEST
In different places we checked the grab op differently when determing
whether we are using _NET_WM_SYNC_REQUEST. This was somewhat covered
up previously by the fact that we only had a sync alarm when using
_NET_WM_SYNC_REQUEST, but that is no longer the case, so consistently
use meta_grab_op_is_resizing() everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=685463
2013-02-13 09:48:27 -05:00
Owen W. Taylor
87fe9685b5 Distinguish "no delay" frames from spontaneous drawing
When a client is drawing as hard as possible (without sleeping
between frames) we need to draw as soon possible, since sleeping
will decrease the effective frame rate shown to the user, and
can also result in the system never kicking out of power-saving
mode because it doesn't look fully utilized.

Use the amount the client increments the counter value by when
ending the frame to distinguish these cases:

 - Increment by 1: a no-delay frame
 - Increment by more than 1: a non-urgent frame, handle normally

https://bugzilla.gnome.org/show_bug.cgi?id=685463
2013-02-13 09:48:27 -05:00
Owen W. Taylor
790bfcad9a MetaWindow: always resize the frame first when we have synchronization
Resizing the frame triggers creation of a new backing pixmap for the
window, so we should do that first before we resize the client window
and mess up the contents of the old backing pixmap.

https://bugzilla.gnome.org/show_bug.cgi?id=685463
2013-02-13 09:48:26 -05:00
Owen W. Taylor
fbfab93c63 Send _NET_WM_FRAME_DRAWN messages
When the application provides the extended second counter for
_NET_WM_SYNC_REQUEST, send a client message with completion
information after the next redraw after each counter update
by the application.

https://bugzilla.gnome.org/show_bug.cgi?id=685463
2013-02-13 09:48:26 -05:00
Owen W. Taylor
70c0d39fa7 Add support for an extended style of _NET_WM_SYNC_REQUEST_COUNTER
If an application provides two values in _NET_WM_SYNC_REQUEST_COUNTER,
use that as a signal that the applications wants an extended behavior
where it can update the counter as well as the window manager. If the
application updates the counter to an odd value, updates of the
window are frozen until the counter is updated again to an even value.

https://bugzilla.gnome.org/show_bug.cgi?id=685463
2013-02-13 09:48:26 -05:00
Owen W. Taylor
7743c70d47 Move sync alarms to be per-window and permanent
Instead of creating a new alarm each time we resize a window
interactively, create an alarm the first time we resize a window
and keep it around permanently until we unmanage the window.
Doing it this way will be useful when we allow the application to
spontaneously generate sync request updates to indicate
frames it is drawing.

https://bugzilla.gnome.org/show_bug.cgi?id=685463
2013-02-13 09:48:25 -05:00
Owen W. Taylor
c9343e3ee3 Implement freezing of updates during resize
Replace the unused meta_compositor_set_updates() with
a reversed-meaning meta_compositor_set_updates_frozen(), and use
it to implement freezing application window updates during
interactive resizing. This avoids drawing new areas of the window
with blank content before the application has a chance to repaint.

https://bugzilla.gnome.org/show_bug.cgi?id=685463
2013-02-13 09:40:07 -05:00
Adel Gadllah
a362c08f4e Fix build error introduced by d482590c84 2013-02-09 17:02:36 +01:00
Adel Gadllah
d482590c84 Fix button check in meta_window_client_message
Fixes a regression introduced in 3a3be74e37

https://bugzilla.gnome.org/show_bug.cgi?id=692718
2013-02-09 13:17:42 +01:00
Adel Gadllah
a2a3188331 Fix compiler warnings 2013-02-08 00:22:54 +01:00
Jasper St. Pierre
453020c315 Make sure to include the old XI2 mask when selecting for events
Some windows may already have event masks on them that we've selected
for, especially if we're using GTK+ windows. In particular, this fixes
window menus in the XI2 port.

https://bugzilla.gnome.org/show_bug.cgi?id=690581
2013-02-07 18:13:40 -05:00
Jasper St. Pierre
a613a55658 Support _NET_WM_OPAQUE_REGION
This new hint allows compositors to know what portions of a window
will be obscured, as a region above them is opaque. For an RGB window,
possible to glean this information from the bounding shape region of
a client window, but not for an ARGB32 window. This new hint allows
clients that use ARGB32 windows to say which part of the window is
opaque, allowing this sort of optimization.

https://bugzilla.gnome.org/show_bug.cgi?id=679901
2013-02-06 00:08:04 -05:00
Jasper St. Pierre
093e101252 Make work_area calculation funcs public and introspectible
https://bugzilla.gnome.org/show_bug.cgi?id=692679
2013-02-06 00:03:47 -05:00
Jasper St. Pierre
6f873be7fa Revert "Make work_area calculation funcs public and introspectible"
This reverts commit d8058138ab.
2013-02-06 00:03:10 -05:00
Jasper St. Pierre
d8058138ab Make work_area calculation funcs public and introspectible
https://bugzilla.gnome.org/show_bug.cgi?id=692679
2013-02-05 23:54:13 -05:00
Adel Gadllah
9a57626556 meta-window-actor: Change unredirection hints to match spec changes
Change the bypass / dont_bypass compositor code to match the latest
spec.

https://bugzilla.gnome.org/show_bug.cgi?id=693064
2013-02-03 14:29:45 +01:00
Florian Müllner
4d9d66da65 window: Add set_icon_geometry() method
Using a public method for setting the (cached) icon geometry rather
than accessing the struct members directly allows setting the icon
geometry from extensions.

https://bugzilla.gnome.org/show_bug.cgi?id=692997
2013-02-01 15:08:48 +01:00
Florian Müllner
30bdadb519 window: Cache _NET_WM_ICON_GEOMETRY
Rather than doing a server round trip each time when retrieving the
icon geometry, use the existing property mechanism to cache it.

https://bugzilla.gnome.org/show_bug.cgi?id=692997
2013-02-01 15:08:38 +01:00
Florian Müllner
c388ccf477 window: Fix get_icon_geometry() annotation
gjs has had support for (out) parameters for quite some time now ...

https://bugzilla.gnome.org/show_bug.cgi?id=692997
2013-02-01 15:08:36 +01:00
Jasper St. Pierre
df15843407 Use meta_window_located_on_workspace() in more places
https://bugzilla.gnome.org/show_bug.cgi?id=691744
2013-01-18 15:45:05 -05:00
Jasper St. Pierre
d8eb47e2b7 window: Make meta_window_located_on_workspace() public
We have some code in gnome-shell that does the equivalent of:

    window.get_workspace() == workspace || window.is_on_all_workspaces();

which is a bit unwieldy. We already have a method in mutter,
so use that and document it.

https://bugzilla.gnome.org/show_bug.cgi?id=691744
2013-01-18 15:45:05 -05:00
Jasper St. Pierre
3a3be74e37 Remove some server calls for core devices
These were missed in the first porting.

https://bugzilla.gnome.org/show_bug.cgi?id=691363
2013-01-08 15:54:50 -05:00
Giovanni Campagna
6431abbc85 Check that the application is responding when activating a window
Currently, we ping windows only when attempting to delete them, but
if the application is not responding, we want to show the dialog
as soon as possible. Given that we cannot be passively notified that
the window stopped responding with the current X11 protocol, a good
workaround is to ping the window when activating it.
If the window stops responding while active, it is expected the user
will try to switch window or open the overview, and when coming back
he'll get the failure dialog.

https://bugzilla.gnome.org/show_bug.cgi?id=684340
2012-12-25 18:39:10 +01:00
Adel Gadllah
2a2ac52726 automaximize: Make it optional
Make automaximize optional by adding a gsetting "auto-maximize"
(defaults to true).

https://bugzilla.gnome.org/show_bug.cgi?id=680990
2012-12-25 13:37:22 +01:00
Giovanni Campagna
6111d3ee4a window: recompute modal dialog attached status when the window type changes
We want to maintain the invariant that an attached modal dialog is always
of type MODAL_DIALOG, so recompute is_attached_dialog() when the window
type changes.

https://bugzilla.gnome.org/show_bug.cgi?id=690454
2012-12-18 23:18:58 +01:00
Adel Gadllah
3876a1a192 Support bypass compositor hints
Add support for _NET_WM_BYPASS_COMPOSITOR and _NET_WM_DONT_BYPASS_COMPOSITOR
as proposed here: https://mail.gnome.org/archives/wm-spec-list/2012-February/msg00010.html

https://bugzilla.gnome.org/show_bug.cgi?id=683020
2012-12-18 19:02:34 +01:00
Jasper St. Pierre
774ceec243 Select for XI2 events everywhere else
In random places that are not grabs, we selected for events on
things like the root window, stage window, COW and more. Switch
these over to using the proper XI2 APIs.

https://bugzilla.gnome.org/show_bug.cgi?id=688779
2012-12-13 17:14:06 -05:00
Jasper St. Pierre
c1b8e0ac8f display: Use XInput2 to grab the pointer
As calling XIGrabDevice multiple times will change it, just
drop the XChangeActivePointerGrab path and just go down the
XIGrabPointer path always.

https://bugzilla.gnome.org/show_bug.cgi?id=688779
2012-12-13 17:14:06 -05:00
Jasper St. Pierre
c90765370d window: Pass the grab timestamp when updating the resize grab
Since XChangeActivePointerGrab doesn't have a direct equivalent
in XI2, we need to make sure we don't re-grab with a newer
tiemstamp.
2012-12-13 17:06:00 -05:00
Jasper St. Pierre
1d827049d6 Port mutter to use XInput2 events instead of Core Events
Mechanically transform the event processing of mutter to care
about XI2 events instead of Core Events. Core Events will be left
in the dust soon, and removed entirely.

https://bugzilla.gnome.org/show_bug.cgi?id=688779
2012-12-13 14:56:25 -05:00
Jasper St. Pierre
881d256ce0 window: Move grab op sync handling code out
This removes some duplicate event type checks, and will make
the code cleaner in the future when we want to make the grab_op_event
handler take an XIDeviceEvent directly.

Based on a patch by Owen Taylor <otaylor@fishsoup.net>

https://bugzilla.gnome.org/show_bug.cgi?id=688779
2012-12-13 14:56:24 -05:00
Jasper St. Pierre
9d904f9a85 Increase typical icon size to 96
Since we want nice alt-tab applications for gnome-shell, we should up the
limit to 96. In the future, we probably want to get rid of the icon-cache,
and allow looking up a correctly sized icon directly from the window.

To prevent app breakage, set the legacy WM_HINTS pixmap size directly to
32x32.

https://bugzilla.gnome.org/show_bug.cgi?id=689651
2012-12-09 20:44:13 -05:00
Florian Müllner
2cc0d31b17 window: Avoid spurious focus-window changes when showing desktop
When using the show-desktop shortcut with no desktop window, unshowing
will focus the second-most-recently-used window. If we find a desktop
window, it will be focused explicitly and everything works as expected;
however without a desktop window, we end up hiding the focus window,
which will use focus_default_window() with the not_this_one parameter
to move focus away. We used to get away with this, as the not_this_one
parameter was ignored until commit e257580b94, now with bug 675982
fixed, we need to explicitly handle the show-desktop case.

https://bugzilla.gnome.org/show_bug.cgi?id=686928
2012-10-26 15:52:32 +02:00
Jasper St. Pierre
7a2c019514 window: Don't move the desktop window after monitor hotplug
If someone plugs in a new monitor, while all their regular windows
should move in absolute X coordinates to ensure they stay on the
same monitor, the desktop window should stay put.

https://bugzilla.gnome.org/show_bug.cgi?id=681159
2012-10-07 13:23:04 -03:00
Florian Müllner
10d53fc7d2 window: Do not restore tiling on unmaximize
When we consider tiling a special case of maximization, it makes
more sense to always unmaximize to the normal state rather than
restoring a previous tile state.

https://bugzilla.gnome.org/show_bug.cgi?id=677565
2012-07-16 22:18:47 +02:00
Florian Müllner
eb1292ea99 window: Handle changes of the attach-modal-dialogs preference
Currently we decide whether a modal dialog should be attached or not
when mapping it, i.e. we don't pick up preference changes that happen
while the dialog is up. It's not really a big deal given that modal
dialogs are usually transitory, but it's easy enough to add a bit of
extra polish ...

https://bugzilla.gnome.org/show_bug.cgi?id=679904
2012-07-16 22:15:13 +02:00
Florian Müllner
0fe0534c85 constraints: Center modal dialogs on their parent
... rather than attaching them to the parent's title bar.

https://bugzilla.gnome.org/show_bug.cgi?id=674499
2012-07-14 03:30:56 +02:00
Florian Müllner
0a50488bef window: Also use hide-titlebar-when-maximized when tiled
Side-by-side tiling is conceptually very close to maximization
("half-maximized"), so it makes sense to also hide the titlebar
in this state if requested by the application.

https://bugzilla.gnome.org/show_bug.cgi?id=679290
2012-07-03 12:21:54 +02:00
Giovanni Campagna
f65b7c59d3 Make it possible to reimplement move-to-workspace keybindings from plugins
Export the necessary functions so that a plugin that wishes to do
so can reimplement those keybindings without loss of functionality.

https://bugzilla.gnome.org/show_bug.cgi?id=674104
2012-06-25 23:11:24 +02:00
Jasper St. Pierre
50bc4ad0e1 Fix bad declarations
meta_screen_get_current_monitor now returns an integer, not a pointer.
2012-06-11 10:13:43 -04:00
Tim L
4595209346 screen: Add new public meta_screen_get_current_monitor API
Similar to meta_screen_get_primary_monitor, this returns a monitor index.
The monitor that the pointer is on. The previous private implementation
has been renamed to meta_screen_get_current_monitor_info.

https://bugzilla.gnome.org/show_bug.cgi?id=642591
2012-06-08 23:06:46 -04:00
Florian Müllner
49400657ca stack: Ignore keep-on-top property on maximized windows
It is impossible to switch to other windows when keep-on-top is set
for maximized windows; given that keep-on-top is only ever useful
to keep a window visible while focusing a different window, the
current behavior is pointless. So ignore keep-on-top while a window
is maximized.

https://bugzilla.gnome.org/show_bug.cgi?id=673581
2012-05-30 15:01:57 +02:00
Jasper St. Pierre
a78fec7951 window: Remove setting of an unused variable
Well, technically it's used, but only in one block, so let's
just make it scoped to that block.

https://bugzilla.gnome.org/show_bug.cgi?id=674876
2012-05-01 18:21:17 -04:00
Owen W. Taylor
c669a3892e meta_window_move_frame(): fix crash when frame is NULL
When meta_frame_calc_borders() was made to take a NULL frame argument,
a crash was accidentally introduced into meta_window_move_frame().

This partially reverts 8c1b2d5.

https://bugzilla.gnome.org/show_bug.cgi?id=675254
2012-05-01 13:44:35 -04:00
Javier Jardón
c64188c67f core/window.c: Remove unused unmap_frame() function 2012-04-26 11:54:31 +01:00
Javier Jardón
4c2371f2e7 Revert "core/window.c: Remove unused function"
This reverts commit ff6c31dcc0.
2012-04-26 11:54:12 +01:00
Javier Jardón
ff6c31dcc0 core/window.c: Remove unused function 2012-04-26 11:29:24 +01:00
Jasper St. Pierre
2d6555ca4d prefs: Remove live-hidden-windows preference
The preference existed, even though it was hard-coded to true. Just
remove it for good.

https://bugzilla.gnome.org/show_bug.cgi?id=671104
2012-04-24 16:40:47 -04:00
Jasper St. Pierre
044d58951e Switch to gtk-doc syntax
https://bugzilla.gnome.org/show_bug.cgi?id=673752
2012-04-24 15:20:39 -04:00
Owen W. Taylor
93d06d4368 Don't try to auto-maximize not-maximizable windows
Starting the auto-maximize process on a window like a
META_WINDOW_DESKTOP window that is not maximizable gets placement into
a confused state and eventually results in the window being positioned
at the wrong position (the position that an auto-maximized window would
be restored to.)

https://bugzilla.gnome.org/show_bug.cgi?id=673566
2012-04-05 14:53:11 -04:00
Rui Matos
f16f47bd38 Revert "window: Stop a gcc warning"
This reverts commit 335d211204 trying
not to trigger the uninitialized variable warning in gcc.
2012-03-19 00:32:34 +01:00
Jasper St. Pierre
335d211204 window: Stop a gcc warning
"warning: 'match_tile_mode' may be used uninitialized in this function", it
complains. It thinks it's not unused because of other values of
window->tile_mode, but other complex logic ensures that it can't be
META_TILE_MAXIMIZED, so this is a safe commit.
2012-03-17 16:59:09 -04:00
Jasper St. Pierre
7f64d6b92e window: Disallow maximization for windows that can't be maximized
Windows that have minimum widths larger than the screen can't be maximized,
even though we put them in a maximized state and allow users to do so:
the window just won't change size and position. Fix this by simply not giving
the option to maximize, like what happens for non-resizable windows.

https://bugzilla.gnome.org/show_bug.cgi?id=643606
2012-03-17 06:40:55 -04:00
Jasper St. Pierre
8c1b2d5eda Simplify the frame testing logic in callers to grab borders
A lot of code did something similar to:

  MetaFrameBorders borders;

  if (window->frame)
    meta_frame_calc_borders (window->frame, &borders);
  else
    meta_frame_borders_clear (&borders);

Sometimes, the else part was omitted and we were unknowingly using
uninitalized values for OR windows. Clean this up by just testing
for a NULL frame in meta_frame_calc_borders and clearing for the
caller if so.

https://bugzilla.gnome.org/show_bug.cgi?id=643606
2012-03-17 06:40:54 -04:00
Jasper St. Pierre
578b1c06c7 window: Fix meta_window_get_workspaces when a window isn't on a workspace
Since we're going to be evaluating the work area at startup now, we need
to make sure that we don't iterate over workspaces before they're assigned.
The easiest way to do this is to make sure that meta_window_get_workspaces
doesn't crash.

https://bugzilla.gnome.org/show_bug.cgi?id=643606
2012-03-16 21:01:48 -04:00
Rui Matos
2926323a9a window: Introduce meta_window_get_tile_match()
Returns the matching tiled window. This is the topmost tiled window in a
complementary tile mode that is:

 - on the same monitor;
 - on the same workspace;
 - spanning the remaining monitor width;
 - there is no 3rd window stacked between both tiled windows that's
   partially visible in the common edge.

https://bugzilla.gnome.org/show_bug.cgi?id=643075
2012-03-16 19:12:05 +01:00
Adel Gadllah
f2f500836e Automaximize large windows on map
Windows that start up in a size that is almost as big as the workarea create
extra work for the user (resizing or maximizing) so save the user's time by
detecting such windows and automaximize them.

https://bugzilla.gnome.org/show_bug.cgi?id=671677
2012-03-15 22:03:00 +01:00
Adel Gadllah
c39998efee Don't unmaximize to nearly maximized size
Basically we don't really want to create windows that are almost maximized in
size but not actually maximized. This creates work for the user and makes it
very difficult to use and resize manually.

So set the newly unmaximized window size to the previously used size or 80% of the
size of the current workarea (attempting to retain natural aspect ratio if
possible), whichever is smaller.

https://bugzilla.gnome.org/show_bug.cgi?id=671677
2012-03-15 22:02:54 +01:00
Rui Matos
860c2a6282 window: Remove prefs listener in _unmanage instead of _finalize
After _unmanage the object is semantically dead even if technically it's not,
so remove the prefs listener here to prevent it being called for a dead
object.

In particular this fixes a crash when starting up gnome-shell with at least
one gimp utility window opened which causes mutter to create a MetaWindow for
it only to immediately get an UnmapNotify afterwards which causes mutter to
unmanage the MetaWindow. Afterwards prefs_changed_callback is called for this
dead MetaWindow and tries to dereference the window->monitor pointer which is
already NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=671087
2012-03-01 10:22:21 +01:00
Jasper St. Pierre
01c363bb6a Use a META_ prefix for enum types, not MUTTER_ 2012-02-23 16:39:28 -05:00
Jasper St. Pierre
c47039db82 window: Fix meta_window_move_frame in the context of the new invisible borders
https://bugzilla.gnome.org/show_bug.cgi?id=659643
2012-02-16 16:46:10 -05:00
Ryan Lortie
1772a2a59c adjust to new Gtk properties for app menu
https://bugzilla.gnome.org/show_bug.cgi?id=668118
2012-01-18 17:26:12 -05:00
Florian Müllner
9729a99ec5 window: Support GTK+'s hide-titlebar-when-maximized hint
For maximized windows, titlebars cannot be used to reposition or
scale the window, so if an application does not use it to convey
useful information (other than the application name), the screen
space occupied by titlebars could be put to better use.
To account for this use case, a setting for requesting that windows'
titlebars should be hidden during maximization has been added to
GTK+, add support for this in the window manager.

https://bugzilla.gnome.org/show_bug.cgi?id=665617
2011-12-15 16:37:20 +01:00
Ryan Lortie
e4ed433e18 Add _DBUS_UNIQUE_NAME and _OBJECT_PATH properties
https://bugzilla.gnome.org/show_bug.cgi?id=664851
2011-12-15 10:21:22 -05:00
Colin Walters
8ab5cc8f19 Load _DBUS_APPLICATION_ID property, expose it via API
This is used to associate GtkApplication -> X window, and will
be consumed by gnome-shell.

https://bugzilla.gnome.org/show_bug.cgi?id=664851
2011-12-15 10:12:31 -05:00
Jasper St. Pierre
3a4512cd91 Use generic marshaller
https://bugzilla.gnome.org/show_bug.cgi?id=662153
2011-12-13 19:53:57 -05:00
Florian Müllner
baeb9fbc4b window: Make meta_window_can_tile_side_by_side() public
In order to support keybindings for window tiling, we need to
determine whether a window is tilable or not, so make this public.

https://bugzilla.gnome.org/show_bug.cgi?id=648700
2011-12-12 11:55:51 +01:00
Florian Müllner
c3d76aead6 window: Relax restrictions for can_tile_maximized ()
The current code requires windows to be resizable to be considered
for tiling, which excludes all maximized/tiled windows. While this
restriction concurs with the desired behavior for edge-tiling, it
feels overly restrictive for keybindings.
As the edge-tiling code in update_move() already ensures the above
restriction, it seems save to remove it from the can_tile_maximized()
function, assuming that windows that are not meant to be tiled or
maximized won't provide a maximize function.

https://bugzilla.gnome.org/show_bug.cgi?id=648700
2011-12-12 11:55:51 +01:00
Florian Müllner
bed9cb1648 window: Keep track of the last full-maximization state
In order to be able to toggle between tiled and normal/maximized
states, we need to keep track of the last full maximization state.

https://bugzilla.gnome.org/show_bug.cgi?id=648700
2011-12-12 11:55:50 +01:00
Florian Müllner
4ca552785f window: Queue a frame redraw after tiling
Usually tiling involves a size change and the frame is redrawn
automatically, however this is not the case when switching directly
between left- and right-tiled.
Ensure that a redraw happens in that case as well.

https://bugzilla.gnome.org/show_bug.cgi?id=648700
2011-12-12 11:55:50 +01:00
Florian Müllner
497f9be61e window: Listen for pref changes
The workspaces-only-on-primary preference changes how windows are
displayed, so listen for pref changes and update the visibility
accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=664853
2011-11-26 11:34:03 +01:00
Florian Müllner
d0910da036 Port preferences to GSettings
Move preferences to GSettings, using mainly shared schemas from
gsettings-desktop-schemas.

Unlike GConf, GSettings support is not optional, as Gio is already
a hard dependency of GTK+.

https://bugzilla.gnome.org/show_bug.cgi?id=635378
2011-11-11 20:26:38 +01:00
Rui Matos
6e47f0e846 window: add _NET_WM_STATE_FOCUSED hint to _NET_WM_STATE
This hint reflects whether a window appears focused.

https://bugzilla.gnome.org/show_bug.cgi?id=661427
2011-11-08 19:19:32 +00:00
Tim Cuthbertson
4fb2fab7f7 window.c: add meta_window_move_resize_frame
meta_window_move_resize_frame operates much like
meta_window_move_resize, but ensures the window
and its frame (if present) will fit within the
specified dimensions.

https://bugzilla.gnome.org/show_bug.cgi?id=651899
2011-11-05 18:52:43 -04:00
Rui Matos
6aa4bfd060 tiling: do not tile if moving in snap mode
If we are moving in snap mode (shift pressed) we don't want to tile. We must
also cancel any pending tiling if snap mode is activated during the move drag.

https://bugzilla.gnome.org/show_bug.cgi?id=662270
2011-10-20 16:18:38 +01:00
Jasper St. Pierre
bb035fe6e0 window: Correct coordinates for the configure event
We should still correct the coordinates for withdrawn windows.
2011-10-17 21:53:58 -04:00
Rui Matos
138eb1e3b4 tiling: keep track of the monitor where a window was tiled
meta_window_get_current_tile_area() computes the area where the tiled window
should be based on the current pointer position but that's only meaningful
when the user is actually dragging the window.

When running the tiling constrain the pointer might be on other monitor and at
that point the window jumps to this other monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=642580
2011-10-18 02:40:36 +01:00
Owen W. Taylor
ba31ba4615 Update window->has_resize_func at the right time when unfullscreening
Since the frame window size that meta_window_move_resize() uses depends
on whether the window has horizontal/vertical resize functionality, we
need to update this flag before we resize the window.

https://bugzilla.gnome.org/show_bug.cgi?id=659854
2011-10-17 15:08:00 -04:00
Owen W. Taylor
f94f008ed6 window.c: use a consistent mapping from frame_type => decorated
If a window had a type hint intended for override-redirect windows
like NOTIFICATION, we ended up with a window that was decorated but
with a frame type of FRAME_TYPE_LAST, causing assertion failures.
Fix this by making recalc_window_features() just call
meta_window_get_frame_type().

https://bugzilla.gnome.org/show_bug.cgi?id=599988
2011-10-17 11:58:10 -04:00
Jasper St. Pierre
c4692b8d51 window: Fix _NET_FRAME_EXTENTS to work properly
_NET_FRAME_EXTENTS should contain the difference between where a window asked
to be placed, and where it is. Ideally, this should be the same as the visible
extents.

https://bugzilla.gnome.org/show_bug.cgi?id=659848
2011-09-24 13:21:25 -04:00
Jasper St. Pierre
764569eb7a window: Fix window placement to exclude invisible borders
A window can specify geometry that it is placed at. We need to exclude invisible
borders when calculating where to place the window, otherwise the window will have
a strange offset.

https://bugzilla.gnome.org/show_bug.cgi?id=659848
2011-09-24 13:21:25 -04:00
Alexander Larsson
19b6888ea5 When monitors change, keep windows on same output.
If XRANDR is availible, we track the first (or primary) output per
crtc (== xinerama monitor) so when the monitors change we can try
to find the same output and move windows there. If we can't find the
original monitor in the new set (or XRANDR is not supported) we move
the window to the primary monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=645408
2011-09-14 15:38:55 +02:00
Rui Matos
7223c4e184 window: remove warning about _NET_WM_MOVERESIZE's lack of timestamps
The comments in the code about the protocol's inadequacies are enough, there's
no need to spam our standard outputs.
2011-09-12 18:46:47 +01:00
Dan Winship
2be1574e55 window: only attach dialogs to NORMAL, DIALOG, and MODAL_DIALOG windows
Attaching dialogs to unusual windows (like the desktop) looks bad, so
don't do it.

https://bugzilla.gnome.org/show_bug.cgi?id=646761
2011-08-27 13:12:25 -04:00