1
0
Fork 0
Commit graph

163 commits

Author SHA1 Message Date
Jonas Ådahl
7c2e926c44 core/core: Remove meta_retheme_all() helper
All it did was get the MetaDisplay and call a function on it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/854
2019-10-15 07:17:29 +00:00
Robert Mader
a8155a0471 meta: Add META namespace to macros
To silence warnings during GIR generation.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/822
2019-10-14 10:14:11 +00:00
Niels De Graef
1c6ea5d1db Use a consistent style for enum braces
https://gitlab.gnome.org/GNOME/mutter/merge_requests/361
2019-02-28 09:31:01 +01:00
Florian Müllner
de76074336 ui: Remove fallback app menu
The app menu is in the process of being retired[0], and the shell
stopped displaying it while applications are in the process of
dropping it. It therefore doesn't make sense to always show a
fallback menu in server-side decorations, applications that still
set the menu can rely on GTK+'s own fallback instead.

[0] https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement

https://gitlab.gnome.org/GNOME/gnome-shell/issues/624
2019-01-30 18:39:42 +00:00
Florian Müllner
d5a7bbd094 Fix builds with G_DISABLE_ASSERT
Commit 25f416c13d added additional compilation warnings, including
-Werror=return-type. There are several places where this results
in build failures if `g_assert_not_reached()` is disabled at compile
time and the compiler misses a return value.

https://gitlab.gnome.org/GNOME/mutter/issues/447
2019-01-25 09:43:06 +01:00
Jonas Ådahl
2f4a68c8c3 Clean up include macros mess
The order and way include macros were structured was chaotic, with no
real common thread between files. Try to tidy up the mess with some
common scheme, to make things look less messy.
2018-11-06 17:17:36 +01:00
Olivier Fourdan
473bf38753 frames: Allow for unknown mouse buttons
Commit 47131b1d ("frames: Handle touch events") introduced an assert to
make sure that all mouse button actions are handled in mutter.

However, mice can have a more than 5 buttons, so simply ignore the
"other" actions instead of aborting.

Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/160
2018-05-25 09:20:36 +00:00
Carlos Garnacho
ac20bf2000 frames: Handle touch events
This is just done on wayland as it'll break horribly on X11, we let
this happen through pointer emulated events in XISelectEvents evmask
instead.

Some things had to be made slightly more generic to accomodate touch
events. The MetaFrames shall lock onto a single touch at a time, we
don't allow crazy stuff like multi-window drag nor multi-edge resizes.

https://bugzilla.gnome.org/show_bug.cgi?id=770185
2018-05-14 17:11:57 +01:00
Carlos Garnacho
3561082aba frames: Make 1st button/motion handlers take generic events
This will ease handling of touch events through these same handlers.

https://bugzilla.gnome.org/show_bug.cgi?id=770185
2018-05-14 13:44:03 +01:00
Marco Trevisan (Treviño)
4339b23dd0 theme, frames: Use surface device scale instead of cairo_scale
Gtk now is caching the themed cairo surfaces, then as per
commit gtk@e36b629c the surface device scale is used to figure
out the current paint scaling.

Without this when using background-image's for window buttons
the -gtk-scaled icons isn't properly resized.

Fixes #99
2018-04-20 14:38:57 +00:00
Florian Müllner
00a5db71cf window: Allow resizing of tiled windows
Currently tiled windows are not resizable and their size is fixed
to half the screen width. Adjust the code to work with fractions
other than half, and allow users to adjust the split by dragging
the window edge that is not constrained by a monitor edge.

Follow-up patches will improve on that by resizing neighboring
tiled windows by a shared edge, and making the functionality
available to client-side decorated windows implementing the
new edge constraints protocol.
2017-10-03 19:38:31 -03:00
Shantanu Goel
3a374a6db5 frames: use correct variable in for loop assignment
update_context_styles is using the wrong variable when advancing
to the next key in the hash table which can cause an infinite
loop if # of variants is ever greater than 1.

This problem was originally reported here:

https://github.com/linuxmint/Cinnamon/issues/5254

The following patch was commited in Mint:

https://github.com/linuxmint/muffin/commit/6120bdde

This patch is just a shorter version of the Mint patch
and they deserve all the credit for the idea.

https://bugzilla.gnome.org/show_bug.cgi?id=780254
2017-04-04 20:09:23 +02:00
Rui Matos
1f20e82a96 ui/frames: Simplify client area control computation
Ungrabbed pointer motion events over a client window area don't even
reach mutter in X compositor mode, but as a wayland compositor we
process those events which ends up in a call stack like:

- meta_window_handle_ungrabbed_event
 - meta_ui_frame_handle_event
  - handle_motion_notify_event
   - get_control
    - meta_ui_frame_calc_geometry

Computing frame geometry is a relatively CPU expensive operation and
doing it on every motion event over a client window is pointless work
since we aren't going to change the cursor or prelight any frame
widget.

This commit special cases the determination of
META_FRAME_CONTROL_CLIENT_AREA using a much faster method. When
continuously moving the pointer over an X (client) window, it results
in a ~40% decrease in mutter cpu usage.

https://bugzilla.gnome.org/show_bug.cgi?id=779436
2017-03-02 19:40:27 +01:00
Jonas Ådahl
cd225c4e19 Always use the default screen
GDK doesn't support multiple screens, so effectively we don't either.
Lets stop pretending we do.

This fixes a few -Wdeprecated warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=769070
2016-07-23 10:55:02 +08:00
Rui Matos
1d2bead358 ui/frames: Drop the current grab info on button release
This was added in commit d05b750b8d and
later removed inadvertently in commit
d561b3b18f .

https://bugzilla.gnome.org/show_bug.cgi?id=767969
2016-06-23 18:45:53 +02:00
Florian Müllner
a174c18fb5 frames: "Initialize" frame background
Frames are painted on the frame window according to the GTK+ theme.
Depending on the target's visual, this means either drawing over
a black destination or a fully transparent one. So in cases where
the theme doesn't paint decorations with full opacity, decorations
for windows with an rgba visual look different from those with a
non-rgba visual. Using an rgba visual for all frames independent
from the client's visual can potentially break clients, so our
only option for a consistent appearance is to explicitly initialize
the frame background to black before painting the theme's decoration
on top.

https://bugzilla.gnome.org/show_bug.cgi?id=745060
2016-06-23 16:47:51 +02:00
Florian Müllner
c61dfa71ed frames: Don't clip out "invisible" parts of frames
The GTK+ theme may draw parts of the decorations outside the actual
frame. Since commit f9db65f47f we make sure that the frame is big
enough to account for any overdrawing, however as we still clip the
cairo context to the actual frame before drawing the decorations,
those parts aren't actually painted.
This issue is not very obvious for most frames, as they use a non-rgba
visual where the unpainted parts appear black, which gives the expected
result with many themes once the shape mask is applied (as the mask does
include any overdrawn parts). For frames using an rgba visual however,
unpainted parts are transparent, so any overdrawn decorations are clearly
missing.
Fix this by only clipping out the client area when drawing decorations.

https://bugzilla.gnome.org/show_bug.cgi?id=745060
2016-06-23 16:47:51 +02:00
Florian Müllner
a809055470 theme: Update style context hierarchy (again)
GtkWindow actually uses two CSS nodes, 'window' and 'decoration'.
Simulate that by using two separate style contexts for the frame.
2016-02-04 15:13:23 +01:00
Alberts Muktupāvels
247909e161 frames: don't force dark theme to all windows
Use global theme variant only if window does not have _GTK_THEME_VARIANT
property. This allows applications to request default theme variant when
global dark theme is enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=761543
2016-02-04 16:02:21 +02:00
Alberts Muktupāvels
e5ce6192f4 frames: default theme variant now is set as empty string
Related change in GTK+:
https://git.gnome.org/browse/gtk+/commit/?id=8eb261988869608604c78ed90de5579beb4ef2b0

https://bugzilla.gnome.org/show_bug.cgi?id=761543
2016-02-04 15:54:26 +02:00
Rui Matos
e0906a77aa ui/frames: Don't focus if the button press is on the client area
This is a really old behavior introduced in commit
585e362526 which is inconsistent since
it only applies to SSD windows.

If we really want this, we should focus the window elsewhere so that
it applies consistently to all windows.

https://bugzilla.gnome.org/show_bug.cgi?id=756789
2016-01-05 20:42:02 +01:00
Florian Müllner
ffd95c2ad5 theme: Complete removal of "fringe" titlebar button support
We have been ignoring those buttons since 3.16 after they had been
broken in the default theme for a couple of versions. As nobody
appears to miss them, it's time to remove them for good.
2015-10-16 04:13:14 +02:00
Marek Chalupa
b97ebc4124 frames: handle META_FRAME_CONTROL_NONE on left click
We can get this operation in some cases, for example when
we're trying to resize window that cannot be resized.
This can occur with maximized windows that have a border
(without border we couldn't resize them by mouse in maximized state).
In this case we reached abort() beacuse we did not handle this op.

https://bugzilla.gnome.org/show_bug.cgi?id=751884
2015-07-15 07:45:02 -05:00
Florian Müllner
57c1078ee7 theme: Scale window decorations on HiDPI displays
As we opt out of GTK+/Clutter's HiDPI handling, we need to apply the
window scaling factor manually to decorations, both the geometry and
when drawing.

https://bugzilla.gnome.org/show_bug.cgi?id=744354
2015-03-17 17:09:48 +01:00
Jasper St. Pierre
cca68b31b1 frames: Refactor out another inner switch 2015-03-08 20:38:30 -07:00
Jasper St. Pierre
85452aff4f frames: Refactor control handling with a switch statement 2015-03-08 20:38:30 -07:00
Jasper St. Pierre
d9d83abae2 frames: Refactor frame button click handling code a title bit 2015-03-08 20:38:30 -07:00
Jasper St. Pierre
05353c1f7e frame: Don't redraw immediately when we resize
We're locked to frame sync anyway, so it doesn't make sense to try to
redraw early. In casual testing, this seems to actually make things
faster, as well.
2015-01-30 13:13:49 -05:00
Jasper St. Pierre
d561b3b18f frames: Clutterify frame event handling
This lets us remove our horrible X11-based, GDK-based hacky frame event
handling in favor of a more sane one in Clutter.
2015-01-19 21:56:08 -08:00
Jasper St. Pierre
ce14bde08d frames: Remove the destroy_event handler
It does nothing.
2015-01-19 21:52:41 -08:00
Florian Müllner
f71315eb1e frames: Fix window-type/frame-type mix-up
Commit 7e66d2a484 killed off META_CORE_GET_FRAME_TYPE, but got
the replacement wrong - MetaWindowType is an enum like MetaFrameType,
but the two are not interchangeable.

https://bugzilla.gnome.org/show_bug.cgi?id=742841
2015-01-13 18:14:26 +01:00
Jasper St. Pierre
87eb5f8632 frames: Simplify our frame title management
This fixes a number of crashers when they try to change their dialog
layout at runtime because we're too tricksy with the frame title.
2015-01-09 16:35:30 -08:00
Jasper St. Pierre
274ea76eea frames: Force on dark theme for all apps if the user requested it
If the user requested a dark theme for all apps through GNOME Tweak
Tool, go ahead and force it for all apps, not only GTK+3 apps.

Thanks to MaTachi on reddit who suggested the idea:

http://www.reddit.com/r/linux/comments/2r1zwj/linus_i_dont_know_who_thought_it_was_a_good_idea/cnc10ui
2015-01-02 09:21:14 -08:00
Jasper St. Pierre
34fbca0181 frames: Remove the easy one-liner meta_core_* wrappers 2015-01-01 12:02:53 -08:00
Jasper St. Pierre
4496fb4447 frames: Remove all other uses of meta_core_get
RIP.
2015-01-01 11:56:14 -08:00
Jasper St. Pierre
7e66d2a484 frames: Punch down META_CORE_GET_FRAME_FLAGS / TYPE
These can be fetched directly off of the MetaWindow.
2015-01-01 11:48:55 -08:00
Jasper St. Pierre
12135afa5e frames: Give Havoc and Owen a heart attack
Break down the beautiful core/ui abstraction barrier by inserting
a pointer to MetaWindow into a MetaUIFrame. I'm a scoundrel, I know.
We'll use this very soon to destroy meta_core_get.
2015-01-01 11:42:25 -08:00
Jasper St. Pierre
cac660a5bc frames: Remove shape_applied
It's also unused.
2015-01-01 11:42:20 -08:00
Jasper St. Pierre
dcce4e64bc frames: We don't need to pass in the frame rect to get_bounds either
The MetaFrameGeometry already has this information.
2015-01-01 11:42:13 -08:00
Jasper St. Pierre
4d3511649b frames: Don't pass the frame rect into get_mask
We can query it directly.
2015-01-01 11:19:35 -08:00
Jasper St. Pierre
d4ea2bbd9c frames: Don't pass the width/height as separate args to get_client_rect
We already have them in the fgeom.
2015-01-01 11:04:11 -08:00
Jasper St. Pierre
2ca4ed6b04 frames: Rename meta_frames_* to meta_ui_frame_* where appropriate 2014-12-31 22:52:50 -08:00
Jasper St. Pierre
a5ad89dd65 frames: Remove last_motion_frame
Nothing cares about it.
2014-12-31 22:46:48 -08:00
Jasper St. Pierre
8fdbae192a frame: Start converting over to direct usage of MetaUIFrame 2014-12-31 22:44:20 -08:00
Jasper St. Pierre
2413e672c8 frame: Put a MetaUIFrame* in our MetaFrame
This is a small start, but it lets us start to clean up this
UI split mess.
2014-12-31 22:43:00 -08:00
Jasper St. Pierre
c8432cc430 frames: Use an early return
To be more consistent with the rest of the code.
2014-12-31 22:43:00 -08:00
Jasper St. Pierre
015864da09 frames: Embed a pointer to MetaFrames inside MetaUIFrame
This removes the MetaFrames argument from our internal APIs.
2014-12-31 22:35:35 -08:00
Jasper St. Pierre
669c9da2a4 frames: Fix astonishing accidental pointer trickery
Whenever we added a frame to the GHashTable, we added the frame itself
as the value, and a pointer to its storage of the frame window XID,
as the key.

When we iterated over the hash table, we actually looked up the
MetaUIFrame in the key, which might seem extraordinarily wrong, but
eagle-eyed viewers might notice that the XID is the first field in
MetaUIFrame, so the key and value are actually the same pointer.

Changing the layout of MetaUIFrame at all causes this to go haywire,
so let's not do this and simply put the MetaUIFrame in the value,
as expected.
2014-12-31 22:35:35 -08:00
Jasper St. Pierre
4d1d8e831e frames: Revert the logic here when the frame type updates
When the frame type updates, we were doing something funky that
caused us to reset the title used for the text layout here. I can't
really think of any place that it would trigger, and in testing I
haven't hit this either, so let's just remove the fancy logic and
assert this.
2014-12-31 22:35:30 -08:00
Jasper St. Pierre
9e199e6350 frames: Pass MetaFrameType into ensure_layout
All the callers already have it, so don't make us fetch it again.
2014-12-31 22:35:29 -08:00