We use it everywhere, so it makes sense to enable it everywhere.
For anyone not in the know, defining COBJMACROS makes Micrsoft headers
for COM objects provide C macros so that instead of having to call
foo->lpVtbl->Release();
to unref a COM object, one can call
IFoo_Release (foo);
Note that thes macros are implemented with inheritance as Release()
is defined on the IUnknown base interface (MS' equivalent to GObject)
and would otherwise require
IUnknown_Release ((IUnknown *) foo);
That line works, too - but it is not necessary.
Existing code assumes displays are new connections and calls
gdk_display_close() on the display when done with whatever it was
doing.
If we return an existing display, that display gets closed...
It's also what the other backends do, including MacOS.
Fixes gsk/misc test.
With the switch to using the glib main context in the clipboard thread,
the clipboard hwnd is no longer used for sending messages.
This means it's not necessary to know it in the main thread.
And that means there's no small window where the clipboard thread spins
up and the window doesn't exist and any copy operation fails.
The main context can be created before spinning up the thread so
that is avoided.
Fixes the gtk/textbuffer test in the testsuite.
Instead of sending windows messages, use the main loop.
This is closer to the expectations of GTK developers and has better
thread safety handling as no HWND is needed as a messaging queue token.
We need to guarantee that we call wayland_display_read_events() after a
poll() and before any other source runs, including any source with
higher priority.
As GSourceFuncs doesn't have a after_poll() vfunc and check() is not
guaranteed to be called for anything but the highest priority, we only
have once chance:
Run with the highest priority
But because we don't want event delivery with ultrahigh priority, we
split the source into two:
* a poll source that polls while blocking wayland reading and
then immediately calls read_events() with priority G_MININT
* our old trusty event source with PRIORITY_EVENTS that dispatches
events
Fixes!7859Fixes#7091
This reverts commit a9723fc96b.
This approach was wrong as it can lead to deadlocks when multiple
threads call poll() at almost the same time and the slower thread only
starts poll()ing when the faster thread has already read the fd.
See further comments for a (hopefully) correct fix.
Reverts !7859
The Wayland source was blocking the Wayland display queue between its
check() and prepare() callbacks.
This is a rare event to cause problems because it requires
1. Another source with
2. a higher priority that
3. triggers at the same time as the Wayland source and
4. triggers a roundtrip or other operation that requires reading events
from the display.
Introduced in commit 2893526a48 during GTK 3.21, so this should
probably be fixed in GTK3, too.
Fixes#7091
Call gdk_ensure_initialized() directly in gdk_display_open_default(),
gdk_display_open(), gdk_x11_display_open() and gdk_display_get_default(),
so we get the right function name in the error message. These functions
are likely candidates that people might call without ensuring that GDK is
initialized.
Don't allow to create displays before gdk has been initialized.
Note that this error triggers in nautilus 47.0, but we consider
what it is doing unsupported and broken.
Related: #7035