Commit Graph

117 Commits

Author SHA1 Message Date
361308962e Routed GTK3 render-time adjustment updates through gtk_xtext_adjustment_set to apply setter updates and emit value-changed, while keeping the GTK2 path on gtk_adjustment_changed 2026-01-25 13:58:11 -07:00
e0c8409971 Updated GTK3 adjustment updates in gtk_xtext_adjustment_set to use GtkAdjustment setters and gtk_adjustment_value_changed, preserving the GTK2 path with gtk_adjustment_changed.
Adjusted GTK3 buffer-show scroll value updates and change signaling to rely on adjustment accessors while keeping the GTK2 flow intact.
2026-01-25 13:07:55 -07:00
08d357dc98 Added explicit GTK3-only branches in gtk_xtext_unrealize() so gtk_widget_get_window() is used without GTK2 struct access leaking into the GTK3 path.
Split the GTK3 and GTK2 initialization paths in gtk_xtext_realize() so the GTK3 branch uses gtk_widget_get_allocation()/gtk_widget_get_parent_window() and the GTK2 branch keeps the direct struct access under #if !HAVE_GTK3.
2026-01-23 22:08:17 -07:00
0df299acf5 Updated gtk_xtext_unrealize() to use GTK3 accessors (gtk_widget_get_window(), gtk_widget_set_window(), and gtk_widget_set_realized()) while keeping the GTK2 struct access in the #if !HAVE_GTK3 branch.
Consolidated the GTK3 vs GTK2 branching in gtk_xtext_realize() so GTK3 uses gtk_widget_get_allocation(), gtk_widget_get_parent_window(), and gtk_widget_set_window(), with the existing GTK2 direct struct access preserved under #if !HAVE_GTK3.
2026-01-23 22:00:36 -07:00
00eb2de4c8 Split the GTK3 and GTK2 branches in gtk_xtext_unrealize() so GTK3 uses gtk_widget_get_window() while the GTK2 path remains under #if !HAVE_GTK3 with direct struct access.
Split the GTK3 and GTK2 branches in gtk_xtext_realize() so GTK3 uses gtk_widget_get_allocation(), gtk_widget_get_parent_window(), and gtk_widget_set_window(), while keeping the existing GTK2 struct access under #if !HAVE_GTK3.
2026-01-23 21:55:46 -07:00
f65f350965 Moved gtk_widget_set_realized() into the GTK3 branch and used GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED) for GTK2, keeping allocation/parent-window access split by #if HAVE_GTK3 2026-01-23 21:52:40 -07:00
1d32aed8dc Added a GTK3-specific branch in gtk_xtext_unrealize() that clears user data via gtk_widget_get_window() while preserving the GTK2 struct access under #if !HAVE_GTK3.
Updated gtk_xtext_realize() to use gtk_widget_get_allocation(), gtk_widget_get_parent_window(), and gtk_widget_set_window() on GTK3, and routed all subsequent window usage through the local window variable instead of direct struct access; the GTK2 path remains intact under #if !HAVE_GTK3.
Adjusted gtk_xtext_clear_background() to use gtk_widget_get_window() on GTK3 rather than widget->window.
2026-01-23 21:40:22 -07:00
5715245080 Updated the GTK3 pointer position query to use gdk_device_get_position without a temporary screen variable while keeping GTK2/GTK3 code paths split by HAVE_GTK3. 2026-01-23 00:38:14 -07:00
796c991dd8 Guarded cursor unref with a null check while keeping GTK2/GTK3-specific cleanup behavior centralized.
Added a helper to clear window backgrounds using GTK2/GTK3-specific APIs and used it during widget realize.
2026-01-23 00:32:59 -07:00
7ac74220c4 Added a GTK3-safe null guard before unrefing cursors while keeping GTK2 behavior under !HAVE_GTK3.
Added a GTK3 pointer-device null fallback in gtk_xtext_get_pointer to safely handle missing devices before using gdk_device_get_position.
2026-01-23 00:27:02 -07:00
5596c8825b Added a GTK2/GTK3-compatible cursor unref helper to centralize cleanup logic.
Switched cursor destruction to use the new helper in the widget teardown path.
2026-01-22 23:32:50 -07:00
a05c064466 Wrapped GTK2-only cursor cleanup with #if !HAVE_GTK3, keeping GTK3 paths on g_object_unref.
Moved GTK2 pointer/background calls into #if !HAVE_GTK3 blocks, leaving GTK3-compatible implementations in #else.
2026-01-22 23:28:24 -07:00
ae86a8db0f Added a GTK3-aware pointer helper that uses gdk_device_get_position while retaining GTK2 behavior under #if !HAVE_GTK3.
Wrapped GTK2-only cursor unref and background pixmap calls with GTK3-compatible g_object_unref and gdk_window_set_background_pattern alternatives.
2026-01-22 23:24:43 -07:00
cf41615cb3 - Reworked GTK window snapshotting in the main GUI to capture into cairo surfaces and convert via gdk_pixbuf_get_from_surface.
- Added a Cairo surface → RGBA pixbuf conversion helper that unpremultiplies ARGB32 data for GTK2 compatibility while keeping window snapshots Cairo-based.
- Updated window snapshotting to use the new Cairo surface conversion instead of gdk_pixbuf_get_from_surface
2026-01-17 22:25:12 -07:00
c1f855c2ab - Updated main GUI color helpers and tab palette generation to use XTextColor, and simplified drag icon snapshotting to use gdk_pixbuf_get_from_window with a null guard.
- Added pixbuf-based cairo surface capture for xtext window scrolling with a fallback to full redraw when capture fails.
2026-01-17 21:56:00 -07:00
4ac836fc66 - Added a shared XTextColor definition and a palette conversion helper for Cairo-ready colors, decoupling renderer palettes from GdkColor usage in the API surface.
- Updated xtext palette APIs to accept internal color arrays directly for rendering setup.
- Wired xtext palette creation through UI entry points to use the new palette helper when constructing or refreshing text views.
2026-01-17 21:39:45 -07:00
0601be026c - Converted text background loading to build Cairo surfaces directly from pixbufs for renderer use.
- Updated the xtext renderer to accept Cairo background surfaces and dropped the GtkStyle attach during realize to keep rendering Cairo/Pango-focused.
- Switched background surface ownership and cleanup to use cairo_surface_t across the shared state and settings update path.
2026-01-17 18:19:00 -07:00
24b0a3d75f - Introduced the XTextColor struct and stored xtext palette/foreground/background colors in internal renderer state rather than GdkColor fields.
- Converted palette colors and background pixmaps into cairo-ready values/surfaces for rendering (including background tiling and separator colors).
2026-01-17 17:44:49 -07:00
2ac5234803 - Added Cairo-based window snapshot conversion (with unpremultiplication) for drag icons and updated drag rendering to use the new helper instead of drawable capture.
- Updated GtkXText to track the draw window and use a pixmap-to-surface helper for Cairo contexts, avoiding drawable references in the struct and rendering flow.
- Added a Cairo helper for capturing window-backed surfaces and used it when blitting during scrolling, fixing the build break from the removed drawable helper.
2026-01-17 17:34:38 -07:00
30e309853c Added the required gdk/gdk.h include before gdkcairo.h in maingui.c to satisfy GDK header include order requirements on Windows builds.
Added cairo surface tracking and context creation helpers for xtext rendering, including state initialization for the new draw surface field.

Replaced GdkPixmap-based offscreen text buffering with cairo surfaces and routed rendering/underline/strikethrough operations through the cairo context helper.
2026-01-17 16:56:35 -07:00
944ce69906 Added a Cairo color helper for drag highlight rendering and applied it to the drag motion drawing path.
Replaced GDK source helpers in the text rendering pipeline with Cairo surface/color helpers for lines, backgrounds, and blits.

Updated render sizing to use window dimensions and switched window copy paths to Cairo surfaces.
2026-01-17 16:46:21 -07:00
5ea424d0e8 start of ciaro implementation. 2026-01-17 16:08:00 -07:00
4683ef705b new name after fork 2026-01-05 23:12:38 -07:00
Collin Funk
180ce9f4fd Change various types to the correct signedness to avoid warnings.
Also cast the check of "inet_addr" to guint32. The POSIX declaration
of this function returns in_addr_t which is the same as uint32_t.
Windows does not define this type and instead uses unsigned long.
2024-01-29 09:06:29 -06:00
Sadie Powell
46c9df1863 Fix various compiler warnings.
fish.c: -Wincompatible-pointer-types
fkeys.c: -Wmisleading-indentation
proto-irc.c: -Wincompatible-pointer-types
util.c: -Wdeprecated-declarations
xtext.c: -Wmaybe-uninitialized
2022-08-29 13:50:03 -05:00
Sadie Powell
55e4f1c42e Implement support for strikethrough text.
https://defs.ircdocs.horse/info/formatting.html
2021-06-20 10:39:39 -05:00
John Levon
163608d7fd Use pango_font_metrics_get_height() to calculate font height (#2500) 2020-09-07 18:53:31 +02:00
Patrick Griffis
eb942fc274 Revert "xtext: Always use Pango to get correct glyph width on Unix"
This reverts commit d3f1ab7813.

The performance even on Linux is just too poor in many cases.
2018-03-13 21:18:16 -04:00
Patrick Griffis
7510ab36b7 xtext: Fix accidental truncation
Fixes #2121
2018-02-11 17:24:32 -05:00
Peng Wu
d3f1ab7813 xtext: Always use Pango to get correct glyph width on Unix
This should be slower but pango seems to be reasonably fast
on Unix though extremely slow on Windows.

https://bugzilla.redhat.com/show_bug.cgi?id=1536298
2018-02-06 17:06:50 -05:00
Patrick Griffis
4cdf6460b6 xtext: Fix invalid utf-8 from truncation 2018-02-06 17:06:50 -05:00
Patrick Griffis
5d3bf39103 xtext: Remove unused code 2018-02-06 17:06:50 -05:00
Rodri
4a228d1efe This patch hopefully solves a bug that causes that when a tab (channel or private) is left with the scrollbar at the bottom, and some new text arrives, and then we select again that tab, sometimes the scrollbar is not completely down and there is hidden text and we have to scroll manually to the bottom to show all text.
This was previously submitted as an issue in: https://github.com/hexchat/hexchat/issues/1948
Maybe it isn't the ideal way to solve it, but at least I tested it and it seems to work.
2018-01-18 15:07:14 -05:00
Francisco Couzo
ee8926503c Prevent undefined behaviour on memcpy 2018-01-18 04:49:10 -05:00
Pavel Djundik
971e5cf4fe Emit word_click even as long as user is not selecting any text when releasing button
This fixes the need to do pixel-perfect clicks to open links in chat
2016-01-10 12:37:30 -08:00
Patrick Griffis
c8539b93fe xtext: Fix overflow on long lines
xtext keeps a static buffer and uses it for various things
and asserts that every text entry is < 4096. It does
this check on gtk_xtext_append*() except it does the check only on
the right half of text when indent is enabled.

This overflow caused corruption in the xtext struct
changing the url check functions making hovering
with the mouse do 'undefined' things.

In the long term this should be removed for a dynamically
allocated buffer so no arbitrary size limit exists and
text gets cut off.

Fixes #1465
Fixes #1186
Fixes #1206
2015-10-30 01:22:13 -04:00
RichardHitt
9664b1b7e3 Fix select regression.
Fix selection when part of the selected text is above/below a border.
Also, fix problems uncovered by static analysis.

Fixes #1261.
2015-08-20 00:23:17 +02:00
RichardHitt
f7bea16e37 xtext: Fix poor performance with nick indent enabled
This fixes xtext re-rendering multiple times when the
indent width is not sufficient

Fixes #1364
Closes #1367
2015-05-18 06:31:00 -04:00
Arnavion
e42da22716 Revert "xtext: Unselect old selection on button press" - breaks clicking URLs to open them.
This reverts commit 8ca96d7ea3.
2015-02-20 02:54:41 -08:00
RichardHitt
8ca96d7ea3 xtext: Unselect old selection on button press
Fixes #943
Closes #1293
2015-02-15 13:17:55 -05:00
Arnavion
9858784eb6 Better project files.
- Output directly to rel\ instead of to bin\ and then copying files over.
- Deduped Win32 vs x64 configs
- Moved some common properties to hexchat.props
- All build intermediates (except htm's intermediates) are no longer emitted in the source directory
2015-02-11 10:01:29 -08:00
TingPing
2a28289314 Don't return 0 in place of NULL 2014-12-31 11:31:17 -05:00
TingPing
83032b1aa3 Use glib for all allocations
- Removes need to check for malloc failure
- Removes need for NULL checks on free
- Adds checks for integer overflows
- Removes some extra memset calls
- Removes chance of mixing libc and glib malloc/free
2014-12-28 06:44:44 -05:00
TingPing
aeb5d15871 More consistently include config.h 2014-12-17 18:21:10 -05:00
TingPing
05a6097dc6 Fix copying timestamp with server-time and indent nicks off 2014-11-30 22:33:30 -05:00
TingPing
85557f2416 Fix duplicate timestamps on selection
Fixes #1226
2014-11-30 22:27:00 -05:00
Campbell Barton
f83d78dd28 Warning cleanup
- ignoring const
- declarations after statements
- some C files didnt include own headers (risking them getting out of sync)

Closes #1064
2014-11-02 14:41:20 -05:00
RichardHitt
6653582f0a Fix textbox not scrolling to to bottom on resize
Set buf->scrollbar_down conditionally when vertically resizing text window
If resize to enlarge appears to go to last line, set buf->scrollbar_down to be sure.

Fixes #1151
Closes #1171
2014-10-10 13:35:00 -04:00
Farow
fd95c729d5 xtext: Add word and line selection modes
Similar to a GtkTextView if you double click you enter word selection mode
and if you triple click you enter line selection mode.
Allowing you to drag and select more than a single character.

Closes #1108
2014-09-01 17:53:03 -04:00
TingPing
b8c02f71d9 win32: Use config.h instead of config-win32.h 2014-06-04 10:30:18 -04:00