Commit Graph

67 Commits

Author SHA1 Message Date
Matthias Clasen
064ad42432 text view: Smooth cursor blinking
Fade the text cursor in and out, instead
of abruptly turning it on and off.
2019-07-21 16:03:49 -07:00
Christian Hergert
4ff9163c47 textview: port GtkTextView to GskPangoRenderer
This removes the use of GtkTextDisplay (a PangoRenderer) to use
the GskPangoRender which generates render nodes. Part of this means
improving the GskPangoRenderer to support the necessary features for
displaying a GtkTextView.

Primarily, this is a merging of GtkTextDisplay features into
GskPangoRender. Additionally, GtkTextDisplay was removed to allow for
gtk_text_layout_snapshot() to be implemented elsewhere.
2019-07-21 16:03:45 -07:00
Matthias Clasen
1f30b7742b textutil: Fix signedness issues in api
A length argument that can be -1 should be signed.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1555
2019-05-01 03:25:29 +00:00
Matthias Clasen
c2c4133eb0 Fix up the border/background-color removal
I overlooked one level of indirection here. Oops.
2019-03-31 20:43:19 -04:00
Matthias Clasen
6f5675ef3c Stop using deprecated style context api
Use the non-deprecated one it wraps, instead.
Yes, this is cheating...
2019-03-31 15:35:20 -04:00
Benjamin Otte
cbb1e74bb5 textview: Only create cairo context in gtktextdisplay.c
Everything else is done using GtkSnapshot now, including renaming the
draw_layer vfunc to snapshot_layer.
2018-07-14 05:27:54 +02:00
Benjamin Otte
73b4a62f51 snapshot: Redo debug messages
Instead of every snapshot function having debug messages, have an
explicit gtk_snapshot_push_debug() function that appends a debug node.
2018-04-24 04:06:58 +02:00
Benjamin Otte
ffc7b2bb0a snapshot: Allow passing the bounds of the created paintable
This allows being more specific about the size.
It's useful in particular when the resulting render nodes might be
too small for the size, not only when they are too large. For the
latter case, using a clip node would be enough.

It also requires adding a clip node when rendering the resulting
paintable, but that should be optimized out by GtkSnapshot when not
necessary.
2018-04-05 14:56:39 +02:00
Benjamin Otte
e3a717363b snapshot: Remove clip argument from gtk_snapshot_new()
It's not used anymore. And anybody who wants to have a clip on a
newly created snapshot can achieve that using gtk_snapshot_push_clip().
2018-04-05 14:56:38 +02:00
Benjamin Otte
9afbf02bc2 textview: Port dnd icon to be a GdkPaintable 2018-03-26 18:16:37 +02:00
Benjamin Otte
60719bb67c textutil: Make gtk_text_util_create_drag_icon() return a paintable 2018-03-26 18:16:36 +02:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +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
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
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
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
Matthias Clasen
012904097a Fix indentation 2016-04-26 21:25:02 -04:00
Matthias Clasen
23df86e923 dnd: Set attributes from all widgets for text drag icons
There is nothing textview-specific here.
2016-04-26 21:23:45 -04:00
Timm Bäder
2182fe7d9d Don't pass widget state flags to GtkStyleContext API 2015-11-22 17:11:35 +01:00
Matthias Clasen
38be852bee Cosmetic: Avoid explicit state variables
Using the state of the context makes this more obviously correct.
2015-11-14 12:32:57 -05:00
Matthias Clasen
02d08a1bd7 text util: Avoid creating transient nodes
We don't need to add .view - its already added, and shouldn't
really be needed in the first place.
2015-11-10 21:59:31 -05:00
Benjamin Otte
91467a45fc stylecontext: Deprecate functions
- gtk_style_context_get_background_color()
- gtk_style_context_get_border_color()

Those functions shouldn't be used anymore, because they don't represent
anything from the CSS styling we support. The background color often
isn't used due to background images and there are actually 4 different
border colors (1 for each side) - if there isn't also a border image in
use.
2014-10-03 06:18:06 +02:00
Yosef Or Boczko
d1e218f4ab Fix a warning
The PangoWrapMode enum has identical layout to GtkWrapMode,
but using the two interchangably causes (justified) compiler
warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=709697
2013-10-15 20:11:30 -04:00
Jasper St. Pierre
2b2162dd5f gtktextutil: Remove the border and background from drag icons
https://bugzilla.gnome.org/show_bug.cgi?id=705605
2013-08-14 07:12:52 -04:00
Benjamin Otte
055b5d83d5 gtk: Use gtk_style_context_get()
... instead of soon-to-be-deprecated gtk_style_context_get_font().
2012-12-06 02:57:18 +01:00
Benjamin Otte
3610ef90c3 Revert part of "textview: Remove extra magic for drawing children"
This partially reverts commit df37446f9b.
The commit changed API that was public (or at least semi-public) and
it's not worth changing that.

The original bug should still be fixed.

https://bugzilla.gnome.org/show_bug.cgi?id=673839
2012-04-10 16:21:07 +02:00
Benjamin Otte
df37446f9b textview: Remove extra magic for drawing children
Instead, just draw the children. The cairo code will keep track of
things, so there's no need to track things.
Also, the old code was doing it wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=672544
2012-04-07 13:01:25 +02:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Carlos Garnacho
c94912afd5 GtkTextUtil: Fix typo
Use the right "context" object around in GtkStyleContext methods.
2011-01-10 23:01:01 +01:00
Carlos Garnacho
2ec40cac8c Make GtkTextUtil use GtkStyleContext. 2011-01-10 20:48:59 +01:00
Benjamin Otte
4138e86ad4 testview: Convert _gtk_text_util_create_rich_drag_icon() to use surfaces 2010-09-26 15:03:01 +02:00
Benjamin Otte
331999d84d textview: API: change gtk_text_layout_draw() to take a cairo_t
This simplifies the API a lot and allows more magic to happen later.
2010-09-26 15:03:01 +02:00
Benjamin Otte
3d340d7449 text: Make _gtk_text_util_create_drag_icon() return a surface
And change its callers to handle it that way.
2010-09-26 15:03:00 +02:00
Javier Jardón
063454f630 gtk/gtktextutil.c: use accessor functions to access GtkWidget 2010-08-22 21:25:23 +02:00
Benjamin Otte
90ac7b915c textview: Replace GdkGC * argument with gpointer
The argument is unused.
That's also the reason why we can pass NULL instead of the real GC in
the caller.
2010-08-10 21:02:29 +02:00
Benjamin Otte
0310626938 textview: draw dnd icon with Pango 2010-07-26 16:42:46 +02:00
Benjamin Otte
3e469d737e textview: Draw drag icons using Cairo 2010-07-26 16:42:46 +02:00
Javier Jardón
0a07e9733b gtk/: fully remove gtkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:51:26 +02:00
Javier Jardón
32b9aeaadd Don't use GTK_WIDGET_STATE in internal code anymore
Use gtk_widget_get/set_state() instead

https://bugzilla.gnome.org/show_bug.cgi?id=69872
2010-03-09 02:40:17 +01:00
Matthias Clasen
a7e5938f58 Un-doc-commentize non-exported functions
svn path=/trunk/; revision=21979
2008-12-29 04:50:15 +00:00
Matthias Clasen
3a4fea3307 Bug 530575 – GtkEntry with invisible chars has a confused cursor in
2008-10-02  Matthias Clasen <mclasen@redhat.com>

        Bug 530575 – GtkEntry with invisible chars has a confused cursor in
        overwrite mode

        * gtk/gtkentry.c (gtk_entry_draw_cursor): Use the visible text
        in the layout when positioning the cursor, not the actual text
        content of the entry. This makes a different when using overwrite
        mode in an invisible entry.
        Problem noticed by Jonathan Blandford

        * gtk/gtktextutil.c: Fix a typo in a comment


svn path=/trunk/; revision=21580
2008-10-03 01:16:48 +00:00
Cody Russell
57223c9a05 Revert name change
svn path=/trunk/; revision=20724
2008-07-01 22:57:50 +00:00
Cody Russell
fce9c8b7d4 Practically everything changed.
2008-06-30  Cody Russell  <bratsche@gnome.org>

        * Practically everything changed.

        Change	all references	of GIMP	Toolkit	(and variations	of it)
        to GTK+	Toolkit, showing no mercy at all to our	beloved
	ancestry. (#540529)


svn path=/trunk/; revision=20709
2008-06-30 23:01:56 +00:00
Michael Natterer
260e94547f allocate the GtkTextUtilCallbackInfo structs with GSlice.
2008-06-26  Michael Natterer  <mitch@imendio.com>

	* gtk/gtktextutil.c (_gtk_text_util_append_special_char_menuitems):
	allocate the GtkTextUtilCallbackInfo structs with GSlice.


svn path=/trunk/; revision=20686
2008-06-26 09:06:48 +00:00
Michael Natterer
7146dd12e5 remove includes from this internal header.
2008-06-24  Michael Natterer  <mitch@imendio.com>

	* gtk/gtktextutil.h: remove includes from this internal header.

	* gtk/gtktextutil.c: include gtktextbuffer.h before gtktextutil.h.


svn path=/trunk/; revision=20678
2008-06-24 09:55:08 +00:00
Johan Dahlin
d97cdbdf53 Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch and Tim


svn path=/trunk/; revision=20669
2008-06-22 14:28:52 +00:00
Yevgen Muntyan
55ac5cd7d9 do right thing in one-character lines and at paragraph end (#448313).
2007-06-28  Yevgen Muntyan  <muntyan@tamu.edu>

	* gtk/gtktextutil.c (_gtk_text_util_get_block_cursor_location):
	do right thing in one-character lines and at paragraph end (#448313).

	* configure.in: require pango-1.17.3 to get fixed pango_layout_index_to_line_x()
	(pango #448342).


svn path=/trunk/; revision=18273
2007-06-28 06:30:21 +00:00
Yevgen Muntyan
ef1e05f7de Implement block-cursor for overwrite mode. (#80378)
2007-06-12  Yevgen Muntyan  <muntyan@tamu.edu>

        * gtk/gtkentry.c (gtk_entry_expose), (gtk_entry_toggle_overwrite),
        (gtk_entry_draw_cursor):
        * gtk/gtkstyle.c (_gtk_widget_get_cursor_gc),
        (_gtk_widget_get_cursor_color):
        * gtk/gtkstyle.h:
        * gtk/gtktextdisplay.c (gtk_text_renderer_prepare_run),
        (gtk_text_renderer_draw_shape), (text_renderer_set_state),
        (render_para):
        * gtk/gtktextlayout.c (gtk_text_layout_set_overwrite_mode),
        (gtk_text_layout_invalidate_cache), (get_block_cursor),
        (add_cursor), (gtk_text_layout_get_line_display),
        (_gtk_text_layout_get_block_cursor):
        * gtk/gtktextlayout.h:
        * gtk/gtktextutil.c (layout_get_char_width),
        (_gtk_text_util_get_block_cursor_location):
        * gtk/gtktextutil.h:
        * gtk/gtktextview.c (gtk_text_view_set_editable),
        (gtk_text_view_toggle_overwrite), (gtk_text_view_set_overwrite),
        (gtk_text_view_ensure_layout), (text_window_invalidate_cursors):
        Implement block-cursor for overwrite mode.  (#80378)


svn path=/trunk/; revision=18108
2007-06-12 05:32:57 +00:00
Matthias Clasen
e7e84bb8ec Remove debug output.
2006-12-24  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtktextutil.c: Remove debug output.

        * gtk/gtktextview.c: Improve the DND scrolling
        behaviour.  (#92387, Carlos Garnacho Parro)
2006-12-25 03:57:39 +00:00