Commit Graph

8888 Commits

Author SHA1 Message Date
Matthias Clasen
2c43f87ef7 win32: Set the surface type
This is copying some code from the corresponding
create_surface implementations of the other backends.
2019-05-28 20:25:16 +00:00
Руслан Ижбулатов
138104de27 GDK W32: Fix the code to compile
Somewhat change the order of initialization (to be closer
to what Wayland backend does).

Also remove the wrapper field that is no longer needed -
it used to hold a pointer to the main GdkWindow instance,
which wrapped GdkWin32ImplWindow. Since impls are gone,
nothing is wrapping anything anymore.

Fix a substitution error, where wrong pointer was added
to the hash table. Added a comment to ensure that future readers
(including myself) won't be confused by the fact that we're
inserting a pointer instead of the handle itself.
2019-05-28 20:25:16 +00:00
Руслан Ижбулатов
d5e26cdb76 GDK W32: be able to handle NULL cursor 2019-05-28 20:25:16 +00:00
Matthias Clasen
c2b9a12f6f surface: Don't dispose the frame clock prematurely
Since we are now sharing frame clocks with multiple
surfaces, we can no longer dispose them unconditionally
when a surface goes away. Only do it if we are a
toplevel (without parent).

This was showing up as criticals on exit when opening
and closing any popover in widget factory.
2019-05-28 20:25:16 +00:00
Matthias Clasen
f728295e8c Cosmetics 2019-05-28 20:25:16 +00:00
Matthias Clasen
09ec88d0ce win32: Build fixes 2019-05-28 20:25:15 +00:00
Matthias Clasen
db855e092d Add a GdkSurface::parent property 2019-05-28 20:25:15 +00:00
Matthias Clasen
fa9cbf6c7d x11: Fix handling of frame clock freezes
Now that popups share the frame clock of their
parent, we have to be much more careful about
freezing the clock, since that may stop updates
for another surface.

This commit makes two changes that make the
X11 handling of the frame clock more similar
to the Wayland backend:
- Use gdk_surface_freeze_updates instead of
  gdk_surface_freeze_toplevel_updates to avoid
  affecting the frame clock
- Bail out early in before_paint/after_paint
  if the surface is frozen, to avoid affecting
  the frame clock

Together, these two make the X11 popup surface
type work without freezing updates for the toplevel.
2019-05-28 20:25:15 +00:00
Matthias Clasen
ef353f24c6 gdk: Inherit the frame clock for popups
With separate clocks, the phases are not coordinated,
which messes with GTKs size allocation machinery treating
the entire widget tree as a whole, and causes us to
run into assertion where popups get drawn before they
are allocated.
2019-05-28 20:25:15 +00:00
Matthias Clasen
18e396ef6c Add gdk_surface_get_parent back
The api is the same, the parent is different.
This now returns the parent of popup surfaces.
2019-05-28 20:25:15 +00:00
Alexander Larsson
ebb89bca0d surface: Remove gdk_surface_set/merge_child_input_shapes()
These are useless now that we don't have child surfaces
2019-05-28 20:25:15 +00:00
Alexander Larsson
1c7eb5ca33 surface: Remove old debug code 2019-05-28 20:25:15 +00:00
Matthias Clasen
b15ba64ec9 surface: Add an autohide property
This api is meant to mimic xdg-popover.grab - we
show the surface, and dismiss it when we get events
on other surfaces. For foreign surfaces, the compositor
handles that for us; for our own, we check outselves
before delivering events to GTK.
2019-05-28 20:25:14 +00:00
Matthias Clasen
2dd15346a7 broadway: Track popups
This is more or less a 1:1 copy of the X11 code.
2019-05-28 20:25:14 +00:00
Matthias Clasen
6f1c32b3eb x11: Implement popup surfaces
Make them use o-r windows, and move
with their parent.

We do a sort-of ok job on stacking order
here - whenever the parent window gets a
ConfigureNotify, we just restack all popups
directly on top of their parent. This is good
enough to keep popups on top of their parent
while we drag it around, and it gets the popup
to disappear when raising another window on
top of the parent.
2019-05-28 20:25:14 +00:00
Matthias Clasen
99783c7fb7 wayland: Use popup parents
Make the Wayland move-to-rect implementation
use popup parents.
2019-05-28 20:25:14 +00:00
Matthias Clasen
1661615fef surface: Stop setting transient-for for popups
This was just a hack to reuse the existing
infrastructure. Now that we store parents separately,
stop doing it.
2019-05-28 20:25:14 +00:00
Matthias Clasen
1fa2a8217f surface: Make move-to-rect work for popups
Now that we store popup parents separately,
the client-side move-to-rect implementation
must use them.
2019-05-28 20:25:14 +00:00
Matthias Clasen
9af6d7f733 surface: Store popup parent
Store popup parents separately from transient-for
parents, since these are separate concepts with
different behaviors. And we need the parent in
the frontend, so we can use it in the fallback
move-to-rect implementation.
2019-05-28 20:25:14 +00:00
Matthias Clasen
33c6dff881 gdk: Introduce a popup surface type
This surface type is meant to have semantics
similar to xdg-popup, with a mandatory parent,
and relative placement using gdk_surface_move_to_rect.
2019-05-28 20:25:14 +00:00
Matthias Clasen
07b3a093bf x11: Remove useless checks
All surfaces are toplevels now, no need
to check for this all over the place.
2019-05-28 20:25:14 +00:00
Matthias Clasen
712a5d4f25 Get rid of GdkSurfaceImpl
We don't need the complicated wrapper system anymore,
since client-side windows are gone. This commit moves
all the vfuncs to GtkSurfaceClass, and changes the
backends to just derive their surface implementation
from GdkSurface.
2019-05-28 20:25:14 +00:00
Matthias Clasen
93b8f2563d gdk: Add a private header
This is in preparation for getting rid of GdkSurfaceImpl.
2019-05-28 20:25:14 +00:00
Matthias Clasen
d2951d3aac Rename surface constructors
We want to use a gdk_surface_new_popup for popups,
and align the constructor names with the surface
types, so rename

gdk_surface_new_popup -> gdk_surface_new_temp
gdk_surface_new_popup_full -> gdk_surface_new_popup

The temp surface type will disappear eventually.
2019-05-28 20:25:14 +00:00
Matthias Clasen
0571fc265b surface: Cosmetics 2019-05-28 20:25:14 +00:00
Matthias Clasen
8536557007 gdk: Drop pass-through surfaces
With client-side windows gone, this property
is no longer used at all, and has been replaced
by a similar concept on the widget level.
Drop it.
2019-05-28 20:25:14 +00:00
Matthias Clasen
47fb092393 gdk: Drop GdkWindowAttr
All the information in it is already contained
in the surface object we pass along, and none
of the backend implementations were using the
attributes at all.
2019-05-28 20:25:14 +00:00
Matthias Clasen
2855729cb4 gdk: Drop input-only surfaces
We are not creating such surfaces anymore, and
they were only ever meaningfully implemented
on X11. Drop the concept, and the api for determining
if a surface is input-only.
2019-05-28 20:25:14 +00:00
Matthias Clasen
1a23ebf105 gdk: Remove an unused field
Spring cleaning. We are not using this field
at all, since we have the input_only boolean.
2019-05-28 20:25:14 +00:00
Matthias Clasen
82c8a05855 Drop gdk_surface_new_temp
This is no longer used, and the only difference
to gdk_surface_new_popup is input-only, which is
an X11-only concept.
2019-05-28 20:25:14 +00:00
Matthias Clasen
7c1509feaa x11: Stop using gdk_surface_new_temp
We can just as well use gdk_surface_new_popup.
2019-05-28 20:25:14 +00:00
Matthias Clasen
448312594c broadway: Stop using gdk_surface_new_temp
This is in preparation for adding a proper
popup surface type.
2019-05-28 20:25:14 +00:00
Matthias Clasen
6029875ed3 wayland: Remove a useless switch
We are setting the title unconditionally, now
2019-05-28 20:25:14 +00:00
Matthias Clasen
8bb7fcd30c docs: Remove references to gdk_device_grab
It is no longer public api, refer to gdk_seat_grab instead.
2019-05-28 20:25:14 +00:00
Matthias Clasen
f692974e5a gdk: Remove remnants of client-side windows
Now that all surfaces are native, we don't need
to separately keep track of grab surfaces and
their native ancestor anymore.
2019-05-28 20:25:14 +00:00
Matthias Clasen
73a6aaebfd surface: Make gdk_surface_get_device_position void
None of the callers were using the return value,
and without child surfaces, it is not very useful.
2019-05-28 20:25:14 +00:00
Matthias Clasen
48b522c487 x11: Drop a gratitious use of gdk_event_get_root_coords
We are in the backend, so we can do the translation ourselves.
2019-05-28 20:25:14 +00:00
Matthias Clasen
bb399b5d8f Remove gdk_surface_get_geometry as public api
We still need to keep the vfunc around, since the
fallback implementation of gdk_display_get_monitor_at_surface
uses it. So, a GDK backend must either have root coordinates
or always return a monitor from monitor_at_surface.
2019-05-28 20:25:14 +00:00
Matthias Clasen
cb23d40d36 Drop gdk_surface_get_root_origin
It was not used.
2019-05-28 20:25:14 +00:00
Matthias Clasen
8ee1620a2c Remove gdk_surface_get_root_coords as public api
We still need to keep the vfunc around, since the
fallback implementation for move_to_rect uses it.
So, a GDK backend must either have root coordinates
or implement move_to_rect.
2019-05-28 20:25:14 +00:00
Matthias Clasen
2ccd0dc8c6 Remove gdk_surface_coords_to/from_parent
This api was unused, and surfaces have no parents anymore.
2019-05-28 20:25:14 +00:00
Matthias Clasen
a3e0329a12 surface: Small simplification
No more special-casing of state setting.
2019-05-28 20:25:14 +00:00
Matthias Clasen
9b54f124e5 surface: Simplify destroy implementation
Without child surfaces, there is no need to recurse.
2019-05-28 20:25:14 +00:00
Matthias Clasen
3248bdc726 surface: Remove abs_x/abs_y
We no longer have child windows, so the offset is
always 0.
2019-05-28 20:25:14 +00:00
Matthias Clasen
0f5a6a3927 surface: Small cleanup
Every surface has an impl now, no need to check.
2019-05-28 20:25:14 +00:00
Matthias Clasen
77e99f70fe surface: Simplify some code
Fold gdk_surface_process_updates_recurse into its
only caller. There is no recursion here anymore.
2019-05-28 20:25:14 +00:00
Matthias Clasen
0699b17848 Remove surface->children
This field is not used at all anymore.
2019-05-28 20:25:13 +00:00
Matthias Clasen
2eebac8819 gdk: Stop using surface->children
It is always NULL.
2019-05-28 20:25:13 +00:00
Matthias Clasen
7aae92656d wayland: Stop using surface->children
It is always NULL.
2019-05-28 20:25:13 +00:00
Matthias Clasen
e68c5541e2 Remove surface->parent
This field is no longer used.
2019-05-28 20:25:13 +00:00
Matthias Clasen
0760958f71 gdk: Stop using surface->parent
It is always NULL.
2019-05-28 20:25:13 +00:00
Matthias Clasen
edab50139a broadway: Stop using surface->parent 2019-05-28 20:25:13 +00:00
Matthias Clasen
6183d58f80 x11: Stop using surface->parent
It is always NULL.
2019-05-28 20:25:13 +00:00
Matthias Clasen
bb1dd3f3ae wayland: Stop using surface->parent
It is always NULL.
2019-05-28 20:25:13 +00:00
Matthias Clasen
60ec1ee334 surface: Remove code dealing with child surfaces
We no longer have child surfaces, so this code
is never run.
2019-05-28 20:25:13 +00:00
Matthias Clasen
90e86b351d surface: minor cleanup
Make gdk_surface_new fully private, and reduce the use
of GdkSurfaceAttr.
2019-05-28 20:25:13 +00:00
Matthias Clasen
989792cbc0 Drop child surfaces
Drop gdk_surface_child_new and the child surface type,
since we no longer use them. Deprecate surface apis
that only make sense with child surfaces.
2019-05-28 20:25:13 +00:00
Matthias Clasen
f7e1146eda wayland: Stop using child surface apis
We no longer have child surfaces.
Drop code that only makes sense in their
presence.
2019-05-28 20:25:13 +00:00
Matthias Clasen
68e5456db9 x11: Stop using child surface api
We no longer have child surfaces.
Drop code that only makes sense in
that case.
2019-05-28 20:25:13 +00:00
Matthias Clasen
9e6d8becbb surface: Start sketching a new surface type
Start by adding a constructor. We have to call it
gdk_surface_new_popup_full for now, since gdk_surface_new_popup
is taken. This may be reshuffled later.
2019-05-28 20:25:13 +00:00
Benjamin Otte
096d28e60c surface: Add marshallers for new events
This way, sysprof can profile through the signal emission, and for
signals this low in the stack, this is very useful.
2019-05-28 19:19:24 +02:00
Matthias Clasen
106dd75b3b Remove an unused function
_gdk_make_event was not used anywhere.
2019-05-27 20:23:50 -04:00
Matthias Clasen
71cc68b14b surface: fix up docs
The docs for gdk_surface_invalidate_region were
talking about a no-longer-existing argument.
2019-05-26 00:07:47 -04:00
Matthias Clasen
c50052e223 Revert "wayland: Keep some resources until destroy"
This reverts commit f2d598b9a1.
2019-05-25 18:08:43 +00:00
Matthias Clasen
beedec1904 broadway: add frame times to the profiler 2019-05-24 07:19:14 -04:00
Olivier Fourdan
713fceb1bd wayland: Use scale from core wl_output protocol
The “xdg-output” protocol provides clients with the outputs size and
position in compositor coordinates, and does not provide the output
scale which is already provided by the core “wl_output” protocol.

So when receiving the wl_output scale event, we should update the scale
regardless of “xdg-output” support, otherwise the scale will remain to
its default value of 1 and the surface will be scaled up by the
compositor to match the actual output scale, which causes blurry fonts
and widgets.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/1901
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2019-05-22 12:22:36 +02:00
Federico Mena Quintero
2a9b3c6a0c Use g_once for all the mkenums template files
Without this, initialization of enum/flags values from multithreaded
programs may not work correctly.

Fixes #1617.
2019-05-21 10:32:08 -05:00
Benjamin Otte
143bba075f win32: Remove outdated workaround
The function that was missing in 2016 does exist now.

Fixes gcc complaining about a wrong declaration.
2019-05-21 07:33:57 +02:00
Benjamin Otte
0877b29e8e win32: Actually pass y variable for y parameter 2019-05-21 07:23:30 +02:00
Benjamin Otte
1793546d7a win32: Remove unused variables 2019-05-21 07:23:30 +02:00
Benjamin Otte
678aa8088f rgba: Add GDK_RGBA() macro
So far it's private, but it's a pretty cute way to use hex colors, so we
might conside making it public.
2019-05-21 06:43:59 +02:00
Matthias Clasen
0a217cdd39 x11: Remove to unused settings
We no longer have settings for gtk-button-images
or gtk-menu-images.
2019-05-19 17:12:37 -04:00
Matthias Clasen
54530334f4 Revert "wayland: Make popups work more than once"
This reverts commit e74c655016.
2019-05-19 16:50:49 +00:00
Matthias Clasen
eed37cd59a Cosmetic changes
Use new-style padding for GdkContentProviderClass.
2019-05-19 16:20:15 +00:00
Matthias Clasen
d4f6bfbdad Merge branch 'frame-pixel-counter' into 'master'
profiling: Add a counter for pixels drawn per frame

See merge request GNOME/gtk!855
2019-05-19 15:20:52 +00:00
Matthias Clasen
e74c655016 wayland: Make popups work more than once
The change to keep some server resources around
until destroy was causing us to not recreate
the right things when a surface is hidden and
then shown again. Make sure to recreate everything.
2019-05-19 04:43:16 +00:00
Matthias Clasen
f2d598b9a1 wayland: Keep some resources until destroy
The Wayland backend was dropping _all_ serverside
resources on hide, which is too early e.g. for
GtkGLArea which wants to use egl resources to
unload textures on unrealize.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1485
2019-05-18 19:15:47 +00:00
Matthias Clasen
6c9d50a013 profiling: Add a counter for pixels drawn per frame
This number clearly shows the recently discovered
"full redraws" problem.
2019-05-18 18:04:35 +00:00
Benjamin Otte
6e2df85ec8 Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

Closes #1900

See merge request GNOME/gtk!854
2019-05-18 15:19:29 +00:00
Benjamin Otte
b76eb96c58 glcontext: Store the updated area in the right place
We need to store the region *before* adding our own damage area, because
we want to only store the changes of this frame, not the whole history.

So do it in the same place Vulkan does it.

Fixes #1900
2019-05-18 17:06:08 +02:00
Matthias Clasen
7e59ec4afc Add clock freezes to the profile 2019-05-16 20:50:31 +00:00
Matthias Clasen
15fec034df always record a frame end time when profiling
We need to keep this time, or we may end up with
negative frame intervals.
2019-05-16 19:45:30 +00:00
Matthias Clasen
33ffd54d5f Redo frame profiling
We were adding incomplete frame timings to the
profile, which lead to occasional nonsense
numbers. Instead, only add timings to the profile
once we marked them as complete. This also
gives us an opportunity to add the presentation
time as a marker.
2019-05-16 19:08:34 +00:00
Matthias Clasen
45b552d146 profiler: Prefer CLOCK_MONOTONIC
This is what g_get_monotonic_time gives us,
after all, and we need to have the same clock
in all our profiler data.
2019-05-15 13:52:12 -04:00
Carlos Garnacho
58cfafdf04 gdk/x11: Remove XI1 remnant
This header is not referenced anywhere.
2019-05-15 01:10:08 +02:00
Carlos Garnacho
c2d92794e2 gdk/x11: Drop GdkDeviceManagerCore
Keep only the XInput2 device manager, which handles "modern" stuff
like scroll and touch.
2019-05-15 01:05:29 +02:00
Carlos Garnacho
33642e2255 gdk/x11: Make XInput2 a mandatory runtime dependency for x11
Besides requiring it at build time, require that the server the client
is running against exposes the XInput2 protocol. We no longer fallback
on a device manager for core events.
2019-05-15 01:05:20 +02:00
Carlos Garnacho
c4446d36de gdk/x11: Drop GDK_CORE_DEVICE_EVENTS environment variable
Support for core events will be discontinued, so this doesn't make sense
anymore.
2019-05-15 01:05:20 +02:00
Carlos Garnacho
c4cf72ecb8 gdk/x11: Remove gdk_disable_multidevice()
Core events will be discontinued, so this call is meaningless now.
2019-05-15 01:05:20 +02:00
Carlos Garnacho
f3250172a4 gdk/x11: Make XInput2 a mandatory build time dependency for x11
XInput2 is more than a decade old already, and the input improvements
there (and in every other backend really) make it untenable to have
support for X11 core input events dragging things behind.
2019-05-15 01:05:20 +02:00
Matthias Clasen
ebc6bd834b profiling: Only use frame timings when we have them
Christian Hergert reported a crash here,
when testing the profiling code.
2019-05-14 12:06:55 +00:00
Matthias Clasen
b3ff4154ec Drop the public profiler api
I meant to do this before merging the profiler
support. Somehow the commit got lost.
2019-05-08 17:00:26 +00:00
Matthias Clasen
879a0c118d Profiler: drop the public api 2019-05-08 16:57:34 +00:00
Chun-wei Fan
705bf48eed gdk/gdkprofiler.c: Don't include unistd.h unconditionally
unistd.h is not universally available, so only include it when it can be
found during the configure stage.
2019-05-07 17:58:14 -07:00
Sebastian Dröge
2bd6661cd3 GdkSurface - Don't call unimplemented NULL set_startup_id() vfunc on Win32
GdkSurface::set_startup_id() is NULL on Win32 and would cause a segfault
if called.

While the documentation of the main caller of set_startup_id(),
gtk_window_set_startup_id(), mentions that it's not implemented on
Windows it can still be automatically called via Glade and simply doing
nothing on Win32 is going to be less disruptive than a segfault.
2019-05-07 21:38:46 +03:00
Matthias Clasen
1660bac6bd frame clock: Add tracing
Emit tracing data for frames. For now, we emit the
entire frame, and the layout and paint phases. Also
emit frames-per-second.
2019-05-07 09:37:59 -07:00
Matthias Clasen
9e40642335 Add a way to start the profiler
If SYSPROF_TRACE_FD is set in the environment,
interpret it as an fd to write profiling data
to.

If GTK_TRACE is set, write profiling data
to a file with name gtk.$PID.syscap.
2019-05-07 09:37:59 -07:00
Matthias Clasen
032bb45ce3 gdk: Add a profiler
This is writing data in the capture format of sysprof,
using the SpCaptureWriter. For now, this is using a
vendored copy of libsysprof. Eventually, we want to
use the static library that sysprof provides.
2019-05-07 09:37:59 -07:00
Benjamin Otte
e29cf84ac4 broadway: Install headers
How are we going to check a display for its broadway-ness otherwise?
2019-05-06 20:15:49 +02:00
Benjamin Otte
7ae675b469 build: Install the backend headers in the backend directories
That's where they are in the sources and we include them from other
headers. So make sure the directories match.
2019-05-06 20:14:53 +02:00
Matthias Clasen
f6225901e8 gdk: Documentation improvements
Document some new x11 symbols.
2019-05-02 02:39:36 +00:00
Matthias Clasen
737400ddbc wayland: sanity check events at the source
Sanity check events before we throw them into
the event queue, as this makes it much easier
to track down the culprit.
2019-05-01 20:51:43 +00:00
Matthias Clasen
134e159bc9 gdk: add a sanity check for events
Before delivering events to GTK, make sure
they're sane. For now, this means making sure
the surface and device are from the same
display.
2019-05-01 20:50:24 +00:00
Matthias Clasen
6f0b47681b seat: Add a sanity check
apis that takes multiple display-relative objects
should make sure that they are all from the same
display, or hard-to-track-down badness will happen
later on.

Add such a check for the surface and device arguments
of gdk_seat_grab. This helped in tracking down
critical warnings from combo boxes in the inspector.
2019-05-01 20:46:02 +00:00
Rico Tzschichholz
724ec3ca92 Add a few placeholder documentation block to have g-i annotations 2019-05-01 15:03:16 +02:00
Matthias Clasen
5b8f1aa2ee Merge branch 'xdg-output' into 'master'
[gtk4] wayland: Add support for xdg-output

Closes #1828

See merge request GNOME/gtk!751
2019-05-01 03:34:56 +00:00
Samuel Thibault
99eee5cea9 Revert "gdk: deactivate/activate surface on keyboard grabs"
This reverts commits 35417a5a74 and
01455399e8.

This reintroduces #85, but see discussion in
https://gitlab.gnome.org/GNOME/gtk/merge_requests/433 for the unforeseen
invasive consequences of these commits.
2019-04-30 16:48:16 +02:00
Chun-wei Fan
efed2641f4 Merge branch 'fix-win32-gl-resize' into 'master'
Fix win32 gl resize

See merge request GNOME/gtk!694
2019-04-30 03:35:16 +00:00
Matthias Clasen
24fa104b61 surface: Add a frame-clock property
Now that GdkSurface has properties, it makes
sense to turn the frame clock into one too.

This will make it easier to reshuffle some
of the surface constructors later.
2019-04-29 15:11:58 -04:00
Jonas Ådahl
5f8543fe81 wayland: Only check top-most for grabbing popups
Non-grabbing popups are not limited to a single
nesting stack, as per the spec, so we should not
prevent that on the client-side.
2019-04-29 16:00:53 +00:00
Matthias Clasen
aae7816557 wayland: Reshuffle some internals
Make find_grab_input_seat return a GdkWaylandSeat
instead of a struct wl_seat, so we can use it and
avoid calling gdk_display_get_default_seat when
we need to get a serial later.
2019-04-29 16:00:09 +00:00
Timm Bäder
6f3e608331 gdkglcontext: Limit gl debug label length
There's a maximum length we have to adhere to, otherwise GL throws a
GL_INVALID_VALUE error.
2019-04-27 10:44:23 +02:00
Chun-wei Fan
b8127670df Merge branch 'fix-gdkwin32-move-drag' into 'master'
gdksurface-win32.c: Acquire root coordinates on drag/move

See merge request GNOME/gtk!693
2019-04-25 15:44:59 +00:00
Alexander Larsson
249f6a85b3 gdkglcontext: Only emit opengl debug calls if GDK_DEBUG=gl-debug
This avoids a potential performance cost in the non-debug case.
2019-04-25 11:36:23 +02:00
Alexander Larsson
b1eedbeb58 GdkGLContext: Add internal functions for KHR_DEBUG calls
This includes pushing and poping debug group messages and labeling
objects.
2019-04-25 11:35:00 +02:00
Timm Bäder
1f5649e1ce GdkWaylandDevice: Don't recreate the default cursor every frame
Save the information whether the cursor in use is the default one, and
don't create a new cursor object in that case.
We previously created a new cursor object every frame just to compare it
to the current cursor in use and then throw it away.
2019-04-23 17:09:14 +02:00
Benjamin Otte
6e59c5c843 gdk: Remove gdk_surface_invalidate_rect() from public API
It's still available for backends, but public API (read: GTK) is
meant to only call gdk_surface_queue_expose() and track its
invalid region itself.
2019-04-21 20:08:05 +02:00
Matthias Clasen
c723893f09 gdk: Remove an unused field
Its not used, so get rid of it.
2019-04-21 11:19:42 -04:00
Matthias Clasen
51b2759eb1 surface: Drop group api
This was only ever implemented on X11, and
GTK is not using it at all. Relegate it to
x11-specific api.
2019-04-20 02:28:46 +00:00
Matthias Clasen
fed2db1493 window: Drop some x11-specific apis
The skip-taskbar, skip-pager and urgency hints were
only ever implemented for X11, and are not very useful
with modern desktops. Relegate the functionality to
x11 backend api, and drop the GtkWindow api.
2019-04-20 02:28:46 +00:00
Matthias Clasen
37fee8c52f wayland: Improve debug output for events
We were missing surfaces in a few places.
2019-04-19 13:58:45 -04:00
Carlos Garnacho
50eb11a2a0 gdk/wayland: Listen to wl_surface events on tablet cursors
And update the surface accordingly (eg. scale on hidpi). The mechanism
that did that for wl_pointer has been made generic so it can be shared
with tablets too.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1675
2019-04-18 19:27:29 +02:00
Matthias Clasen
e8f898508a Merge branch 'handle-tool-scale-fix' into 'master'
gdkdevice-wayland: Update pointer scale on tablet tool proximity events

See merge request GNOME/gtk!582
2019-04-18 16:55:28 +00:00
Matthias Clasen
ecdad20827 wayland: Avoid using uninitialized memory
_gdk_wayland_cursor_get_buffer was not initializing
its out variables in the 'not found' case. This
was showing up in protocol traces as garbage hotspots
being sent to the compositor.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1328
2019-04-18 14:27:00 +00:00
Olivier Fourdan
1f58e0ed6b wayland: Add support for xdg-output
Previously, the GDK backend for Wayland would deduce the logical size
of the monitors from the wl_output size and scale.

With the addition of fractional scaling which advertises a larger scale
value and then scale down the client surface, the computed logical size
of the monitors in GDK would be wrong and confuse applications which
insist on using the monitor size and position (like Firefox).

The xdg-output protocol aims at describing outputs in a way which is more
in line with the concept of an output on desktop oriented systems by
presenting the outputs using their logical size and position appropriately
transformed.

Add support for the optional xdg-output protocol so that the size and
position of the monitors as reported by GDK is correct even when using
fractional scaling.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/1828
2019-04-16 16:14:43 +02:00
Benjamin Otte
0791924bf7 Convert fallthrough comments to G_GNUC_FALLTHROUGH
This way it's very obvious that fallthrough is indeed what we want.

Also bump the glib requirement to 2.59 which introduced
G_GNUC_FALLTHROUGH.
2019-04-15 14:40:25 +02:00
Benjamin Otte
98e076b51e rgba: Add gdk_rgba_parser_parse()
This function is a (private) function to parse a GdkRGBA accoridng to
the CSS specs. We should probably use it for gdk_rgba_parse(), but that
would change the syntax we accept there...

This also introduces a dependency of libgdk on libgtkcss.

So far, no users for this function exist.
2019-04-12 19:34:28 +02:00
Benjamin Otte
a938c14d11 build: Add gtk-css static library
This library is meant to be the new CSS library that gets used from GDK,
GSK and GTK for string printing and parsing.

As a first step, move GtkCssProviderError into it.

While doing so, split it into GtkCssParserError (for critical problems)
and GtkCssParserWarning (for non-critical problems).
2019-04-12 19:34:28 +02:00
Emmanuele Bassi
f25832455f vulkan: Add missing enumeration value
Vulkan 1.1.97 added VK_ERROR_INVALID_DEVICE_ADDRESS_EXT, and we now must
handle it.
2019-04-12 18:03:22 +01:00
Chris Williams
0bf4c2420d gdkframeclockidle: Don't permanently skew frame time
Since commit 3b2f9395, the frame time may be set into the future, so
only ensure monotonicity, and don't store the offset. This prevents the
frame time from becoming out of sync with g_get_monotonic_time().

Fixes #1612
2019-04-09 16:26:25 -04:00
Chris Williams
f813bc1823 gdkframeclockidle: Remove unused struct member
compute_frame_time() has been using g_get_monotonic_time() instead of
GTimer since commit 7dfa4121.
2019-04-08 20:37:00 -04:00
Matthias Clasen
d3c0899000 gdk: Fix an indentation mishap
Commit f1d61d5515 inadvertedly
destroyed indentation in most of gdksurface.c. Fix this.
2019-04-06 16:48:52 +00:00
Matthias Clasen
624c30ecd2 Drop gdk_wayland_surface_set_use_custom_surface
This is unused in GTK, and it does not seem useful
enough to keep around.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1806
2019-04-03 23:23:24 +00:00
Matthias Clasen
64fd5158bf gdk: Change some async dnd api
The pattern we generally follow is to put the
async result right after the source object, in
finish functions. Do this for gdk_drop_read_finish.
2019-04-02 15:11:06 +00:00
Matthias Clasen
8e4e4401c5 gdk: Change some async clipboard api
The pattern we generally follow is to put the
async result right after the source object, in
finish functions. Do this for gdk_clipboard_read_finish.
2019-04-02 15:10:53 +00:00
Chun-wei Fan
7a45768efe gdkglcontext-win32.c: Fix Resizing and moving
We preiously did not apply the resizes and moves as they were previously
only done in the Cairo drawing context on Win32.  Fix this by applying
this too in the GL drawing context.
2019-04-01 14:51:29 +08:00
Chun-wei Fan
3a56da60dd gdk/win32/gdkcairocontext-win32.c: Make functions shared in backend
Make gdk_win32_surface_get_queued_window_rect() and
gdk_win32_surface_apply_queued_move_resize() not static functions, as we
want to use them in gdkglcontext-win32.c, to fix resizing and moving.
2019-04-01 14:51:13 +08:00
Chun-wei Fan
896104939b gdksurface-win32.c: Acquire root coordinates on drag/move
As in commit d45996c, the x and y coordinates passed into begin_drag and
begin_move are no longer root coordinates but are now surface
coordinates.

Use the x and y surface coordinates to acquire the root x and y
coordinates so that resizing and moving can work as expected.
2019-04-01 14:22:38 +08:00
Matthias Clasen
1e372f57f9 Don't mark GDK_SURFACE_STATE_TILED as deprecated
I've come to the conclusion that we should keep
this state, since not all backends support per-edge
information. Updated the docs to explain how the
tiled state relates to the per-edge states.
2019-03-29 11:55:58 -04:00
Matthias Clasen
1ea1decfd6 Add a missing include 2019-03-29 11:55:42 -04:00
Matthias Clasen
04dfbf7513 Remove gdk_device_grab/ungrab from public api
They are still used internally in gdk, but we no
longer offer them as public api.
2019-03-29 11:31:13 -04:00
Alexander Larsson
5bc8f8826f broadway: Optionally support data: uris instead of blobs
This is nice when you want to make a "screenshot" by using save-as.
Its not going to perform as well though, so you have to enable it
by adding ?datauri to the url
2019-03-29 14:30:13 +01:00
Alexander Larsson
4e7eccbb49 broadway: Report some level of frame timings
This is not ideal because we report the time of a full roundtrip, rather
than the presentation time, but its better than nothing, and i'm not sure
how the browser time should be reconciled.
2019-03-29 14:30:13 +01:00
Alexander Larsson
27e47d5df6 broadway: Change events and ops enums to straight ints 2019-03-29 14:30:13 +01:00
Alexander Larsson
7002688398 broadway: More multi-display fixes
When doing idle flushing, do so per display rather than a global
and some find_display hack.
2019-03-29 14:30:13 +01:00
Alexander Larsson
54167ec3fa broadway: Add warning for unexpected roundtrip delays 2019-03-29 14:30:13 +01:00
Alexander Larsson
a966fe1ed5 broadway: Keep track of surface owner and only send input to that client 2019-03-29 14:30:13 +01:00
Alexander Larsson
ab801fe782 broadway: Fix handling of input with multiple in-process GdkDisplays
We need each instance to only forward input to the right display.
This make the inspector work better.
2019-03-29 14:30:13 +01:00
Alexander Larsson
b58a366dc6 broadway: Support patching nodes for textures and transforms 2019-03-29 14:30:13 +01:00
Alexander Larsson
f30ba56323 broadway: Reintroduce smarter diffing
We now send very minimal diff operations.
2019-03-29 14:30:13 +01:00
Alexander Larsson
4dfe2e6e2f broadway: Initial restructuring of node tree diffing
This goes back to a very naive diff, but that reuses nodes from
previous frames using the node id. This will be a bettter base
to start from.
2019-03-29 14:30:13 +01:00
Alexander Larsson
90c5a5ff6b broadway: Update broadway_node_type_names 2019-03-29 14:30:13 +01:00
Alexander Larsson
6040a7370c Broadway: Send configure notify on move/resize too 2019-03-29 14:30:13 +01:00
Alexander Larsson
c8d7b4a79a broadway: Fix coordinates when drag move/resizeing
The x/y passed in are in the surface, not root coords.
2019-03-29 14:30:13 +01:00
Chun-wei Fan
4784c5a980 gdk/win32/gdkdrag-win32.c: Include math.h
We need that for round().
2019-03-29 16:50:53 +08:00
Matthias Clasen
f89c93ea8e Merge branch 'window-api-cleanup' into 'master'
GtkWindow api cleanup

See merge request GNOME/gtk!674
2019-03-28 00:14:51 +00:00
Matthias Clasen
bbb6772934 win32: Drop set_role
One overlooked (non-)implementation of set_role.
2019-03-27 18:48:59 -04:00
Matthias Clasen
3600d129bf win32: Add a missing include
We are using round() now, so include math.h.
2019-03-27 18:47:56 -04:00
Matthias Clasen
0d43d11387 gdk: Drop gdk_surface_set_role
This is a very old X session management thing, and you
will be hard-pressed to find a session manager that can
make use of it, and even harder-pressed to find apps
using it to their advantage.
2019-03-27 17:29:17 -04:00
Matthias Clasen
8ef4e231ec gdk: Stop implementing set_role
All but the X implementation of these were
empty anyway. And the X one is just setting
a property.
2019-03-27 17:29:17 -04:00
Alexander Larsson
9212727f53 broadway: Use css transforms
This allows generic transforms nodes to work.
2019-03-27 19:27:16 +01:00
Alexander Larsson
411dc7e138 broadway: Fix leftover dom modification not using display_commands 2019-03-27 14:21:28 +01:00
Matthias Clasen
c0aaa43122 Rename gdk_device_get_surface_at_position_double
We can drop the double suffix now.
2019-03-26 18:12:55 -04:00
Matthias Clasen
5935f26a1d Drop gdk_device_get_surface_at_position
It is no longer used.
2019-03-26 18:12:55 -04:00
Matthias Clasen
9021e7d3cd gdk: Stop using gdk_device_get_surface_at_position
We should always use the double variant.
2019-03-26 18:12:55 -04:00
Matthias Clasen
03eb455c93 Rename gdk_device_get_position_double
We can drop the double suffix now.
2019-03-26 18:12:55 -04:00
Matthias Clasen
6288043ec2 Drop gdk_device_get_position
It is no longer used.
2019-03-26 18:12:55 -04:00
Matthias Clasen
8dece0e940 gdk: Stop using gdk_device_get_position
We should always use the double variant of this api.
2019-03-26 18:12:55 -04:00
Matthias Clasen
21580309d3 Rename gdk_surface_get_device_position_double
Drop the _double suffix, now that the int version is gone.
2019-03-26 18:12:54 -04:00
Matthias Clasen
f1d61d5515 Drop gdk_surface_get_device_position
Not used anymore.
2019-03-26 18:08:39 -04:00
Matthias Clasen
54a969e0ad gdk: Stop using gdk_surface_get_device_position
Use the double variant instead.
2019-03-26 17:55:29 -04:00
Matthias Clasen
d45996c728 Avoid root coordinates in begin_drag/move apis
Change the all the begin_drag and begin_move apis in
GdkSurface and GtkWindow to expect surface coordinates.

Update the x11 implementation to translate to root
coordinates where it matters. Wayland is ignoring the
coordinates anyway.
2019-03-26 15:57:11 -04:00
Alexander Larsson
6fce18e1a1 broadway: Remove some spew 2019-03-26 17:09:41 +01:00
Alexander Larsson
cf4226586a broadway: Load all textures before applying display ops, fixing flickers 2019-03-26 17:07:47 +01:00
Alexander Larsson
0481aa10e7 broadway: Use const use for constants in the js code 2019-03-26 17:07:47 +01:00
Alexander Larsson
edbaa0964f broadway: Clean up stuff using const defines 2019-03-26 17:07:47 +01:00
Alexander Larsson
fbefec52a5 Broadway: Add id for nodes and reuse old ones
When sending render nodes from the client to the daemon we add an id,
and whenever we're about to re-send the entire tree node we instead
send the old id. We track all the nodes for the previous frame
of the surface this way.

Having the id on the daemon side will allow us do to much better deltas.
2019-03-26 17:07:47 +01:00
Alexander Larsson
87a13fe3d2 broadway: Prepare for splitting display ops out of command handling 2019-03-26 17:07:47 +01:00
Alexander Larsson
2f85443e37 broadway: Refcount textures
We want to delay some rendering, and to make that safe we need to correctly
refcount the use of blob uris for the textures so that we don't unref
it while something is scheduled to use it.
2019-03-26 17:07:47 +01:00
Alexander Larsson
3bbbe9f71b broadway: Don't crash of drag-resizing when already active
This is what the X11 code does.
2019-03-26 17:07:47 +01:00
Alexander Larsson
890b759091 broadway: Send actual float32, not some hack 2019-03-26 17:07:47 +01:00
Alexander Larsson
d997903d29 broadway: Use DataView instead of hand-rolled int parsers
This is nicer in general, but also will let us do floats more sanely.
2019-03-26 17:07:47 +01:00
Alexander Larsson
b097f0a7d8 Broadway: Add node for debug nodes
This can be helpful when debugging broadway.
2019-03-26 17:07:47 +01:00
Alexander Larsson
1b5b1bfd0e broadway: Don't fall back for translation transform nodes
These are trivial anyway
2019-03-26 17:07:47 +01:00
Christoph Reiter
0638dca29a win32: remove another call to gdk_device_warp()
Inline the implementation (untested). To fix the build.
2019-03-26 08:20:07 +01:00
Christoph Reiter
ae68dc7a7d win32: remove unused gdk_display_warp_device
to fix the build
2019-03-26 07:59:01 +01:00
Matthias Clasen
20b4a8b38c Yet another win32 build fix
So much empty warping.
2019-03-25 23:29:34 -04:00
Matthias Clasen
4dfe2a8aa8 Fix the windows build
There was another warp implementation that needed to be removed.
This commit also addresses a number of compiler warnings
in passing.
2019-03-25 20:06:08 -04:00
Matthias Clasen
f2dff5115f win32: Drop the warp implementation
We no longer support pointer warping.
2019-03-25 10:16:14 -04:00
Matthias Clasen
3d37f08f38 Remove gdk_device_warp
This was only ever implemented on X11, and is
not something we want to encourage apps to do, ever.
2019-03-24 20:49:08 -04:00
Руслан Ижбулатов
8da56cef79 GDK W32: Fix property setting to correctly use static strings
The strings that are set are static, so g_value_set_static_string() should
be used to set them instead of g_value_set_string().
2019-03-22 16:59:03 +00:00
Руслан Ижбулатов
64ab82c403 GDK W32: Test for IME correctly
ImmIsIME() doesn't work (always returns TRUE) since Vista.
Use ITfActiveLanguageProfileNotifySink to detect TSF changes,
which are equal to IME changes for us.

Also make sure that IMMultiContext re-loads the IM when keyboard layout
changes, otherwise there's a subtle bug that could happen:
* Run GTK application with non-IME layout (US, for example)
* Focus on an editable widget (GtkEntry, for example)
* IM Context is initialized to use the simple IM
* Switch to an IME layout (such as Korean)
* Start typing
* Since IME module is not loaded yet, keypresses are handled
  by a default MS IME handler
* Once IME commits a character, GDK will get a WM_KEYDOWN,
  which will trigger a GdkKeyEvent, which will be handled by
  an event filter in IM Context, which will finally re-evaluate
  its status and load IME, and only after that GTK will get
  to handle IME by itself - but by that point input would
  already be broken.
To avoid this we can emit a dummy event (with Void keyval),
which will cause IM Context to load the appropriate module
immediately.
2019-03-22 16:58:59 +00:00
Carlos Garnacho
65d9b7ee86 gdk: Include copy of glib/gconstructor.h
This is named gdkconstructor.h to avoid any possible conflicts. This fixes
the current usages of G_HAS_CONSTRUCTORS, as that header is not installed
by glib.
2019-03-17 21:29:59 +01:00
Matthias Clasen
06f790d663 gdk: Add a related_target field to some events
Crossing and focus change events are emitted between
two widgets, and want to associate both with the
events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
c73972f7df gdk: Rename gdk_event_set_user_data
Lets call it what it is, the target.
All of this is private api anyway.

Update all callers.
2019-03-16 21:24:45 -04:00
Matthias Clasen
8d5f1ae662 gdk: Add crossing mode and detail to focus events
We want focus events more similar to crossing events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
eacbeb9efd x11: Don't emit GDK_NOTHING events
They are good for nothing.
2019-03-06 23:42:36 -05:00
Bastien Nocera
91ad2eef5c surface: Advise using gtk_window_present_with_time()
Rather than gtk_window_present()
2019-02-25 17:38:08 +01:00
Bastien Nocera
df6494d73a Add 4.0 deprecation warning macros
Note that functions deprecated in 4.0 will cause deprecation warnings
even with the pre-4.0 GTK development versions.
2019-02-25 17:38:08 +01:00
Matthias Clasen
397b8ee9d5 docs: Its just GTK now
Another round of + removal.
2019-02-24 13:33:36 -05:00