mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-19 20:20:18 +00:00
Removed GTK2/GTK3 dual-path preprocessor branches across src/fe-gtk by keeping GTK3-native paths only, including the high-density targets you prioritized (xtext.c, setup.c, maingui.c, gtkutil.c, servlistgui.c).
Removed GTK2 compatibility shims from headers (fe-gtk.h, gtkutil.h), leaving direct GTK3-facing declarations/includes only (and platform-specific guards unrelated to GTK2 kept as-is). Cleaned GTK2-specific comments/wording now that behavior is GTK3-native (menu accelerator note and emoji/userlist comment blocks).
This commit is contained in:
@@ -51,13 +51,6 @@
|
||||
#include "xtext.h"
|
||||
#include "gtkutil.h"
|
||||
|
||||
#ifndef HAVE_GTK3
|
||||
#if GTK_MAJOR_VERSION >= 3
|
||||
#define HAVE_GTK3 1
|
||||
#else
|
||||
#define HAVE_GTK3 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define ICON_ADD "zc-menu-add"
|
||||
#define ICON_REMOVE "zc-menu-remove"
|
||||
@@ -108,21 +101,11 @@ struct _SexySpellEntryPriv
|
||||
};
|
||||
|
||||
static void sexy_spell_entry_class_init(SexySpellEntryClass *klass);
|
||||
#if HAVE_GTK3
|
||||
static void sexy_spell_entry_editable_init (GtkEditableInterface *iface);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
static void sexy_spell_entry_editable_init (GtkEditableClass *iface);
|
||||
#endif
|
||||
static void sexy_spell_entry_init(SexySpellEntry *entry);
|
||||
static void sexy_spell_entry_finalize(GObject *obj);
|
||||
static void sexy_spell_entry_destroy(GObject *obj);
|
||||
#if HAVE_GTK3
|
||||
static gboolean sexy_spell_entry_draw(GtkWidget *widget, cairo_t *cr);
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
static gint sexy_spell_entry_expose(GtkWidget *widget, GdkEventExpose *event);
|
||||
#endif
|
||||
static gint sexy_spell_entry_button_press(GtkWidget *widget, GdkEventButton *event);
|
||||
|
||||
/* GtkEditable handlers */
|
||||
@@ -266,12 +249,7 @@ sexy_spell_entry_class_init(SexySpellEntryClass *klass)
|
||||
|
||||
object_class->dispose = sexy_spell_entry_destroy;
|
||||
|
||||
#if HAVE_GTK3
|
||||
widget_class->draw = sexy_spell_entry_draw;
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
widget_class->expose_event = sexy_spell_entry_expose;
|
||||
#endif
|
||||
widget_class->button_press_event = sexy_spell_entry_button_press;
|
||||
|
||||
/**
|
||||
@@ -302,19 +280,11 @@ sexy_spell_entry_class_init(SexySpellEntryClass *klass)
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
static void
|
||||
sexy_spell_entry_editable_init (GtkEditableInterface *iface)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !HAVE_GTK3
|
||||
static void
|
||||
sexy_spell_entry_editable_init (GtkEditableClass *iface)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static gint
|
||||
gtk_entry_find_position (GtkEntry *entry, gint x)
|
||||
@@ -327,7 +297,6 @@ gtk_entry_find_position (GtkEntry *entry, gint x)
|
||||
gint pos;
|
||||
gboolean trailing;
|
||||
|
||||
#if HAVE_GTK3
|
||||
{
|
||||
gint layout_x;
|
||||
gint layout_y;
|
||||
@@ -335,35 +304,16 @@ gtk_entry_find_position (GtkEntry *entry, gint x)
|
||||
gtk_entry_get_layout_offsets(entry, &layout_x, &layout_y);
|
||||
x -= layout_x;
|
||||
}
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
x = x + entry->scroll_offset;
|
||||
#endif
|
||||
|
||||
layout = gtk_entry_get_layout(entry);
|
||||
text = pango_layout_get_text(layout);
|
||||
#if HAVE_GTK3
|
||||
cursor_index = g_utf8_offset_to_pointer(
|
||||
text,
|
||||
gtk_editable_get_position(GTK_EDITABLE(entry))) - text;
|
||||
#endif
|
||||
#if !HAVE_GTK3
|
||||
cursor_index = g_utf8_offset_to_pointer(text, entry->current_pos) - text;
|
||||
#endif
|
||||
|
||||
line = pango_layout_get_lines(layout)->data;
|
||||
pango_layout_line_x_to_index(line, x * PANGO_SCALE, &index, &trailing);
|
||||
|
||||
#if !HAVE_GTK3
|
||||
if (index >= cursor_index && entry->preedit_length) {
|
||||
if (index >= cursor_index + entry->preedit_length) {
|
||||
index -= entry->preedit_length;
|
||||
} else {
|
||||
index = cursor_index;
|
||||
trailing = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
pos = g_utf8_pointer_to_offset (text, text + index);
|
||||
pos += trailing;
|
||||
@@ -718,7 +668,6 @@ static GtkWidget *
|
||||
sexy_spell_entry_icon_menu_item (const char *label, const char *stock_name)
|
||||
{
|
||||
GtkWidget *item;
|
||||
#if HAVE_GTK3
|
||||
const char *icon_name;
|
||||
GtkWidget *box;
|
||||
GtkWidget *image = NULL;
|
||||
@@ -736,13 +685,6 @@ sexy_spell_entry_icon_menu_item (const char *label, const char *stock_name)
|
||||
gtk_box_pack_start (GTK_BOX (box), image, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), label_widget, FALSE, FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (item), box);
|
||||
#else
|
||||
GtkWidget *image;
|
||||
|
||||
item = gtk_image_menu_item_new_with_label (label);
|
||||
image = gtkutil_image_new_from_stock (stock_name, GTK_ICON_SIZE_MENU);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
|
||||
#endif
|
||||
|
||||
return item;
|
||||
}
|
||||
@@ -1244,7 +1186,6 @@ sexy_spell_entry_recheck_all(SexySpellEntry *entry)
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_GTK3
|
||||
static gboolean
|
||||
sexy_spell_entry_draw(GtkWidget *widget, cairo_t *cr)
|
||||
{
|
||||
@@ -1257,29 +1198,7 @@ sexy_spell_entry_draw(GtkWidget *widget, cairo_t *cr)
|
||||
|
||||
return GTK_WIDGET_CLASS(parent_class)->draw (widget, cr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !HAVE_GTK3
|
||||
static gint
|
||||
sexy_spell_entry_expose(GtkWidget *widget, GdkEventExpose *event)
|
||||
{
|
||||
SexySpellEntry *entry = SEXY_SPELL_ENTRY(widget);
|
||||
GtkEntry *gtk_entry = GTK_ENTRY(widget);
|
||||
PangoLayout *layout;
|
||||
|
||||
layout = gtk_entry_get_layout(gtk_entry);
|
||||
if (gtk_entry->preedit_length == 0)
|
||||
{
|
||||
pango_layout_set_attributes(layout, entry->priv->attr_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
pango_layout_set_attributes(layout, empty_attrs_list);
|
||||
}
|
||||
|
||||
return GTK_WIDGET_CLASS(parent_class)->expose_event (widget, event);
|
||||
}
|
||||
#endif
|
||||
|
||||
static gint
|
||||
sexy_spell_entry_button_press(GtkWidget *widget, GdkEventButton *event)
|
||||
|
||||
Reference in New Issue
Block a user