Commit Graph

2619 Commits

Author SHA1 Message Date
Robert Mader
7a46378e71 gdk/x11: Honor hotspot during drag cancel animation
Otherwise the icon "jumps" to the cursor position with its top left when
the animation starts.
This is especially visible if the dragged item is big, like when dragging
mails in Thunderbird.
2019-12-09 01:45:30 +01:00
Emmanuele Bassi
def700739d Use a single compilation symbol
We use a compilation symbol in our build to allow the inclusion of
specific headers while building GTK, to avoid the need to include only
the global header.

Each namespace has its own compilation symbol because we used to have
different libraries, and strict symbol visibility between libraries;
now that we have a single library, and we can use private symbols across
namespaces while building GTK, we should have a single compilation
symbol, and simplify the build rules.
2019-11-27 13:33:43 +00:00
Emmanuele Bassi
b70e4f6de9 Rename "iconify" to "minimize"
The "iconified" state is mostly an X11-ism; every other platform calls
this state "minimized" because it may not involve turning a window into
an icon at all.
2019-11-16 20:07:37 +00:00
Andy Holmes
d32cd210bb Correct GdkX11 import path in docs and include guards
Update the include directives in the documentation, as well as the
include guards in headers, to point to gdk/x11/gdkx.h.

closes #2254
2019-11-16 01:35:09 -08:00
Mohammed Sadiq
e79d585b00 gdkselectionoutputstream-x11: Fix a memory leak 2019-10-27 14:05:46 +05:30
Дилян Палаузов
6ded38de2b Minor typos in the Documentation (a/an) 2019-08-25 12:52:46 +00:00
Matthias Clasen
4fa1f459dd Merge branch 'gdkmonitor-x11-manufacturer' into 'master'
gdk: x11: Fill GdkMonitor manufacturer with PNP id from EDID

Closes #1765

See merge request GNOME/gtk!859
2019-08-25 11:58:02 +00:00
Christoph Reiter
7b0af75a57 Remove NEED_XIPROTO_H_FOR_XREPLY check
It was only defined in the old autotools build to support a >20 year old x11,
https://bugzilla.gnome.org/show_bug.cgi?id=148032
2019-08-21 20:46:30 +02:00
Priit Laes
f43d344aa3 gdk: x11: Fill GdkMonitor manufacturer with PNP id from EDID
Previously, the manufacturer property of the GdkMonitor was NULL,
and having at least PNP id at GdkMonitor.manufacturer makes it
possible to distinguish between different monitors programmatically.
2019-08-06 09:16:01 +03:00
Jonas Ådahl
0885eb0a7b gdk: Remove gdk_surface_move_resize() API
Windows/surface's aren't supposed to be explicitly moved by any external
part, so don't provide API for doing so. Usage throughout Gdk is
replaced by the corresponding backend variants.
2019-07-25 10:35:43 +02:00
Jonas Ådahl
fc68d1b1e6 gdk: Make backends implement move_to_rect()
The generic layer still does the heavy lifting, leaving the backends
more or less just act as thin wrappers, dealing a bit with global
coordinate transformations. The end goal is to remove explicit surface
moving from the generic gdk layer.
2019-07-25 10:24:50 +02:00
Jonas Ådahl
b329090e69 gdk: Remove gdk_surface_move()
Generic gdk code now uses the internal helper; backends use their own
private implementations when necessary.
2019-07-25 10:24:50 +02:00
Jonas Ådahl
6314ebd435 gdk/surface: Add toplevel_resize vfunc
To separate how toplevels and popups are configured, a first step is to
introduce a resize-only vfunc for backends to implement. It's meant to
only configure toplevel windows, i.e. popups. Currently it's used for
both types, but introducing the resize-only API is a first step.
2019-07-25 10:24:50 +02:00
Jordi Mas
7d1c6272be Use commas to differentiate between text and filename 2019-07-24 13:51:22 +00:00
Benjamin Otte
96b782c026 x11: Make sure stream stays alive long enough
When unreffing the stream from a different thread, the close function
will schedule its cleanup asynchornously in the main thread.
We need to make sure the stream object stays alive for as long as
that hasn't happened, so ref() it.

Fixes #2003
2019-07-05 21:17:00 +02:00
Jonas Ådahl
5db079b052 gdk/frameclock: Make surfaces inhibit freeze
To make a frame clock tick as long as any of the associated surfaces
expect to receive ticks, make the surfaces inhibit freezing the clock,
instead of directly tell the frame clock to freeze itself.

This makes it so that as long as any surface using a certain frame clock
is not frozen (e.g. just received a frame event from the display
server), the frame clock will not be frozen.

With this, the frame clock is initiated as frozen, and won't be thawed
until any surface inhibits freeze. It will be frozen again, when every
surface has that previously inhibited freeze uninhibited freeze.
2019-07-03 11:42:28 +02:00
Emmanuele Bassi
f524a9315b Set the monitor's connector under X11
Like we do on Wayland.

In this case, we copy it from the same source as the output name,
because it's going to match.
2019-06-24 15:38:36 +01:00
Benjamin Otte
c0bbfd950d x11: Actually call the finished func when finishing
Copy/paste madness was calling the status func...
2019-06-18 15:53:18 -04:00
Matthias Clasen
1f70bc4bf3 gdk: Create a global shared GL context
Create a global GL context that connects all
GL contexts on a display and lets us share textures
between them.
2019-06-04 23:00:02 +00:00
Matthias Clasen
2ae6f1a741 Add a gtk-overlay-scrolling setting
This is in preparation for letting user opt out of
overlay scrolling in the control-center.
2019-05-31 14:07:15 +00:00
Niels De Graef
df9aed6c61 Fix some GObject introspection annotations
Fixes several warnings by the GIR compiler.
2019-05-30 20:34:43 +02:00
Christian Hergert
f507a79056 marshallers: ensure g_cclosure_marshal_VOID__VOIDv is used
If we set c_marshaller manually, then g_signal_newv() will not setup a
va_marshaller for us. However, if we provide c_marshaller as NULL, it will
setup both the c_marshaller (to g_cclosure_marshal_VOID__VOID) and
va_marshaller (to g_cclosure_marshal_VOID__VOIDv) for us.
2019-05-29 13:22:31 -07:00
Matthias Clasen
987e7878a2 Drop gdk_surface_get_frame_extents
No longer used.
2019-05-29 18:04:08 +00:00
Matthias Clasen
0103c13632 x11: Set surface position correctly
The X backend was storing global coordinates
in surface->x/y, and keeping the parent-relative
positions in its own fields. Switch this around
to store the relative position in x/y, as is
expected by the frontend.
2019-05-29 18:04:08 +00:00
Matthias Clasen
2aa0ceaeca x11: Disconnect from the frame clock
The frame clock can now survive its surface,
so we need to disconnect signal handlers.
2019-05-28 20:25:17 +00:00
Matthias Clasen
3d283cc8f4 gdk: Maintain popup tree in the frontend
We will need this information here, and we can
share the child lists between various backends.
2019-05-28 20:25:17 +00:00
Matthias Clasen
44be64278b surface: Make surface-type a property
Make surface-type a construct-only property,
so we can set it before the frame clock.
2019-05-28 20:25:16 +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
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
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
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
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
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
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
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
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
9b54f124e5 surface: Simplify destroy implementation
Without child surfaces, there is no need to recurse.
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
6183d58f80 x11: Stop using surface->parent
It is always NULL.
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
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
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
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
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
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
Rico Tzschichholz
724ec3ca92 Add a few placeholder documentation block to have g-i annotations 2019-05-01 15:03:16 +02: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
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
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
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
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
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
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
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
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
Matthias Clasen
eacbeb9efd x11: Don't emit GDK_NOTHING events
They are good for nothing.
2019-03-06 23:42:36 -05:00
Matthias Clasen
08badd23cd Drop some dead code
There were some internal uses of GdkEventFunc. Thankfully,
they were unused, so lets just drop them.
2019-02-23 14:13:57 -05:00
Emmanuele Bassi
22f073b57b docs: Fix references to pkg-config files
The pkg-config files for GDK were dropped in 4.0, and now the GTK
pkg-config files have been renamed.
2019-02-06 10:40:51 +01:00
Emmanuele Bassi
45361e19c3 Rename more GSources to use gtk 2019-02-06 10:37:24 +01:00
Matthias Clasen
101f1c7b42 gdk: Stop using deprecated pango api 2019-02-04 18:28:31 -05:00
Benjamin Otte
359bc7695c build: Reintroduce warning flags from autotools
Some of the flags got lost in the meson transition or were demoted from
error flags to warning flags.
This commit reintroduces them.

It also includes fixes for the code that had warnings with those flags.
The big one being -Wshadow.
2019-01-22 04:33:12 +01:00
Matthias Clasen
a80007ac12 Fix XChangeProperty calls
They must be long...

Closes: #1556
2019-01-02 19:26:56 -05:00
Peter Hutterer
38cba6895a x11: make the tool lookup dependent on the hw id as well
Tools on the same physical item have the same serial number, so the eraser
and the pen part of a single pen share that serial number. With the current
lookup code, we'll always return whichever tool comes first into proximity.

Change the code to use the hw id in addition to the serial number, this way we
can differ between two tools.
2018-12-18 21:41:49 +01:00
Peter Hutterer
e95e045898 x11: don't add unknown tools to our list
Generic tools (Bamboo, built-in tablets) always have the same serial number
assigned by the wacom driver. This includes the touch tool when the wacom
driver handles the touch evdev node (common where users require the wacom
gestures to work).

When the first device is the touch device, a tool is created with that serial.
All future tools now return the touch tool on lookup since they all share the
same serial number. Worse, this happens *across* devices, so the pen
event node gets assigned the touch tool because they all have the same serial.

Since we don't actually care about the touch as a tool, let's skip any unknown
tool. This captures pads as well.
2018-12-18 21:41:09 +01:00
Peter Hutterer
1b730dcf31 x11: get the tool type from the wacom driver properties
Any wacom device currently sets the tool type to UNKNOWN. The wacom driver has
a property that exports the tool type as one of stylus, eraser, cursor, pad or
touch. Only three of those are useful here but that's better than having all
of them as unknown.
2018-12-18 21:41:08 +01:00
Timm Bäder
94745241c2 GdkGLContext: Fix damage computation with buffer_age
As per the spec:

> The back buffer can
> either be reported as invalid (has an age of 0) or it may be
> reported to contain the contents from n frames prior to the
> current frame.

So a  buffer age of 1 means that the buffer was used in the last frame.
We were handling buffer_age==1 the same as buffer_age==0, i.e. we
returned the full damage for the surface.

[1] https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_buffer_age.txt
2018-12-02 13:25:43 +01:00
Christoph Reiter
b061821f24 g-i: Add some nullable annotations
Based on grepping arg docs for NULL.
See https://gitlab.gnome.org/GNOME/pygobject/issues/261
2018-11-18 13:36:50 +01:00
Mohammed Sadiq
1ce960c85b gdkselectioninputstream-x11: Fix memory leak 2018-09-16 20:08:25 +05:30
Benjamin Otte
375fbd4e47 gdk: Remove key_event->string and key_event->length
They're unused.
2018-07-30 19:32:38 +02:00
Matthias Clasen
ad6255a841 Merge branch 'xfixes-timestamp' into 'master'
x11: Ignore old XFixesSelectionNotify events

Closes #14

See merge request GNOME/gtk!259
2018-07-25 11:21:01 +00:00
Nirbheek Chauhan
5df4d27752 meson: libgdk-broadway.a depends on broadwayjs.h
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1218

Also fix another dependency error I found.
2018-07-23 20:15:44 +05:30
Jason Crain
77c3ef48cf x11: Ignore old XFixesSelectionNotify events
GtkEntryCompletion can rapidly release and claim ownership of the
primary selection. This generates multiple XFixesSelectionNotify events,
first stating that no one owns the selection, then another stating that
we own the selection. The notification that no one owns the selection
causes GtkEntryCompletion to deselect the text, breaking inline
autocompletion.

This fixes it by ignoring any XFixesSelectionNotify with a timestamp
earlier than our clipboard timestamp.

Fixes #14
2018-07-21 15:22:04 -05:00
Timm Bäder
446b2e25d3 Avoid a g_object_get path
We can use gdk_device_get_n_axes instead and will get the same result.
2018-07-17 17:33:46 +02:00
Matthias Clasen
7a1073c3ae Revert "gdk: Drop configure events"
This reverts commit a8926c9d87.
2018-07-15 20:23:45 -04:00
Matthias Clasen
168523264c x11: Set actions on drag
We should pass the actions to the newly created
drag object in drag_begin.
2018-07-15 16:50:06 -04:00
Matthias Clasen
435f143e2e x11: Rename a file
Keep in line with the parent class.
2018-07-15 16:47:17 -04:00
Matthias Clasen
2d83bb1b91 x11: Stop using GdkDrag fields 2018-07-15 16:43:28 -04:00
Matthias Clasen
228f813c43 dnd: Drop gdk_drag_drop
This is an inconsistently used private api, and just adds
a vfunc indirection for no other benefit.
2018-07-15 15:58:05 -04:00
Matthias Clasen
d148f26658 Drop gdk_surface_withdraw
'withdrawn' is an X11-centric concept, and the function
can just as well be replaced by gdk_surface_hide.
2018-07-15 15:29:58 -04:00
Matthias Clasen
7ca6440f4d gdk: Drop map events
We are really inconsistent about generating these,
and they are not actually used in GTK+. Instead,
add a boolean GdkSurface::mapped property.
2018-07-15 15:10:56 -04:00
Matthias Clasen
a8926c9d87 gdk: Drop configure events
Replace configure events with a GdkSurface::size-changed signal.
This is part of the move to use events only for input.
2018-07-15 11:51:09 -04:00
Benjamin Otte
6afb6bb9d2 x11: Set BackPixmap = None unconditionally
Makes it more obvious what we actually want.

Related: #1134
2018-07-14 05:27:54 +02:00
Matthias Clasen
f432c937cc dnd: Drop gdk_drag_abort
This function is never called, so drop it, its vfunc,
and all the backend implementations.
2018-07-12 13:57:45 +02:00
Matthias Clasen
a756caa106 dnd: Drop suggested_action
The only user of this field was the x11 backend, and it
turns out that it does not need to store the value at all.
2018-07-12 13:02:42 +02:00
Matthias Clasen
da22ba3b86 drag: Split a setter
In preparation for moving the suggested action
to the x11 backend, split the setter off.
2018-07-12 13:02:42 +02:00
Matthias Clasen
94af080fb6 Rename a property
Change GdkDrag::action to GdkDrag::selected-action, which is
more clearly different from actions, and follows the existing
name of the struct field and getter.
2018-07-12 13:02:42 +02:00
Matthias Clasen
db0b9f61ae dnd: Add a GdkDrag::action property
This lets us drop the ::action-changed signal for the
property change notification. But, can just as well move
the signal class handers which just update the cursor
to the ::action setter. No need to do this in the backends.
2018-07-12 13:02:42 +02:00
Matthias Clasen
64f5afe608 dnd: Rename headers
Rename gdkdnd.h to gdkdrag.h, to go along with gdkdrop.h

This commit includes the necessary updates to the X11, Wayland
and Broadway backends. Other backends have to be updated separately.
2018-07-02 15:00:50 +02:00