Commit Graph

25066 Commits

Author SHA1 Message Date
Carlos Garnacho
6f4c7d66a4 x11: Check wacom button flags to determine whether button is mode switch
Checking the leds is not really accurate, since some devices have mode
switch buttons without leds. Check in the button flags whether they are
mode switch buttons for any of ring/ring2/strip/strip2, and return the
appropriate group.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/952
2019-11-29 18:10:14 +00:00
Florian Müllner
c843102eec stack: Delegate layer calculation to a window vfunc
While most of the code to compute a window's layer isn't explicitly
windowing backend specific, it is in practice: On wayland there are
no DESKTOP windows(*), docks(*) or groups.

Reflect that by introducing a calculate_layer() vfunc that computes
(and sets) a window's layer.

(*) they shall burn in hell, amen!

https://gitlab.gnome.org/GNOME/mutter/merge_requests/949
2019-11-29 15:14:38 +01:00
Florian Müllner
b753213f9b window: Add get_default_layer() helper
Most of the layer computation that the stack does actually depends
on the windowing backend, so we will move it to a vfunc.

However before we do that, split out the bit that will be shared.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/949
2019-11-29 15:14:38 +01:00
Florian Müllner
599d8e3287 stack: Move HAS_TRANSIENT_TYPE macro to window-private
We'll soon need it elsewhere, so move it to a shared location.
While at it, convert it to a function.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/949
2019-11-29 15:14:38 +01:00
Florian Müllner
1c89fce30e stack: Allow promoting transient windows to their parent's layer
When a window that should be stacked above another one is placed in a lower
layer than the other window, we currently allow promoting it to the higher
layer when it has a "transient type". We should do the same when the window
is an actual transient of the other window.

This is particularly relevant for wayland windows, where types play a
much smaller role: Transient windows like non-modal dialogs (and since
commit 666bef7a, popup windows as well) currently end up underneath their
always-on-top parent.

https://gitlab.gnome.org/GNOME/mutter/issues/587
2019-11-28 21:10:47 +01:00
Robert Mader
0247d35e5a shaped-texture: Do not invalidate content on set_cogl_texture()
This was wrongly introduced in 75cffd0ec4. As the comment above explains, we
only want to queue redraws in response to surface/buffer damage.

This triggered a full redraw when using DMA buffers on Wayland as we currently
create a new texture on every buffer_attach(), breaking partial invalidation.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/947
2019-11-26 21:35:50 +01:00
Marco Trevisan (Treviño)
427670cc63 device-manager-x11: Ignore events if no source device is set
There might be some inconsistent event for which we don't have a known
source device.

In the current state we don't handle them and we could crash when getting
the current device tool.

So, add an utility function that retrieves the source device for an event
that warns if no device is found, and use this for Motion, Key and Button
events.

In case we don't have a valid source in such case, just return early instead
of trying to generate invalid clutter events.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/823
2019-11-23 01:38:16 +00:00
Jonas Ådahl
4af4b79123 window: Assert we have an up to date monitor after they changed
Add an assert that we don't have a MetaWindow::monitor pointer that
points to an old MetaLogicalMonitor. After this, and the other
monitors-changed callbacks have been called, the old MetaLogicalMonitor
will be destoryed, thus if we didn't update the pointer here, we'll
point to freed memory, and will eventually crash later on.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/929
2019-11-23 00:58:19 +00:00
Corentin Noël
5582d7b3be background: set_file accepts NULL files
https://gitlab.gnome.org/GNOME/mutter/merge_requests/941
2019-11-22 22:13:35 +00:00
Corentin Noël
4cccba5cac workspace-manager: get_workspace_by_index can return NULL
https://gitlab.gnome.org/GNOME/mutter/merge_requests/941
2019-11-22 22:13:35 +00:00
Carlos Garnacho
f4bf48a7d7 clutter: Drop unused API
clutter_stage_*_get_clip_region_bounds() is no longer used and may be
removed.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/867
2019-11-22 21:07:05 +00:00
Carlos Garnacho
353d7909f6 clutter: Check updated devices with the current clip
We do check the clip area as an optimization to know which input devices
might need updating state after a relayout (Assuming that if a device is
under a non-painted area, it's actor beneath didn't change).

Use the clip region for this, and drop the last usage of the clip region
bounds.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/867
2019-11-22 21:07:05 +00:00
Carlos Garnacho
a586f6a152 cogl: Drop unused struct field
We only ever stored that the current clip uses the stencil buffer, but
never read it back. It doesn't seem like we'll have an use for it.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/867
2019-11-22 21:07:05 +00:00
Carlos Garnacho
e44bd2edb4 compositor: Use redraw clip region to cull out children
This will avoid repainting too much of the background if the
bounding box turned out to be too large.

https://bugzilla.gnome.org/show_bug.cgi?id=782344
2019-11-22 21:07:05 +00:00
Carlos Garnacho
8598b654ba clutter/cogl: Use regions for clipping if necessary
Use the new cogl function to perform clipping if the clip area
consists of more than a single rectangle.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/867
2019-11-22 21:07:05 +00:00
Carlos Garnacho
a1116bc6c8 cogl: Add support for clipping regions
This uses the stencil buffer to poke holes in the shape of the
given cairo_region_t that we will draw through.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/867
2019-11-22 21:07:05 +00:00
Robert Mader
8e172aeecb cleanup: Use g_clear_handle_id() for g_source_remove()
It makes sure we do not forget to zero the id and lets us avoid
zero checks before. We use it for all new code, lets clean up the
existing code base.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/947
2019-11-22 01:27:40 +01:00
Robert Mader
51f68f1054 clutter/cally-root: Use g_clear_signal_handler and fix a signal leak
This commit was split out from `cleanup: Use g_clear_signal_handler()
where possible` as it fixes an actual signal leak and should therefore
get backported to stable releases.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/940
2019-11-21 15:02:27 +00:00
Robert Mader
92375c75f8 cleanup: Use g_clear_signal_handler() where possible
This is inspired by 98892391d7 where the usage of
`g_signal_handler_disconnect()` without resetting the corresponding
handler id later resulted in a bug. Using `g_clear_signal_handler()`
makes sure we avoid similar bugs and is almost always the better
alternative. We use it for new code, let's clean up the old code to
also use it.

A further benefit is that it can get called even if the passed id is
0, allowing us to remove a lot of now unnessecary checks, and the fact
that `g_clear_signal_handler()` checks for the right type size, forcing us
to clean up all places where we used `guint` instead of `gulong`.

No functional changes intended here and all changes should be trivial,
thus bundled in one big commit.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/940
2019-11-21 15:02:27 +00:00
Adam Jackson
22d1febf3c cogl: Remove unused CoglShaderLanguage
There is only GLSL.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/819
2019-11-20 12:15:49 -05:00
Adam Jackson
5aa971b177 cogl: Collapse some COGL_PIPELINE_{VERT,FRAG,PROG}END arrays
There is only GLSL now.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/819
2019-11-20 12:15:49 -05:00
Adam Jackson
e922c640ef cogl: Remove unused CoglPipelineFragend::passthrough
https://gitlab.gnome.org/GNOME/mutter/merge_requests/819
2019-11-20 12:15:49 -05:00
Adam Jackson
f5050a4f80 cogl: Remove unused CoglPipelineFragend::pipeline_set_parent_notify
https://gitlab.gnome.org/GNOME/mutter/merge_requests/819
2019-11-20 12:15:49 -05:00
Adam Jackson
8cac82318f cogl: Remove unused CoglPipelineProgramType
There is only GLSL.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/819
2019-11-20 12:15:45 -05:00
Adam Jackson
23e9fd3dfa cogl: Remove unused COGL_OBJECT_DEFINE_DEPRECATED_REF_COUNTING
https://gitlab.gnome.org/GNOME/mutter/merge_requests/933
2019-11-20 11:59:15 -05:00
Adam Jackson
13fd213064 cogl: Remove unported test-vertex-buffer-mutability
https://gitlab.gnome.org/GNOME/mutter/merge_requests/933
2019-11-20 11:59:15 -05:00
Adam Jackson
c69dc7566b cogl: Remove unused includes of cogl-vertex-buffer-private.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/933
2019-11-20 11:59:15 -05:00
Adam Jackson
c6f5b7f1a1 cogl: Remove unused deprecated cogl_framebuffer_{,v}draw_*
https://gitlab.gnome.org/GNOME/mutter/merge_requests/933
2019-11-20 11:59:15 -05:00
Adam Jackson
1076b31464 cogl: Remove unused deprecated cogl_onscreen_{add,remove}_swap_buffers_callback
https://gitlab.gnome.org/GNOME/mutter/merge_requests/933
2019-11-20 11:59:15 -05:00
Adam Jackson
0d006bc8d9 cogl: Remove unused deprecated cogl_matrix_ortho
https://gitlab.gnome.org/GNOME/mutter/merge_requests/933
2019-11-20 11:59:15 -05:00
Adam Jackson
794d3239c7 cogl: Remove deprecated cogl_color_set_from_*
https://gitlab.gnome.org/GNOME/mutter/merge_requests/933
2019-11-20 11:59:15 -05:00
Carlos Garnacho
e5af790acb wayland: Move "ownership" of the DnD selection source to the data device
On wl_data_source destruction we used to indirectly unset the DnD selection
owner via the wl_resource destructor triggering the destruction of the
MetaWaylandDataSource, which would be caught through the weak ref set by
the MetaWaylandDragGrab.

This works as long as the grab is held, however we have a window between
the button being released and the drop site replying with
wl_data_offer.finish that the MetaWaylandDataSource is alive, but its
destruction wouldn't result in the call chain above to unsetting the DnD
source.

In other selection sources, we let the MetaWaylandDataDevice hold the
"ownership" of the MetaWaylandDataSource, and its weak ref functions unset
the respective MetaSelection owners. Do the same here, so the
MetaWaylandDataSource destruction is listened for all its lifetime.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/591
2019-11-20 12:07:51 +01:00
Carlos Garnacho
48639ac5da wayland: Do not cancel data source on offer destruction
This is wrong for both clipboard and DnD, as the selection source
will still be able to focus another surface, and churn another
wl_offer.

We should just detach the data offer from the data source in this
case, and let the source live on. However, we should still check
that there is a source and an offer to finish DnD, do that when
handling the drop operation instead.

https://gitlab.gnome.org/GNOME/mutter/issues/591
2019-11-20 12:07:51 +01:00
Carlos Garnacho
e7b2f9603e wayland: Avoid redundant cancel() call
This is unnecessary as we are unsetting the DnD selection owner,
and will result in the related data source being cancelled already.

https://gitlab.gnome.org/GNOME/mutter/issues/591
2019-11-20 12:07:51 +01:00
Carlos Garnacho
46b3811e22 wayland: Drop unused wl_signal structs
Those were used to signal clipboard ownership around, but that got
replaced by MetaSelection and friends. These signals are no longer
listened on, so can be safely removed.

https://gitlab.gnome.org/GNOME/mutter/issues/591
2019-11-20 12:07:51 +01:00
Adam Jackson
7adaaab2d6 clutter: Remove deprecated ClutterTableLayout
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:27 +00:00
Adam Jackson
289e24f1f7 clutter: Remove some unused deprecated clutter_actor API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:27 +00:00
Adam Jackson
c4d1e150ba clutter: Remove some unused deprecated clutter_alpha API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:27 +00:00
Adam Jackson
293ec0a1cb clutter: Remove some unused deprecated clutter_state API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:27 +00:00
Adam Jackson
24b38a5059 clutter: Remove some unused deprecated clutter_animation API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:27 +00:00
Adam Jackson
c74f4f6340 clutter: Remove some unused deprecated clutter_table_layout API
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:27 +00:00
Adam Jackson
3e9f8471fc clutter: Remove unused deprecated clutter_container_{add,remove}_valist
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:26 +00:00
Adam Jackson
0a41f0f855 clutter: Remove unused deprecated/clutter-bin-layout.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:26 +00:00
Adam Jackson
375d35be60 clutter: Remove unused deprecated/clutter-animatable.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:26 +00:00
Adam Jackson
6da568e29a clutter: Remove unused deprecated/clutter-stage-manager.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:26 +00:00
Adam Jackson
c039764d52 clutter: Remove unused deprecated/clutter-keysyms.h
https://gitlab.gnome.org/GNOME/mutter/merge_requests/921
2019-11-19 21:50:26 +00:00
Thomas Hindoe Paaboel Andersen
d3afe4308a test: use correct enum
The function create_texture() in test-wrap-modes.c takes a
TestUtilsTextureFlags. However a CoglTextureFlags is passed instead
in two calls. As the enums are identical this patch changes it to
use the TestUtils type.

The enum definitions:

typedef enum
{
  COGL_TEXTURE_NONE           = 0,
  COGL_TEXTURE_NO_AUTO_MIPMAP = 1 << 0,
  COGL_TEXTURE_NO_SLICING     = 1 << 1,
  COGL_TEXTURE_NO_ATLAS       = 1 << 2
} CoglTextureFlags;

typedef enum
{
  TEST_UTILS_TEXTURE_NONE           = 0,
  TEST_UTILS_TEXTURE_NO_AUTO_MIPMAP = 1 << 0,
  TEST_UTILS_TEXTURE_NO_SLICING     = 1 << 1,
  TEST_UTILS_TEXTURE_NO_ATLAS       = 1 << 2
} TestUtilsTextureFlags;

https://gitlab.gnome.org/GNOME/mutter/merge_requests/938
2019-11-16 00:14:20 +01:00
Thomas Hindoe Paaboel Andersen
d48fec8855 cogl: drop extraneous parentheses
Fixes a compile warning with clang

https://gitlab.gnome.org/GNOME/mutter/merge_requests/938
2019-11-16 00:14:14 +01:00
Thomas Hindoe Paaboel Andersen
d992722c24 cogl: correct check for COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL
In _cogl_offscreen_gl_allocate we only want to perform certain actions if
COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL is not set in create_flags.

We perfrom this check with:

if (!offscreen->create_flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL)

which is not correct as we negate the create_flags before the bitwise &.

It happens to work as intended though, as CoglOffscreenFlags only has one
element, and that element has the value 1. If the flag is not set then the
nagation of create_flags is true and the bitwise and with the element value
is true as well.
If any flag is set then the negation will give 0 and the bitwise & will be
false.

So while it works correctly it is fragile as either additional flags or a
change in the enum element value will break this check. This patch makes
things a bit more safe by adding parentheses to let the bitwise & happen
before the negation.

Definition of the enum:

typedef enum
{
  COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL = 1
} CoglOffscreenFlags;

https://gitlab.gnome.org/GNOME/mutter/merge_requests/938
2019-11-16 00:13:59 +01:00
Thomas Hindoe Paaboel Andersen
81bb4f0051 cogl: return correct enum type
cogl_pipeline_get_front_face_winding() is supposed to return a CoglWinding. It
takes a CoglPipeline as argument and does the following input validation:

g_return_val_if_fail (cogl_is_pipeline (pipeline),
                      COGL_PIPELINE_CULL_FACE_MODE_NONE);

The returned COGL_PIPELINE_CULL_FACE_MODE_NONE is not a winding.

The function was added with this check 8 years ago in
5369b3c601

I do not see any of the two options in the CoglWinding as particularly good
choice for a return value on bad input, but let's go with
COGL_WINDING_CLOCKWISE as that is equivalent with the behavior for all
these years.

Definitions of the two enums:

typedef enum
{
  COGL_WINDING_CLOCKWISE,
  COGL_WINDING_COUNTER_CLOCKWISE
} CoglWinding;

typedef enum
{
  COGL_PIPELINE_CULL_FACE_MODE_NONE,
  COGL_PIPELINE_CULL_FACE_MODE_FRONT,
  COGL_PIPELINE_CULL_FACE_MODE_BACK,
  COGL_PIPELINE_CULL_FACE_MODE_BOTH
} CoglPipelineCullFaceMode;

https://gitlab.gnome.org/GNOME/mutter/merge_requests/934
2019-11-13 20:37:05 +01:00