1
0
Fork 0
Commit graph

4388 commits

Author SHA1 Message Date
Jasper St. Pierre
a8df208a5c window-x11: Keep flags where they're used
Just a simple code cleanup
2014-05-28 11:43:11 -04:00
Jasper St. Pierre
f3f3c94831 frame: Don't reset window->rect 2014-05-28 10:50:23 -04:00
Jasper St. Pierre
6e06648f7a window: Refactor all move/resize operations to be in frame rect space
For Wayland, we want to have everything possible in terms of the frame
rect, or "window geometry" as the Wayland protocol calls it, in order
to properly eliminate some flashing when changing states to fullscreen
or similar.

For this, we need to heavily refactor how the code is structured, and
make it so that meta_window_move_resize_internal is specified in terms
of the frame rect coordinate space, and transforming all entry points
to meta_window_move_resize_internal.

This is a big commit that's hard to tear apart. I tried to split it
as best I can, but there's still just a large amount of changes that
need to happen at once.

Expect some regressions from this. Sorry for any temporary regression
that this might cause.
2014-05-27 15:44:34 -04:00
Jasper St. Pierre
afb41f715b core: Make META_CORE_GET_FRAME_RECT return the "frame rect"
We have two different coordinate spaces here. One is the rectangle
returned by meta_window_get_frame_rect, which is called the "frame
rect" or "the window geometry", which includes visible frame borders
but not invisible frame borders. The other is "frame->rect" which
corresponds to the frame's server geometry. That is, it includes
both visible and invisible frame borders.

These two were of course the same until we introduced invisible
frame borders, and an executive decision was made to make
meta_window_get_frame_rect return the rectangle bounding the
visible portions of the frame.

As time went on, the "frame rect" turned out to be more useful when
making decisions upon, since the user often doesn't think about the
invisible window geometry as part of the window.

We already calculate what amounts to the "frame rect" in the theme
code, so just change META_CORE_GET_FRAME_RECT to consume that
directly.
2014-05-27 15:44:33 -04:00
Jasper St. Pierre
19d26dde92 core: Convert GET_FRAME_WIDTH / GET_FRAME_HEIGHT to GET_FRAME_RECT
Since we're going to be calling meta_window_get_frame_rect in here
soon, I'd rather it be one method call, rather than two. We can't
put it at the toplevel, since that might cause infinite recursion
(e.g. meta_core_get calls meta_window_get_frame_rect calls
meta_ui_get_frame_borders calls meta_core_get, ...)
2014-05-27 15:44:33 -04:00
Jasper St. Pierre
4acb902423 window: Correct the anchoring of drag moving / resizing
Now that meta_window_move_resize and friends act in frame rect
coordinates, we need to convert the initial grab_anchor_window_pos
storage to be in frame rect coordinates as well.
2014-05-27 15:44:33 -04:00
Jasper St. Pierre
626516d12e window: Remove meta_window_move as well
Move to meta_window_move_frame everywhere...
2014-05-27 15:44:33 -04:00
Jasper St. Pierre
1c94df2553 window: Replace meta_window_resize_with_gravity with a frame-rect variant
More low-hanging fruit for our window geometry cleanups...
2014-05-27 15:44:33 -04:00
Jasper St. Pierre
266166a2d6 window: Make meta_window_unmaximize_with_gravity internal 2014-05-27 15:15:57 -04:00
Jasper St. Pierre
3a0af0faae window: Add a meta_window_get_titlebar_rect 2014-05-27 15:15:56 -04:00
Jasper St. Pierre
0890eaa3fe window: Rename get_geometry to get_session_geometry 2014-05-27 15:15:56 -04:00
Jasper St. Pierre
d4058d947b window: Remove meta_window_get_rect
It's a bad API that returns weird results you wouldn't expect.
2014-05-27 15:15:41 -04:00
Jasper St. Pierre
b704659899 backend: Add an XIWarpPointer wrapper
This makes Alt+F7 / Alt+F8 work respectively under X11 nested mode.
For the native backend implementation, we'll need a special Clutter
function, so don't implement that for now.
2014-05-27 14:28:35 -04:00
Florian Müllner
0a9187a6e9 window: Add accessor method for gtk_theme_variant
This is useful information for UI associated with a window, so add
a corresponding method.

https://bugzilla.gnome.org/show_bug.cgi?id=730752
2014-05-27 19:40:06 +02:00
Florian Müllner
31db32e826 Actually implement opening the app menu
The last commit added support for the "appmenu" button in decorations,
but didn't actually implement it. Add a new MetaWindowMenuType parameter
to the show_window_menu () functions and use it to ask the compositor
to display the app menu when the new button is activated.

https://bugzilla.gnome.org/show_bug.cgi?id=730752
2014-05-27 19:40:06 +02:00
Florian Müllner
c2ea650b3c Add support for app-menu button in window decorations
We want to synchronize the button layouts of our server side
decorations and GTK+'s client side ones. However each currently
may contain buttons not supported by the other, which makes this
unnecessarily tricky.
So add support for a new "appmenu" button in the layout, to display
the fallback app menu in the decorations.

https://bugzilla.gnome.org/show_bug.cgi?id=730752
2014-05-27 19:40:05 +02:00
Jasper St. Pierre
969131f00e core: Reindent 2014-05-27 13:25:25 -04:00
Jasper St. Pierre
c98090c061 constraints: Remove improper frame_rect_to_client_rect for placement
Constriants are now in frame rect coordinates.
2014-05-26 13:27:54 -04:00
Jasper St. Pierre
3168d3b5e6 window: Move the extents storage above the rects
So all the rects are grouped together.
2014-05-24 20:47:56 -04:00
Jasper St. Pierre
efcd7d86e7 wayland: Add support for show_window_menu 2014-05-24 15:56:04 -04:00
Florian Müllner
04449923bd Remove MetaMenuIconType
Unused since 2006, quick, before we hit the 10-year mark!
2014-05-23 20:45:55 +02:00
Jasper St. Pierre
47b3336ffa monitor-manager-xrandr: Make sure to XFlush the XUngrabServer
Otherwise, the server may not receive our request, meaning that
we'll hang onto the server grab forever.
2014-05-22 17:39:46 -04:00
Jasper St. Pierre
0f37c1b58e keybindings: Replace the incomprehensible set of flags with a gravity param 2014-05-22 16:09:14 -04:00
Jasper St. Pierre
a3747725ed window-wayland: Don't use meta_window_get_position 2014-05-22 15:47:30 -04:00
Jasper St. Pierre
c448650a60 keybindings: Correct move_to_corner_backend
meta_window_get_position() returns the client rect position, which
we then pass to meta_window_move_frame. Just use the existing frame
rect coordinates.
2014-05-22 15:47:30 -04:00
Jasper St. Pierre
c45f616fdc keybindings: Fix code style 2014-05-22 15:47:30 -04:00
Jasper St. Pierre
9402691aaa window-x11: Remove a use of meta_window_get_position 2014-05-22 15:47:29 -04:00
Jasper St. Pierre
cbffbb0be0 window: Rename the requested_rect to the unconstrained_rect
The requested_rect is a strange name for it, because it's not actually
the rect that the user or client requested all the time: in the case of
a simple move or a simple resize, we calculate some of the fields
ourselves.

To the MetaWindow subclass implementations, it just means "the rect
before we constrained it", so just use the name unconstrained_rect.
This also makes it match the name of the MetaWindow field.
2014-05-22 15:39:10 -04:00
Jasper St. Pierre
9df5b17940 window: Allow passing garbage window sizes for move-only actions
We'll just fix them up in meta_window_move_resize_internal.
2014-05-22 15:39:10 -04:00
Jasper St. Pierre
feae23506b window-x11: Move the comment about StaticGravity resizing down 2014-05-22 15:39:09 -04:00
Jasper St. Pierre
6408e59c7c wayland: Move checks for grabbing into a central location
This means that we won't have as much work to do to introduce similar
checks for touch.
2014-05-22 10:58:07 -04:00
Jasper St. Pierre
47d72680ff keybindings: Correct coords for window menu for CSD windows 2014-05-22 10:51:05 -04:00
Jasper St. Pierre
6513cbb470 Add back coordinates to the window menu
It looks weird to have Alt+Space pop up under the cursor instead
of the top-left corner of the window, and the Wayland request will
pass through the coordinates as well.

Add it to the compositor interface, and extend the
_GTK_SHOW_WINDOW_MENU ClientMessage to support it as well.
2014-05-22 10:50:57 -04:00
Jasper St. Pierre
50b81fe4b9 x11: Add support for a new _GTK_SHOW_WINDOW_MENU request
To show the window menu from a client-side decoration.
2014-05-21 18:55:47 -04:00
Florian Müllner
f38c1f6ab4 window: Fix delayed mouse mode on X
On X, basing the check whether the pointer is on the window on
Clutter events does not work, as the relevant events are handled
by GDK instead.
So add an X-specific window_has_pointer() implementation to also
fix mouse mode when running as X compositor.

https://bugzilla.gnome.org/show_bug.cgi?id=730541
2014-05-21 22:56:14 +02:00
Florian Müllner
f159611fab window: Fix delayed mouse mode
Using clutter_actor_has_pointer() to test whether the pointer is
on the window makes for clean and nice-looking code, but does not
work in practice - ClutterActor:has-pointer is not recursive, so
we miss when the pointer is on the associated surface actor rather
than the actor itself.
Instead, check whether the window actor contains the core pointer's
pointer actor, which actually works.

https://bugzilla.gnome.org/show_bug.cgi?id=730541
2014-05-21 22:56:14 +02:00
Jasper St. Pierre
f1a7231ac2 window: Remove another comment reference to StaticGravity 2014-05-21 13:20:10 -04:00
Jasper St. Pierre
21991a7edb window: Remove some overcomplicated uses of meta_window_move_resize
Replace them with meta_window_move_frame, since that's all we need
to do.
2014-05-21 13:15:49 -04:00
Jasper St. Pierre
3f1b6ddc8f window-x11: Rearrange locals a tiny bit 2014-05-21 13:03:39 -04:00
Jasper St. Pierre
aa84813400 window-x11: Calculate size_dx / size_dy before assigning to window->rect
This makes sure that we grow / shrink the frame and window in the
correct order.
2014-05-21 13:02:26 -04:00
Jasper St. Pierre
dd243813e1 window-x11: Simplify leftovers from the static gravity code removal 2014-05-21 12:52:44 -04:00
Jasper St. Pierre
d8c2933c58 window-x11: Don't bother calculating the actual deltas for the frame
It's not necessary. All we care about is whether the size / position
has changed.
2014-05-21 12:25:27 -04:00
Jasper St. Pierre
2b798511de window-x11: Consistently include the bottom border on shaded windows
We already do it in the theme code, but not the actual WM code. Since
we include the left/right borders, it only seems fair to include the
bottom border.

This effectively makes it so that shading a window means that the
client window "slot" has 0 height.
2014-05-21 12:21:05 -04:00
Jasper St. Pierre
6c37f6e601 window: Remove meta_window_resize
It's unused, and it's a poor API. resize_with_gravity and resize_frame
are better.
2014-05-21 12:16:56 -04:00
Jasper St. Pierre
92e9f3d467 window: Reindent slightly 2014-05-21 12:16:56 -04:00
Jasper St. Pierre
05419b8450 frame: Make sure to XSync before grabbing keybindings
Otherwise, the X server might read the backend's connection before
GTK+'s, meaning that it sees the XIGrabKeycode requests before the
CreateWindow.

This fixes keybindings on windows not working immediately.

Thanks to Rui Matos <tiagomatos@gmail.com> and
Julien Cristau <jcristau@debian.org> for helping track down the issue.
2014-05-21 11:29:36 -04:00
Jasper St. Pierre
e215c07439 window: Make border_width private to X11 2014-05-20 15:59:17 -04:00
Jasper St. Pierre
5b7dff7a57 window: Move constructors to the respective header files 2014-05-20 15:59:17 -04:00
Jasper St. Pierre
1a3aa75385 window: Move meta_window_wayland_new to window-wayland.c 2014-05-20 15:59:17 -04:00
Jasper St. Pierre
41880778b5 window-wayland: Change the state on grab op transitions
This could affect the RESIZING state.
2014-05-20 15:59:17 -04:00
Jasper St. Pierre
ecb4e09ec5 window-x11: Make sure to chain up in grab_op_began / ended
To make sure shaken_loose gets reset.
2014-05-20 15:59:16 -04:00
Jasper St. Pierre
d02505852d window: Move _NET_WM_DESKTOP setting to window-x11 2014-05-20 15:59:16 -04:00
Jasper St. Pierre
3941dc7537 core: Remove some unused meta_core_get requests 2014-05-20 15:59:16 -04:00
Jasper St. Pierre
e790c45303 place: Don't require checking for changing
The only time this can change is if find_first_fit returns TRUE,
at which point we already jump out.
2014-05-20 15:59:16 -04:00
Jasper St. Pierre
ae4e553ddb place: Move maximization path above first fit finding 2014-05-20 15:59:15 -04:00
Jasper St. Pierre
809568280b place: Simplify control flow and fix a crash 2014-05-20 15:59:15 -04:00
Jasper St. Pierre
4053c92abf Rework timestamp pinging
If a window temporarily goes unresponsive, and then returns later, we
should hide the kill dialog that we showed to the user.
2014-05-20 15:59:15 -04:00
Jasper St. Pierre
56906a29e0 window: Make propagate_focus_appearance internal to MetaWindow
It's an internal helper function. The public interface is
meta_window_activate or meta_window_focus.
2014-05-20 15:59:15 -04:00
Jasper St. Pierre
2c0ad5bef7 window: Replace the user_rect with the unconstrained_rect
Realistically, the user rect contains the unconstrained window
rectangle coordinates that we want to be displaying, in case
something in the constraints change.

Rename it to the "unconstrained_rect", and change the code to always
save it, regardless of current state.

When metacity was originally being built, the purpose of the user
rect was a lot less clear. The code only saved it on user actions,
with various other calls to save_user_window_placement() and a force
mechanism sprinkled in to avoid windows being snapped back to odd
places when constraints changed.

This could lead to odd bugs. For instance, if the user uses some
extension which automatically tiles windows and didn't pass
user_action=TRUE, and then the struts changed, the window would be
placed back at the last place a user moved it to, rather than where
the window was tiled to.

The META_IS_USER_ACTION flag is still used in the constraints code
to determine whether we should allow shoving windows offscreen, so
we can't remove it completely, but we should think about splitting
out the constrainment policies it commands for a bit more
fine-grained control.

https://bugzilla.gnome.org/show_bug.cgi?id=726714
2014-05-20 15:59:14 -04:00
Rico Tzschichholz
4a7939268c build: Add org.freedesktop.login1.xml to EXTRA_DIST 2014-05-20 18:50:33 +02:00
Jasper St. Pierre
80266d3071 keybindings: Clean up code a tiny bit 2014-05-20 12:25:41 -04:00
Jasper St. Pierre
8e5cfccf49 Revert "launcher: Put in some markers to help diff make a readable patch"
The markers have fulfilled their purpose.
2014-05-19 15:09:23 -04:00
Jasper St. Pierre
dcf64ca167 launcher: Replace mutter-launch with logind integration
This uses David Herrmann's new logind sessions interface to retrieve
fds for input devices, rather than using a custom setuid helper to do
the management. This vastly simplifies the interface.

This requires systemd v210, at least.

https://bugzilla.gnome.org/show_bug.cgi?id=724604
2014-05-19 15:09:23 -04:00
Jasper St. Pierre
f93fc1506b launcher: Put in some markers to help diff make a readable patch 2014-05-19 15:09:22 -04:00
Jasper St. Pierre
4ee8fb8154 launcher: Pause Clutter during VT switches 2014-05-19 15:09:20 -04:00
Jasper St. Pierre
446b75907e launcher: Remove the "VT-switched lock"
We'll replace it by pausing the Clutter master clock.
2014-05-19 15:03:06 -04:00
Jasper St. Pierre
550f1989ff window: Complete moving enter/leave handling here 2014-05-19 15:03:05 -04:00
Rico Tzschichholz
91a6f42345 Drop leftover menu.h/metaaccellabel.h references
In addition to 8640982e68
2014-05-18 15:51:14 +02:00
Jasper St. Pierre
8640982e68 Convert window menus to a compositor implementation 2014-05-17 15:16:23 -04:00
Jasper St. Pierre
480a853263 x11: Add simple cursor renderer 2014-05-17 13:27:16 -04:00
Jasper St. Pierre
b05953d960 cursor: Add a META_CURSOR_NONE
This is for cases where we have a MetaCursorReference that does
not have an X cursor equivalent... we have to return something!
2014-05-17 13:27:16 -04:00
Jasper St. Pierre
3a0de6a4f1 cursor: Correct switching between fallback and backend cursors
When switching from the stage cursor to the native cursor, we
forgot to repaint the stage to get rid of the old cursor. Fix
this by having the abstract cursor renderer class track whether
we're using the backend, rather than doing chain-up shenanigans.
2014-05-17 13:27:15 -04:00
Jasper St. Pierre
fb9f22c02f cursor-renderer-native: Don't move the cursor when we don't need to 2014-05-17 10:58:49 -04:00
Jasper St. Pierre
10ac1000f7 cursor-renderer: We always use a MetaStage 2014-05-17 10:50:44 -04:00
Jasper St. Pierre
c81a0dede2 keybindings: Don't crash if we don't have any windows to activate
Pressing Alt+Tab when we have no windows should not crash your
desktop, especially when it's so easy to hit when trying to test
switching VTs.
2014-05-15 15:50:31 -04:00
Jasper St. Pierre
fc8a2b8a42 keybindings: Rename initial_selection to window
Since we removed the tabpopup, this name doesn't make much sense
anymore.
2014-05-15 15:50:31 -04:00
Jasper St. Pierre
2ae0a72dad wayland: Don't try to autostart gnome-session
It won't work.
2014-05-15 14:16:38 -04:00
Jasper St. Pierre
5b17c72047 backend: Create the cursor renderer after the monitor manager
The native cursor renderer needs to connect to the monitor manager's
signals.
2014-05-15 14:16:37 -04:00
Jasper St. Pierre
8d9653dece pointer: Update the button count after repicking
The default focus interface uses the button count to determine
whether we should update the pointer focused surface. When releasing
an implicit grab, we need to send the button release events to the
implicitly grabbed surface, so we can't reset the focus surface too
soon. We already explicitly set the focus at the end of implicit
grabs, so counting the buttons after is perfectly fine.
2014-05-15 13:59:28 -04:00
Jasper St. Pierre
e2b7b26f28 wayland: Use meta_window_move to position xdg_popup windows
This makes sure we set the user rect as well, which is necessary to
have things not "snap back" to weird locations.
2014-05-14 12:01:11 -04:00
Jasper St. Pierre
71544fbf4e display: Replace set_grab_op_cursor with update_cursor
Now that we don't have to regrab to change the cursor, since it's
simply the cursor on the root window, all we have to do is update
the cursor on the screen.
2014-05-14 09:20:49 -04:00
Jasper St. Pierre
c8f3820956 backend-x11: Always pass None for the cursor
This means we fall back to what's defined on the root window, which
will give us our properly set cursor.
2014-05-13 16:20:03 -04:00
Jasper St. Pierre
f57b0726a0 cursor-tracker: Remove the grab cursor
We expect that meta_screen_set_cursor while grabbed will properly
set the cursor on the root window. Make sure this works by simply
always using the root cursor when we have an active grab.
2014-05-13 16:20:03 -04:00
Jasper St. Pierre
da175bca52 cursor-tracker: Use a separate cursor for xfixes cursor tracking 2014-05-13 16:20:03 -04:00
Jasper St. Pierre
33cb7f4a2c wayland: Send a correct width / height for state changes
If we send out a configure notify for a window and then have some
other kind of state change, we need to make sure that we continue
to send out that new size, rather than the last size the client
sent us a buffer for.

In particular, a client might give us a 250x250 buffer and then
immediately request fullscreen. We send out a configure for the
monitor size and a state that tells it it's full-screen, but then
it takes focus, and since the client hasn't sent us a buffer for
the new size, we tell it it's fullscreen at 250x250.

Fix this.
2014-05-12 18:25:24 -04:00
Jasper St. Pierre
7732447abc wayland: Update to latest xdg-shell protocol 2014-05-12 18:25:23 -04:00
Jasper St. Pierre
c49c37999c wayland: Move appears-focused changed handling to window-wayland 2014-05-12 18:25:19 -04:00
Jasper St. Pierre
91f35d6a01 wayland: Use standard SINCE version definitions 2014-05-12 17:01:00 -04:00
Jasper St. Pierre
4334135c52 events: Make sure to reset current_time after handling events
Otherwise, we'll have a stale value leftover in current_time that
won't be reset until the next event.
2014-05-09 11:51:28 -04:00
Jasper St. Pierre
03c4de5590 events: Set display->current_time when we start processing the event
Otherwise, the time will be refetched during processing.
2014-05-09 11:51:28 -04:00
Jasper St. Pierre
7a109a18af events: Move window button handling to window.c
Look at how clean GCD is now!!!
2014-05-08 15:34:27 -04:00
Jasper St. Pierre
d9b72b0f43 events: Clean up event replay code 2014-05-08 15:30:09 -04:00
Jasper St. Pierre
a7ea54bd7d events: Swallow all events directly on windows
This is how the X11 mode works.
2014-05-08 15:28:06 -04:00
Jasper St. Pierre
df642b96e2 events: Replace a switch statement with a simple if test 2014-05-08 15:28:06 -04:00
Jasper St. Pierre
f56cc1f733 events: Remove extra check for certain grab op
We already explicitly test that there's no grab op right below.
2014-05-08 15:28:06 -04:00
Jasper St. Pierre
f5bff4b7f3 events: Move the overlay_key_only_pressed handling to keybindings.c
Now the switch statement is entirely about window operations.
2014-05-08 15:28:06 -04:00
Jasper St. Pierre
bbfdf5dd2a events: Move keybindings event handling out of the giant switch 2014-05-08 15:28:06 -04:00
Jasper St. Pierre
9b95eda42a events: Remove an unnecessary check 2014-05-08 15:28:06 -04:00
Jasper St. Pierre
2d225a3386 events: Don't check if we have the grab to raise / focus a window
It isn't necessary. As an X11 compositor, we'll only see the event
if we have the grab on the window, anyway.

This was causing issues moving windows as a Wayland compositor.
2014-05-08 14:19:22 -04:00
Jasper St. Pierre
7b3cdc8f96 display: Correct check for grab_window_buttons
When we're a Wayland compositor, we get all the events, no exceptions,
so we don't need to grab.

This was masking focusing and raising issues under nested that showed
up under native.
2014-05-08 14:19:22 -04:00