Commit Graph

2821 Commits

Author SHA1 Message Date
Benjamin Otte
8a2f3e1fe5 x11: Move function call
The GLX visual selection is GLX specific, so it can be handled by the GLX
code.

There should be no reordering here, the call was just moved.
2021-07-22 16:06:05 +02:00
Benjamin Otte
8dfc627e46 glx: Don't initialize GLX multiple times.
Either it is initialized or it isn't.
2021-07-22 16:06:05 +02:00
Benjamin Otte
0fce30070f x11: Initialize GL at startup
We need to initialize GL to select the Visual we are going to use for
all our Windows.

As the Visual needs to be known before we know if we are even gonna use
GL later, we can't avoid initializing it.

Note that this previously happened, too. It was just hidden behind the
GdkScreen initialization.
2021-07-22 16:06:05 +02:00
Benjamin Otte
8bfe82f686 x11: Don't share cached GLX visuals with GTK3
We don't want to bind ourselves to GTK3 - both because we don't want to
accidentally cause bugs in a different codebase and because we want to
deviate from it.

While doing so, also store visuals as visuals and not as integers.
And only store one Visual because GTK4 only uses one visual.

And then remove the code that is leftover for dealing with the
compatibility Visual for GTK3.

PS: I'm kinda proud of my STRINGIFY_WITHOUT_BRACKETS hack.
2021-07-22 16:06:05 +02:00
Benjamin Otte
7d32ec51e7 x11: Reorder code
Initialize the GL visuals from gdkdisplay.c so the call into the GL
stack isn't hidden in gdkvisual.c

This is relevant for further commits.
2021-07-22 16:06:05 +02:00
Benjamin Otte
5784f8c2f9 x11: Stop reordering visuals
The old code was ordering visuals by depth, but considering that these
days we either use the default visual or a 32bit RGBA visual, that
reordering does not have an effect anymore.

In theory, the only effect is that the GLX Visual selection might select
a different replacement Visual when it checks for improved GL Visuals, but
even there I can't come up with a case where that matters, because
again, the visuals are only reordered by depth and we want to keep the
depth.

In any case, make this a separate commit so bisecting can find this
problem if it ever shows up.
2021-07-22 16:06:05 +02:00
Benjamin Otte
74e01ddec5 x11: Remove unused function
Now that we can't create extra GdkX11Screens anymore, this also means
that there is exactly 1 GdkX11Screen per GdkX11Display.
2021-07-22 16:06:05 +02:00
Benjamin Otte
1347573139 x11: Move code where it belongs
Instead of the display telling the screen to tell the visuals to tell
the display to initialize itself, just init the display directly.

What a concept.
2021-07-22 16:06:05 +02:00
Benjamin Otte
0ae2acfb1a x11: Remove XComposite
It's only used during DND to allow use of the root window's cow window
as a DND target, because apparently gnome-shell used to think that was a
great idea to DND to the overview.

Somebody complain to gnome-shell devs about it not being a good idea if
they want it fixed.
Potentially using Wayland is a better idea though.

This reverts 85ae875dcb

Related: https://bugzilla.gnome.org/show_bug.cgi?id=601731
2021-07-20 14:00:25 -04:00
Benjamin Otte
afc5f46ca9 x11: Remove unused headers 2021-07-20 14:00:25 -04:00
hudeng
fd0d3283e0 gdk: fix gtk app startup with 'g_value_set_boxed: assertion G_VALUE_HOLDS_BOXED (value) failed error message' when xsettings use 'XSETTINGS_TYPE_COLOR' type 2021-07-02 17:23:56 +08:00
Matthias Clasen
80c33ca2dd Merge branch 'wip/otte/for-master' into 'master'
x11: Be more careful with NVIDIA workaround

See merge request GNOME/gtk!3620
2021-06-02 14:57:52 +00:00
Matthias Clasen
fff2b3c710 gdk: Clean up docs syntax
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Benjamin Otte
5af6c37f8c x11: Be more careful with NVIDIA workaround
Check that we are indeed running inside an Xorg server before enabling
the workaround.

XWayland or other nested X servers deadlock when that workaround is
applied.
2021-05-22 01:43:31 +02:00
Matthias Clasen
4a0d3d7acc docs: Reduce redundancy
Remove a boatload of "or %NULL" from nullable parameters
and return values. gi-docgen generates suitable text from
the annotation that we don't need to duplicate.

This adds a few missing nullable annotations too.
2021-05-20 20:45:06 -04:00
Matthias Clasen
7fe0610b68 introspection: Stop using allow-none
allow-none has been deprecated for a long time
already. Instead use optional and nullable everywhere.
2021-05-20 19:17:49 -04:00
Matthias Clasen
8ba16eb4f1 Documentation fixes
Mostly fixing up indentation of continuation lines,
and other small cleanups.
2021-05-20 19:17:49 -04:00
Emmanuele Bassi
b3d6928f35 x11: Pair eglInitialize with eglTerminate
If we bail out after EGL initialization we want to go back to a stable
state and not leave EGL hanging.
2021-05-13 18:23:50 +01:00
Emmanuele Bassi
3d8ba93f59 x11: Loosen the match for the NVIDIA driver
It seems nVidia puts a different string in the GL_VENDOR than the one it
uses for GLX.
2021-05-13 18:22:30 +01:00
Emmanuele Bassi
abc2d7e4a9 x11: Add EGLDisplay getter
Getting an EGLDisplay object is messy; might as well expose the function
we use internally to save some time.
2021-05-11 12:42:16 +01:00
Emmanuele Bassi
69856a9aac x11: Don't update GLX visuals with EGL
We're going to get into a messy situation, with both GLX and EGL
initialized.

If we're already using EGL, skip the whole cache.
2021-05-10 21:19:14 +01:00
Emmanuele Bassi
c35a6725b9 x11: Always fall back to GLX on NVIDIA
At least until we can guarantee that EGL-X11 works fine there.
2021-05-10 20:44:35 +01:00
Emmanuele Bassi
a57f79006a x11: Move the damage fences into the GLX code
It's GLX-specific anyway, there's no need to complicate things by having
half the code in the generic path, and half in the GLX one.
2021-05-10 20:44:35 +01:00
Emmanuele Bassi
6600b0b507 x11: Add debug toggle for preferring GLX
Mostly as a way to compare the EGL and GLX implementations.
2021-05-10 20:44:35 +01:00
Emmanuele Bassi
9a19e3c741 x11: Add profiler marks for SwapBuffers 2021-05-10 20:44:35 +01:00
Emmanuele Bassi
8924d614c0 x11: Use EGL for GL support
This makes the X11 backend similar to the Wayland one, when it comes to
OpenGL.

Fall back to GLX only if EGL support is not available.
2021-05-10 20:44:35 +01:00
Emmanuele Bassi
03f76eccf5 x11: Decouple GLX from GdkX11GLContext
If we want to add an EGL implementation for the X11 backend, we are
going to need to move the GLX bits into their own class. The first step
is to declare GdkX11GLContext as an abstract type, and then subclass it
into a GdkX11GLContextGLX type, which includes the whole GLX
implementation.
2021-05-10 20:44:35 +01:00
Carlos Garnacho
081e127377 gdk/x11: Ensure to map the non-ewmh moveresize emulation window before use
Otherwise, we don't deem it as able to be grabbed, which we intend to do
immediately after.
2021-05-07 15:51:52 +02:00
Dan Cîrnaț
13b94dab10 Conditional check for gdesktopappinfo header
GDesktopAppInfo is not available on macOS and needs to be disabled
2021-05-06 10:38:41 +02:00
Matthias Clasen
e2722f03ac x11: A few static analysis fixes 2021-05-03 07:44:38 -04:00
Matthias Clasen
f37662c655 x11: Try harder to find the right monitor
If we deal with a panel, we end up with no monitor,
and crash, which isn't great and isn't necessary.

Fixes: #3900
2021-04-26 23:20:10 -04:00
Matthias Clasen
142984cbf7 Merge branch 'untrusted-beep' into 'master'
x11: Don't beep on untrusted displays

Closes #3862

See merge request GNOME/gtk!3463
2021-04-21 10:12:39 +00:00
Matthias Clasen
5587ee0c30 x11: Don't beep on untrusted displays
This can trigger BadAccess, and we don't
want that.

Fixes: #3862
2021-04-20 21:42:57 -04:00
Matthias Clasen
ce2a433ca1 Fix a possible crash in gtk_show_uri
g_file_get_basename can return NULL.
Deal with it somehow.

Fixes: #3883
2021-04-19 16:49:02 -04:00
Matthias Clasen
6f11165dd1 x11: Be quiet on exit by default
The condition we check for to catch X servers going away
may not be accurate anymore, and the warning shows up in
logs, causing customers to be concerned. So, be quiet by
default, unless the user explicitly asked for a message.
2021-04-13 14:52:48 -04:00
Olivier Fourdan
80ba38a0b3 x11/dnd: Ignore XErrors from the COW
The DnD code for X11 adds the composite overlay window (aka COW) to the
cache.

Yet the X11 requests to get and release the COW may trigger XErrors that
we ought to ignore otherwise the client will abort.

Fixes: #3715
2021-03-22 15:38:58 +01:00
Kjell Ahlstedt
0f6b91109e gdkglcontext-x11: Don't assume that cairo-xlib.h is in cairo directory
If cairo is a subproject, it's not necessarily installed when gtk
is built. In the source tree, cairo's headers are not stored in
a directory called 'cairo'.
2021-03-16 11:47:16 +01:00
Benjamin Otte
dbd19bf27a x11: Don't call _gdk_surface_update_size() all the time
We were calling _gdk_surface_update_size() every frame, even if the
window size didn't change. This would cause us to discard all cached
buffers and redraw the whole screen.

This was BAD.
2021-03-15 03:16:50 +01:00
Benjamin Otte
97fad45237 surface: Remove unused gdk_surface_get_unscaled_size()
Also remove unscaled_width/height members in the win32 backend.

Both of those are unused.
2021-03-15 02:56:28 +01:00
Emmanuele Bassi
6f93e63d21 docs: Move detached sections into their own content file 2021-03-11 16:37:30 +00:00
Matthias Clasen
ad9c813ed1 x11: Apply popup shadow with 2021-02-14 10:12:10 -05:00
Emmanuele Bassi
cf3f742ad8 x11: Move from g_memdup() to g_memdup2()
The g_memdup() function is replaced by a safer version in newer versions
of GLib.
2021-02-11 14:22:22 +00:00
Matthias Clasen
0bce63e3ab x11: More dnd fixes
Whenever we communicate targets, we need to the union, otherwise
we don't tell the other side about our serialization. This makes
drops of images from gtk4-icon-browser to gimp and libreoffice
succeed in transferring data.

Fixes: #3654
2021-02-07 09:03:22 -05:00
Matthias Clasen
5b45f267d6 x11: Pass mimetypes when creating output stream
When creating the output stream for a drop, we must
pass the mimetypes we support, otherwise the picking
of the right handler does not work.

Fixes: #3652
2021-02-07 01:32:39 -05:00
Matthias Clasen
f26f15fced x11: Fix a memory leak
We ref the content formats here, so we better unref it
when done.
2021-02-07 01:31:40 -05:00
Matthias Clasen
a37044f36c x11: Some code cleanups
Fix some glaring misindentation.
2021-02-07 01:30:50 -05:00
Matthias Clasen
927fdb9a83 x11: A case of argument order confusion
translate_keysym was expecting its arguments the
other way around.

Pointed out in https://www.viva64.com/en/b/0793/
2021-02-04 00:20:26 -05:00
Matthias Clasen
c78036fc51 x11: Handle X-specific targets in drops
This code is very similar to the handling for these
targets in the clipboard case.

Fixes: #3642
2021-02-03 14:17:04 -05:00
Matthias Clasen
f14762b026 x11: Notify on surface scale changes
Emit property notification when the surface scale
changes.
2021-01-16 15:22:46 -05:00
Ignacio Casal Quinteiro
45ec3fc389 seat: improve api to take into account the tool type
Otherwise if we have several tools with the same serial
and hardware id we might match the wrong tool.
2021-01-07 12:50:48 +01:00