Commit Graph

7685 Commits

Author SHA1 Message Date
Matthias Clasen
909330f347 wayland: Fix animated cursors
We must reset the image delay when stopping the timeout,
otherwise the code setting it up thinks it is still running.

This fixes cursor animation only working for the very first
enter of a widget with an animated cursor, as seen in the
cursors example in gtk4-demo.
2017-11-05 11:27:06 -05:00
Matthias Clasen
65a7557fc1 Fix some typos
Correct function names in the docs, etc.
2017-11-04 23:51:25 -04:00
Benjamin Otte
e484af8e96 wayland: Fix embarassing bug
Yes, I did not get to test this code path until now. Because nobody uses
icon surfaces, boo!
2017-11-05 00:07:18 +01:00
Benjamin Otte
7e137b2524 gdk: Use G_N_ELEMENTS() when iterating over constant arrays
And do that everywhere.

Because if we don't, we're gonna crash sometimes.
2017-11-05 00:07:18 +01:00
Benjamin Otte
d092e8dd78 gdk: Fix fallback names for the help cursor 2017-11-05 00:07:18 +01:00
Benjamin Otte
70846c85b3 window: Make icons GdkTextures
Cairo surfaces are bad, mkay?
2017-11-05 00:07:17 +01:00
Benjamin Otte
4c2bae3a1a texture: Add gdk_texture_new_from_file()
and gdk_texture_new_from_resource().

While doing set, turn all GDK_AVAILABLE_IN_3_90 into
GDK_AVAILABLE_IN_3_94 because that's now true after the renaming.
2017-11-04 15:22:25 +01:00
Rico Tzschichholz
7b0ed47525 x11: Make gdk_x11_display_get_xcursor be recognized as instance method 2017-11-04 13:23:02 +01:00
Chun-wei Fan
3228149892 gdk/win32: Fix Win32 GL Context switching
Since on Windows we need to use a good amount of temporary GL contexts,
we need to switch back to the original GL contexts we were using when
we are done with the temporary GL contexts, otherwise multi-GL windows
will cause confusions causing display artifacts and crashes.

Also, use the GdkWin32GLContext::gl_hdc consistently throughout
the code and remove the GdkWin32Display::gl_hdc as Lukas K pointed out
that GdkWin32Display::gl_hdc becomes out-of-date and so the HDC that the
GL context is bound to becomes incorrect in sceanarios using multiple
windows with GtkGLArea/GdkGLArea items (which would cause the artifacts in
programs that use multiple windows with GtkGLArea/GdkGLArea items, and it
turns out that GdkWin32Display::gl_hdc is actually not necessary to help
keep track of the HDCs we use for our GL contexts.

This will also fix on Windows with GDK_GL=always, or when GSK's gl
renderer is used.

Partly based on patch from Lukas K <lu@0x83.eu>

https://bugzilla.gnome.org/show_bug.cgi?id=789213
2017-11-04 10:39:03 +08:00
Chun-wei Fan
6a12a3cd10 gdk/win32: Fix build after GdkScreen and cursor cleanups
Move the leftovers from the removals to use the current APIs, to fix the
build.  Also for gdk_device_virtual_set_window_cursor(), only do
something when a valid GdkCursor is passed in here.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2017-11-04 10:32:21 +08:00
Benjamin Otte
d78bbb7e96 x11: Don't use g_hash_table_steal()
It returns TRUE/FALSE, not the item you've stolen, so if you free that,
your X connections is gonna have a BadCursor.
2017-11-04 01:35:59 +01:00
Benjamin Otte
9323d098a6 gdk: Cursors no longer have a display
Change constructors to reflect that.

While doing so, also add a fallback argument to the cursor constructors,
so it is now possible to create cursors with fallback.
2017-11-04 00:07:13 +01:00
Benjamin Otte
4e7a056777 gdk: Cursors are created generically
There are no longer subclasses for cursors now.
2017-11-04 00:07:13 +01:00
Benjamin Otte
ec824b9e50 wayland: Redo cursor handling
This is in line with the X11 changes last patch.
2017-11-04 00:07:13 +01:00
Benjamin Otte
e294f71555 x11: Redo cursor handling completely
Instead of creating a GdkX11Cursor, create GdkCursors. Cache the XCursor
in a hash table instead.

Also, make use of the new fallback mechanism for fallback code: Make
sure to provide cursors for the names that are guaranteed to exist, but
do not do bad attempts at displaying texture surfaces.
Black/White/transparent is not a replacement for those.
2017-11-04 00:07:13 +01:00
Benjamin Otte
d30d55be9e gdk: Make cursors instantiable
This way, backends can instantiate GdkCursor objects directly.

Do that for broadway to test that it indeed works.
2017-11-04 00:07:13 +01:00
Benjamin Otte
428547e14f gdk: Add gdk_cursor_hash() and gdk_cursor_equal()
This is so GDK backends can put cursors into hash tables and avoid
duplicates.
2017-11-04 00:07:13 +01:00
Benjamin Otte
6b2ea46a5f gdk: Add gdk_cursor_get_fallback()
There's no way to use it yet, but I want it to be available for
refactoring the backends.
2017-11-04 00:07:13 +01:00
Benjamin Otte
5adf21a17d cursor: Turn new_from_surface() into new_from_texture()
Also turn all the arguments into read-only properties on the GdkCursor
object.
2017-11-04 00:07:13 +01:00
Benjamin Otte
0cad0caf7d broadway: Don't crash on startup 2017-11-04 00:07:13 +01:00
Benjamin Otte
81c2bebaca gdk: Remove ability to download a cursor 2017-11-04 00:07:13 +01:00
Benjamin Otte
ca3c23662c GskTexture => GdkTexture
We want this thing to replace GdkPixbuf, so it has to live in GDK.
2017-11-04 00:07:13 +01:00
Benjamin Otte
8ba9ae6012 gdk: Add gdk_cursor_get_name()
Also add the GdkCursor::name property.
2017-11-04 00:07:13 +01:00
Benjamin Otte
a1759a0a52 gdk: Get rid of GdkCursorType
Now that we no longer have API that uses cursor types, don't keep them
around.
2017-11-04 00:07:13 +01:00
Benjamin Otte
8aa68110bd x11: Remove gdk_x11_grab_server()
Luckily, this one is unused.
2017-11-02 12:47:50 +01:00
Benjamin Otte
9c98adcd15 gdk: Remove GdkWindow.set_device_cursor() vfunc
That one calls through to GdkDevice.set_window_cursor(), so let's just
use that one.
2017-11-02 12:42:58 +01:00
Benjamin Otte
d380cf114b x11: Remove outdated functions from API
We don't want generic APIs that do random stuff on the default X display.
2017-11-02 12:42:58 +01:00
Benjamin Otte
f33c20920b x11: Add API to query root window and screen from GdkDisplay 2017-11-02 12:42:16 +01:00
Emmanuele Bassi
d2e9a5fa88 x11: Use backend-specific API to get GdkScreen
The gdk_display_get_default_screen() function was removed, but the X11
GdkEventSource still lobs around GdkX11Screen instances.
2017-11-02 06:42:49 +00:00
Matthias Clasen
4a2dc53a76 Drop foreign window checks in Broadway
The broadway backen never creates foreign windows,
so no need to check for this type of window.
2017-11-01 22:55:34 -04:00
Matthias Clasen
6ba48bd0d8 Drop foreign window checks in Wayland
The wayland backend never creates foreign windows,
so no need to check for this type of window.
2017-11-01 22:55:27 -04:00
Matthias Clasen
9f6b556dc2 Stop using foreign windows for xsettings
Stop wrapping the xsettings manager window in a foreign
window. This means that we cannot use the gdk window filter
APIs anymore, so just do the filtering in a non-generic
way.
2017-11-01 22:55:17 -04:00
Matthias Clasen
5bd8884bf8 Stop providing the owner in GdkEventOwnerChange
This information is rarely useful, and it is one
of the last places where we create foreign windows.
2017-11-01 22:53:24 -04:00
Matthias Clasen
33195d473c Remove an unused function 2017-11-01 22:49:52 -04:00
Matthias Clasen
3a5b478e0f wayland: Some cursor cleanups
Remove methods that are not used.
2017-11-01 22:35:19 -04:00
Matthias Clasen
c958818631 Some forgotten cleanups 2017-11-01 21:53:50 -04:00
Matthias Clasen
2a60928157 t Remove gdk_cursor_new_for_display
The preferred api to create cursors is by name, and the
GdkCursorType enumeration can directly trace its ancestry
to the horrible X cursor font. So lets stop using it.
2017-11-01 21:49:05 -04:00
Matthias Clasen
3b7763eebc Drop gdk_screen_get_display
This is not longer used.
2017-11-01 20:57:46 -04:00
Matthias Clasen
dcf2553f23 win32: Stop using gdk_screen_get_display
We can just use the field directly.
2017-11-01 20:54:50 -04:00
Matthias Clasen
b44ef37a21 quartz: Stop using gdk_screen_get_display
We can just use the field directly.
2017-11-01 20:54:22 -04:00
Matthias Clasen
93053adbf6 mir: Stop using gdk_screen_get_display
Just use the field directly.
2017-11-01 20:48:03 -04:00
Matthias Clasen
fee93d8d7b x11: Stop using gdk_screen_get_display
Never necessary, we can just use the field directly.
2017-11-01 20:48:03 -04:00
Matthias Clasen
a16a25151c Drop GdkScreen from public api
It is still used by some of the backends, so keep the
files around.
2017-11-01 19:44:29 -04:00
Matthias Clasen
0f9e9a9ec2 wayland: No more screen
This gets rid of the GdkWaylandScreen object and all
remnants of GdkScreen in the wayland backend.
2017-11-01 19:44:29 -04:00
Matthias Clasen
047eac5a96 x11: Add backend api to get the screen
gdk_display_get_default_screen is gone, but we still
have x11-specific screen apis that GTK+ is using, so
we need an alterative way to get the screen object.
2017-11-01 19:44:28 -04:00
Matthias Clasen
8144d31ebe Stop talking about GdkScreen in the docs
This api is going away.
2017-11-01 19:44:28 -04:00
Matthias Clasen
7f0b5297c6 Drop gdk_display_get_default_screen
Also remove the backend implementations.
This api is no longer used.
2017-11-01 19:44:28 -04:00
Matthias Clasen
adfbc82202 Fix a compiler warning. 2017-11-01 19:44:28 -04:00
Matthias Clasen
feb870add3 Drop gdk_screen_get_default
This function is not used anymore.
2017-11-01 19:44:28 -04:00
Matthias Clasen
a5ba92830e x11: Stop using gdk_screen_get_default
This api is going away.
2017-11-01 19:44:28 -04:00