Commit Graph

29754 Commits

Author SHA1 Message Date
Timm Bäder
1aa811ce12 Remove all gtk_widget_get_content_size usages
And remove the function itself. Make everything use gtk_widget_get_width
and gtk_widget_get_height instead.
2017-12-06 07:56:12 +01:00
Christian Hergert
dc8320c129 autocleanups: allow g_autoptr() usage with GtkTreePath
As the summary says, this allows using g_autoptr(GtkTreePath). This is
useful for API that uses out parameters for GtkTreePath that need to be
freed.

https://bugzilla.gnome.org/show_bug.cgi?id=791234
2017-12-05 12:33:50 +00:00
Matthias Clasen
b5c62cf86f Revert "clipboard: Add gdk_clipboard_set()"
This reverts commit dc50e0637f.

This broke the build.
2017-12-04 23:09:54 -08:00
Benjamin Otte
dc50e0637f clipboard: Add gdk_clipboard_set()
This API allows specifying a GType and va_args of a value of that type
to set the clipboard contents. This massively simplifies setting weird
object types into the clipboard.
2 example patches included in this patch are the GtkTextBuffer and the
file list in the file chooser.

Using gobject-introspection, this should work without specifying the
type, so that you can literlally say
  clipboard.set ("Hello World")
or
  clipboard.set (pixbuf)
which is why I've also marked all other setters as (skip). They just
exist in C as wrappers for type safety reasons.
2017-12-05 05:29:03 +01:00
Benjamin Otte
4658d7ea54 dnd: Remove x/y coordinates from drag-data-received
This is in preparation of using input streams to show that these
coordinates aren't needed most of the time and can otherwise be saved
during GtkWidget::drag-drop.
2017-12-05 05:29:00 +01:00
Timm Bäder
8619ff0744 switch: Remove unused variable 2017-12-04 18:35:48 +01:00
Matthias Clasen
841eb45b66 actionbar: Add more docs for gtk_action_bar_get_revealed
This stops gtk-doc complaints.
2017-12-04 07:42:01 -08:00
Matthias Clasen
b912416be5 about dialog: Add some missing docs
gtk_about_dialog_set/get_system_information are new,
and were missing docs.
2017-12-04 07:42:01 -08:00
Timm Bäder
93df23d962 Remove some more gtk_widget_get_content_size uses 2017-12-04 12:42:52 +01:00
Timm Bäder
3a3783dfcd image: Stop using gtk_widget_get_content_size 2017-12-04 12:24:18 +01:00
Timm Bäder
dbc4796d6a popover: Stop using gtk_widget_get_content_size 2017-12-03 22:05:15 +01:00
Timm Bäder
7cc9bee7a2 spinner: Stop using gtk_widget_get_content_size 2017-12-03 22:04:59 +01:00
Benjamin Otte
acee3809b3 dnd: Remove unused variables 2017-12-03 06:50:51 +01:00
Matthias Clasen
e74c46fc4e dnd: Handle rootwin drop in gdk
This lets us drop the only use of the drag protocol in gtk.
2017-12-03 06:22:25 +01:00
Matthias Clasen
6cfb55a396 dnd: Remove much of the unmanaged dnd 2017-12-03 06:17:42 +01:00
Benjamin Otte
437d70f569 gdk: Get rid of owner change events
They're unused now.
2017-12-03 05:46:49 +01:00
Benjamin Otte
2d5c82b4ec gtk: Remove GtkClipboard 2017-12-03 05:46:49 +01:00
Benjamin Otte
24c934f8c0 entry: Port to GdkClipboard 2017-12-03 05:46:49 +01:00
Benjamin Otte
0ff3340da7 main: Implement storing all clipboards 2017-12-03 05:46:48 +01:00
Benjamin Otte
4cce109e16 application: Put shared code into a common function 2017-12-03 05:46:48 +01:00
Benjamin Otte
ca96fac488 filechooserwidget: Port to new clipboard
We use the new GDK_TYPE_FILE_LIST here.
2017-12-03 05:46:48 +01:00
Benjamin Otte
5632d0eabb label: Port to new clipboard 2017-12-03 05:46:48 +01:00
Benjamin Otte
f53848c360 textview: Redo clipboard handling
Instead of using GtkClipboard and handling everything ourselves, we now
put GtkTextBuffer into the GdkClipboard and register (de)serializers for
text/plain.
2017-12-03 05:46:48 +01:00
Benjamin Otte
8cd5e0af1a recentchooser: Port to GdkClipboard 2017-12-03 05:46:48 +01:00
Benjamin Otte
909b6877bd linkbutton: Port to GdkClipboard 2017-12-03 05:46:48 +01:00
Benjamin Otte
825612b419 a11y: Port to GdkClipboard 2017-12-03 05:46:47 +01:00
Benjamin Otte
54c8a4b3b7 widget: Add gtk_widget_get_clipboard()
... and gtk_widget_get_primary_clipboard().

They both give out the new GdkClipboard.
2017-12-03 05:46:47 +01:00
Benjamin Otte
a59572f96d widget: gtk_widget_get_clipboard => gtk_widget_get_old_clipboard
Just rename the function, so the previous one can be used for the
new clipboard.
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
481c6ad99a dnd: Add gtk_drag_set_icon_texture() 2017-12-02 16:21:58 +01:00
Benjamin Otte
20de4c86ad selection: Add texture getter/setter 2017-12-02 16:21:58 +01:00
Benjamin Otte
85b3f6d372 image: Add gtk_image_new_from_texture()
Docs and header knew about this function.
There just was no implementation.
2017-12-02 16:21:58 +01:00
Benjamin Otte
373848f561 image: Store pixbufs as textures, not surfaces 2017-12-02 16:21:58 +01: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
Руслан Ижбулатов
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
Руслан Ижбулатов
6a770517cc Only register application/x-rootwindow-drop on X11
application/x-rootwindow-drop is not useful anywhere else,
so put it under #ifdef GDK_WINDOWING_X11

On W32 this prevents toplevels from automatically becoming valid
drop targets with a useless drop type.

(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:31 +00:00
Carlos Garnacho
645e67231e gtkeventcontrollerscroll: Add some docs 2017-12-02 00:29:37 +01:00
Matthias Clasen
4930153413 Finish conversion of pixbuf cell renderer icon size
Change the name of the property from stock-size to icon-size,
and make it an enum property instead of uint. This makes it
impossible to specify invalid numeric values in ui files, and
at the same time makes it possible to refer to the existing
values by their nick.

Fix up the callers.
2017-12-01 10:36:17 -05:00
Matthias Clasen
1c59db9bff placesview: Drop the word stock from the docs
It does not really add anything here, and makes it harder
to grep for occurrences of stock ids.
2017-12-01 10:30:21 -05:00
Matthias Clasen
77d12c0451 recent chooser: Stop specifying stock-size
We were using a no-longer-existing numeric value here,
and we can just rely on the theme to set this now.
2017-12-01 10:30:21 -05:00
Matthias Clasen
dc12dc4495 toolbutton: Remove the word stock from internal docs
We no longer support stock items.
2017-12-01 10:30:20 -05:00
Matthias Clasen
60c3afe0fe recent chooser: Remove the word stock from the docs
We don't support stock items anymore.
2017-12-01 10:30:20 -05:00
Matthias Clasen
86ae1df257 filechooser: Remove the word stock from the docs
It does not really add anything here, and makes it harder
to grep for occurrences of stock ids.
2017-12-01 10:30:20 -05:00
Matthias Clasen
8c95071eea entry: Remove references to stock ids from the docs
We no longer support stock images.
2017-12-01 10:30:20 -05:00
Matthias Clasen
6de5cd57e7 image definition: Drop unused struct
We no longer support stock images.
2017-12-01 10:30:20 -05:00
Alexander Larsson
478b1d56f8 Revert "gtksnapshot: Merge trivial clip duplicates"
This reverts commit d95cbb2757.

This is better solved by commit 94184eda42
2017-12-01 09:08:57 +01:00
Timm Bäder
c42e026058 snapashot: Optimize rounded clip nodes
If the rounded clip node is rectilinear, we can simplify it to a normal
clip node. If not, we really need to use a rounded clip node. In both
cases, we can do the same check we do when collecting normal clips and
avoid the clip node altogether if the child node does not get clipped
anyway.

This saves between 3 and 10 nodes in the widget factory, depending on
what page gets rendered.
2017-12-01 08:14:01 +01:00
Timm Bäder
94184eda42 snapshot: Only create clip nodes if we need to
Clip nodes have a clip rect and we only need to actually create a clip
node if any child node gets clipped at all. If the clip rect conains the
child node bounds entirely, we don't need a clip node.
2017-12-01 07:38:43 +01:00
Timm Bäder
ff35fbf120 window: Plug a memory leak 2017-12-01 07:30:25 +01:00
Matthias Clasen
d005109133 Drop unused gtkcssstylefuncs.c
Clean up all the places where the header was still
included needlessly.
2017-11-30 18:46:54 -05:00
Matthias Clasen
eb32a2c228 css style funcs: Avoid pixbufs
We can get what we need with GdkTexture.
2017-11-30 17:40:41 -05:00
Matthias Clasen
dc15978ac8 Avoid GdkPixbuf in docs
GdkTexture is preferred now.
2017-11-30 17:32:05 -05:00
Matthias Clasen
a1c0b81bae icon helper: Avoid gratitious pixbuf use
We can just get the texture directly from the icontheme.
2017-11-30 17:31:17 -05:00
Matthias Clasen
029165638b mountoperation: Store icons as textures
This reduces the amount of pixbufs in this code.
2017-11-30 16:48:25 -05:00
Alexander Larsson
d95cbb2757 gtksnapshot: Merge trivial clip duplicates
I got a lot of "clip in clip" cases, for example a CellClip with a
CellTextClip inside. It is really trivial to merge these when we
pop and makes it easier for all backends, so lets do that.
2017-11-30 21:57:42 +01:00
Matthias Clasen
2edd3741f6 Use the new texture utils here
One less place where we juggle pixbufs.
2017-11-30 07:54:52 -05:00
Matthias Clasen
b8b33d1f36 Make texture variants of some pixbuf utils
This will let us avoid direct pixbuf use in some places.
2017-11-30 07:54:27 -05:00
Matthias Clasen
bd1a9c1afe recent manager: Drop an unused field 2017-11-30 07:03:20 -05:00
Matthias Clasen
a9f12892ea Fix up a doc comment 2017-11-29 23:39:06 -05:00
Matthias Clasen
f57aa47a40 Remove some unused includes
These show up in a grep for "pixbuf".
2017-11-29 23:39:06 -05:00
Matthias Clasen
b65f871929 Use a texture instead of a pixbuf in gtk_render_icon
This gets rid of more GdkPixbuf in the API.

Update all callers.
2017-11-29 23:30:47 -05:00
Matthias Clasen
0b39631464 textview: Replace pixbufs by textures
This affects a few apis, such as gtk_text_iter_get_pixbuf,
gtk_text_buffer_insert_pixbuf and GtkTextBuffer::insert-pixbuf,
which have all been replaced by texture equivalents.

Update all callers.
2017-11-29 23:22:13 -05:00
Benjamin Otte
3d4743ee62 textview: Remove serialization API
It's unused. Plain text is not using that framework, neither is
in-process same-display transmission.

So it was only useful for sharing text with custom tags across
applications, and nobody is doing that.
2017-11-29 23:03:33 -05:00
Benjamin Otte
138abdbc47 a11y: Remove AtkStreamableContent implementation
That is some old code that still uses IOChannels, and the only
pseudouser is at-spi-atk's commented out code that is still using
CORBA types.

So get rid of it now before I need to start adapting it to the new
clipboard.
2017-11-29 23:03:33 -05:00
Matthias Clasen
c088d69f93 icon theme: Remove unused code
The deprecated api to add builtin icons was removed
a year ago, so we don't need the code anymore that deals
with looking up builtin icons.
2017-11-29 22:25:57 -05:00
Matthias Clasen
0063145ed8 tooltip: Set icon from texture instead of pixbuf
Another part of removing GdkPixbuf from APIs.
2017-11-29 22:17:59 -05:00
Matthias Clasen
dfd194a5fa Drop gtk_cell_view_new_with_pixbuf
We have a texture-based alternative for this now.
2017-11-29 20:26:28 -05:00
Matthias Clasen
1fcfff6861 dnd: Stop using gdk_cursor_new_from_pixbuf
We can just use gdk_cursor_new_from_texture here.
2017-11-29 20:13:26 -05:00
Matthias Clasen
c2a38612a9 Drop gtk_drag_source_set_icon_pixbuf
Part of removing GdkPixbuf from the API.
2017-11-29 20:02:47 -05:00
Matthias Clasen
c0d6fd4f86 icon-browser: Stop using gtk_drag_source_set_icon_pixbuf
We can just use gtk_drag_source_set_icon_name.
2017-11-29 20:01:32 -05:00
Matthias Clasen
2ac0df0b75 Drop gtk_css_image_surface_new_for_pixbuf
It is unused private api.
2017-11-29 19:47:57 -05:00
Matthias Clasen
8cdaaffd42 Avoid pixbufs when loading themed icons
We can directly get a texture from GtkIconTheme now.
2017-11-29 19:44:30 -05:00
Matthias Clasen
507ef68faa Add gtk_cell_view_new_with_texture
Just more api to replace pixbufs with textures.
2017-11-29 19:28:53 -05:00
Matthias Clasen
7b032a9862 Drop gtk_snapshot_render_icon
Its not used, and we are working towards removing
GdkPixbuf in the API.
2017-11-29 18:34:45 -05:00
Matthias Clasen
4db2426336 window: Stop using GdkPixbuf
We can get by with just using GdkTexture.
2017-11-29 17:28:15 -05:00
Matthias Clasen
83ab83043e Cosmetic formatting fixes 2017-11-29 17:28:15 -05:00
Matthias Clasen
65808418e1 Drop gtk_application_is_inhibited
This function returns global session state that may
not be available to applications (e.g. in sandboxed
environments), and is not needed by applications,
so just drop it, instead of keeping a function around
that can't be guaranteed to work.
2017-11-28 23:02:58 -05:00
Matthias Clasen
4371f370bc Improve the docs
Document that gtk_application_is_inhibited can't
be guaranteed to work.
2017-11-28 22:52:44 -05:00
Benjamin Otte
4ebbb19e25 inspector: Reorganize stack
There are too many stack elements in the main stack. So add a substack
for the pages that display common global state. The appropriate name I
found for it was "Global".

It's used to house the General, Visual, Resources and Statistics pages
for now.
2017-11-29 04:22:53 +01:00
Benjamin Otte
c60df96deb inspector: remove visible=TRUE properties
This is the defualt these days.
2017-11-29 04:22:53 +01:00
Rico Tzschichholz
2d797dd816 Fix some parameter name mismatches to make g-ir-scanner happier 2017-11-28 15:24:49 +01:00
Matthias Clasen
43e59258e4 Fix up _gtk_widget_list_devices
When I rewrote that function to not use GdkDeviceManager,
I overlooked that the window filtering needs to apply
to the master pointer as well, as other code assumes
that _gtk_widget_get_device_window will return non-NULL
on the devices in the list. Fix this.
2017-11-27 12:35:10 -05:00
Matthias Clasen
8747c7a42a Fix a typo
The signal is called ::unpaired-release.
2017-11-27 10:56:09 -05:00
Matthias Clasen
268ebb3a46 listbox: Handle unpaired releases as well
Same as for flowbox in the previous commit.
2017-11-26 19:52:01 -05:00
Carlos Garnacho
0567b41f24 gtkflowbox: Activate items on ::unpaired-release
If the flowbox is single-click.

https://bugzilla.gnome.org/show_bug.cgi?id=789163
2017-11-26 19:42:03 -05:00
Carlos Garnacho
bce91555f5 gtkgesturemultipress: Add ::unpaired-release signal
This signal will be emitted whenever the gesture received a
button release or touch end event without a pairing button
press or touch begin. This usually happens when grabs transfer
input from one widget to another mid-press.

https://bugzilla.gnome.org/show_bug.cgi?id=789163
2017-11-26 19:42:03 -05:00
Kjell Ahlstedt
7ef5858f8d GtkWindow: Fix the down-scaling in icon_from_list()
Must use floating-point division to get the correct scale factors.
cairo_set_source_surface() must be called after cairo_scale().

https://bugzilla.gnome.org/show_bug.cgi?id=790287
2017-11-26 18:54:59 -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
835805ad61 treeview: Don't use GdkDeviceManager
We can just as well use GdkSeat to enumerate (attached)
devices. Note that this change excludes floating devices
from consideration.

This keeps the copy-pasted code in sync with gtkwindow.c
2017-11-25 11:04:14 -05:00
Matthias Clasen
7c0a1ddb05 window: Don't use GdkDeviceManager
We can just as well use GdkSeat to enumerate (attached)
devices. Note that this change excludes floating devices
from consideration.
2017-11-25 11:04:14 -05:00
Matthias Clasen
2250daeb53 widget: Don't use GdkDeviceManager
We can just as well use GdkSeat to enumerate the devices.
2017-11-25 11:04:13 -05:00
Daniel Boles
630f83957a Entry:show-emoji-icon is in GTK+ 3 too
Document the earliest version reached.
2017-11-23 17:21:36 +00:00
Daniel Boles
89c51f51e2 Be more specific in ::insert-emoji Since tag
I had been unsure whether to include the minor version, but
:show-emoji-icon already did, so do the same here to match.
2017-11-23 17:18:36 +00:00
Daniel Boles
9fef90b0f7 Add Since to ::insert-emoji, and some trivialities
Document when these keybinding signals were added.
2017-11-22 22:36:31 +00:00
Matthias Clasen
567447456e text view: Support the Emoji chooser
Similar to GtkEntry, add an "Insert Emoji" context
menu item, and add the same keybindings. We don't
add the icon here, since it is not clear where it
would go.

https://bugzilla.gnome.org/show_bug.cgi?id=790029
2017-11-22 16:50:10 -05:00
Matthias Clasen
462a77ffb5 Fix indentation mishap 2017-11-22 16:50:10 -05:00
Daniel Boles
fecce75c73 SpinButton: Explain meaning of nullable Adjustment
configure() marked the @adj argument as (allow-none) but did not explain
what passing NULL would do. Fix that, and move it to (nullable) as well.
2017-11-22 20:58:28 +00:00
Daniel Boles
98c1f16002 doc: Replace uses of #NULL with %NULL 2017-11-22 20:58:28 +00:00
Daniel Boles
23f7208235 CellRendererPixbuf: Link stock-size doc → IconSize
Add a doc comment for :stock-size in order to link to GtkIconSize.
2017-11-22 20:48:11 +00:00
Daniel Boles
7c2e28c8c5 doc: TextLayout: Add missing (out) annotations
and move from (allow-none) to (optional)
2017-11-22 20:48:11 +00:00
Chun-wei Fan
a687fd9aeb gtk/gskpango.c: Use g_snprintf()
This fixes the build of GTK+ master on Visual Studio 2013 (and possibly
others) as snprintf() may not be supported even if the required C99
features are supported by the compiler.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2017-11-21 14:22:23 +08:00
Chun-wei Fan
8059975f74 gtk/gtkseclection.c: Don't build X11 items unconditionally
Limit building the X11 items only when GDK_WINDOWING_X11 is defined.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2017-11-21 14:16:19 +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
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
Benjamin Otte
0b40ad32f3 selection: Make GtkTargetList members private
Outside of the target list, don't access it directly, instead use public
APIs like the newly introduced gtk_target_list_intersects().
2017-11-20 23:12:33 +01:00
Benjamin Otte
c863ac0f90 dnd: Remove GtkTargetEntry and GtkTargetFlags
warning: We don't do any same-app checks anymore so you currently can
copy local data into external apps.

This will be fixed later.
2017-11-20 23:12:33 +01:00
Matthias Clasen
49d02eff93 emoji chooser: break out a helper function
This is just a small cleanup.
2017-11-19 22:43:36 -05:00
Matthias Clasen
5a6c6070d6 remove debug spew 2017-11-19 22:43:36 -05:00
Matthias Clasen
4d9b7b2359 entry: Add a key binding for the emoji chooser
Make Ctrl-. and Ctrl-; bring up the emoji chooser.

https://bugzilla.gnome.org/show_bug.cgi?id=789160
2017-11-19 18:06:19 -05:00
Matthias Clasen
1cd5df9404 emoji chooser: Make menu key work as expected
Whenever we have a right-click action, we should make
the menu key work as a keyboard-accessible alternative.
2017-11-19 18:04:38 -05:00
Matthias Clasen
d3a358b9bd Adwaita: Bring fix focus in flowbox
Bring back the focus rectangle for flowbox children.
Its absence makes keynav in flowboxes really difficult.
2017-11-19 18:04:31 -05:00
Matthias Clasen
5e748ce940 emoji chooser: handle right-click
Whereever we handle long-press for touch, it makes sense to handle
right-click as a faster alternative for mouse-based interaction.

This commit makes right-click work to bring up the variation
selector for Emojis.
2017-11-19 18:04:26 -05:00
Matthias Clasen
4d0a57fe0b listbox: Listen to ::stopped on the press gesture
Otherwise, we end up interpreting grab notify's as
button releases, which is not right. This matches
what GtkFlowBox does.
2017-11-19 14:49:58 -05:00
Matthias Clasen
2f9d980c93 Trivial cleanup
Better to use G_SOURCE_REMOVE than FALSE, for clarity.
2017-11-19 09:28:00 -05:00
Matthias Clasen
1f8debbac9 emoji chooser: Don't leak gestures
We were not freeing these gestures as we should.
2017-11-19 09:27:53 -05:00
Matthias Clasen
a8531605db Some more interning
This avoids more strdups at startup.
2017-11-18 08:18:11 -05:00
Matthias Clasen
997f0de4d5 a11y: Intern a string 2017-11-17 23:25:45 -05:00
Matthias Clasen
7dded559c0 cell area: Use GTK_PARAM_READWRITE consistently 2017-11-17 23:25:07 -05:00
Matthias Clasen
7c4a1a596f icon helper: Avoid a few string copies 2017-11-17 23:21:24 -05:00
Matthias Clasen
8c06cd5f98 styleproperty: Use G_PARAM_STATIC_STRINGS 2017-11-17 22:56:25 -05:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Matthias Clasen
dd7163a699 settings: Use gdk_display_set_cursor_theme
This allows us to reduce the amount of ifdef ugliness.
2017-11-17 17:56:03 -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
4865c3273a clipboard: Use gdk_display_get_last_seen_time
This removes the backend dependent code from gtkclipboard.c.
A good thing!
2017-11-17 15:40:49 -05:00
Benjamin Otte
594aae71e5 toolbar: Remove gdk_flush() calls
It's not 2003 anymore.
2017-11-17 08:07:27 +01:00
Benjamin Otte
0019178014 main: Don't gdk_flush() after every main loop wait
For a start, this makes gtk_main() work different from g_main_loop_run()
calls.

But most importantly, modern GDK does proper syncing itself and doesn't
need to rely on a catch-all to get it right.
2017-11-17 08:07:10 +01:00
Matthias Clasen
daacd25344 selection: Use x11-specific traps
The generic trap api is going away.
2017-11-16 23:42:55 -05:00
Matthias Clasen
8b3e9fe35c mountoperation-x11: Use x11-specific traps
The generic trap api is going away.
2017-11-16 23:36:21 -05:00
Matthias Clasen
95876cbc9c Remove gdk/gdkx.h
It was just a kludge.
2017-11-16 23:00:01 -05:00
Matthias Clasen
dca8c8e189 gtk: Stop using gdk_notify_startup_complete_with_id
This function is about to go away. Instead, use the
display-specific function that this is a wrapper of.
2017-11-16 22:45:04 -05:00
Benjamin Otte
3f5178dc21 selection: Remove the info uint
Instead of allowing people to pass a uint user-data, insist on them
comparing mime types.

The user data was a uint instead of a pointer anyway, so uniqueness
could not be guaranteed and it caused more issues than it was worth.
And that's ignoring the fact that it basically wasn't used.
2017-11-16 22:59:43 +01:00
Benjamin Otte
5da3059175 selection: Remove gtk_target_table_*() functions 2017-11-16 22:59:42 +01:00
Benjamin Otte
b200d4f099 textview: Stop playing shenanigans with the target list
This breaks GtkSourceView adding custom targets on top of GtkTextView,
but we'll fix that later.
2017-11-16 22:59:42 +01:00
Benjamin Otte
47e75b34a4 selection: Make GtkTargetEntry not allocatable
And remove it being registered as a boxed type (lol).
2017-11-16 22:59:42 +01:00
Matthias Clasen
e62ec97707 HighContrast: misc fixes
The HighContrast theme was not parsing anymore, due to
leftover widget style properties, and some missed cleanups,
like -gtk-icon-effect. Also update for the new focus handling,
and make checks and radios sharp again.
2017-11-15 18:08:46 -05:00
Matthias Clasen
a4c4df3b95 Adwaita: Make checks and radios sharp again
The assets we have are 14x14, set -gtk-icon-size to reflect that.
2017-11-15 18:07:52 -05:00
Matthias Clasen
d9a146f54a Change icon-size properties
We no longer support registering custom icon sizes, so
we can make these properties just enums. This also lets
us specify them by nick in ui files. Nice!
2017-11-15 14:22:17 -05:00
Matthias Clasen
a28cf475af image: Update docs
Mention the new icon-size style classes, update the docs
for removed arguments and return values, and add new
functions to the docs.
2017-11-15 14:22:17 -05:00
Matthias Clasen
43a9b82797 Support -gtk-icon-size for builtins
This makes css icons more similar to themed icons, which
is the overall goal here.
2017-11-15 14:22:17 -05:00
Matthias Clasen
0d23606653 Drop gtk_icon_size_lookup
Add a new, private gtk_image_get_image_size to replace it, and
update the remaining callers in a suitable way.
2017-11-15 14:22:17 -05:00
Matthias Clasen
866ff2b8f0 recentchooser: Use GIcon instead of GdkPixbuf 2017-11-15 14:22:17 -05:00
Matthias Clasen
c6c3427507 iconhelper: Query size via CSS
Instead of looking at the icon size, look at the CSS value for
-gtk-icon-size. Set style classes depending on icon size instead.

Trivially change Adwaita and HighContrast to report the same values as
before.
2017-11-15 14:22:17 -05:00
Matthias Clasen
2301d8d90b enums: Change GtkIconSize values
The new values are the ones we intend to keep. The old ones had
duplicated meanings and nobody knew which one to take.
2017-11-15 14:22:17 -05:00
Benjamin Otte
e5da85631a image: Don't take icon size in set_from_definition() 2017-11-15 14:22:17 -05:00
Matthias Clasen
67268bcc23 filechooserwidget: icon size is always 16 2017-11-15 14:22:17 -05:00
Matthias Clasen
b598a5ab78 filechooserbutton: icon size is always 16
So define it that way.
2017-11-15 14:22:17 -05:00
Benjamin Otte
e0a5f4e081 cellrendererspinner: Don't track old icon size
It was only used to avoid gtk_icon_size_lookup() calls and those aren't
expensive.
2017-11-15 14:22:17 -05:00
Matthias Clasen
dbfaa99107 image: Remove icon-size argument from icon setters
Instead, add a function gtk_image_set_icon_size() for the cases where
overriding the icon size is necessary.

Treat icon sizes the same way as pixel sizes, too. So gtk_image_clear()
no longer unsets the icon size.
2017-11-15 14:22:17 -05:00
Benjamin Otte
049cc6aa01 image: Change getters
Instead of returning the icon size with them, make
gtk_image_get_icon_name() and gtk_image_get_gicon() only return the icon
itself.

As a benefit, we can turn them into regular getters that return values
instead of requiring out parameters.

Instead, provide gtk_image_get_icon_size() to query the icon size.
2017-11-15 14:22:17 -05:00
Benjamin Otte
f53b72e5ff button: Get rid of icon size
In fact, make gtk_button_new_from_icon_name() just set the icon-name
property instead of creating a GtkImage.
2017-11-15 14:22:16 -05:00
Benjamin Otte
3da65ff233 scalebutton: Remove icon size 2017-11-15 14:22:16 -05:00
Benjamin Otte
a7754a14b5 toolbar: Remove icon sizes 2017-11-15 14:22:16 -05:00
Benjamin Otte
8df61992d7 tooltips: Remove GtkIconSize usage 2017-11-15 14:22:16 -05:00
Benjamin Otte
129dc7d73b css: Add -gtk-icon-size
This will replace GtkIconSize in future patches.
2017-11-15 14:22:16 -05:00
Benjamin Otte
dcc2577b97 introspection: Fix build 2017-11-15 19:33:26 +01:00
Benjamin Otte
4c4e914806 gdk: Replace GDK_NONE with NULL 2017-11-15 19:07:17 +01:00
Benjamin Otte
5a1a11bcde dnd: Make GtkDragDest and GtkDragSource use GtkTargetList
This gets rid of GtkTargetEntry in the API and consistently uses
GtkTargetList.
2017-11-15 19:07:17 +01:00
Benjamin Otte
7efc5a1558 clipboard: Consistently use GtkTargetList
Some code was using GtkTargetList, some used GtkTargetEntry and some
GtkTargetPair.
2017-11-15 19:07:16 +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
Benjamin Otte
13ca03efb1 cellrendererpixbuf: Remove stock-detail property
GTK3 didn't use that property already...
2017-11-14 18:37:38 -05:00
Benjamin Otte
515b13fdd5 messagedialog: Remove unused header 2017-11-14 18:24:43 -05:00
Benjamin Otte
77efc60a15 placessiderbar: Fix sunny compilation
Make compilation not warn about unused variables when compiling with
HAVE_CLOUDPROVIDERS undefined.
2017-11-13 23:45:18 +01:00
Benjamin Otte
457bf3b604 widget: No need to update events
GtkWindow queues for all events anyway, so the needed ones are already
there.
2017-11-13 23:41:38 +01:00
Benjamin Otte
ed1b6a9bed gdkwindow: Remove event_mask arguments from constructors 2017-11-13 23:41:38 +01:00
Benjamin Otte
9d56cee622 widget: Remove gtk_widget_set_device_enabled()
Nobody is using it.
2017-11-13 23:41:37 +01:00
Matthias Clasen
724863c275 icontheme: Add a trailing / when enumerating resources
This avoids extra string copies in GResource.
2017-11-13 12:13:42 -05:00
Carlos Soriano
1b1cb8295b gtkplacessidebar: Fix new tab/window handling for cloud accounts
It wasn't taking into account whether the sidebar had support for them
or not, resulting in a file chooser with open in new tab/window menu
items when it's not supported.

To fix it, do as with the other menus and check for the availability of
new tab/window flags.

https://bugzilla.gnome.org/show_bug.cgi?id=786123
2017-11-13 16:57:02 +01:00
Carlos Soriano
f54e7712c5 gtkplacessidebar: Adapt to libcloudproviders 0.2.x
And a few improvements on the way.

https://bugzilla.gnome.org/show_bug.cgi?id=786123
2017-11-13 16:55:10 +01:00
Matthias Clasen
2ff175938d application: Append a / to the icon resource path
g_resources_enumerate_children expects the path to end
in a '/' (even though thats not stated in the docs), and
will copy it if that isn't the case. Avoid the copy
by putting  a '/' there to begin with.
2017-11-13 07:35:18 -05:00
Matthias Clasen
ec1ea0db04 icontheme: Append a / to the resource path
g_resources_enumerate_children expects the path to end
in a '/' (even though thats not stated in the docs), and
will copy it if that isn't the case. Avoid the copy
by putting  a '/' there to begin with.
2017-11-13 07:33:35 -05:00
Benjamin Otte
e0d3602331 a11y: Handle a treeview with no columns
Code was spewing criticals to stderr because of nonexisting columns. So
check that there's actually an existing column first.
2017-11-13 03:51:53 +01:00
Benjamin Otte
b968147e0a treeview: Only update vadjustment in size_allocate()
The 2 calls even do different things, but because the one in allocate
always overrides the one here...
2017-11-13 01:53:45 +01:00
Benjamin Otte
f31a51a1c8 treeview: Pass height to allocate as argument
Instead of exporting a function to query it.
2017-11-13 01:28:16 +01:00
Benjamin Otte
b47ff72ebc progresstracker: Don't hand out NaN
When the duration is set to 0, clamp it to 1us. This way we're almost
correct: We should really instantly finish, but we don't. But we do
respect the delay.

Doing this properly would require some refactoring of how the progress
tracker actually maintains progress, and this is just a quick fix.
2017-11-12 06:22:34 +01:00
Benjamin Otte
6eead8f6a3 treeview: Use gtk_widget_get_width()
... instead of gtk_widget_get_allocated_width() and same for height.

This makes the treeview do the right thing when used with padding.
2017-11-12 05:46:06 +01:00
Benjamin Otte
61ecd10240 treeview: Don't allocate columns outside of size_allocate() 2017-11-12 05:38:58 +01:00
Benjamin Otte
5db1aa5401 treeview: Fix RTL column header allocation 2017-11-12 05:37:06 +01:00
Benjamin Otte
48de0bf741 treeview: width_changed is always true, so remove it
Also, sanitize the RTL correction code that made sure resizing the width
of a treeview would keep the contents glued to the right border instead
of the left border.
2017-11-12 05:31:21 +01:00
Matthias Clasen
f40b3bc5bc Fix up managed dnd
Since commit 6c56d04cee,
we were doing some calls twice in the managed dnd case,
leading to double drops.
2017-11-11 07:50:11 -05:00
Benjamin Otte
af13d474e8 textview: Remove GDK windows 2017-11-11 05:37:37 +01:00
Benjamin Otte
26909ee913 textview: Simplify gtk_text_view_buffer_to_window_coords()
... and gtk_text_view_window_to_buffer_coords()
2017-11-11 05:25:22 +01:00
Benjamin Otte
2533ad723a textview: Use text_window_get_width()/height()
Instead of poking the GdkWindow. They have the same size after all.
2017-11-11 05:12:07 +01:00
Benjamin Otte
17600b6bab textview: Make the semi-private headrs really private
Rename the files to have the private.h ending.

And remove gtktextdisplay.h from the installed files.
2017-11-11 05:01:31 +01:00
Benjamin Otte
d18b10a3d7 textview: Store border window sizes in a custom struct
That way, we don't need to have a GtKRequisition in every TextWindow.
2017-11-11 04:30:00 +01:00
Benjamin Otte
d65d5d0a84 gtktexttag: Remove GtkTextTag::event and gtk_text_tag_event()
GtkSourceView is not using it, so it's unneeded. And it's certainly
diving deep into event internals of GtkTextView which hinders a proper
gesturization.
2017-11-11 04:25:11 +01:00
Benjamin Otte
52424d8640 textview: Hide the selection bubble better
The selection bubble is not part of the text windows, so hiding it
during scroll should not be done in the text window code.

Also remove an unused variable that was only set in that code but never
read.
2017-11-11 02:49:08 +01:00
Benjamin Otte
e9dd5f327f flowbox: Compute view box from correct variables 2017-11-11 02:49:08 +01:00
Matthias Clasen
12837f6905 Drop the last use of GDK_MULTIHEAD_SAFE
This define is not used anymore, this was a leftover.
2017-11-10 16:14:19 -05:00
Kjell Ahlstedt
b0d1ae4a5c GtkCssImageIconTheme: Don't try to unref a NULL pointer
In gtk_css_image_icon_theme_snapshot(), don't try to unref icon_info
if it's NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=790171
2017-11-10 16:48:30 +01:00
Benjamin Otte
1da8c1b27f rendericon: Add missing include 2017-11-10 15:04:13 +01:00
Benjamin Otte
5b94fe6342 stylecontext: Make first property name explicit
Insist that a first non-NULL property is passed to
gtk_style_context_get().

This is in particular relevant because of dropping the state argument
since GTK3, and code like
  gtk_style_context_get (context, state, "font", &font);
would keep compiling without warnings without this change.
2017-11-10 14:56:42 +01:00
Benjamin Otte
51c5ccf412 a11y: Report correct spinner size 2017-11-10 14:56:42 +01:00
Benjamin Otte
723bf44887 calendar: Fix for GTK4 changes 2017-11-10 14:56:42 +01:00
Matthias Clasen
2aa52c7d00 Simplify the gtk_snapshot_icon_texture API
Instead of passing the color matrix in from the outside,
just pass a boolean and set up the matrix internally.
2017-11-08 22:21:42 -05:00
Matthias Clasen
7aa236fbb2 Fix a compiler warning 2017-11-08 22:09:34 -05:00
Matthias Clasen
a381ee6a55 Fix a typo 2017-11-08 22:09:23 -05:00