Commit Graph

8116 Commits

Author SHA1 Message Date
Benjamin Otte
fe7c283aea clipboard: Add infrastructure to store clipboards
Clipboard managers will be so happy once the backends actually implement
it!
2017-12-03 05:46:48 +01:00
Benjamin Otte
51e46cc898 contentprovider: Add ref_storable_formats()
This is to be used for advocating to clipboard managers.
2017-12-03 05:46:48 +01:00
Benjamin Otte
6b326b14c0 gdk: Add GDK_TYPE_FILE_LIST with serializers
This is a GSList of GFile and we want it so we can operate with lists of
files and text/uri-list.

I chose GSList over GList because that's what the GtkFileChooser API
uses, too.
2017-12-03 05:46:48 +01:00
Benjamin Otte
928c98a84e gdk: Add serializers and deserializers for GFile
in particular, support:
GFile <=> text/uri-list
GFile  => text/plain
2017-12-03 05:46:48 +01:00
Benjamin Otte
4e06aaeaa8 gdk: Add gdk_content_formats_new_for_gtype()
Many places create formats for a single tpye, so make it easy for them
to get this without having to create a builder first.
2017-12-03 05:46:48 +01:00
Benjamin Otte
cc07800570 gdk: Allow setting task data on (de)serializers
This mirrors GTask.
2017-12-03 05:46:48 +01:00
Benjamin Otte
134076e738 x11: Implement claiming the X Selection with the clipboard
... and of course support writing to other apps.
2017-12-03 05:46:47 +01:00
Benjamin Otte
c66a61d896 x11: Add gdk_x11_display_get_max_request_size()
There's multiple places in the clipboard code where I need it, so make
it a custom function.
2017-12-03 05:46:47 +01:00
Benjamin Otte
8e132ef0c4 clipboard: Allow claiming the clipboard to fail
Also make clipboard_claim() a vfunc so backends can override it.

Because the whole operation a vfunc, backends have the option of adding
code before the actual claim is done and potentially even fail or do
something after the successful claim.
2017-12-03 05:46:47 +01:00
Benjamin Otte
7426f1a16b gdkcontentformats: Change the matching API
Instead of having just one function that has the gtype and mime type as
out arguments, have 3 functions: 1 that finds any match, 1 that finds a
GType match and one for a mime type match.

This makes the API way more convenient to use.
2017-12-03 05:46:47 +01:00
Benjamin Otte
25c3895836 clipboard: Add serialization
This completes the local clipboard code.
2017-12-03 05:46:47 +01:00
Benjamin Otte
12ca641ff5 clipboard: Implement local fallback clipboard transfers
This requires implementing a "pipe" so we can have 2 streams running:
  contentprovider => serializer => outputstream
  inputstream => deserializer => reader
And the pipe shoves the data from the outputstream into the inputstream.
2017-12-03 05:46:47 +01:00
Benjamin Otte
888e5257e0 clipboard: Introduce GdkContentProvider
GdkContentProvider is the object that represents local data in the
clipboard.

This patch only introduces the object and adds the clipboard properties,
it does not yet provide a way for the actual implementations to access
it.

The only access that is implemented is the local shortcut GValue access.
2017-12-03 05:46:47 +01:00
Benjamin Otte
3023d254dd clipboard: Make value getters set the passed in value
Don't return a const GValue, that's ugly API. Instead require people to
pass in a preinitialized GValue and set that one.
2017-12-03 05:46:47 +01:00
Benjamin Otte
9b78d76873 x11: Improve fallbacks for text
(1) Try all passed in formats in order if one of them fails.
(2) Don't blindly accept all formats, make sure they are mime types
(3) Add a bunch of special non-mime types that plug converters to
    get to mime types
2017-12-03 05:46:46 +01:00
Benjamin Otte
88684baecf clipboard: Add gdk_clipboard_read_text_async()
Also add deserializers for G_TYPE_STRING.
2017-12-03 05:46:28 +01:00
Benjamin Otte
02d1f90d13 clipboard: Add gdk_clipboard_read_pixbuf_async() 2017-12-03 05:46:28 +01:00
Benjamin Otte
91910ba013 gdk: Im[plement content deserializing
Add infrastructure to do GInputStream => GType conversions. Use that to
implement gdk_clipboard_read_value() which reads into GValues.
2017-12-03 05:46:27 +01:00
Benjamin Otte
970cb100af x11: Improve debugging output for selection input stream 2017-12-03 05:46:27 +01:00
Benjamin Otte
41f70e18af clipboard: Refactor gdk_clipboard_read() to be async
This allows us not just to pass any mime type to the read function, but
it also makes it possible to pass multiple mime types and the clipboard
can then try them in order until it finds a supported one.

This is so far not implemented though.
2017-12-03 05:46:26 +01:00
Benjamin Otte
516f35b865 x11: Use async queue and implement sync reads on selections stream
Turns out, way too many async operations are implemented by running the
sync operation in a thread. The easiest solution is to support that is
to use a GAsyncQueue for the buffers and deadlock if called from the
main thread.
2017-12-03 05:43:24 +01:00
Benjamin Otte
c91a38b013 clipboard: Implement gdk_clipboard_read() 2017-12-03 05:43:24 +01:00
Benjamin Otte
13fb3fd4a0 x11: Implement INCR reads 2017-12-03 05:43:24 +01:00
Benjamin Otte
fe9045d82e x11: Various clipboard cleanups
(1) Turn X11 clipboard event handling into a regular filter function
(2) Maintain a timestamp in the clipboard, so we can pass it when
    querying selections.
2017-12-03 05:43:24 +01:00
Benjamin Otte
a5ab9a9671 clipboard: Add gdk_clipboard_claim_remote()
This allows the remote clipboard to take over. The X11 clipboard already
does that.
2017-12-03 05:43:24 +01:00
Benjamin Otte
4728dd0a9e x11: Add an initial clipboard implementation
This does nothing but download the targets and debug-print them.
2017-12-03 05:43:24 +01:00
Matthias Clasen
e94b9b9a62 gdk: A GdkClipboard API draft
This commit adds a GdkClipboard object which is intended to
replace GtkClipboard, eventually.
2017-12-03 05:43:24 +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
Руслан Ижбулатов
6c29e81051 W32: Massive W32 DnD fix
Massive changes to OLE2 DnD protocol, which was completely broken before:
* Keep GdkDragContext and OLE2 objects separate (don't ref/unref them
  together, don't necessarily create them together).
* Keep IDataObject formats in the object itself, not in a global variable.
* Fix getdata() to look up the request target in its format list, not in the
  global hash table
* Create target GdkDragContext on each drag_enter, destroy it on drag_leave,
  whereas IDropTarget is created when a window becomes a drag destination
  and is re-used indefinitely.
* Query the source IDataObject for its supported types, cache them in the
  target (!) context. This is how GTK+ works, honestly.
* Remember current_src_object when we initiate a drag, to be able
  to detect later on that the data object is ours and use a
  shortcut when querying targets
* Make sure GDK_DRAG_MOTION is only sent when something changes
* Support GTK drag cursors
* Ensure that exotic GTK clipboard formats are registered
  (but try to avoid registering formats that can't be used between applications).
* Don't enumerate internal formats
* Ensure that DnD indicator window can't accept drags or receive any kind of input
  (use WS_EX_TRANSPARENT).
* Remove unneeded indentation in _gdk_win32_dnd_do_dragdrop()
* Fix indentation in gdk_win32_drag_context_drop_finish()
* Remove obsolete comments in _gdk_win32_window_register_dnd()
* Check for DnD in progress when processing WM_KILLFOCUS, don't emit a grab
  break event in such cases (this allows alt-tabbing while DnD is in progress,
  though there may be lingering issues with focus after dropping...)
* Support Shell ID List -> text/uri-list conversion, now it's possible
  to drop files (dragged from Explorer) on GTK+ applications
* Explicitly use RegisterClipboardFormatA() when we know that the string
  is not in unicode. Otherwise explicitly use RegisterClipboardFormatW()
  with a UTF8->UTF16 converted string
* Fix _gdk_win32_display_get_selection_owner() to correctly bail
  when selection owner HWND is NULL (looking up GdkWindow for NULL
  HWND always succeeds and returns the root window - not the intended
  effect)
* More logging
* Send DROP_FINISHED event after DnD loop ends
* Send STATUS event on feedback
* Move GetKeyboardState() and related code into _gdk_win32_window_drag_begin(),
  so that it's closer to the point where last_pt and start_pt are set
* Use & 0x80 to check for the key being pressed. Windows will set low-order bit
  to 1 for all mouse buttons to indicate that they are toggled, so simply
  checking for the value not being 0 is not enough anymore.
  This is probably a new thing in modern W32 that didn't exist before
  (OLE2 DnD code is old).
* Fixed (hopefully) and simplified HiDPI parts of the code.

Also adds managed DnD implementation for W32 GDK backend (for both
OLE2 and LOCAL protocols). Mostly a copy of the X11 backend code, but
there are some minor differences:
* doesn't use drag_window field in GdkDragContext,
  uses the one in GdkWin32DragContext exclusively
* subtracts hotspot offset from the window coordinates when showing
  the dragback animation
* tries to consistently support scaling and caches the scale
  in the context
* Some keynav code is removed (places where grabbing/ungrabbing should
  happen is marked with TODOs), and the rest is probably inert.

Also significantly changes the way selection (and clipboard) is handled
(as MSDN rightly notes, the handling for DnD and Clipboard
 formats is virtually the same, so it makes sense to handle
 both with the same code):
* Don't spam GDK_OWNER_CHANGE, send them only when owner
  actually changes
* Open clipboard when our process becomes the clipboard owner
  (we are doing it anyway, to empty the clipboard and *become* the owner),
  and then don't close it until a scheduled selection request event
  (with TARGETS target) is received. Process that event by announcing
  all of our supported formats (by that time add_targets() should have
  been called up the stack, thus the formats are known; just in case,
  add_targets() will also schedule a selection request, if one isn't
  scheduled already, so that late-coming formats can still be announced).
* Allow clipboard opening for selection_convert() to be delayed if it
  fails initially.
* The last two points above should fix all the bugs about GTK+ rising
  too much ruckus over OpenClipboard() failures, as owner change
  *is allowed* to fail (though not all callers currently handle
  that case), and selection_convert() is asynchronous to begin with.
  Still, this is somewhat risky, as there's a possibility that the
  code will work in unexpected ways and the clipboard will remain open.
  There's now logging to track the clipboard being opened and closed,
  and a number of failsafes that try to ensure that it isn't kept open
  for no reason.
* Added copious notes on the way clipboard works on X11, Windows and GDK-W32,
  also removed old comments in DnD implementation, replaced some of them
  with the new ones
* A lot of crufty module-global variables are stuffed into a singleton
  object, GdkWin32Selection. It's technically possible to make it a
  sub-object of the Display object (the way Wayland backend does),
  but since Display object on W32 is a singleton anyway... why bother?
* Fixed the send_change_events() a bit (was slightly broken in one of the
  previous iterations)
* Ensure that there's no confusion between selection conversion (an artifact
  term from X11) and selection transmutation (changing the data to be W32-compatible)
* Put all the transmutation code and format-target-matching code into gdkselection-win32.c,
  now this code isn't spread across multiple files.
* Consequently, moved some code away from gdkproperty-win32.c and gdkdnd-win32.c
* Extensive format transmutation checks for OLE2 DnD and clipboard.
  We now keep track of which format mappings are for transmutations,
  and which aren't (for example, when formats are passed as-is, or when
  a registered name is just an alias)
* Put transmutation code into separate functions

* Ensure that drop target keeps a format->target map for supported formats,
  this is useful when selection_convert() is called, as it only receives a
  single target and no hints on the format from which the data should
  be transmuted into this target.
* Add clear_targets() on W32, to de called by GTK
* Use g_set_object() instead of g_ref_object() where it is allowed.
* Fix indentation (and convert tabs to spaces), remove unused variables

(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:34 +00:00
Руслан Ижбулатов
3237c2172a GDK W32: Don't leak the atom name string
https://bugzilla.gnome.org/show_bug.cgi?id=786509
2017-12-02 10:38:33 +00:00
Руслан Ижбулатов
c4617d3268 GDK W32: Fix a typo in OLE2 DnD code
https://bugzilla.gnome.org/show_bug.cgi?id=786509
2017-12-02 10:38:32 +00:00
Руслан Ижбулатов
33de691d9f GDK W32: More flexible modal operation mode
Instead of using a boolean to indicate a modal operation being in progress,
use a set of flags, and allow these to be set and unset independently.

Specifically, this allows WM_CAPTURECHANGED handler to only act when a drag-move or
drag-resize modal operation is in progress, and ignore DND (which can also cause
WM_CAPTURECHANGED to be posted). This avoids a crash due to assertion failure when
OLE2 DND code tries to end a modal operation that was already ended by the WM_CAPTURECHANGED
handler.

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

https://bugzilla.gnome.org/show_bug.cgi?id=786121
2017-12-02 10:38:30 +00:00
Руслан Ижбулатов
323a601123 GDK W32: fix monitor pruning code
Decrement the counter for each removed element, otherwise we skip
one element every time we remove one. Also, no need for continue here.
2017-12-02 10:38:29 +00:00
Руслан Ижбулатов
50bbac6005 GDK W32: Correctly report window position in HiDPI mode
Window position returned by get_frame_extents() should be scaled.

Also take this opportunity to apply the same rounding that X11 backend
applies.

https://bugzilla.gnome.org/show_bug.cgi?id=788053
2017-12-02 10:38:28 +00:00
Chun-wei Fan
eb6d5b6b27 GDK-Win32: Fix AeroSnap on HiDPI
Commit 1d0fad3 revealed that there were some assumptions made that were
actually to compensate for the bug fixed by that commit, so we need to
remove those assumptions as they would result in AerSnap to not work
properly on HiDPI screens.

Also re-do how we set the x and y positions of our GdkWindow, so that we
are more consistent across the board when we go between a GDK window
coordinate and a Windows API window cooredinate.

This would also simplify the code a bit.

https://bugzilla.gnome.org/show_bug.cgi?id=785999
2017-12-02 10:38:27 +00:00
Руслан Ижбулатов
d7e2017c28 GDK W32: Handle drivers that do not send WT_CSRCHANGE after WT_PROXIMITY
Some drivers don't do that (not sure whether that is the correct behaviour
or not). Remember each WT_PROXIMITY with LOWORD(lParam) != 0 that we get,
then look for a WT_CSRCHANGE. If WT_CSRCHANGE doesn't come, but a WT_PACKET
does, assume that this device is the one that sent WT_PROXIMITY.

Also include fallback code to ensure that WT_PACKETs for an enabled device
disable the system pointer, because WT_PROXIMITY handler might have
enabled it by mistake, since it's not possible to know which device left
the proximity (it might have been a disabled device).

https://bugzilla.gnome.org/show_bug.cgi?id=778328
2017-12-02 10:38:26 +00:00
Руслан Ижбулатов
3c9b667d3e GDK W32: Apply HiDPI scale properly to monitors
Previously HiDPI scale was retrieved and applied too late in the initialization
process to affect monitor size and monitor workarea size, but the code that
initializes these sizes *did* try to use the scale, even though it was always
getting scale=1.

To fix this, move the too-late code into monitor enumeration routine.
This also fixes a probable semantic bug where width and height were divided
by scale, again.

Now monitor and workarea should be in application pixels (i.e. divided by scale),
as intended.

https://bugzilla.gnome.org/show_bug.cgi?id=778835
2017-12-02 10:38:25 +00:00
Руслан Ижбулатов
27ed9fb11d GDK W32: Different maximized window position for non-CSD windows
It seems that WM interprets the same MINMAXINFO contents differently
depending on which styles the window has. Play along.

https://bugzilla.gnome.org/show_bug.cgi?id=765161
2017-12-02 10:38:24 +00:00
Руслан Ижбулатов
58ba4d6a3e GDK W32: Ensure that we use made-up monitors when there are none
Previously GDK only made up monitors when it initially found none. Now it
also makes up monitors when it initially finds some, but later fails to get
their informatin in a normal way and finally prunes them out, being left with
zero monitors.

Having zero-length monitor array is unexpected and causes a number
of critical warnings and some critical functionality (such as displaying
drop-down menus) fails in such cases.

Ideally, there might be such a way to interrogate W32 API that produces the
information about non-real (but active) monitors out of it so that it isn't
necessary for us to make stuff up. However, this code is already complicated,
and i am not prepared to dig W32 API to find a way to do this.

This fixes the issues people had when they accessed a Windows desktop via RDP.

https://bugzilla.gnome.org/show_bug.cgi?id=777527
2017-12-02 10:38:23 +00:00
Руслан Ижбулатов
f7ae36739a GDK W32: Fix idiotic gdk_win32_display_get_monitor() implementation
Replace the code borrowed from the X11 backend with the code borrowed from Wayland backend. Now GTK doesn't crash when the number of monitors is zero.
2017-12-02 10:38:22 +00:00
Руслан Ижбулатов
c36d66bdb6 GDK W32: Use keyboard hook to detect AeroSnap combinations better
Windows WM handles AeroSnap for normal windows on keydown. We did this
on keyup only because we do not get a keydown message, even if Windows WM
does nothing with a combination. However, in some specific cases it DOES
do something - and we have no way to detect that. Specifically, winkey+downarrow
causes maximized window to be restored by WM, and GDK fails to detect that. Then
GDK gets a keyup message, figures that winkey+downarrow was pressed and released,
and handles the combination - by minimizing the window.

To overcome this, install a low-level keyboard hook (high-level ones have
the same problem as normal message loop - they don't get messages when
Windows WM handles combinations) and use it to detect interesting key combinations
before Windows WM has a chance to block them from being processed.

Once an interesting combination is detected, post a message to the window, which
will be handled in due order.

It should be noted that this code handles key repetitions in a very crude manner.

The downside is that AeroSnap will not work if hook installation function call fails.
Also, this is a global hook, and if the hook procedure does something wrong, bad things
can happen.

https://bugzilla.gnome.org/show_bug.cgi?id=776031
2017-12-02 10:38:21 +00:00
Руслан Ижбулатов
cba75d8239 GDK W32: Handle CapsLock as part of the key shift level
Instead of using some kind of flawed logic about modifying a keypress result
when CapsLock is toggled, just add a CapsLock shift level (and all derived
shift levels, i.e. Shift+CapsLock and CapsLock+AltGr and Shift+CapsLock+AltGr)
and query Windows keyboard layout API about the result of keypresses involving
CapsLock.

Keysym table is going to be (roughly) twice as large now, but CapsLock'ed
keypresses will give correct results for some keyboard layouts (such as
Czech keyboard layout, which without this change produces lowercase letters
for CapsLock->[0,2,3,4...] instead of uppercase ones).

Keymap update time also increases accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=165385
2017-12-02 10:38:20 +00:00
Руслан Ижбулатов
33442d953d GDK W32: Special handling for VK_PAUSE
Similar to VK_DIVIDE, this key can't be mapped to a scancode by
MapVirtualKeyEx(). Googling suggests that this is a known bug.

https://bugzilla.gnome.org/show_bug.cgi?id=769214
2017-12-02 10:38:19 +00:00
Руслан Ижбулатов
e1240b42ed GDK W32: Change WM_SYSMENU style switch logic
Instead of checking for window state and giving it extra styles that
fit, just give it all styles that it is missing. It turned out that
otherwise it is impossible to, for example, restore a maximized window
via sysmenu. Also, be more flexible towards GDK/WM window state mismatches
and consider the window minimized/maximized if *either* GDK or WM thinks so.

https://bugzilla.gnome.org/show_bug.cgi?id=776485
2017-12-02 10:38:19 +00:00
Руслан Ижбулатов
9e5fc16307 GDK W32: Remove unneeded assertion
Just set check_for_dpi_awareness = TRUE and eventually it will be handled
correctly, even if setDpiAwareFunc() returns E_ACCESSDENIED or shcore functions
are NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=777031
2017-12-02 10:38:18 +00:00
Руслан Ижбулатов
285ebd58a8 GDK W32: Handle maximizing correctly for small primary monitors
When primary monitor is smaller than the actual monitor on which the
window is being maximized, the WM will do widnow size adjustments
that will completely screw the window size if we try to make it
smaller than 100% fullscreen (to account for taskbar size, for example).

Fix this by overriding maximized window size during WM_WINDOWPOSCHANGING.

https://bugzilla.gnome.org/show_bug.cgi?id=775808
2017-12-02 10:38:17 +00:00
Руслан Ижбулатов
c7bdf643c5 GDK: Make sure W32 backend compiles without GdkDeviceManager
https://bugzilla.gnome.org/show_bug.cgi?id=773299
2017-12-02 10:37:23 +00:00
Timm Bäder
dfc7a531db wayland: Never send NULL app id
The old gdk_get_program_class was never returning NULL, but
g_get_prgname might. So use the same fallback app id name we were using
before.
2017-12-01 07:30:25 +01:00
Alexander Larsson
61ea8e8676 broadway: Add some (disabled) debugging tools 2017-11-30 21:57:42 +01:00
Alexander Larsson
af890e6677 broadway: Don't send node updates to browser if nothing changed 2017-11-30 21:57:42 +01:00
Alexander Larsson
d43008b2a5 broadway: Fix texture hash function 2017-11-30 21:57:42 +01:00
Alexander Larsson
f5e0986230 vulkan: Don't crash if vkEnumeratePhysicalDevices fails 2017-11-30 21:57:42 +01:00
Alexander Larsson
c30073793e broadway: Improve logging
We now log backwards, so that the latest is always visible.
Also, we use <pre> with a smaller size.
2017-11-30 21:57:42 +01:00
Alexander Larsson
521b09cc96 broadway: Send diffs of node trees
Reusing pre-created nodes is a lot faster both in terms of
dom modifications and of transfer sizes.
2017-11-30 21:57:42 +01:00
Alexander Larsson
3d4a9324e6 broadway: Add broadway_node_equal 2017-11-30 21:57:42 +01:00
Alexander Larsson
46c4869945 broadway: Prepare for implementing diff 2017-11-30 21:57:42 +01:00
Alexander Larsson
e43f031769 broadway: Add div for container nodes
We need this so that all nodes have divs, otherwise diffing is going
to be very hard.
2017-11-30 21:57:42 +01:00
Alexander Larsson
1820362b2b broadway: Deserialize node tree in server
This doesn't really change anything, but it is in preparation for diffing
the trees.
2017-11-30 21:57:42 +01:00
Alexander Larsson
907e071c90 broadway: Add a texture cache
This ensures we never upload a texture we already have locally available.
2017-11-30 21:57:42 +01:00
Alexander Larsson
d284c3fa85 broadway: Re-add seat and core device creation 2017-11-30 21:57:42 +01:00
Matthias Clasen
c750c0e571 Drop gdk_cursor_new_from_pixbuf
Part of the push to remove GdkPixbuf from the API.
2017-11-29 20:16:43 -05:00
Matthias Clasen
7217689e02 docs: Remove mentions of gdk_cursor_new_from_pixbuf
This function is going away.
2017-11-29 20:14:53 -05:00
Christophe Fergeau
9259ca98f3 wayland: Fix indentation of previous commit 2017-11-29 12:21:19 +01:00
Christophe Fergeau
ff3da0818c wayland: emit GDK_SELECTION_CLEAR on owner changes
The wayland backend currently never emits GDK_SELECTION_CLEAR events.
GtkClipboard uses this signal in order to clear the clipboard owner when
the selection is set to something outside the application.
This commit ensures the wayland backend emits GDK_SELECTION_CLEAR before
setting the clipboard owner to NULL, as this means we lost the
selection.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790031
2017-11-29 11:29:30 +01:00
Christophe Fergeau
93f6f253ea wayland: Remove unused data structure
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790031
2017-11-29 11:29:29 +01:00
Matthias Clasen
0dfe12fab0 gdk: Add some missing autocleanups
GdkMonitor and GdkSeat were missing here.
2017-11-28 15:03:48 -05:00
Rico Tzschichholz
2d797dd816 Fix some parameter name mismatches to make g-ir-scanner happier 2017-11-28 15:24:49 +01:00
Carlos Garnacho
cabfdd5c48 gdkseatdefault: Use TABLET_STYLUS capability for styli/erasers/cursors
Those are devices created for drawing tablets, so using the "pointer"
capability is far too generic.
2017-11-27 21:41:25 +01:00
Carlos Garnacho
7decad177c gdk/wayland: Emit GdkSeat::device-added/removed
Those were never sent in this backend...
2017-11-27 19:51:38 +01:00
Matthias Clasen
b8c58f41b6 wayland: Don't provide gsetting if dconf is not available
This makes gtk+ fall back to reading ~/.config/gtk-3.0/settings.ini
on systems with Wayland, but without dconf (do those exist?).

https://bugzilla.gnome.org/show_bug.cgi?id=790201
2017-11-26 19:40:28 -05:00
Matthias Clasen
1884558470 wayland: Drop GdkWaylandDeviceManager
This object had no functionality left.
2017-11-25 11:04:15 -05:00
Matthias Clasen
05149a391f Drop GdkDeviceManager entirely
Nothing uses it anymore.
2017-11-25 11:04:15 -05:00
Matthias Clasen
7e40fcc344 Drop the ::device-manager property
Not used for anything anymore.
2017-11-25 11:04:15 -05:00
Matthias Clasen
bad53bc201 x11: Stop deriving from GdkDeviceManager
We can just derive from GObject.
2017-11-25 11:04:15 -05:00
Matthias Clasen
da8bcc7ed9 wayland: Stop deriving from GdkDeviceManager
We can just derive from GObject.
2017-11-25 11:04:15 -05:00
Matthias Clasen
01278e591c win32: Stop deriving from GdkDeviceManager
We can just derive from GObject.
2017-11-25 11:04:15 -05:00
Matthias Clasen
1471c64fb2 quartz: Stop deriving from GdkDeviceManager
We can just derive from GObject.
2017-11-25 11:04:15 -05:00
Matthias Clasen
fd958939be Drop the GdkDeviceManager::display property
Move this to the backends, and stop deriving
from GdkDeviceManager.
2017-11-25 11:04:15 -05:00
Matthias Clasen
7c33baabd2 Remove the get_client_pointer vfunc 2017-11-25 11:04:15 -05:00
Matthias Clasen
0ec491ea9d Drop the get_client_pointer vfunc
There is no api using this anymore.
2017-11-25 11:04:15 -05:00
Matthias Clasen
b6a634fe38 Drop the list_devices vfunc
We no longer have api that uses this.
2017-11-25 11:04:15 -05:00
Matthias Clasen
ecb96257b9 Drop gdk_device_manager_list_devices
It is not used and GdkDeviceManager is going away.
2017-11-25 11:04:15 -05:00
Matthias Clasen
30a037c4fe gdk: Drop devicemanager signals
Nobody is emitting them anymore.
2017-11-25 11:04:15 -05:00
Matthias Clasen
efbcb38fdf wayland: Stop emitting devicemanager signals
Nobody is listening to these signals anymore.
2017-11-25 11:04:15 -05:00
Matthias Clasen
c9261f50aa x11: Stop emitting devicemanager signals
Nobody is listening to these anymore, so there
is no point in emitting them.
2017-11-25 11:04:14 -05:00
Matthias Clasen
cd3d2badf0 display: Drop the device_manager for good
This is now entirely the backends responsibility.
2017-11-25 11:04:14 -05:00
Matthias Clasen
639d93687f wayland: Stop using display->device_manager
We can keep the device manager in the backend.
2017-11-25 11:04:14 -05:00
Matthias Clasen
95ae688072 quartz: Stop using display->device_manager
We can keep the device manager in the backend.
2017-11-25 11:04:14 -05:00
Matthias Clasen
ab0aea900c win32: Stop using gdk_display_get_device_manager
We can keep the devicemanager in the backend.
2017-11-25 11:04:14 -05:00
Matthias Clasen
aae4fafad2 x11: Stop using gdk_display_get_device_manager
We can keep the displaymanager in the backend.
2017-11-25 11:04:14 -05:00
Matthias Clasen
6489bc1929 broadway: Remove devicemanager implementation
It is not used and not needed anymore.
2017-11-25 11:04:14 -05:00
Matthias Clasen
1023249e31 broadway: Stop using GdkDeviceManager
We can use the GdkSeat apis for this.
2017-11-25 11:04:14 -05:00
Matthias Clasen
903959301b display: Stop using devicemanager internally
We can just use the seats to find out about device removals.
2017-11-25 11:04:14 -05:00
Matthias Clasen
1f6fb4e716 Drop GdkDeviceManager APIs
No longer used outside of the backends.
2017-11-25 11:04:14 -05:00
Matthias Clasen
a4cd4535dc Don't mention GdkDeviceManager in docs
It is going away.
2017-11-25 11:04:14 -05:00
Matthias Clasen
480ea400f3 Drop support for setting event masks for floating devices
These are very rarely needed, and are X11-specific.
If it turns out that somebody needs this, it can come
back as X11-specific functionality.
2017-11-25 11:04:14 -05:00
Matthias Clasen
4c40accbb9 gdk: Move gdk_disable_multidevice tot he X11 backend
This api only ever did something for X11, so move
it there. Update the docs and adapt the only caller.
2017-11-25 11:04:14 -05:00
Matthias Clasen
0cfc812a5d Drop gdk_display_get_device_manager API
GdkDeviceManager is being replaced by GdkSeat.
2017-11-25 11:04:14 -05:00
Matthias Clasen
371ea7cbe9 gdk: Remove a leftover GdkScreen 2017-11-25 10:17:19 -05:00
Alexander Larsson
cfb76fedb6 broadway: Roundtrip each update to rate limit redraw 2017-11-23 10:48:29 +01:00
Alexander Larsson
b74959a605 broadway: Add clip node 2017-11-23 10:48:29 +01:00
Alexander Larsson
9e5a22bbe5 broadway: Add opacity node 2017-11-23 10:48:29 +01:00
Alexander Larsson
9b1f6acc2b broadway: Add shadow node 2017-11-23 10:48:29 +01:00
Alexander Larsson
cbbbf49043 broadway: Add node cache for text 2017-11-23 10:48:29 +01:00
Alexander Larsson
6cc96318c8 broadway: Remove inflate code
This is not used anymore
2017-11-23 10:48:29 +01:00
Alexander Larsson
278370c8e5 broadway: Add linear gradient node 2017-11-23 10:48:29 +01:00
Alexander Larsson
f7ff6dbb66 broadway: Add RoundedClip node 2017-11-23 10:48:29 +01:00
Alexander Larsson
0083c084e4 broadway: Add inset shadow 2017-11-23 10:48:29 +01:00
Alexander Larsson
35ceb8e626 broadway: Add outset shadow node 2017-11-23 10:48:29 +01:00
Alexander Larsson
0ad523038c broadway: Fix border node positioning 2017-11-23 10:48:29 +01:00
Alexander Larsson
cf03229a99 broadway: Add border node 2017-11-23 10:48:29 +01:00
Alexander Larsson
5a8d204c83 broadway: Clean up node parser 2017-11-23 10:48:29 +01:00
Alexander Larsson
0b38ab339e broadway: Add color nodes 2017-11-23 10:48:29 +01:00
Alexander Larsson
cfdb3952c6 broadway: Fix input events 2017-11-23 10:48:29 +01:00
Alexander Larsson
97c0d112af broadway: Don't swap node trees until all images are loaded 2017-11-23 10:48:29 +01:00
Alexander Larsson
fd0285de09 broadway: Rewrite textures in nodes to global 2017-11-23 10:48:29 +01:00
Alexander Larsson
54e7a8f0c0 broadway: Remove remaining unused window_update code 2017-11-23 10:48:29 +01:00
Alexander Larsson
f7d8ee041b broadway: Initial version of using actual render nodes 2017-11-23 10:48:29 +01:00
Alexander Larsson
cc7423855b broadway: Use textures to configure window contents
Instead of using the old buffer code, just use textures to define the
window contents.
2017-11-23 10:46:47 +01:00
Alexander Larsson
a4636a06a7 broadway: Actually upload textures to client 2017-11-23 10:46:47 +01:00
Alexander Larsson
ef79621c44 broadway: Introduce global ids for the textures 2017-11-23 10:46:47 +01:00
Alexander Larsson
48d587d255 broadway: Add support for uploading textures to daemon 2017-11-23 10:46:47 +01:00
Alexander Larsson
f31d7e1f91 broadway: Support fd passing in protocol
This will be used to pass buffers
2017-11-23 10:46:47 +01:00
Alexander Larsson
43a02da07b broadwayd: Read using socket API
This changes nothing, but it allows us to later recieve
unix messages and thus fd passing
2017-11-23 10:46:47 +01:00
Alexander Larsson
620d3cf402 broadway: Only support (non-abstract) sockets
We want to use fd passing, so drop tcp
2017-11-23 10:46:47 +01:00
Daniel Boles
98c1f16002 doc: Replace uses of #NULL with %NULL 2017-11-22 20:58:28 +00:00
Bastien Nocera
ef031d87be frame-clock: Fix typo in API documentation 2017-11-22 15:24:19 +01:00
Chun-wei Fan
e076cc7b1f GDK/Win32: Fix build after GDK Root Window and DND changes
Ensure that things build again, and instead use the Windows API to
acquire the screen dimensions (note: this may need to be scaled for
HiDPI, but since I do not own a WinTab-based device, I will need to
keep the dimensions as-is for now).

Also update the gdkdnd-win32.c code to use formats rather than targets.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2017-11-22 22:18:28 +08:00
Benjamin Otte
c82378ea57 gdk: Add GType support to GdkContentFormats
This is not used by anything yet, but add it now, so people looking at
this new code can make sense of it.
Plus, the documentation mentions it, so better have the docs make sense.

It will be used once we add support for conversions to GDK and allow
doing cipboard/dnd by GValue.
2017-11-20 23:22:28 +01:00
Benjamin Otte
1a70ca75e8 gdk: Sanitize GdkContentFormats API
Make sure the API reflects the idea that GdkContentFormats is a set
containing mime types. In particular, treat the object itself as a
plural - it's named content format`S' after all - and therefor use
the correct verb form.

Also make GdkContentFormats keep an array instead of a list, now that
it's immutable.
2017-11-20 23:15:11 +01:00
Benjamin Otte
fc2ce5a925 gdk: Make GdkContentFormats immutable 2017-11-20 23:13:10 +01:00
Benjamin Otte
1a482ad276 gdk: Add GdkContentFormatsBuilder
Yes, the name is too long.
No, I couldn't think of a shorter one.
2017-11-20 23:12:48 +01:00
Benjamin Otte
d6a209816b gdkdnd: Make GdkDragContext->formats a GdkContentFormats
Instead of it being a GList of GdkAtoms.
2017-11-20 23:12:33 +01:00
Benjamin Otte
9a6ec4e959 contentformats: Rename GtkTargetList
It's now called GdkContentsFormat
2017-11-20 23:12:33 +01:00
Benjamin Otte
0638bbb5d5 gdk: Move GtkTargetList to GDK
It's gonna be renamed next, so put it in the right source file already.

For now retain the old name to keep the diff small.
2017-11-20 23:12:33 +01:00
Matthias Clasen
315db6d505 wayland: Intern signal names 2017-11-17 23:22:02 -05:00
Matthias Clasen
4dc4db56dc wayland: Intern settings keys 2017-11-17 22:47:49 -05:00
Matthias Clasen
3b06ae5072 gdk: Intern signal names
We were forgetting this in a few places.
2017-11-17 22:47:26 -05:00
Matthias Clasen
a129053ed9 gdk: Use G_PARAM_SPEC_STATIC_STRINGS throughout
This avoids some string copies at startup.
2017-11-17 21:38:08 -05:00
Matthias Clasen
c2f6208ce5 Add private api for setting cursor theme
This is implemented in multiple gdk backends,
and we can avoid and ugly ifdef cascade in gtk
by adding a vfunc for this.
2017-11-17 17:42:12 -05:00
Matthias Clasen
2d591cde78 Include gdk-private.h
This gives us access to private gdk api.
2017-11-17 16:34:04 -05:00
Matthias Clasen
1ec93bdda6 gdk: Move code around
Move the gdk_display functions to gdkdisplay.c.
They are misplaced in gdkevents.c.
2017-11-17 16:22:21 -05:00
Matthias Clasen
dbb18ad5d8 gdk: Add a private method to get a server timestamp
This is needed in the clipboard code. We don't make
it public, since that code is destined to eventually
live in gdk anyway.
2017-11-17 15:39:08 -05:00
Matthias Clasen
6263286c4a Drop gdkscreen.h
Nothing uses GdkScreen anymore, so we can get rid of it.
2017-11-17 13:54:04 -05:00
Matthias Clasen
0b8c88f7d6 quartz: Remove remaining uses of GdkScreen 2017-11-17 13:47:15 -05:00
Matthias Clasen
a62e75964c quartz: Make GdkQuartzScreen a plain object
No need to derive this from GdkScreen anymore.
2017-11-17 13:47:15 -05:00
Matthias Clasen
77f921f5de quartz: Drop an unused include
No GdkScreen apis are used in here.
2017-11-17 13:47:15 -05:00
Matthias Clasen
c7b5cb8e8e quartz: Avoid a screen argument
The screen is never used in _gdk_quartz_screen_get_setting,
so drop it.
2017-11-17 13:47:15 -05:00
Matthias Clasen
0f2d7d41f1 win32: Remove remaining uses of GdkScreen 2017-11-17 13:47:15 -05:00
Matthias Clasen
d24ae9c032 win32: Make GdkWin32Screen a plain object
No need to derive this from GdkScreen anymore.
2017-11-17 13:47:14 -05:00
Matthias Clasen
211d72e545 win32: Avoid a screen argument
The screen is never used in _gdk_win32_screen_get_setting,
so drop it.
2017-11-17 13:21:24 -05:00
Matthias Clasen
e8353eab26 win32: Remove an unused include
No GdkScreen apis are used in here.
2017-11-17 13:20:53 -05:00
Matthias Clasen
34fa61e13c Fix the build 2017-11-17 13:12:51 -05:00
Matthias Clasen
71c463ae85 x11: Drop GdkX11Visual as public api
There was no useful functionality left here,
so just remove this from the api altogether.
2017-11-17 13:03:11 -05:00
Matthias Clasen
8ced2c6478 x11: Stop using GdkScreen altogether
Derive GdkX11Screen directly from GObject, and
remove the last remaining uses of GdkScreen.
2017-11-17 10:51:55 -05:00
Matthias Clasen
2daa7d1a53 x11: Stop using GdkScreen in api
This type is going away, so switch to using GdkX11Screen
everywhere.
2017-11-17 10:51:55 -05:00
Matthias Clasen
abb1d59d4e Stop calling _gdk_screen_close
It does nothing useful, and is going away.
2017-11-17 10:51:55 -05:00
Matthias Clasen
a5e1276924 Stop including gdkscreen.h
It is not used anymore.
2017-11-17 10:51:55 -05:00
Philip Withnall
bd89ff4c9e broadway: Add missing dependency to build
The generated file clienthtml.h is #included by broadway-server.c, which
is one of the sources of the broadway library — so clienthtml.h needs to
be one of the sources of that library too.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790489
2017-11-17 10:14:42 +00:00
Alexander Larsson
810ba4edcf broadway: Fix toplevel handling
The toplevels list contains GdkWindowImplBroadways, and we shouldn't
free it.
2017-11-17 10:37:01 +01:00
Benjamin Otte
f4ec6290f8 gdk: Remove gdk_flush()
If you need to flush a display, use gdk_display_flush().

There is never a need to flush displays you don't know about.
2017-11-17 08:36:35 +01:00
Matthias Clasen
9629f9acc9 Add a comment
Document that gdk-private.h is meant for private gdk<>gtk apis.
2017-11-17 00:37:10 -05:00
Matthias Clasen
fc0f7dc217 Remove gdkprivate.h
This is one-too-many private headers. Move the few
declarations here to gdkinternals.h.
2017-11-17 00:34:04 -05:00
Matthias Clasen
38c8310969 Drop gdkmain.h 2017-11-17 00:16:09 -05:00
Matthias Clasen
3f0d42f74b Stop including gdkmain.h
It is empty now.
2017-11-17 00:16:09 -05:00
Matthias Clasen
26d5b04124 Drop an empty file
Nothing deprecated left!
2017-11-17 00:08:24 -05:00
Matthias Clasen
6e94be3f50 Drop the error trap vfuncs
No longer used.
2017-11-17 00:08:24 -05:00
Matthias Clasen
30e6a4c29d Drop the generic error trap api
This is only implemented on X11, so we don't
need generic api for it.
2017-11-17 00:08:24 -05:00
Matthias Clasen
90d502fdbd x11: Fix error traps in the dnd code
The code for grabbing keys was using a generic
error trap call, and more concerning, it was forgetting
to pop the trap.
2017-11-16 23:56:11 -05:00
Matthias Clasen
5517ab0651 Drop an unused variable
These are no longer used.
2017-11-16 23:27:14 -05:00
Matthias Clasen
92f49ed3e3 Drop a duplicate definition
GDK_PRIORITY_EVENTS is already defined in gdkevents.h
2017-11-16 23:23:42 -05:00
Matthias Clasen
6bf215bc15 Drop gdk_set_program_class
Together with the corresponding getter.
This is x11-specific functionality.
2017-11-16 23:22:08 -05:00
Matthias Clasen
d73898437f x11: Add gdk_x11_display_set_program_class
The program class is a very X-specific concept.
There should be x11-backend api to deal with it.
2017-11-16 23:21:06 -05:00
Matthias Clasen
49f3d86c84 wayland: Stop using gdk_get_program_class
This is an abuse, at best. If we need to pass the
app id down here, lets pass the app id.
2017-11-16 23:18:03 -05:00
Matthias Clasen
95876cbc9c Remove gdk/gdkx.h
It was just a kludge.
2017-11-16 23:00:01 -05:00
Matthias Clasen
39386275a4 Move some code around
Move gdk_disable_multidevice to gdkdisplaymanager.[hc].
2017-11-16 22:54:26 -05:00
Matthias Clasen
211f16d68b Drop gdk_notify_startup_complete
This function and its variant are just wrappers
around the display-specific function.
2017-11-16 22:45:52 -05:00
Matthias Clasen
419a9af28c gdk: Move some headers around
Move gdk_flush and gdk_set_allowed_backends to where they
belong.
2017-11-16 22:18:45 -05:00
Matthias Clasen
baf40d35c5 Drop gdk_beep
This is an unnecessary wrapper around gdk_display_beep.
2017-11-16 22:10:26 -05:00
Matthias Clasen
ce13dbba10 Drop gdk_set_double_click_time
This is an unnecessary and not-recommended-to-be-used
wrapper around gdk_display_set_double_click_time.
2017-11-16 22:04:25 -05:00
Benjamin Otte
e9629a5149 wayland: Fix initial cursor
Make sure the initial cursor isn't random which would happen due to an
early exit when cursor == pointer->cursor triggered because both were
NULL.
2017-11-15 19:07:17 +01:00
Benjamin Otte
4c4e914806 gdk: Replace GDK_NONE with NULL 2017-11-15 19:07:17 +01:00
Benjamin Otte
cb941956d3 gdk: Turn GdkAtom into a const char *
Instead of an integer, it is now a char pointer. We also use
g_intern_string() instead of doing the interning ourselves.
2017-11-15 19:07:17 +01:00
Benjamin Otte
0451c6d30c gdk: Make GDK_NONE Atom translate to NULL
Instead of the string "NONE" we now use NULL.
2017-11-15 19:07:17 +01:00
Benjamin Otte
a385a50260 gdk: Get rid of magic special atoms 2017-11-15 19:07:17 +01:00
Benjamin Otte
41f9a174e2 x11: Remove special casing for GdkAtoms
This is in preparation for the GdkAtom removal
2017-11-15 19:07:17 +01:00
Benjamin Otte
fb94f79094 selection: Remove #ifdef WAYLAND
Instead, turn the functions into backend API:
  gdk_broadway_display_add_selection_targets()
  gdk_broadway_display_clear_selection_targets()
Remove the old per-backend functions, too.
2017-11-15 19:07:16 +01:00
Matthias Clasen
0436cc44fc win32: Remove all checks for GDK_WINDOW_ROOT
We are no longer creating windows of this type, so no
need to check for it.
2017-11-14 18:16:19 -05:00
Matthias Clasen
e2682e62a8 win32: Remove all uses of get_root_window
This is following similar changes done in the x11 and
broadway backends, but it has not been built.
Some fixups may be needed.
2017-11-14 18:16:19 -05:00
Benjamin Otte
ed1b6a9bed gdkwindow: Remove event_mask arguments from constructors 2017-11-13 23:41:38 +01:00
Benjamin Otte
ef5a6835b2 window: Set ALL_EVENT_MASK
This is a trivial commit that does a big change: We now ignore event masks.

Further commits will clean up code, but if bisection ends up here, you
know it's because code is getting delivered events that it weren't getting
before.
2017-11-13 23:41:37 +01:00
Benjamin Otte
de40ced21c gdk: Fix GDK_ALL_EVENTS_MASK
This mask was forgotten to update when the last 2 event masks were
added, probably because it looks like it's already maxed.
2017-11-13 23:41:37 +01:00
Matthias Clasen
5f73afae3d x11: Remove mentions of GDK_WINDOW_ROOT
This backend never creates a window of this type, so no
need to check for it anymore.
2017-11-13 16:47:50 -05:00
Matthias Clasen
964cdaf3a3 x11: Stop creating a root window
We no longer need it.
2017-11-13 16:39:54 -05:00
Matthias Clasen
5999b1c73a x11: Store toplevel list in GdkDisplay
This will let us get rid of the root window.
2017-11-13 16:32:34 -05:00
Matthias Clasen
8af666cb4f x11: Remove another use of the root window
We just need the X root window here.
2017-11-13 16:09:47 -05:00
Matthias Clasen
7839e0d7d5 x11: Fix a crash
This was crashing the moment a second window is opened.
2017-11-11 12:07:11 -05:00
Matthias Clasen
bdb442be21 x11: Reduce uses of the root window
Avoid calling the get_root_window api that returns
a GdkWindow in some places, and instead use the X
root window directly.
2017-11-09 22:52:37 -05:00
Chun-wei Fan
c06b1cc103 Win32: Re-work cursor handling
Like the X11 and Wayland backends, re-work how the cursors are being
handled.  So, we use a hash table to cache up the HCURSORS that we
create along the way.

We still need to cache up the icon/cursor themes since this is something
that is not part of Windows but was added on to support icon/cursor themes
such as Adwaita on Windows, but should be in-line with what is going on in
GdkCursor.

Also, remove the _gdk_grab_cursor global variable in gdkprivate-win32.h,
and replace it with another variable in the GdkWin32Display structure,
to make things cleaner in the process.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2017-11-09 08:30:09 +08:00
Matthias Clasen
73a3d4b785 wayland: Drop an unused function
We no longer create a root window, so need to have
a function for it.
2017-11-07 07:43:09 -05:00
Benjamin Otte
2177b191ba x11: Correctly set icons
X11 obviously doesn't use 4 bytes for a 4 bytes pixel. Rather, it uses
unsigned long, which happens to be 8 bytes these days.
2017-11-07 12:24:43 +01:00
Matthias Clasen
efd86912f0 broadway: Drop the root window
We already have a list of toplevels, so we don't
need the root window for this.
2017-11-06 21:51:30 -05:00
Matthias Clasen
6261f5f7b8 wayland: Drop the root window
We can just keep a list of toplevels in the display.
2017-11-06 18:52:37 -05:00
Matthias Clasen
20fab69c38 Drop gdk_display_get_root_window
This is no longer used.
2017-11-05 21:45:51 -05:00
Matthias Clasen
063db3630b x11: Stop using gdk_display_get_root_window
Use the backend api for this.
2017-11-05 21:45:51 -05:00
Matthias Clasen
5db2352eba x11: Make gdk_x11_display_get_root_window available
This will replace the frontend api of the same name.
2017-11-05 21:45:51 -05:00
Matthias Clasen
c1c919cf7d win32: Stop using gdk_display_get_root_window
Use the newly introduced backend api for this purpose.
2017-11-05 21:45:51 -05:00
Matthias Clasen
be75984485 win32: Make gdk_win32_display_get_root_window available
This will be used to replace the equivalent frontend api,
which is going away.
2017-11-05 21:45:51 -05:00
Matthias Clasen
2eb78a2374 wayland: Stop using gdk_display_get_root_window
We can just use the display field directly.
2017-11-05 19:44:39 -05:00
Matthias Clasen
f3150c3a43 Typo fix 2017-11-05 19:43:39 -05:00
Matthias Clasen
a163d5b7a7 broadway: Stop using gdk_display_get_root_window
We can just use the field in the display.
2017-11-05 19:37:54 -05:00
Matthias Clasen
c08a6a062f Stop using the root window in gdk_window_create_similar_image_surface
Just create a plain image surface if we don't get a window.
This should work just fine and lets us drop another implicit
use of the root window.
2017-11-05 19:30:54 -05:00
Matthias Clasen
de83fc48bf Stop defaulting to the root window in gdk_window_get_geometry
This function is not documented as accepting NULL for the
window, and we don't want to have the root window sneakily
appear in the api like this.
2017-11-05 19:29:49 -05:00
Matthias Clasen
50cf11d398 Make toplevels have parent == NULL
This is a move towards removing root windows as a frontend
gdk concept.
2017-11-05 19:28:37 -05:00
Matthias Clasen
119c433882 x11: Handle parent being NULL when creating windows
We want to make toplevels have a NULL parent, this
gets us ready for it.
2017-11-05 19:25:22 -05:00
Matthias Clasen
c16a0bd9b7 Drop gdk_display_get_toplevel_windows
Nothing uses this private api anymore, so we can drop it.
2017-11-05 18:39:01 -05:00
Matthias Clasen
28a8d03c0b x11: Drop use of gdk_display_get_toplevel_windows
Use the newly introduced helper for this task.
2017-11-05 18:36:49 -05:00
Matthias Clasen
76b6d86659 x11: Add a helper to get all toplevels
This will let us avoid frontend API for this task.
2017-11-05 18:33:56 -05:00
Matthias Clasen
e980f68f5b quartz: Drop another use of gdk_display_get_toplevel_windows
This one was forgotten in the previous commit.
2017-11-05 18:30:03 -05:00
Matthias Clasen
4f701c71f1 quartz: Drop use of gdk_display_get_toplevel_windows
We can use the newly added helper function for this.
2017-11-05 18:28:27 -05:00
Matthias Clasen
c44e693b26 quartz: Add a function to get all toplevels
This will let us avoid frontend API for this.
2017-11-05 18:27:49 -05:00
Matthias Clasen
84a3772ef6 broadway: Stop using gdk_display_get_toplevel_windows
We already keep a list of all toplevels in the broadway
display struct. Just use it.
2017-11-05 18:19:04 -05:00
Matthias Clasen
807cac2c79 quartz: Drop mentions of foreign windows
The quartz backend never creates foreign windows,
so no need to check for window type.
2017-11-05 12:09:06 -05:00
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