Commit Graph

1285 Commits

Author SHA1 Message Date
Chun-wei Fan
934354fb8c gdkglcontext-win32.c: Fix window->surface changes
Rename the GdkSurface variables to surface, and make sure that we are
creating the context GObject correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-29 13:25:12 +08:00
Руслан Ижбулатов
7ccf6a7df7 GDK W32: remove unused client_message
This seems to be a leftover from API that was removed in
commit c332ac207a back in 2011.
The code, as it is now, does not even make sense.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 08:33:10 +00:00
Руслан Ижбулатов
5c9ae36c50 GDK W32: drop cursor-related GdkWin32Display functions
These functions went away in commit 77bab4e027

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 08:33:09 +00:00
Руслан Ижбулатов
102f802b04 GDK W32: remove the use of GDK_SURFACE_STATE
GDK_WINDOW_STATE (or, after rename, GDK_SURFACE_STATE) got
removed from GDK in commit 11a946df39

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 08:33:08 +00:00
Руслан Ижбулатов
35305bfc85 GDK W32: move GdkWin32MonitorDpiType to a different header
https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 08:33:07 +00:00
Руслан Ижбулатов
69e1128cd3 GDK W32: _gdk_surface_invalidate_{for_expose,region}
https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 16:13:42 +08:00
Руслан Ижбулатов
6100a9d692 GDK W32: drop the use of gdk_keymap_get_default()
https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 16:10:38 +08:00
Руслан Ижбулатов
5ff9e34fbb GDK W32: Adapt DnD event putting to recent changes
Set the display for each event that we put.
Also reorganize the dnd_event_put() function a bit, giving it a surface
directly instead of setting it by implication.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-24 10:59:02 +00:00
Руслан Ижбулатов
b8e6d06372 GDK W32: Don't check dest_surface for != NULL on button events
dest_surface is going to always be NULL for source contexts.
Previously we used to put the root window there to pass this check,
but root windows are gone (and root surfaces never existed to begin
with), so we have to adapt.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-24 10:28:11 +00:00
Руслан Ижбулатов
6b50788901 GDK W32: Init display scale to the global Windows scale, not 1
This affects gdk_device_query_state() for the virtual device. It has
no window, and is forced to query the display itself, and display
defaults its scale to 1 even for HiDPI desktops. Use the same
"query scale of a NULL monitor" trick that we use in other places
to get the global desktop scale.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-24 10:09:54 +00:00
Руслан Ижбулатов
6bdb004dfd GDK W32: adapt to the recent changes in GdkEvent
https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-24 10:09:52 +00:00
Benjamin Otte
cb4ec6f384 gdk: Remove GdkSurfaceImpl::shape_combine_region vfunc
... and all the implementations.

Input shapes still exist.
2018-03-21 23:28:26 +01:00
Benjamin Otte
4fff16860f gdk: Remove a bunch of unused variables 2018-03-21 23:28:26 +01:00
Alexander Larsson
39851fbdbf Continue renaming window to surface
This renames a lot of arguments, local variables and functions.
2018-03-21 11:49:14 +01:00
Alexander Larsson
8d05fcd35c Fix up indentation after GdkSurface rename
This fixes up a lot of the indentation issues from the
rename of windows to surfaces, at least the ones in the headers
and many others.
2018-03-21 09:06:31 +01:00
Alexander Larsson
4ac450b324 Convert all references to GdkEvent->surface 2018-03-20 16:25:50 +01:00
Alexander Larsson
3dce0dcca7 GdkSurface: Rename lots of stuff from window->surface
Mostly these are internal things, but the major public change is
that event.window is now event.surface.
2018-03-20 15:14:10 +01:00
Alexander Larsson
9a7e721181 GdkSurface: Rename various functions and variables
This is an automatic rename of various things related
to the window->surface rename.

Public symbols changed by this is:
 GDK_MODE_WINDOW
 gdk_device_get_window_at_position
 gdk_device_get_window_at_position_double
 gdk_device_get_last_event_window
 gdk_display_get_monitor_at_window
 gdk_drag_context_get_source_window
 gdk_drag_context_get_dest_window
 gdk_drag_context_get_drag_window
 gdk_draw_context_get_window
 gdk_drawing_context_get_window
 gdk_gl_context_get_window
 gdk_synthesize_window_state
 gdk_surface_get_window_type
 gdk_x11_display_set_window_scale
 gsk_renderer_new_for_window
 gsk_renderer_get_window
 gtk_text_view_buffer_to_window_coords
 gtk_tree_view_convert_widget_to_bin_window_coords
 gtk_tree_view_convert_tree_to_bin_window_coords

The commands that generated this are:

git sed -f g "GDK window" "GDK surface"
git sed -f g window_impl surface_impl
(cd gdk; git sed -f g impl_window impl_surface)
git sed -f g WINDOW_IMPL SURFACE_IMPL
git sed -f g GDK_MODE_WINDOW GDK_MODE_SURFACE
git sed -f g gdk_draw_context_get_window gdk_draw_context_get_surface
git sed -f g gdk_drawing_context_get_window gdk_drawing_context_get_surface
git sed -f g gdk_gl_context_get_window gdk_gl_context_get_surface
git sed -f g gsk_renderer_get_window gsk_renderer_get_surface
git sed -f g gsk_renderer_new_for_window gsk_renderer_new_for_surface

(cd gdk; git sed -f g window_type surface_type)
git sed -f g gdk_surface_get_window_type gdk_surface_get_surface_type

git sed -f g window_at_position surface_at_position
git sed -f g event_window event_surface
git sed -f g window_coord surface_coord
git sed -f g window_state surface_state
git sed -f g window_cursor surface_cursor
git sed -f g window_scale surface_scale
git sed -f g window_events surface_events
git sed -f g monitor_at_window monitor_at_surface
git sed -f g window_under_pointer surface_under_pointer
(cd gdk; git sed -f g for_window for_surface)
git sed -f g window_anchor surface_anchor
git sed -f g WINDOW_IS_TOPLEVEL SURFACE_IS_TOPLEVEL
git sed -f g native_window native_surface
git sed -f g source_window source_surface
git sed -f g dest_window dest_surface
git sed -f g drag_window drag_surface
git sed -f g input_window input_surface

git checkout NEWS* po-properties po docs/reference/gtk/migrating-3to4.xml
2018-03-20 12:05:26 +01:00
Alexander Larsson
890080ebf7 GdkWindow -> GdkSurface: File renames
Rename all *window.[ch] source files.

This is an automatic operation, done by the following commands:

for i in $(git ls-files gdk | grep window); do
    git mv $i $(echo $i | sed s/window/surface/);
    git sed -f g $(basename $i) $(basename $i | sed s/window/surface/) ;
done

git checkout NEWS* po-properties po
2018-03-20 11:46:11 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Emmanuele Bassi
bfcb978079 Drop the last mentions of motion hint events
The GDK_POINTER_MOTION_HINT_MASK enumeration value is gone, but we're
still keeping around the "is_hint" field in GdkEventMotion, even though
every backend sets it to `false` — except for the core X11 device
manager.
2018-02-05 14:00:51 +00:00
Emmanuele Bassi
2cbe094b91 Allow binding GdkContentFormatsBuilder
GdkContentFormatsBuilder is currently not introspectable, as it does not
have a GType. We can turn it into a boxed type, but we need to implement
memory management for it.

The current gdk_content_formats_builder_free() function returns a newly
constructed value, so we cannot use it as a GBoxedFreeFunc; additionally
copying a GdkContentFormatsBuilder contents would make it a bit odd, as
you could get multiple identical GdkContentFormats out of the copies.

A simple approach is to model the GdkContentFormatsBuilder API to follow
the GBytes one: use reference counting for memory management, and have
a function to release a reference, return a GdkContentFormats, and reset
the GdkContentFormatsBuilder state.

For language bindings, we can provide a get_formats() function that
returns the GdkContentFormats instance and resets the builder instance,
leaving the reference count untouched.

For C convenience we can keep gdk_content_formats_builder_free(), and
make it a wrapper around gdk_content_formats_builder_get_formats(), with
the guarantee that it'll free the builder instance regardless of its
current reference count.

https://bugzilla.gnome.org/show_bug.cgi?id=793097
https://blogs.gnome.org/otte/2018/02/03/builders/
2018-02-03 16:24:13 +01:00
Emmanuele Bassi
888dfe499d Drop the Big GDK Lock
GDK has a lock to mark critical sections inside the backends.
Additionally, code that would re-enter into the GTK main loop was
supposed to hold the lock.

Back in the Good Old Days™ this was guaranteed to kind of work only on
the X11 backend, and would cause a neat explosion on any other GDK
backend.

During GTK+ 3.x we deprecated the API to enter and leave the critical
sections, and now we can remove all the internal uses of the lock, since
external API that uses GTK+ 4.x won't be able to hold the GDK lock.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:07:10 +01:00
Emmanuele Bassi
c655759cef Replace gdk_threads_add_timeout* with g_timeout_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_timeout() and
gdk_threads_add_timeout_full() exist is to allow invoking a callback
with the GDK lock held, in case 3rd party libraries still use the
deprecated gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing timeout callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Руслан Ижбулатов
266d4b31b8 GDK W32: Remove non-managed DnD code
All DnD is now managed in GDK.

This commit also rearranges some code in _gdk_win32_window_drag_begin().

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-01-10 16:57:31 +08:00
Руслан Ижбулатов
b11b342ad4 GDK W32: stop using the OWNERCHANGE event
It was removed completely. For now just comment out the code that used to emit it.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-01-10 16:57:24 +08:00
Matthias Clasen
65fc43a1f3 Drop GDK_CLIENT_EVENT
We never generate events of this type, so no need
to carry it around.
2017-12-14 22:55:03 -05:00
Benjamin Otte
5d70bbf4c4 display: Remove leftover old clipboard APIs 2017-12-14 13:35:32 +01:00
Matthias Clasen
54a6273191 Drop gdk_atom_intern
Atoms are just interned strings now, so we can just
use g_intern_string.
2017-12-13 23:39:03 -05:00
Matthias Clasen
4c083c1ed4 Drop gdk_atom_name
Since atoms are just interned strings now, we can just
cast them to const char * where needed.
2017-12-13 23:26:23 -05:00
Benjamin Otte
b49a9b9933 dnd: Remove gdk_drag_get_selection()
Without selections, drags can't have them either.

Also included is removing the selection from GtkSelectionData.

Includes a bunch of crude cleanups to Wayland code that no longer has to
care about selection atoms.
2017-12-14 04:39:22 +01:00
Benjamin Otte
65fcff87b2 gdk: Remove ability to request selection notifications
Without selections, that's kinda pointless.
2017-12-14 04:20:48 +01:00
Benjamin Otte
f2bb2024c8 gdk: Remove properties
They are not used anymore.

Gone with them are PropertyNotify events.
2017-12-14 03:05:34 +01:00
Benjamin Otte
a4b42f0b73 gdk: Remove selection defines
And with it, remove the selections section from the docs.

So selections are gone for good now.
2017-12-14 03:05:34 +01:00
Benjamin Otte
4042d5f242 gdk: Remove ability to own a selection
With this, the GDK_EVENT_SELECTION_REQUEST and GDK_EVENT_SELECTION_CLEAR
and the associated GtkWidget signals are gone, too.
2017-12-13 23:39:02 +01:00
Benjamin Otte
b66052f3ce gdk: Remove gdk_selection_add_targets()
It's not needed anymore, now that we can look at the content provider's
formats.

Alose remove all the API in GTK that was used to set it.
2017-12-13 19:27:51 +01:00
Benjamin Otte
218efa62ef dnd: Pass dx/dy instead of x_root/y_root
This way, we don't need root coordinates when computing the dnd start
position.
2017-12-11 01:02:31 +01:00
Benjamin Otte
0d31eb8670 dnd: Add gdk_drag_context_get_display()
Also turn it into a readable, construct-only property.

Every GDK object should have this. (Apart from GdkDisplay, obviously.)
2017-12-10 01:09:14 +01:00
Руслан Ижбулатов
bcc77e169c GDK W32: Remove stray debug code
I have no idea how this slipped into master (these two lines are not present
in the same commit that went into gtk-3-22).
2017-12-03 06:10:03 +00:00
Matthias Clasen
6ab72b2653 Remove GdkDragProtocol from the api
...together with apis that return it. We were not using this
information in GTK+ at all, so no need to provide it.
2017-12-03 06:41:08 +01:00
Руслан Ижбулатов
174a36257f GDK W32: Plug a resource leak
Ensure that surfaces allocated in the impl are destroyed in finalize()

https://bugzilla.gnome.org/show_bug.cgi?id=787089
2017-12-03 03:19:02 +00:00
Руслан Ижбулатов
ae76d19663 GDK W32: Remove an unnecessary type check
No idea why it's here, the hash table can store any kind of data,
there's no reason why it wouldn't be able to store an old X string type.
Might be a holdout from the old days, when strings were handled in
a special way (stored directly in the clipboard?).

https://bugzilla.gnome.org/show_bug.cgi?id=786509
2017-12-02 10:38:42 +00:00
Руслан Ижбулатов
c89c19d2f9 GDK W32: Make sure drag source window is not NULL
This prevents GTK from throwing a bunch of warnings when it tries
to get drag source window -> screen of that window -> ipc widget for that screen,
and then tries to attach a signal handler to that widget.

Specifically, this happens when we get a DnD move from another
application.

https://bugzilla.gnome.org/show_bug.cgi?id=786509
2017-12-02 10:38:41 +00:00
Руслан Ижбулатов
f0d04f82f8 GDK W32: Special handling for DELETE requests
1) Ensure that any DELETE requests from the target are sent to GDK, even if
   both the source and the target are in the same process and it
   is therefore possible to use a shortcut and call the handler directly
   in GTK layer
2) Ensure that target GDK doesn't do anything when GTK asks it to send
   a DELETE request, just report back immediately (the code up the stack
   does not check for successfullness when request is DELETE, so not giving
   it any data is OK).

The source code already synthesizes a DELETE request, so that side is
also taken care of.

https://bugzilla.gnome.org/show_bug.cgi?id=786509
2017-12-02 10:38:40 +00:00
Руслан Ижбулатов
5e2e0af8b4 GDK W32: Preserve the target value for change_property()
We need to know the target atom value to know when we need to
do something with side-effects (since side-effects are expressed via
special target values). Previously, the code side-stepped that by looking
at the data type (which was rather unique for the one side-effect
target that we supported, signalled by the TARGETS target),
but for the DELETE target that seems to be no longer an option, hence the new
field to carry this information past the convert_selection() routine.

This prevents GDK from throwing a warning when trying to convert
a DELETE target, which has no format or data objects set.

The side-effects for the DELETE target happen earlier, in GTK layer.
By the point it gets to change_property(), it's a no-op.

https://bugzilla.gnome.org/show_bug.cgi?id=786509
2017-12-02 10:38:39 +00:00
Руслан Ижбулатов
44bc05df80 Fix a nefarious typo 2017-12-02 10:38:38 +00:00
Руслан Ижбулатов
5d0bfdd840 GDK W32: Ensure that selection request is processed
To do that, run the message loop for one second or until the side-effect
of running the selection request handler is achieved (as opposed to
running it until the event is no longer queued).

The disavantage of this method is that if the event handling is
somehow missed (due to a variety of reasons - after all, it's not
a straight path from an event being queued to property_change()
being called), this will loop for one second. Since we do process
events during that time, this will not hang the application, but
might still restrict some of the functionality.

https://bugzilla.gnome.org/show_bug.cgi?id=786509
2017-12-02 10:38:37 +00:00
Руслан Ижбулатов
a66017a6a0 GDK W32: Refuse to release mouse grab while in DnD mode
Handle WM_CANCELMODE and do nothing in response to it when DnD is
active. Otherwise pass it to DefWindowProc, which will call ReleaseCapture()
on our behalf.
This prevents us from losing mouse capture when alt-tabbing during DnD
(this includes the feature of Windows Explorer where dragging stuff over
a window button in the taskbar causes that window to receive focus, i.e.
keyboardless alt-tabbing).

https://bugzilla.gnome.org/show_bug.cgi?id=786509
2017-12-02 10:38:36 +00:00
Руслан Ижбулатов
6d37ed6256 GDK W32: Update layered windows on opacity changes
Without this patch layered windows are only updated when they are moved
by the user or then their contents changes. This patch adds opacity
changes to the list of things that make GDK update a window. Without this
windows that don't redraw and are not moved by the used (DnD drag indicator
windows, for example) don't change their opacity.

(This commit is cherry-picked from the gtk-3-22 branch)

https://bugzilla.gnome.org/show_bug.cgi?id=786509
2017-12-02 10:38:35 +00:00