Commit Graph

728 Commits

Author SHA1 Message Date
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
Philip Withnall
7e8831d668 gtktextview: Add a missing g_assert_not_reached() for switch default
Clarifies the code and helps catch invalid enum values before they
propagate further. Also add a comment about why two seemingly legitimate
values are not handled there (they’re handled higher up in the file).

Coverity CID: 1457700

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

https://bugzilla.gnome.org/show_bug.cgi?id=788787
2017-10-11 17:26:54 +01:00
Timm Bäder
4a03e86d4f textdisplay: Remove widgets parameter from gtk_text_layout_draw
All calls in gtk+ were passing NULL anyway.
2017-10-10 09:49:35 +02:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garnacho
a9988e18b0 gtk: Remove 2BUTTON and 3BUTTON events and event types
Those should be interpreted by widget-local gestures, not guessed at a
high level with no notions of the specific context. Users will want
GtkGestureMultiPress to replace these events.
2017-09-19 18:40:50 +02:00
Matthias Clasen
96daf93821 text view: Use GdkEvent API 2017-09-19 18:39:03 +02:00
Carlos Garnacho
9f32f5f994 textview: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Nelson Benítez León
c3c10edd09 textview: fix bug on DnD displaced limits of selection
The fix of commit f2fd655754
should be confined to DnD coords only, because otherwise
it causes the start and end of the selection to be displaced.

https://bugzilla.gnome.org/show_bug.cgi?id=785736
2017-08-29 19:26:07 +01:00
Timm Bäder
afa9b5032c textview: Draw children using gtk_widget_snapshot_child 2017-08-21 12:27:10 +02:00
Timm Bäder
a8a755e5cd widget: Remove gtk_widget_set_redraw_on_alloc
Since gtk+ draws more than the widget and allocates more size to it than
it knows about, this flag doesn't work anymore. Removing it (or setting
it to TRUE for widgets that used to set it to FALSE) fixes drawing
invalidation when these widgets get allocated a new size.
2017-08-09 16:26:26 +02:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
dd9c3fc8ab textview: Invalidate entire widget 2017-07-19 21:27:15 -04:00
Timm Bäder
dc473b4180 textview: Remove size_changed check in size-allocate
It's broken and we only hit size-allocate when the size changes anyway.
2017-07-19 21:27:15 -04:00
Timm Bäder
d832001baa textview: Use correct size for cairo node bounds 2017-07-19 21:27:15 -04:00
Timm Bäder
01cdcec3ea textview: Use ::snapshot 2017-07-19 21:27:13 -04:00
Timm Bäder
60e053f52a Remove calls to gtk_widget_set_allocation
gtk_widget_size_allocate_with_baselines does it automatically now.
2017-07-19 21:27:12 -04:00
Timm Bäder
2cd1a984cf set clip of more widgets 2017-07-19 21:27:11 -04:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
b01a9a6440 gtktextview: Drop GdkWindow checks on events
These are now wrong and prevent the code from running correctly.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
ca07c11172 gtktextview: Set "text" pointer cursor
This is no longer set through the Gdkwindow, so use private GtkWidget
API.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
d39afa6011 imcontext: Remove API dependency on GdkWindow
There is now a set_client_widget() to hint the IM about positioning
and whatnot.
2017-05-25 16:25:58 +02:00
Timm Bäder
f053a63d74 container: Remove include_internals parameter from forall
with include_internals=TRUE, this is the same as the (still private)
gtk_widget_forall, or just using the children/sibling accessors in a
loop.
2017-04-25 20:30:37 +02:00
Timm Bäder
43cdeee3c4 widget: Save pointer to focus child
Do the same thing GtkContainer does.
2017-03-31 09:50:39 +02:00
Daniel Boles
b00b7c3b0e TextView: Be const-correct when passing a pointer
The TextIter is passed by pointer for efficiency. We neither need to
modify it, nor should we leave it possible to accidentally do so. So,
it should be passed as a pointer-to-const.
2017-03-27 19:14:38 +01:00
Daniel Boles
c78f6c804e TextView: Get line direction in more efficient way
We do not need to go through the heavyweight process of constructing a
TextLineDisplay just to get the direction out of it, when we can simply
use TextIter API to get the text and then get its direction using Pango.

Adapted from a patch by Mehdi Sadeghi for GtkSourceView:

https://bugzilla.gnome.org/show_bug.cgi?id=779081#c20
2017-03-26 16:14:10 +01:00
Daniel Boles
b23513e2da TextView—Avoid pointless Pango in iter_line_is_rtl
Get the direction that was already worked out and stored in the
TextLineDisplay, rather than making Pango figure it out again.

https://bugzilla.gnome.org/show_bug.cgi?id=136059
2017-02-22 21:28:13 +00:00
Daniel Boles
2c9c871c5f TextView—Plug a memory leak
Thanks to Nelson Benitez for pointing this out.

https://bugzilla.gnome.org/show_bug.cgi?id=136059
2017-02-22 21:27:59 +00:00
Daniel Boles
0128b8d33f TextView—Fix inverted movements by arrows in RTL
Using Ctrl + left/right to skip between words, or left/right to cancel a
selection, were causing movement on the screen in the opposite direction
of the glyph on the key. This was surprising and awful UX for RTL users.

This is based on a patch covering the former case by:
Author:    Mehdi Sadeghi <mehdi@mehdix.org>
Date:      Sat Feb 18 02:16:00 2017 +0000

https://bugzilla.gnome.org/show_bug.cgi?id=136059
2017-02-19 12:39:05 +00:00
Benjamin Otte
4850271ae8 API: Remove gtk_cairo_should_draw_window()
The answer is: Yes.
2016-11-23 18:48:38 +01:00
Matthias Clasen
2c26f0cae4 Complete the privatization of GtkTextAttributes
This was not quite complete, as gtktextattributes.h was still
being included in public headers.

https://bugzilla.gnome.org/show_bug.cgi?id=773903
2016-11-04 12:05:52 -04:00
Benjamin Otte
acd801000c textview: Convert to no-window widget 2016-11-03 03:00:15 +01:00
Benjamin Otte
5e07a31d2b gtk: Call gtk_widget_set_has_window() on every widget
Even if we just set it to the value it already had.
2016-11-02 06:54:57 +01:00
Matthias Clasen
6e178aede2 Use GdkRGBA for text attributes
Now that GtkTextAttributes is private, we can clean this struct
up a bit. The first step is to switch from GdkColor to GdkRGBA,
and adapt all users.
2016-11-01 13:58:10 -04:00
Matthias Clasen
745c348ff8 Make GtkTextAttributes private
This is a problematic struct, and giving direct access to it
has kept us from making improvements to GtkTextView. Drop it
from the public API, together with the auxiliary APIs. If
it turns out that this functionality is needed, we should add
individual getters.
2016-11-01 13:58:10 -04:00
Benjamin Otte
a81c309c39 textview: Use gtk_widget_draw() 2016-10-27 05:07:23 +02:00
Benjamin Otte
a9c05448a8 textview: Get rid of the pixel cache 2016-10-27 05:03:06 +02:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Timm Bäder
6525b95e25 textview: Remove deprecated GtkScrollable API 2016-10-22 17:02:06 +02:00
Timm Bäder
d56962740d textview: Remove error-underline-color style property 2016-10-18 00:29:16 +02:00
Benjamin Otte
210e1665de textview: Use gdk_window_new_child() 2016-10-18 00:22:35 +02:00
Emmanuele Bassi
175800f345 Add private header for GtkTextView
This allows us to declare the symbols that are currently used inside
gtktextdisplay.c without incurring in the wrath of the compiler.
2016-10-17 11:10:14 +01:00
Emmanuele Bassi
dae97c3027 textview: Remove commented block
It's referencing gdk_cairo_create(), which does not exist any more.
2016-10-17 10:44:27 +01:00
Benjamin Otte
4df6ddad54 API: container: Remove gtk_container_set_border_width() 2016-10-16 18:18:58 +02:00
Benjamin Otte
1518fe0a8f API: stylecontext: Remove state argument from getters
The argument must always be the current state.
2016-10-16 18:18:58 +02:00