Commit Graph

771 Commits

Author SHA1 Message Date
Timm Bäder
fef4f0704a textview: Use content size when validating contents 2018-02-25 16:47:20 +01:00
Peter Bloomfield
1828c6b1cd text-view: make measure() use the layout height
GtkTextView::measure should include the height of the text-layout in its
minimum and natural heights. This fixes scrolling when a text-view has a
scrolled-window ancestor that is not its immediate parent.
2018-02-21 08:22:42 -05:00
Timm Bäder
78c6f713dd textview: Implement measure()
Don't use the current layout size as minimum size anymore, that doesn't
make sense. Also move the code from size_request() from gtk2 into the
now current measure() function.
2018-02-16 17:41:41 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Emmanuele Bassi
c655759cef Replace gdk_threads_add_timeout* with g_timeout_add()
The main GDK thread lock is not portable and deprecated.

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Emmanuele Bassi
334acbfc39 Replace gdk_threads_add_idle* with g_idle_add()
The main GDK thread lock is not portable and deprecated.

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Timm Bäder
3265013268 textview: Remove some stray debugging output
Leftover from 7046463b88
2018-01-19 08:17:03 +01:00
Matthias Clasen
327ec24e51 text view: Stop using ::focus-in/out-event
We can just use the generic ::event here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
7046463b88 textview: Use a motion event controller
This lets us replace the ::motion-notify-event handler.
2018-01-16 14:14:10 -05:00
Timm Bäder
3f68475b6f Make a few more code samples compile 2018-01-03 17:11:32 +01:00
Matthias Clasen
7d659b21e6 Drop deprecated text view layers
These have been marked as deprecated, so lets drop them.
2017-12-29 13:13:36 -05:00
Benjamin Otte
31119c89df gtk: Remove unused include 2017-12-15 23:53:18 +01:00
Matthias Clasen
e92c0e85ec Replace gdk_keymap_get_for_display by gdk_display_get_keymap
Replace all uses of the old function by the new one.
No functional change.
2017-12-15 07:44:58 -05:00
Matthias Clasen
54a6273191 Drop gdk_atom_intern
Atoms are just interned strings now, so we can just
use g_intern_string.
2017-12-13 23:39:03 -05:00
Carlos Garnacho
d491e49fd6 gtk: s/gdk_event_free/g_object_unref/ 2017-12-14 01:05:48 +01:00
Benjamin Otte
04ac4c66ae dnd: Pass device, not event
You don't start a dnd operation with a device, you start it with an
event.
2017-12-12 00:31:49 +01:00
Benjamin Otte
756b276070 dnd: Remove button argument from drag_begin()
It was unused.
2017-12-12 00:29:51 +01:00
Benjamin Otte
7a17865b22 dnd: Remove "delete" argument from gtk_drag_finish()
The argument is ignored by anything but X11.
It's treated like suggested_action == MOVE.

So do that in gtk_drag_finish(), too.
2017-12-10 01:33:38 +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
93df23d962 Remove some more gtk_widget_get_content_size uses 2017-12-04 12:42:52 +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
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
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
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
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
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
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -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
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
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
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
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
197eeade74 textview: Use gtk_widget_set_cursor()
This currently breaks because we still use GdkWindows. Soon...
2017-11-04 15:22:25 +01:00
Benjamin Otte
f7646cf541 textview: Remove GdkWindow usage from the public API
A sideeffect is that we don't set the correct parent window on child
widgets anymore, but that is hopefully going to be fixed once we get rid
of child windows completely.
2017-11-04 15:22:25 +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
bd6b6ed93c gdk: Remove VisibilityNotify events 2017-11-01 22:00:34 +01:00
Timm Bäder
3dca25b6e4 textview: Remove {top,bottom,left,right}_border
These are now the same as the equivalent _margin values.
2017-10-31 10:10:53 +01:00
Timm Bäder
3c0657f0fd textview: Stop fiddling with CSS padding
This is done automatically now and doing it again here means we apply
the padding twice.
2017-10-31 10:10:53 +01:00
Timm Bäder
9bc7581f1c css: Replace _AFFECTS_TEXT with _TEXT_SIZE and _TEXT_CLIP
It was used to mark css properties that affect widgets with text, but it
caused unnecessary invalidations. E.g. 'color' was marked as
AFFECTS_TEXT but changing just the color of a label should not
automatically queue a resize, which is what the code in
gtk_widget_real_style_updated does.

Replace this flag with GTK_CSS_AFFECTS_TEXT_SIZE and
GTK_CSS_AFFECTS_TEXT_CLIP, which GtkWidget can use only if the widget
actually has text.
2017-10-12 15:42:03 +02:00