Compare commits
104 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 984a9c2c09 | |||
| 0c406160e6 | |||
| f35b8a7541 | |||
| 9948ca7be2 | |||
| eaf41cc90c | |||
| 9e0c471b03 | |||
| dc282991c6 | |||
| 7931ab5f33 | |||
| 416a4cf5ea | |||
| bbd4e2f60d | |||
| 5577e30ad4 | |||
| 5caf8ca76b | |||
| fda4546de5 | |||
| fe7dcf6eec | |||
| 539e3d387b | |||
| efbb26b8cb | |||
| 69251d051a | |||
| d930c4a4d1 | |||
| f36e41600a | |||
| 78d013f8d3 | |||
| b4ae491b45 | |||
| 1469d01e2e | |||
| b0083b33bb | |||
| c5c75f338e | |||
| 572266429f | |||
| 91ad2eef5c | |||
| 14890fad47 | |||
| 5a6a7b50af | |||
| 8438880906 | |||
| df6494d73a | |||
| 9335cde8e8 | |||
| e836c575ce | |||
| 47fb1ec4c4 | |||
| f0624266dc | |||
| 74ab3cdf75 | |||
| 58c2bea959 | |||
| d3c45cb979 | |||
| df27cb7240 | |||
| 397b8ee9d5 | |||
| 6687a0892a | |||
| 77c0e68b57 | |||
| fd667bb203 | |||
| d773bc0689 | |||
| eddc823378 | |||
| eb1310effe | |||
| 8a0182e401 | |||
| edc4f954c6 | |||
| c35554cf68 | |||
| 9861887f1a | |||
| 3ae31b0e79 | |||
| 06df7e6f2c | |||
| 0d39cb7379 | |||
| cc216c9e84 | |||
| 09fea73a40 | |||
| 704e377fae | |||
| 12663d2844 | |||
| 4e8aa0c37a | |||
| ea4f552d50 | |||
| 2501152842 | |||
| a13d8501d4 | |||
| 69b1a348c6 | |||
| b82e57fec6 | |||
| 5dbfb18d11 | |||
| b6893b6d9f | |||
| 4001e7645b | |||
| ac8b192eab | |||
| fad9468e77 | |||
| 222d310370 | |||
| fe95391184 | |||
| e16cdb141c | |||
| 08badd23cd | |||
| cc2c39209c | |||
| d633beaccd | |||
| 23fb77af43 | |||
| ccbaec0231 | |||
| 89470ab201 | |||
| a3901f2563 | |||
| 5dd0863bd7 | |||
| 8d93321461 | |||
| 3ccbcf9f55 | |||
| ef5108c89f | |||
| 0230a7b1e5 | |||
| 55337c588c | |||
| 9e231f6333 | |||
| 3ebf19b783 | |||
| 9591d40742 | |||
| de6132a158 | |||
| ddb52a5b5e | |||
| 47249431e3 | |||
| f9041230c6 | |||
| e54ce8f328 | |||
| 8d987be673 | |||
| 445dca42f5 | |||
| c53e9ed6aa | |||
| 2b9436b279 | |||
| bd99ae3767 | |||
| 0e603a6646 | |||
| 9d0e8b85c1 | |||
| da0bd697b8 | |||
| 3471aac4ef | |||
| 593774133f | |||
| 3fa28ffd92 | |||
| 5383d11bb4 | |||
| ed65ab1ba9 |
@@ -23,7 +23,7 @@
|
||||
|
||||
## Version information
|
||||
<!--
|
||||
- Which version of GTK+ you are using
|
||||
- Which version of GTK you are using
|
||||
- What operating system and version
|
||||
- For Linux, which distribution
|
||||
- If you built GTK+ yourself, the list of options used to configure the build
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
## Version information
|
||||
<!--
|
||||
- Which version of GTK+ you are using
|
||||
- Which version of GTK you are using
|
||||
- What operating system and version
|
||||
- for Linux, which distribution
|
||||
- If you built GTK+ yourself, the list of options used to configure the build
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
if 'DESTDIR' not in os.environ:
|
||||
gtk_api_version = sys.argv[1]
|
||||
gtk_abi_version = sys.argv[2]
|
||||
gtk_libdir = sys.argv[3]
|
||||
gtk_datadir = sys.argv[4]
|
||||
|
||||
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
|
||||
gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
|
||||
gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
|
||||
|
||||
print('Compiling GSettings schemas...')
|
||||
subprocess.call(['glib-compile-schemas',
|
||||
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
|
||||
|
||||
print('Updating icon cache...')
|
||||
subprocess.call(['gtk-update-icon-cache', '-q', '-t' ,'-f',
|
||||
os.path.join(gtk_datadir, 'icons', 'hicolor')])
|
||||
|
||||
print('Updating module cache for print backends...')
|
||||
os.makedirs(gtk_printmodule_dir, exist_ok=True)
|
||||
subprocess.call(['gio-querymodules', gtk_printmodule_dir])
|
||||
|
||||
print('Updating module cache for input methods...')
|
||||
os.makedirs(gtk_immodule_dir, exist_ok=True)
|
||||
subprocess.call(['gio-querymodules', gtk_immodule_dir])
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
gtk_api_version=$1
|
||||
gtk_abi_version=$2
|
||||
gtk_libdir=$3
|
||||
gtk_datadir=$4
|
||||
|
||||
# Package managers set this so we don't need to run
|
||||
if [ -z "$DESTDIR" ]; then
|
||||
echo Compiling GSettings schemas...
|
||||
glib-compile-schemas ${gtk_datadir}/glib-2.0/schemas
|
||||
|
||||
echo Updating desktop database...
|
||||
update-desktop-database -q ${gtk_datadir}/applications
|
||||
|
||||
echo Updating icon cache...
|
||||
gtk-update-icon-cache -q -t -f ${gtk_datadir}/icons/hicolor
|
||||
|
||||
echo Updating module cache for print backends...
|
||||
mkdir -p ${gtk_libdir}/gtk-4.0/4.0.0/printbackends
|
||||
gio-querymodules ${gtk_libdir}/gtk-4.0/4.0.0/printbackends
|
||||
|
||||
echo Updating module cache for input methods...
|
||||
mkdir -p ${gtk_libdir}/gtk-4.0/4.0.0/immodules
|
||||
gio-querymodules ${gtk_libdir}/gtk-4.0/4.0.0/immodules
|
||||
fi
|
||||
@@ -80,7 +80,7 @@ on_entry_changed (GtkWidget *widget, gpointer data)
|
||||
|
||||
page_number = gtk_assistant_get_current_page (assistant);
|
||||
current_page = gtk_assistant_get_nth_page (assistant, page_number);
|
||||
text = gtk_entry_get_text (GTK_ENTRY (widget));
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (widget));
|
||||
|
||||
if (text && *text)
|
||||
gtk_assistant_set_page_complete (assistant, current_page, TRUE);
|
||||
|
||||
@@ -71,20 +71,12 @@ find_toplevel_at_pointer (GdkDisplay *display)
|
||||
GdkSurface *pointer_window;
|
||||
GtkWidget *widget = NULL;
|
||||
|
||||
pointer_window = gdk_device_get_surface_at_position (gtk_get_current_event_device (),
|
||||
NULL, NULL);
|
||||
pointer_window = gdk_device_get_surface_at_position (gtk_get_current_event_device (), NULL, NULL);
|
||||
|
||||
/* The user data field of a GdkSurface is used to store a pointer
|
||||
* to the widget that created it.
|
||||
*/
|
||||
if (pointer_window)
|
||||
{
|
||||
gpointer widget_ptr;
|
||||
gdk_surface_get_user_data (pointer_window, &widget_ptr);
|
||||
widget = widget_ptr;
|
||||
}
|
||||
widget = GTK_WIDGET (gtk_root_get_for_surface (pointer_window));
|
||||
|
||||
return widget ? gtk_widget_get_toplevel (widget) : NULL;
|
||||
return widget;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -28,7 +28,7 @@ copy_button_clicked (GtkWidget *button,
|
||||
clipboard = gtk_widget_get_clipboard (entry);
|
||||
|
||||
/* Set clipboard text */
|
||||
gdk_clipboard_set_text (clipboard, gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||
gdk_clipboard_set_text (clipboard, gtk_editable_get_text (GTK_EDITABLE (entry)));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -50,7 +50,7 @@ paste_received (GObject *source_object,
|
||||
if (text)
|
||||
{
|
||||
/* Set the entry text */
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), text);
|
||||
g_free (text);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -256,7 +256,7 @@ mask_entry_set_background (MaskEntry *entry)
|
||||
{
|
||||
if (entry->mask)
|
||||
{
|
||||
if (!g_regex_match_simple (entry->mask, gtk_entry_get_text (GTK_ENTRY (entry)), 0, 0))
|
||||
if (!g_regex_match_simple (entry->mask, gtk_editable_get_text (GTK_EDITABLE (entry)), 0, 0))
|
||||
{
|
||||
PangoAttrList *attrs;
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ interactive_dialog_clicked (GtkButton *button,
|
||||
label = gtk_label_new_with_mnemonic ("_Entry 1");
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
|
||||
local_entry1 = gtk_entry_new ();
|
||||
gtk_entry_set_text (GTK_ENTRY (local_entry1), gtk_entry_get_text (GTK_ENTRY (entry1)));
|
||||
gtk_editable_set_text (GTK_EDITABLE (local_entry1), gtk_editable_get_text (GTK_EDITABLE (entry1)));
|
||||
gtk_grid_attach (GTK_GRID (table), local_entry1, 1, 0, 1, 1);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), local_entry1);
|
||||
|
||||
@@ -77,7 +77,7 @@ interactive_dialog_clicked (GtkButton *button,
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
|
||||
|
||||
local_entry2 = gtk_entry_new ();
|
||||
gtk_entry_set_text (GTK_ENTRY (local_entry2), gtk_entry_get_text (GTK_ENTRY (entry2)));
|
||||
gtk_editable_set_text (GTK_EDITABLE (local_entry2), gtk_editable_get_text (GTK_EDITABLE (entry2)));
|
||||
gtk_grid_attach (GTK_GRID (table), local_entry2, 1, 1, 1, 1);
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), local_entry2);
|
||||
|
||||
@@ -85,8 +85,8 @@ interactive_dialog_clicked (GtkButton *button,
|
||||
|
||||
if (response == GTK_RESPONSE_OK)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (entry1), gtk_entry_get_text (GTK_ENTRY (local_entry1)));
|
||||
gtk_entry_set_text (GTK_ENTRY (entry2), gtk_entry_get_text (GTK_ENTRY (local_entry2)));
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry1), gtk_editable_get_text (GTK_EDITABLE (local_entry1)));
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry2), gtk_editable_get_text (GTK_EDITABLE (local_entry2)));
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
@@ -199,7 +199,7 @@ edit_label_done (GtkWidget *entry, gpointer data)
|
||||
gtk_container_child_get (GTK_CONTAINER (fixed), entry, "x", &x, "y", &y, NULL);
|
||||
|
||||
label = GTK_WIDGET (g_object_get_data (G_OBJECT (entry), "label"));
|
||||
gtk_label_set_text (GTK_LABEL (label), gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||
gtk_label_set_text (GTK_LABEL (label), gtk_editable_get_text (GTK_EDITABLE (entry)));
|
||||
|
||||
gtk_widget_destroy (entry);
|
||||
}
|
||||
@@ -218,7 +218,7 @@ edit_cb (GtkWidget *child)
|
||||
|
||||
g_object_set_data (G_OBJECT (entry), "label", child);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), gtk_label_get_text (GTK_LABEL (child)));
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), gtk_label_get_text (GTK_LABEL (child)));
|
||||
g_signal_connect (entry, "activate", G_CALLBACK (edit_label_done), NULL);
|
||||
gtk_fixed_put (GTK_FIXED (fixed), entry, x, y);
|
||||
gtk_widget_grab_focus (entry);
|
||||
|
||||
@@ -305,7 +305,7 @@ update_display (void)
|
||||
char *font_desc;
|
||||
char *features;
|
||||
|
||||
text = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (gtk_label_get_selection_bounds (GTK_LABEL (label), &ins, &bound))
|
||||
{
|
||||
@@ -728,7 +728,7 @@ adjustment_changed (GtkAdjustment *adjustment,
|
||||
char *str;
|
||||
|
||||
str = g_strdup_printf ("%g", gtk_adjustment_get_value (adjustment));
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), str);
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), str);
|
||||
g_free (str);
|
||||
|
||||
update_display ();
|
||||
@@ -741,7 +741,7 @@ entry_activated (GtkEntry *entry,
|
||||
gdouble value;
|
||||
gchar *err = NULL;
|
||||
|
||||
value = g_strtod (gtk_entry_get_text (entry), &err);
|
||||
value = g_strtod (gtk_editable_get_text (GTK_EDITABLE (entry)), &err);
|
||||
if (err != NULL)
|
||||
gtk_adjustment_set_value (adjustment, value);
|
||||
}
|
||||
@@ -821,7 +821,7 @@ add_axis (FT_Var_Axis *ax, FT_Fixed value, int i)
|
||||
gtk_grid_attach (GTK_GRID (variations_grid), axis_scale, 1, i, 1, 1);
|
||||
axis_entry = gtk_entry_new ();
|
||||
gtk_widget_set_valign (axis_entry, GTK_ALIGN_BASELINE);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (axis_entry), 4);
|
||||
gtk_editable_set_width_chars (GTK_EDITABLE (axis_entry), 4);
|
||||
gtk_grid_attach (GTK_GRID (variations_grid), axis_entry, 2, i, 1, 1);
|
||||
|
||||
axis = g_new (Axis, 1);
|
||||
@@ -1639,7 +1639,7 @@ static char *text;
|
||||
static void
|
||||
switch_to_entry (void)
|
||||
{
|
||||
text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||
text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (entry)));
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (stack), "entry");
|
||||
gtk_widget_grab_focus (entry);
|
||||
}
|
||||
@@ -1677,7 +1677,7 @@ entry_key_press (GtkEventController *controller,
|
||||
{
|
||||
if (keyval == GDK_KEY_Escape)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), text);
|
||||
stop_edit ();
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
static void
|
||||
do_number (GtkButton *button, GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_text (entry, gtk_button_get_label (button));
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), gtk_button_get_label (button));
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
||||
+23
-15
@@ -171,8 +171,24 @@ on_pad_knob_change (GSimpleAction *action,
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_hierarchy_changed (GtkWidget *widget,
|
||||
GtkWidget *previous_toplevel)
|
||||
drawing_area_unroot (GtkWidget *widget)
|
||||
{
|
||||
DrawingArea *area = (DrawingArea *) widget;
|
||||
GtkWidget *toplevel;
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
||||
if (area->pad_controller)
|
||||
{
|
||||
gtk_widget_remove_controller (toplevel, GTK_EVENT_CONTROLLER (area->pad_controller));
|
||||
area->pad_controller = NULL;
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (drawing_area_parent_class)->unroot (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_root (GtkWidget *widget)
|
||||
{
|
||||
DrawingArea *area = (DrawingArea *) widget;
|
||||
GSimpleActionGroup *action_group;
|
||||
@@ -180,20 +196,12 @@ drawing_area_hierarchy_changed (GtkWidget *widget,
|
||||
GtkWidget *toplevel;
|
||||
gint i;
|
||||
|
||||
if (previous_toplevel && area->pad_controller)
|
||||
{
|
||||
gtk_widget_remove_controller (previous_toplevel,
|
||||
GTK_EVENT_CONTROLLER (area->pad_controller));
|
||||
area->pad_controller = NULL;
|
||||
}
|
||||
GTK_WIDGET_CLASS (drawing_area_parent_class)->root (widget);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (area));
|
||||
if (!GTK_IS_WINDOW (toplevel))
|
||||
return;
|
||||
|
||||
action_group = g_simple_action_group_new ();
|
||||
area->pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (action_group),
|
||||
NULL);
|
||||
area->pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (action_group), NULL);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (pad_actions); i++)
|
||||
{
|
||||
@@ -220,8 +228,7 @@ drawing_area_hierarchy_changed (GtkWidget *widget,
|
||||
gtk_pad_controller_set_action_entries (area->pad_controller, pad_actions,
|
||||
G_N_ELEMENTS (pad_actions));
|
||||
|
||||
gtk_widget_add_controller (toplevel,
|
||||
GTK_EVENT_CONTROLLER (area->pad_controller));
|
||||
gtk_widget_add_controller (toplevel, GTK_EVENT_CONTROLLER (area->pad_controller));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -233,7 +240,8 @@ drawing_area_class_init (DrawingAreaClass *klass)
|
||||
widget_class->snapshot = drawing_area_snapshot;
|
||||
widget_class->map = drawing_area_map;
|
||||
widget_class->unmap = drawing_area_unmap;
|
||||
widget_class->hierarchy_changed = drawing_area_hierarchy_changed;
|
||||
widget_class->root = drawing_area_root;
|
||||
widget_class->unroot = drawing_area_unroot;
|
||||
|
||||
area_signals[COLOR_SET] =
|
||||
g_signal_new ("color-set",
|
||||
|
||||
@@ -85,7 +85,7 @@ stop_search (GtkButton *button,
|
||||
static void
|
||||
clear_entry (GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_text (entry, "");
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), "");
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -19,7 +19,7 @@ hex_spin_input (GtkSpinButton *spin_button,
|
||||
gchar *err;
|
||||
gdouble res;
|
||||
|
||||
buf = gtk_spin_button_get_text (spin_button);
|
||||
buf = gtk_editable_get_text (GTK_EDITABLE (spin_button));
|
||||
res = strtol (buf, &err, 16);
|
||||
*new_val = res;
|
||||
if (*err)
|
||||
@@ -41,8 +41,8 @@ hex_spin_output (GtkSpinButton *spin_button)
|
||||
buf = g_strdup ("0x00");
|
||||
else
|
||||
buf = g_strdup_printf ("0x%.2X", (gint) val);
|
||||
if (strcmp (buf, gtk_spin_button_get_text (spin_button)))
|
||||
gtk_spin_button_set_text (spin_button, buf);
|
||||
if (strcmp (buf, gtk_editable_get_text (GTK_EDITABLE (spin_button))))
|
||||
gtk_editable_set_text (GTK_EDITABLE (spin_button), buf);
|
||||
g_free (buf);
|
||||
|
||||
return TRUE;
|
||||
@@ -60,7 +60,7 @@ time_spin_input (GtkSpinButton *spin_button,
|
||||
gchar *endh;
|
||||
gchar *endm;
|
||||
|
||||
text = gtk_spin_button_get_text (spin_button);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (spin_button));
|
||||
str = g_strsplit (text, ":", 2);
|
||||
|
||||
if (g_strv_length (str) == 2)
|
||||
@@ -99,8 +99,8 @@ time_spin_output (GtkSpinButton *spin_button)
|
||||
hours = gtk_adjustment_get_value (adjustment) / 60.0;
|
||||
minutes = (hours - floor (hours)) * 60.0;
|
||||
buf = g_strdup_printf ("%02.0f:%02.0f", floor (hours), floor (minutes + 0.5));
|
||||
if (strcmp (buf, gtk_spin_button_get_text (spin_button)))
|
||||
gtk_spin_button_set_text (spin_button, buf);
|
||||
if (strcmp (buf, gtk_editable_get_text (GTK_EDITABLE (spin_button))))
|
||||
gtk_editable_set_text (GTK_EDITABLE (spin_button), buf);
|
||||
g_free (buf);
|
||||
|
||||
return TRUE;
|
||||
@@ -132,7 +132,7 @@ month_spin_input (GtkSpinButton *spin_button,
|
||||
for (i = 1; i <= 12; i++)
|
||||
{
|
||||
tmp1 = g_ascii_strup (month[i - 1], -1);
|
||||
tmp2 = g_ascii_strup (gtk_spin_button_get_text (spin_button), -1);
|
||||
tmp2 = g_ascii_strup (gtk_editable_get_text (GTK_EDITABLE (spin_button)), -1);
|
||||
if (strstr (tmp1, tmp2) == tmp1)
|
||||
found = TRUE;
|
||||
g_free (tmp1);
|
||||
@@ -162,8 +162,8 @@ month_spin_output (GtkSpinButton *spin_button)
|
||||
for (i = 1; i <= 12; i++)
|
||||
if (fabs (value - (double)i) < 1e-5)
|
||||
{
|
||||
if (strcmp (month[i-1], gtk_spin_button_get_text (spin_button)))
|
||||
gtk_spin_button_set_text (spin_button, month[i-1]);
|
||||
if (strcmp (month[i-1], gtk_editable_get_text (GTK_EDITABLE (spin_button))))
|
||||
gtk_editable_set_text (GTK_EDITABLE (spin_button), month[i-1]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -68,7 +68,7 @@ search_text_changed (GtkEntry *entry, IconBrowserWindow *win)
|
||||
{
|
||||
const gchar *text;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
@@ -322,7 +322,7 @@ icon_visible_func (GtkTreeModel *model,
|
||||
gboolean visible;
|
||||
|
||||
search = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (win->search));
|
||||
search_text = gtk_entry_get_text (GTK_ENTRY (win->searchentry));
|
||||
search_text = gtk_editable_get_text (GTK_EDITABLE (win->searchentry));
|
||||
|
||||
if (win->symbolic)
|
||||
column = ICON_STORE_SYMBOLIC_NAME_COLUMN;
|
||||
|
||||
@@ -1406,7 +1406,7 @@ open_popover_text_changed (GtkEntry *entry, GParamSpec *pspec, GtkWidget *button
|
||||
{
|
||||
const gchar *text;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
gtk_widget_set_sensitive (button, strlen (text) > 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -213,6 +213,7 @@ gdk_surface_get_pass_through
|
||||
gdk_surface_move
|
||||
gdk_surface_resize
|
||||
gdk_surface_move_resize
|
||||
gdk_surface_move_to_rect
|
||||
gdk_surface_has_native
|
||||
gdk_surface_raise
|
||||
gdk_surface_lower
|
||||
@@ -240,7 +241,6 @@ gdk_surface_thaw_updates
|
||||
gdk_surface_get_frame_clock
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_surface_set_user_data
|
||||
gdk_surface_set_accept_focus
|
||||
gdk_surface_get_accept_focus
|
||||
gdk_surface_set_focus_on_map
|
||||
@@ -252,7 +252,6 @@ gdk_surface_set_title
|
||||
GDK_PARENT_RELATIVE
|
||||
gdk_surface_set_cursor
|
||||
gdk_surface_get_cursor
|
||||
gdk_surface_get_user_data
|
||||
gdk_surface_get_geometry
|
||||
gdk_surface_set_geometry_hints
|
||||
gdk_surface_get_width
|
||||
@@ -278,7 +277,6 @@ GdkModifierIntent
|
||||
gdk_surface_get_parent
|
||||
gdk_surface_get_toplevel
|
||||
gdk_surface_get_children
|
||||
gdk_surface_get_children_with_user_data
|
||||
gdk_surface_peek_children
|
||||
gdk_surface_set_icon_name
|
||||
gdk_surface_set_transient_for
|
||||
@@ -377,6 +375,7 @@ gdk_content_formats_builder_to_formats
|
||||
GDK_TYPE_FILE_LIST
|
||||
gdk_file_list_get_type
|
||||
gdk_content_formats_get_type
|
||||
gdk_content_formats_builder_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -442,6 +441,7 @@ gdk_keymap_get_modifier_state
|
||||
gdk_keymap_add_virtual_modifiers
|
||||
gdk_keymap_map_virtual_modifiers
|
||||
gdk_keymap_get_modifier_mask
|
||||
gdk_keymap_get_display
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_keyval_name
|
||||
@@ -622,6 +622,7 @@ GDK_BUTTON_SECONDARY
|
||||
gdk_event_new
|
||||
gdk_event_copy
|
||||
gdk_event_get_axes
|
||||
gdk_event_get_axis
|
||||
gdk_event_get_button
|
||||
gdk_event_get_click_count
|
||||
gdk_event_get_coords
|
||||
@@ -662,9 +663,6 @@ gdk_event_get_touchpad_gesture_n_fingers
|
||||
gdk_event_get_touchpad_gesture_phase
|
||||
gdk_event_get_touchpad_scale
|
||||
gdk_event_is_sent
|
||||
<SUBSECTION>
|
||||
gdk_event_handler_set
|
||||
GdkEventFunc
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_get_show_events
|
||||
@@ -687,6 +685,7 @@ GDK_TYPE_SCROLL_DIRECTION
|
||||
GDK_TYPE_NOTIFY_TYPE
|
||||
GDK_IS_EVENT
|
||||
gdk_event_get_type
|
||||
gdk_event_sequence_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -782,7 +781,6 @@ GDK_ACTION_ALL
|
||||
|
||||
gdk_drag_get_display
|
||||
gdk_drag_get_actions
|
||||
gdk_drag_get_suggested_action
|
||||
gdk_drag_get_selected_action
|
||||
gdk_drag_get_formats
|
||||
gdk_drag_get_device
|
||||
|
||||
@@ -15,7 +15,9 @@ private_headers = [
|
||||
'gdkdisplaymanagerprivate.h',
|
||||
'gdkdisplayprivate.h',
|
||||
'gdkdndprivate.h',
|
||||
'gdkdragprivate.h',
|
||||
'gdkdrawcontextprivate.h',
|
||||
'gdkdropprivate.h',
|
||||
'gdkeventsprivate.h',
|
||||
'gdkframeclockidleprivate.h',
|
||||
'gdkframeclockprivate.h',
|
||||
|
||||
@@ -26,72 +26,53 @@
|
||||
widgets and windows, you should read this chapter; this will be
|
||||
useful to know if you decide to implement your own widgets. This
|
||||
chapter will also clarify the reasons behind the ways certain
|
||||
things are done in GTK; for example, why you cannot change the
|
||||
background color of all widgets with the same method.
|
||||
things are done in GTK.
|
||||
</para>
|
||||
|
||||
<refsect2 id="drawing model windows">
|
||||
|
||||
<title>Windows and events</title>
|
||||
|
||||
<para>
|
||||
Programs that run in a windowing system generally create
|
||||
rectangular regions in the screen called
|
||||
<firstterm>windows</firstterm>. Traditional windowing systems
|
||||
do not automatically save the graphical content of windows, and
|
||||
instead ask client programs to repaint those windows whenever it
|
||||
is needed. For example, if a window that is stacked below other
|
||||
windows gets raised to the top, then a client program has to
|
||||
repaint the area that was previously obscured. When the
|
||||
windowing system asks a client program to redraw part of a
|
||||
window, it sends an <firstterm>exposure event</firstterm> to the
|
||||
program for that window.
|
||||
Applications that use a windowing system generally create
|
||||
rectangular regions in the screen called <firstterm>surfaces</firstterm>
|
||||
(GTK is following the Wayland terminology, other windowing systems
|
||||
such as X11 may call these <firstterm>windows</firstterm>).
|
||||
Traditional windowing systems do not automatically save the
|
||||
graphical content of surfaces, and instead ask applications to
|
||||
provide new content whenever it is needed.
|
||||
For example, if a window that is stacked below other
|
||||
windows gets raised to the top, then the application has to
|
||||
repaint it, so the previously obscured area can be shown.
|
||||
When the windowing system asks an application to redraw
|
||||
a window, it sends a <firstterm>frame event</firstterm>
|
||||
(<firstterm>expose event</firstterm> in X11 terminology)
|
||||
for that window.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Each GTK toplevel window or dialog is associated with a
|
||||
windowing system surface. Child widgets such as buttons or
|
||||
entries don't have their own surface; they use the surface
|
||||
of their toplevel.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Here, "windows" means "rectangular regions with automatic
|
||||
clipping", instead of "toplevel application windows". Most
|
||||
windowing systems support nested windows, where the contents of
|
||||
child windows get clipped by the boundaries of their parents.
|
||||
Although GTK and GDK in particular may run on a windowing
|
||||
system with no such notion of nested windows, GDK presents the
|
||||
illusion of being under such a system. A toplevel window may
|
||||
contain many subwindows and sub-subwindows, for example, one for
|
||||
the menu bar, one for the document area, one for each scrollbar,
|
||||
and one for the status bar. In addition, controls that receive
|
||||
user input, such as clickable buttons, are likely to have their
|
||||
own subwindows as well.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In practice, most windows in modern GTK application are client-side
|
||||
constructs. Only few windows (in particular toplevel windows) are
|
||||
<emphasis>native</emphasis>, which means that they represent a
|
||||
window from the underlying windowing system on which GTK is running.
|
||||
For example, on X11 it corresponds to a <type>Window</type>; on Win32,
|
||||
it corresponds to a <type>HANDLE</type>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Generally, the drawing cycle begins when GTK receives an
|
||||
exposure event from the underlying windowing system: if the
|
||||
Generally, the drawing cycle begins when GTK receives
|
||||
a frame event from the underlying windowing system: if the
|
||||
user drags a window over another one, the windowing system will
|
||||
tell the underlying window that it needs to repaint itself. The
|
||||
tell the underlying surface that it needs to repaint itself. The
|
||||
drawing cycle can also be initiated when a widget itself decides
|
||||
that it needs to update its display. For example, when the user
|
||||
types a character in a <link
|
||||
linkend="GtkEntry"><classname>GtkEntry</classname></link>
|
||||
widget, the entry asks GTK to queue a redraw operation for
|
||||
itself.
|
||||
types a character in an entry widget, the entry asks GTK to queue
|
||||
a redraw operation for itself.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The windowing system generates events for native windows. The GDK
|
||||
interface to the windowing system translates such native events into
|
||||
<link linkend="GdkEvent"><structname>GdkEvent</structname></link>
|
||||
structures and sends them on to the GTK layer. In turn, the GTK layer
|
||||
finds the widget that corresponds to a particular
|
||||
<classname>GdkSurface</classname> and emits the corresponding event
|
||||
signals on that widget.
|
||||
The windowing system generates frame events for surfaces. The GDK
|
||||
interface to the windowing system translates such events into
|
||||
emissions of the ::render signal on the affected surfaces.
|
||||
The GTK toplevel window connects to that signal, and reacts appropriately.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -112,8 +93,13 @@
|
||||
it does. On top of this GTK has a frame clock that gives a
|
||||
“pulse” to the application. This clock beats at a steady rate,
|
||||
which is tied to the framerate of the output (this is synced to
|
||||
the monitor via the window manager/compositor). The clock has
|
||||
several phases:
|
||||
the monitor via the window manager/compositor). A typical
|
||||
refresh rate is 60 frames per second, so a new “pulse” happens
|
||||
roughly every 16 milliseconds.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The clock has several phases:
|
||||
<itemizedlist>
|
||||
<listitem><para>Events</para></listitem>
|
||||
<listitem><para>Update</para></listitem>
|
||||
@@ -125,24 +111,24 @@
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The Events phase is a long stretch of time between each
|
||||
redraw where we get input events from the user and other events
|
||||
The Events phase is a stretch of time between each redraw where
|
||||
GTK processes input events from the user and other events
|
||||
(like e.g. network I/O). Some events, like mouse motion are
|
||||
compressed so that we only get a single mouse motion event per
|
||||
clock cycle.
|
||||
compressed so that only a single mouse motion event per clock
|
||||
cycle needs to be handled.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Once the Events phase is over we pause all external events and
|
||||
run the redraw loop. First is the Update phase, where all
|
||||
Once the Events phase is over, external events are paused and
|
||||
the redraw loop is run. First is the Update phase, where all
|
||||
animations are run to calculate the new state based on the
|
||||
estimated time the next frame will be visible (available via
|
||||
the frame clock). This often involves geometry changes which
|
||||
drives the next phase, Layout. If there are any changes in
|
||||
widget size requirements we calculate a new layout for the
|
||||
widget hierarchy (i.e. we assign sizes and positions). Then
|
||||
we go to the Paint phase where we redraw the regions of the
|
||||
window that need redrawing.
|
||||
drive the next phase, Layout. If there are any changes in
|
||||
widget size requirements the new layout is calculated for the
|
||||
widget hierarchy (i.e. sizes and positions for all widgets are
|
||||
determined). Then comes the Paint phase, where we redraw the
|
||||
regions of the window that need redrawing.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -184,162 +170,57 @@
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="scene-graph">
|
||||
<title>The scene graph</title>
|
||||
|
||||
<para>
|
||||
The first step in “drawing” a window is that GTK creates
|
||||
<firstterm>render nodes</firstterm> for all the widgets
|
||||
in the window. The render nodes are combined into a tree
|
||||
that you can think of as a <firstterm>scene graph</firstterm>
|
||||
describing your window contents.
|
||||
</para>
|
||||
<para>
|
||||
Render nodes belong to the GSK layer, and there are various kinds
|
||||
of them, for the various kinds of drawing primitives you are likely
|
||||
to need when translating widget content and CSS styling. Typical
|
||||
examples are text nodes, gradient nodes, texture nodes or clip nodes.
|
||||
<para>
|
||||
<para>
|
||||
In the past, all drawing in GTK happened via cairo. It is still possible
|
||||
to use cairo for drawing your custom widget contents, by using a cairo
|
||||
render node.
|
||||
</para>
|
||||
</para>
|
||||
A GSK <firstterm>renderer</firstterm> takes these render nodes, transforms
|
||||
them into rendering commands for the drawing API it targets, and arranges
|
||||
for the resulting drawing to be associated with the right surface. GSK has
|
||||
renderers for OpenGL, Vulkan and cairo.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="hierarchical-drawing">
|
||||
<title>Hierarchical drawing</title>
|
||||
|
||||
<para>
|
||||
During the Paint phase we will send a single expose event to
|
||||
the toplevel window. The event handler will create a cairo
|
||||
context for the window and emit a GtkWidget::draw() signal
|
||||
on it, which will propagate down the entire widget hierarchy
|
||||
in back-to-front order, using the clipping and transform of
|
||||
the cairo context. This lets each widget draw its content at
|
||||
the right place and time, correctly handling things like
|
||||
partial transparencies and overlapping widgets.
|
||||
During the Paint phase GTK receives a single ::render signal on the toplevel
|
||||
window. The signal handler will create a snapshot object (which is a
|
||||
helper for creating a scene graph) and emit a GtkWidget::snapshot() signal,
|
||||
which will propagate down the widget hierarchy. This lets each widget
|
||||
snapshot its content at the right place and time, correctly handling things
|
||||
like partial transparencies and overlapping widgets.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When generating the event, GDK also sets up double buffering to
|
||||
avoid the flickering that would result from each widget drawing
|
||||
itself in turn. <xref linkend="double-buffering"/> describes
|
||||
the double buffering mechanism in detail.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Normally, there is only a single cairo context which is used in
|
||||
the entire repaint, rather than one per GdkSurface. This means you
|
||||
have to respect (and not reset) existing clip and transformations
|
||||
set on it.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Most widgets, including those that create their own GdkSurfaces have
|
||||
a transparent background, so they draw on top of whatever widgets
|
||||
are below them. This was not the case in GTK 2 where the theme set
|
||||
the background of most widgets to the default background color. (In
|
||||
fact, transparent GdkSurfaces used to be impossible.)
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The whole rendering hierarchy is captured in the call stack, rather
|
||||
than having multiple separate draw emissions, so you can use effects
|
||||
like e.g. cairo_push/pop_group() which will affect all the widgets
|
||||
below you in the hierarchy. This makes it possible to have e.g.
|
||||
partially transparent containers.
|
||||
To avoid excessive work when generating scene graphs, GTK caches render nodes.
|
||||
Each widget keeps a reference to its render node (which in turn, will refer to
|
||||
the render nodes of children, and grandchildren, and so on), and will reuse
|
||||
that node during the Paint phase. Invalidating a widget (by calling
|
||||
gtk_widget_queue_draw()) discards the cached render node, forcing the widget
|
||||
to regenerate it the next time it needs to handle a ::snapshot.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="scrolling drawing model">
|
||||
<title>Scrolling</title>
|
||||
|
||||
<para>
|
||||
Traditionally, GTK has used self-copy operations to implement
|
||||
scrolling with native windows. With transparent backgrounds, this
|
||||
no longer works. Instead, we just mark the entire affected area for
|
||||
repainting when these operations are used. This allows (partially)
|
||||
transparent backgrounds, and it also more closely models modern
|
||||
hardware where self-copy operations are problematic (they break the
|
||||
rendering pipeline).
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="double-buffering">
|
||||
<title>Double buffering</title>
|
||||
|
||||
<para>
|
||||
If each of the drawing calls made by each subwidget's
|
||||
<literal>draw</literal> handler were sent directly to the
|
||||
windowing system, flicker could result. This is because areas may get
|
||||
redrawn repeatedly: the background, then decorative frames, then text
|
||||
labels, etc. To avoid flicker, GTK employs a <firstterm>double
|
||||
buffering</firstterm> system at the GDK level. Widgets normally don't
|
||||
know that they are drawing to an off-screen buffer; they just issue their
|
||||
normal drawing commands, and the buffer gets sent to the windowing system
|
||||
when all drawing operations are done.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Two basic functions in GDK form the core of the double-buffering
|
||||
mechanism: <link
|
||||
linkend="gdk_surface_begin_paint_region"><function>gdk_surface_begin_paint_region()</function></link>
|
||||
and <link
|
||||
linkend="gdk_surface_end_paint"><function>gdk_surface_end_paint()</function></link>.
|
||||
The first function tells a <classname>GdkSurface</classname> to
|
||||
create a temporary off-screen buffer for drawing. All
|
||||
subsequent drawing operations to this window get automatically
|
||||
redirected to that buffer. The second function actually paints
|
||||
the buffer onto the on-screen window, and frees the buffer.
|
||||
</para>
|
||||
|
||||
<refsect2 id="automatic-double-buffering">
|
||||
<title>Automatic double buffering</title>
|
||||
|
||||
<para>
|
||||
It would be inconvenient for all widgets to call
|
||||
<function>gdk_surface_begin_paint_region()</function> and
|
||||
<function>gdk_surface_end_paint()</function> at the beginning
|
||||
and end of their draw handlers.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To make this easier, GTK normally calls
|
||||
<function>gdk_surface_begin_paint_region()</function>
|
||||
before emitting the #GtkWidget::draw signal, and
|
||||
then it calls <function>gdk_surface_end_paint()</function>
|
||||
after the signal has been emitted. This is convenient for
|
||||
most widgets, as they do not need to worry about creating
|
||||
their own temporary drawing buffers or about calling those
|
||||
functions.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
However, some widgets may prefer to disable this kind of
|
||||
automatic double buffering and do things on their own.
|
||||
To do this, call the
|
||||
<function>gtk_widget_set_double_buffered()</function>
|
||||
function in your widget's constructor. Double buffering
|
||||
can only be turned off for widgets that have a native
|
||||
window.
|
||||
</para>
|
||||
|
||||
<example id="disabling-double-buffering">
|
||||
<title>Disabling automatic double buffering</title>
|
||||
|
||||
<programlisting>
|
||||
static void
|
||||
my_widget_init (MyWidget *widget)
|
||||
{
|
||||
...
|
||||
|
||||
gtk_widget_set_double_buffered (widget, FALSE);
|
||||
|
||||
...
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
When is it convenient to disable double buffering? Generally,
|
||||
this is the case only if your widget gets drawn in such a way
|
||||
that the different drawing operations do not overlap each
|
||||
other. For example, this may be the case for a simple image
|
||||
viewer: it can just draw the image in a single operation.
|
||||
This would <emphasis>not</emphasis> be the case with a word
|
||||
processor, since it will need to draw and over-draw the page's
|
||||
background, then the background for highlighted text, and then
|
||||
the text itself.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Even if you turn off double buffering on a widget, you
|
||||
can still call
|
||||
<function>gdk_surface_begin_paint_region()</function> and
|
||||
<function>gdk_surface_end_paint()</function> by hand to use
|
||||
temporary drawing buffers.
|
||||
</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
@@ -827,7 +827,7 @@ search_text_changed (GtkEntry *entry,
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, match_start, match_end;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
|
||||
<chapter id="WindowWidgets">
|
||||
<title>Windows</title>
|
||||
<xi:include href="xml/gtkroot.xml" />
|
||||
<xi:include href="xml/gtkwindow.xml" />
|
||||
<xi:include href="xml/gtkdialog.xml" />
|
||||
<xi:include href="xml/gtkmessagedialog.xml" />
|
||||
|
||||
@@ -675,12 +675,6 @@ gtk_combo_box_new
|
||||
gtk_combo_box_new_with_entry
|
||||
gtk_combo_box_new_with_model
|
||||
gtk_combo_box_new_with_model_and_entry
|
||||
gtk_combo_box_get_wrap_width
|
||||
gtk_combo_box_set_wrap_width
|
||||
gtk_combo_box_get_row_span_column
|
||||
gtk_combo_box_set_row_span_column
|
||||
gtk_combo_box_get_column_span_column
|
||||
gtk_combo_box_set_column_span_column
|
||||
gtk_combo_box_get_active
|
||||
gtk_combo_box_set_active
|
||||
gtk_combo_box_get_active_iter
|
||||
@@ -695,6 +689,7 @@ gtk_combo_box_popdown
|
||||
gtk_combo_box_get_popup_accessible
|
||||
gtk_combo_box_get_row_separator_func
|
||||
gtk_combo_box_set_row_separator_func
|
||||
GtkSensitivityType
|
||||
gtk_combo_box_set_button_sensitivity
|
||||
gtk_combo_box_get_button_sensitivity
|
||||
gtk_combo_box_get_has_entry
|
||||
@@ -923,8 +918,6 @@ gtk_entry_new
|
||||
gtk_entry_new_with_buffer
|
||||
gtk_entry_get_buffer
|
||||
gtk_entry_set_buffer
|
||||
gtk_entry_set_text
|
||||
gtk_entry_get_text
|
||||
gtk_entry_get_text_length
|
||||
gtk_entry_set_visibility
|
||||
gtk_entry_get_visibility
|
||||
@@ -937,10 +930,6 @@ gtk_entry_set_activates_default
|
||||
gtk_entry_get_activates_default
|
||||
gtk_entry_set_has_frame
|
||||
gtk_entry_get_has_frame
|
||||
gtk_entry_set_width_chars
|
||||
gtk_entry_get_width_chars
|
||||
gtk_entry_set_max_width_chars
|
||||
gtk_entry_get_max_width_chars
|
||||
gtk_entry_set_alignment
|
||||
gtk_entry_get_alignment
|
||||
gtk_entry_set_placeholder_text
|
||||
@@ -1819,7 +1808,6 @@ gtk_menu_new
|
||||
gtk_menu_new_from_model
|
||||
gtk_menu_set_display
|
||||
gtk_menu_reorder_child
|
||||
gtk_menu_attach
|
||||
gtk_menu_popup_at_rect
|
||||
gtk_menu_popup_at_widget
|
||||
gtk_menu_popup_at_pointer
|
||||
@@ -1841,7 +1829,6 @@ gtk_menu_attach_to_widget
|
||||
gtk_menu_detach
|
||||
gtk_menu_get_attach_widget
|
||||
gtk_menu_get_for_attach_widget
|
||||
GtkMenuPositionFunc
|
||||
GtkMenuDetachFunc
|
||||
<SUBSECTION Standard>
|
||||
GTK_MENU
|
||||
@@ -2281,11 +2268,6 @@ gtk_range_set_increments
|
||||
gtk_range_set_range
|
||||
gtk_range_get_round_digits
|
||||
gtk_range_set_round_digits
|
||||
GtkSensitivityType
|
||||
gtk_range_set_lower_stepper_sensitivity
|
||||
gtk_range_get_lower_stepper_sensitivity
|
||||
gtk_range_set_upper_stepper_sensitivity
|
||||
gtk_range_get_upper_stepper_sensitivity
|
||||
gtk_range_get_flippable
|
||||
gtk_range_set_flippable
|
||||
gtk_range_get_range_rect
|
||||
@@ -2718,12 +2700,6 @@ gtk_spin_button_get_snap_to_ticks
|
||||
gtk_spin_button_get_update_policy
|
||||
gtk_spin_button_get_value
|
||||
gtk_spin_button_get_wrap
|
||||
gtk_spin_button_set_text
|
||||
gtk_spin_button_get_text
|
||||
gtk_spin_button_set_max_width_chars
|
||||
gtk_spin_button_get_max_width_chars
|
||||
gtk_spin_button_set_width_chars
|
||||
gtk_spin_button_get_width_chars
|
||||
GTK_INPUT_ERROR
|
||||
<SUBSECTION Standard>
|
||||
GTK_SPIN_BUTTON
|
||||
@@ -4400,6 +4376,7 @@ gtk_snapshot_push_clip
|
||||
gtk_snapshot_push_rounded_clip
|
||||
gtk_snapshot_push_cross_fade
|
||||
gtk_snapshot_push_blend
|
||||
gtk_snapshot_push_debug
|
||||
gtk_snapshot_pop
|
||||
gtk_snapshot_save
|
||||
gtk_snapshot_restore
|
||||
@@ -4493,6 +4470,7 @@ gtk_widget_set_parent
|
||||
gtk_widget_set_parent_surface
|
||||
gtk_widget_get_parent_surface
|
||||
gtk_widget_get_toplevel
|
||||
gtk_widget_get_root
|
||||
gtk_widget_get_ancestor
|
||||
gtk_widget_is_ancestor
|
||||
gtk_widget_translate_coordinates
|
||||
@@ -4553,7 +4531,6 @@ gtk_widget_get_allocated_width
|
||||
gtk_widget_get_allocated_height
|
||||
gtk_widget_get_allocation
|
||||
gtk_widget_get_allocated_baseline
|
||||
gtk_widget_get_allocated_size
|
||||
gtk_widget_get_width
|
||||
gtk_widget_get_height
|
||||
gtk_widget_compute_bounds
|
||||
@@ -4758,12 +4735,9 @@ gtk_window_set_startup_id
|
||||
gtk_window_set_role
|
||||
gtk_window_get_decorated
|
||||
gtk_window_get_deletable
|
||||
gtk_window_get_default_icon_list
|
||||
gtk_window_get_default_icon_name
|
||||
gtk_window_get_default_size
|
||||
gtk_window_get_destroy_with_parent
|
||||
gtk_window_get_icon
|
||||
gtk_window_get_icon_list
|
||||
gtk_window_get_icon_name
|
||||
gtk_window_get_mnemonic_modifier
|
||||
gtk_window_get_modal
|
||||
@@ -4784,13 +4758,7 @@ gtk_window_has_group
|
||||
gtk_window_get_window_type
|
||||
gtk_window_move
|
||||
gtk_window_resize
|
||||
gtk_window_set_default_icon_list
|
||||
gtk_window_set_default_icon
|
||||
gtk_window_set_default_icon_from_file
|
||||
gtk_window_set_default_icon_name
|
||||
gtk_window_set_icon
|
||||
gtk_window_set_icon_list
|
||||
gtk_window_set_icon_from_file
|
||||
gtk_window_set_icon_name
|
||||
gtk_window_set_auto_startup_notification
|
||||
gtk_window_get_mnemonics_visible
|
||||
@@ -5902,8 +5870,8 @@ GtkMountOperationPrivate
|
||||
<SECTION>
|
||||
<FILE>gtktransform</FILE>
|
||||
<TITLE>3D transformations</TITLE>
|
||||
GtkTransformType;
|
||||
GtkTransform;
|
||||
GtkTransformType
|
||||
GtkTransform
|
||||
gtk_transform_ref
|
||||
gtk_transform_unref
|
||||
<SUBSECTION>
|
||||
@@ -6703,8 +6671,8 @@ gtk_gesture_single_get_type
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkeventcontrollerlegacy</FILE>
|
||||
<TITLE>GtkEventControllerlegacy</TITLE>
|
||||
GtkEventControllerlegacy
|
||||
<TITLE>GtkEventControllerLegacy</TITLE>
|
||||
GtkEventControllerLegacy
|
||||
gtk_event_controller_legacy_new
|
||||
|
||||
<SUBSECTION Standard>
|
||||
@@ -7196,3 +7164,12 @@ gtk_media_stream_error_valist
|
||||
GTK_TYPE_MEDIA_STREAM
|
||||
gtk_media_stream_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkroot</FILE>
|
||||
<TITLE>GtkRoot</TITLE>
|
||||
GtkRoot
|
||||
gtk_root_get_for_surface
|
||||
<SUBSECTION Private>
|
||||
gtk_root_get_type
|
||||
</SECTION>
|
||||
|
||||
@@ -137,6 +137,7 @@ gtk_radio_tool_button_get_type
|
||||
gtk_range_get_type
|
||||
gtk_recent_manager_get_type
|
||||
gtk_revealer_get_type
|
||||
gtk_root_get_type
|
||||
gtk_scale_button_get_type
|
||||
gtk_scale_get_type
|
||||
gtk_scrollable_get_type
|
||||
|
||||
@@ -608,7 +608,7 @@
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to changes in the API of GtkEntry and GtkSearchEntry</title>
|
||||
<title>Adapt to changes in the API of GtkEntry, GtkSearchEntry adn GtkSpinButton</title>
|
||||
<para>
|
||||
The GtkEditable has been made more useful, and the core functionality of
|
||||
GtkEntry has been broken out as a GtkText widget. GtkEntry, GtkSearchEntry,
|
||||
@@ -620,7 +620,8 @@
|
||||
<para>
|
||||
Use GtkEditable API for editable functionality, and widget-specific APIs for
|
||||
things that go beyond the common interface. For password entries, use
|
||||
GtkPasswordEntry.
|
||||
GtkPasswordEntry. As an example, gtk_spin_button_set_max_width_chars()
|
||||
has been removed in favor of gtk_editable_set_max_width_chars().
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -47,8 +47,7 @@ this reference manual for details.
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
Where can I get help with GTK, submit a bug report, or make a feature
|
||||
request?
|
||||
Where can I get help with GTK, submit a bug report, or make a feature request?
|
||||
</para></question>
|
||||
|
||||
<answer>
|
||||
@@ -63,13 +62,14 @@ See the <link linkend="gtk-resources">documentation on this topic</link>.
|
||||
|
||||
|
||||
<qandaentry>
|
||||
<question><para>How do I port from one GTK
|
||||
version to another?</para></question>
|
||||
<question><para>
|
||||
How do I port from one GTK version to another?
|
||||
</para></question>
|
||||
|
||||
<answer>
|
||||
|
||||
<para>
|
||||
See <xref linkend="gtk-migrating-2-to-3"/>.
|
||||
See <xref linkend="migrating"/>.
|
||||
You may also find useful information in the documentation for
|
||||
specific widgets and functions.
|
||||
</para>
|
||||
@@ -88,8 +88,7 @@ against the documentation.
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
How does memory management work in GTK? Should I free data returned
|
||||
from functions?
|
||||
How does memory management work in GTK? Should I free data returned from functions?
|
||||
</para></question>
|
||||
|
||||
<answer>
|
||||
@@ -528,10 +527,9 @@ the call away if it appears that the value is not being used.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A common workaround for this problem is to store the result in a volatile
|
||||
variable, which keeps the compiler from optimizing the call away.
|
||||
GLib provides the g_type_ensure() function to work around this problem.
|
||||
<informalexample><programlisting>
|
||||
volatile GType dummy = GTK_TYPE_BLAH;
|
||||
g_type_ensure (GTK_TYPE_BLAH);
|
||||
</programlisting></informalexample>
|
||||
</para>
|
||||
</answer>
|
||||
@@ -546,32 +544,9 @@ How do I create a transparent toplevel window ?
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
To make a window transparent, it needs to use a visual which supports that.
|
||||
This is done by getting the RGBA visual of the screen with
|
||||
gdk_screen_get_rgba_visual() and setting it on the window. Note that
|
||||
gdk_screen_get_rgba_visual() will return %NULL if transparent windows
|
||||
are not supported on the screen, you should fall back to
|
||||
gdk_screen_get_system_visual() in that case. Additionally, note that this
|
||||
will change from screen to screen, so it needs to be repeated whenever the
|
||||
window is moved to a different screen.
|
||||
<informalexample><programlisting>
|
||||
GdkVisual *visual;
|
||||
|
||||
visual = gdk_screen_get_rgba_visual (screen);
|
||||
if (visual == NULL)
|
||||
visual = gdk_screen_get_system_visual (screen);
|
||||
|
||||
gtk_widget_set_visual (GTK_WIDGET (window), visual);
|
||||
</programlisting></informalexample>
|
||||
To fill the alpha channel on the window simply use cairos
|
||||
RGBA drawing capabilities.
|
||||
</para>
|
||||
<para>
|
||||
Note that the presence of an RGBA visual is no guarantee that the
|
||||
window will actually appear transparent on screen. On X11, this
|
||||
requires a compositing manager to be running. See
|
||||
gdk_display_is_composited() for a way to find out if the alpha
|
||||
channel will be respected.
|
||||
Any toplevel window can be transparent.
|
||||
It is just a matter of setting a transparent background
|
||||
in the CSS style for it.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
@@ -587,9 +562,19 @@ channel will be respected.
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
See <link linkend="TreeWidget">tree widget overview</link> — you
|
||||
should use the #GtkTreeView widget. (A list is just a tree with no branches,
|
||||
so the tree widget is used for lists as well).
|
||||
This question has different answers, depending on the size of the dataset
|
||||
and the required formatting flexibility.
|
||||
</para>
|
||||
<para>
|
||||
If you want to display a large amount of data in a uniform way, your
|
||||
best option is a #GtkTreeView widget. See <link linkend="TreeWidget">tree
|
||||
widget overview</link>. A list is just a tree with no branches, so the treeview
|
||||
widget is used for lists as well.
|
||||
</para>
|
||||
<para>
|
||||
If you want to display a small amount of items, but need flexible formatting
|
||||
and widgetry inside the list, then you probably want to use a #GtkListBox,
|
||||
which uses regular widgets for display.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
@@ -620,7 +605,11 @@ single-line text entry, see #GtkEntry.
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
#GtkImage can display images in just about any format GTK understands.
|
||||
GTK has two widgets that are dedicated to displaying images. #GtkImage, for
|
||||
small, fixed-size icons and #GtkPicture for content images.
|
||||
</para>
|
||||
<para>
|
||||
Both can display images in just about any format GTK understands.
|
||||
You can also use #GtkDrawingArea if you need to do something more complex,
|
||||
such as draw text or graphics over the top of the image.
|
||||
</para>
|
||||
@@ -653,9 +642,10 @@ How do I change the color of a widget?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
See gtk_widget_override_color() and gtk_widget_override_background_color().
|
||||
You can also change the appearance of a widget by installing a
|
||||
custom style provider, see gtk_style_context_add_provider().
|
||||
The background color of a widget is determined by the CSS style that applies
|
||||
to it. To change that, you can set style classes on the widget, and provide
|
||||
custom CSS to change the appearance. Such CSS can be loaded with
|
||||
gtk_css_provider_load_from_file() and its variants. See gtk_style_context_add_provider().
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
@@ -665,16 +655,6 @@ How do I change the font of a widget?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
This has several possible answers, depending on what exactly you want to
|
||||
achieve. One option is gtk_widget_override_font().
|
||||
<informalexample><programlisting>
|
||||
PangoFontDesc *font_desc = pango_font_description_new (<!-- -->);
|
||||
pango_font_description_set_size (font_desc, 40);
|
||||
gtk_widget_override_font (widget, font);
|
||||
pango_font_description_free (font_desc);
|
||||
</programlisting></informalexample>
|
||||
</para>
|
||||
<para>
|
||||
If you want to make the text of a label larger, you can use
|
||||
gtk_label_set_markup():
|
||||
<informalexample><programlisting>
|
||||
@@ -939,32 +919,28 @@ How do I use cairo to draw in GTK applications ?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
The #GtkWidget::draw signal gets a ready-to-use cairo context
|
||||
as parameter that you should use.
|
||||
</para>
|
||||
<para>
|
||||
All drawing in GTK is normally done in a draw handler, and GTK
|
||||
creates a temporary pixmap for double-buffering the drawing.
|
||||
It is possible to turn off double-buffering, with
|
||||
gtk_widget_set_double_buffered(), but this is not ideal,
|
||||
since it can cause some flickering.
|
||||
Use gtk_snapshot_append_cairo() in your #GtkWidget::snapshot signal handler
|
||||
to optain a cairo context and draw with that.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
Can I improve the performance of my application by using the
|
||||
Glitz or GL backend of cairo ?
|
||||
Can I improve the performance of my application by using another backend
|
||||
of cairo (such as GL) ?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
No. The GDK X11 backend uses the cairo X backend (and the other
|
||||
GDK backends use their respective native cairo backends). The
|
||||
GTK developers believe that the best way to improving the GDK
|
||||
drawing performance is to optimize the cairo X backend and the
|
||||
relevant code paths in the X server that is uses (mostly the
|
||||
Render extension).
|
||||
No. Most drawing in GTK is not done via cairo anymore (but instead
|
||||
by the GL or Vulkan renderers of GSK).
|
||||
</para>
|
||||
<para>
|
||||
If you use cairo for drawing your own widgets, gtk_snapshot_append_cairo()
|
||||
will choose the most appropriate surface type for you.
|
||||
</para>
|
||||
<para>
|
||||
If you are interested in using GL for your own drawing, see #GtkGLArea.
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
@@ -974,8 +950,11 @@ Can I use cairo to draw on a #GdkPixbuf ?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
No, at least not yet. The cairo image surface does not support the
|
||||
pixel format used by GdkPixbuf.
|
||||
No. The cairo image surface does not support the pixel format used by GdkPixbuf.
|
||||
</para>
|
||||
<para>
|
||||
If you need to get cairo drawing into a format that can be displayed efficiently
|
||||
by GTK, you may want to use an image surface and gdk_memory_texture_new().
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ create_entry (void)
|
||||
widget = gtk_entry_new ();
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||
gtk_entry_set_text (GTK_ENTRY (widget), "Entry");
|
||||
gtk_editable_set_text (GTK_EDITABLE (widget), "Entry");
|
||||
gtk_editable_set_position (GTK_EDITABLE (widget), -1);
|
||||
|
||||
return new_widget_info ("entry", widget, SMALL);
|
||||
@@ -320,7 +320,7 @@ create_combo_box_entry (void)
|
||||
g_object_unref (model);
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||
gtk_entry_set_text (GTK_ENTRY (child), "Combo Box Entry");
|
||||
gtk_editable_set_text (GTK_EDITABLE (child), "Combo Box Entry");
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||
|
||||
@@ -399,7 +399,7 @@ create_search_bar (void)
|
||||
widget = gtk_search_bar_new ();
|
||||
|
||||
entry = gtk_search_entry_new ();
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), "Search Bar");
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), "Search Bar");
|
||||
gtk_container_add (GTK_CONTAINER (widget), entry);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ search_text_changed (GtkEntry *entry,
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, match_start, match_end;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
@@ -58,7 +58,7 @@ find_word (GtkButton *button,
|
||||
const gchar *word;
|
||||
|
||||
word = gtk_button_get_label (button);
|
||||
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
|
||||
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -25,7 +25,7 @@ search_text_changed (GtkEntry *entry,
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, match_start, match_end;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
|
||||
@@ -29,7 +29,7 @@ search_text_changed (GtkEntry *entry,
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, match_start, match_end;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
@@ -56,7 +56,7 @@ find_word (GtkButton *button,
|
||||
const gchar *word;
|
||||
|
||||
word = gtk_button_get_label (button);
|
||||
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
|
||||
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -31,7 +31,7 @@ search_text_changed (GtkEntry *entry,
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, match_start, match_end;
|
||||
|
||||
text = gtk_entry_get_text (entry);
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
@@ -58,7 +58,7 @@ find_word (GtkButton *button,
|
||||
const gchar *word;
|
||||
|
||||
word = gtk_button_get_label (button);
|
||||
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
|
||||
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -364,7 +364,7 @@ combo_changed (GtkComboBox *combo,
|
||||
str = g_strjoinv (",", accels);
|
||||
g_strfreev (accels);
|
||||
|
||||
gtk_entry_set_text (entry, str);
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), str);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -389,7 +389,7 @@ response (GtkDialog *dialog,
|
||||
if (!action)
|
||||
return;
|
||||
|
||||
str = gtk_entry_get_text (entry);
|
||||
str = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
accels = g_strsplit (str, ",", 0);
|
||||
|
||||
gtk_application_set_accels_for_action (gtk_window_get_application (user_data), action, (const gchar **) accels);
|
||||
|
||||
@@ -40,4 +40,8 @@ PangoDirection gdk_unichar_direction (gunichar ch);
|
||||
PangoDirection gdk_find_base_dir (const char *text,
|
||||
int len);
|
||||
|
||||
void gdk_surface_set_widget (GdkSurface *surface,
|
||||
gpointer widget);
|
||||
gpointer gdk_surface_get_widget (GdkSurface *surface);
|
||||
|
||||
#endif /* __GDK__PRIVATE_H__ */
|
||||
|
||||
@@ -51,12 +51,12 @@
|
||||
* This section describes the GDK initialization functions and miscellaneous
|
||||
* utility functions, as well as deprecation facilities.
|
||||
*
|
||||
* The GDK and GTK+ headers annotate deprecated APIs in a way that produces
|
||||
* The GDK and GTK headers annotate deprecated APIs in a way that produces
|
||||
* compiler warnings if these deprecated APIs are used. The warnings
|
||||
* can be turned off by defining the macro %GDK_DISABLE_DEPRECATION_WARNINGS
|
||||
* before including the glib.h header.
|
||||
*
|
||||
* GDK and GTK+ also provide support for building applications against
|
||||
* GDK and GTK also provide support for building applications against
|
||||
* defined subsets of deprecated or new APIs. Define the macro
|
||||
* %GDK_VERSION_MIN_REQUIRED to specify up to what version
|
||||
* you want to receive warnings about deprecated APIs. Define the
|
||||
@@ -108,14 +108,6 @@
|
||||
* of deprecated GDK APIs.
|
||||
*/
|
||||
|
||||
typedef struct _GdkPredicate GdkPredicate;
|
||||
|
||||
struct _GdkPredicate
|
||||
{
|
||||
GdkEventFunc func;
|
||||
gpointer data;
|
||||
};
|
||||
|
||||
typedef struct _GdkThreadsDispatch GdkThreadsDispatch;
|
||||
|
||||
struct _GdkThreadsDispatch
|
||||
@@ -307,11 +299,11 @@ gdk_should_use_portal (void)
|
||||
* locked for performance reasons. So e.g. you must coordinate
|
||||
* accesses to the same #GHashTable from multiple threads.
|
||||
*
|
||||
* GTK+, however, is not thread safe. You should only use GTK+ and GDK
|
||||
* GTK, however, is not thread safe. You should only use GTK and GDK
|
||||
* from the thread gtk_init() and gtk_main() were called on.
|
||||
* This is usually referred to as the “main thread”.
|
||||
*
|
||||
* Signals on GTK+ and GDK types, as well as non-signal callbacks, are
|
||||
* Signals on GTK and GDK types, as well as non-signal callbacks, are
|
||||
* emitted in the main thread.
|
||||
*
|
||||
* You can schedule work in the main thread safely from other threads
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* [Cairo](http://cairographics.org) is a graphics
|
||||
* library that supports vector graphics and image compositing that
|
||||
* can be used with GDK. GTK+ does all of its drawing using cairo.
|
||||
* can be used with GDK and GTK.
|
||||
*
|
||||
* GDK does not wrap the cairo API, instead it allows to create cairo
|
||||
* contexts which can be used to draw on #GdkSurfaces. Additional
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
*
|
||||
* You can use gdk_display_manager_get() to obtain the #GdkDisplayManager
|
||||
* singleton, but that should be rarely necessary. Typically, initializing
|
||||
* GTK+ opens a display that you can work with without ever accessing the
|
||||
* GTK opens a display that you can work with without ever accessing the
|
||||
* #GdkDisplayManager.
|
||||
*
|
||||
* The GDK library can be built with support for multiple backends.
|
||||
|
||||
+7
-36
@@ -67,10 +67,6 @@
|
||||
/* Private variable declarations
|
||||
*/
|
||||
|
||||
static GdkEventFunc _gdk_event_func = NULL; /* Callback for events */
|
||||
static gpointer _gdk_event_data = NULL;
|
||||
static GDestroyNotify _gdk_event_notify = NULL;
|
||||
|
||||
static void gdk_event_constructed (GObject *object);
|
||||
static void gdk_event_finalize (GObject *object);
|
||||
|
||||
@@ -153,14 +149,16 @@ gdk_event_class_init (GdkEventClass *klass)
|
||||
void
|
||||
_gdk_event_emit (GdkEvent *event)
|
||||
{
|
||||
if (gdk_event_get_event_type (event) == GDK_NOTHING)
|
||||
{
|
||||
g_warning ("Ignoring GDK_NOTHING events; they're good for nothing");
|
||||
return;
|
||||
}
|
||||
|
||||
if (gdk_drag_handle_source_event (event))
|
||||
return;
|
||||
|
||||
if (gdk_surface_handle_event (event))
|
||||
return;
|
||||
|
||||
if (_gdk_event_func)
|
||||
(*_gdk_event_func) (event, _gdk_event_data);
|
||||
gdk_surface_handle_event (event);
|
||||
}
|
||||
|
||||
/*********************************************
|
||||
@@ -415,33 +413,6 @@ _gdk_event_queue_flush (GdkDisplay *display)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_handler_set:
|
||||
* @func: the function to call to handle events from GDK.
|
||||
* @data: user data to pass to the function.
|
||||
* @notify: the function to call when the handler function is removed, i.e. when
|
||||
* gdk_event_handler_set() is called with another event handler.
|
||||
*
|
||||
* Sets the function to call to handle all events from GDK.
|
||||
*
|
||||
* Note that GTK+ uses this to install its own event handler, so it is
|
||||
* usually not useful for GTK+ applications. (Although an application
|
||||
* can call this function then call gtk_main_do_event() to pass
|
||||
* events to GTK+.)
|
||||
**/
|
||||
void
|
||||
gdk_event_handler_set (GdkEventFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
if (_gdk_event_notify)
|
||||
(*_gdk_event_notify) (_gdk_event_data);
|
||||
|
||||
_gdk_event_func = func;
|
||||
_gdk_event_data = data;
|
||||
_gdk_event_notify = notify;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_new:
|
||||
* @type: a #GdkEventType
|
||||
|
||||
@@ -125,18 +125,6 @@ typedef struct _GdkEventPadGroupMode GdkEventPadGroupMode;
|
||||
typedef struct _GdkEventSequence GdkEventSequence;
|
||||
typedef union _GdkEvent GdkEvent;
|
||||
|
||||
/**
|
||||
* GdkEventFunc:
|
||||
* @event: the #GdkEvent to process.
|
||||
* @data: (closure): user data set when the event handler was installed with
|
||||
* gdk_event_handler_set().
|
||||
*
|
||||
* Specifies the type of function passed to gdk_event_handler_set() to
|
||||
* handle all GDK events.
|
||||
*/
|
||||
typedef void (*GdkEventFunc) (GdkEvent *event,
|
||||
gpointer data);
|
||||
|
||||
/**
|
||||
* GdkEventType:
|
||||
* @GDK_NOTHING: a special code to indicate a null event.
|
||||
@@ -446,11 +434,6 @@ gboolean gdk_events_get_center (GdkEvent *event1,
|
||||
gdouble *x,
|
||||
gdouble *y);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_event_handler_set (GdkEventFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_event_set_display (GdkEvent *event,
|
||||
GdkDisplay *display);
|
||||
|
||||
+4
-4
@@ -179,7 +179,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
|
||||
* This signal is emitted as the second step of toolkit and
|
||||
* application processing of the frame. Any work to update
|
||||
* sizes and positions of application elements should be
|
||||
* performed. GTK+ normally handles this internally.
|
||||
* performed. GTK normally handles this internally.
|
||||
*/
|
||||
signals[LAYOUT] =
|
||||
g_signal_new (g_intern_static_string ("layout"),
|
||||
@@ -197,7 +197,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
|
||||
* This signal is emitted as the third step of toolkit and
|
||||
* application processing of the frame. The frame is
|
||||
* repainted. GDK normally handles this internally and
|
||||
* produces expose events, which are turned into GTK+
|
||||
* produces expose events, which are turned into GTK
|
||||
* #GtkWidget::draw signals.
|
||||
*/
|
||||
signals[PAINT] =
|
||||
@@ -230,7 +230,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
|
||||
* @clock: the frame clock emitting the signal
|
||||
*
|
||||
* This signal is emitted after processing of the frame is
|
||||
* finished, and is handled internally by GTK+ to resume normal
|
||||
* finished, and is handled internally by GTK to resume normal
|
||||
* event processing. Applications should not handle this signal.
|
||||
*/
|
||||
signals[RESUME_EVENTS] =
|
||||
@@ -289,7 +289,7 @@ gdk_frame_clock_get_frame_time (GdkFrameClock *frame_clock)
|
||||
* content and want to continually request the
|
||||
* %GDK_FRAME_CLOCK_PHASE_UPDATE phase for a period of time,
|
||||
* you should use gdk_frame_clock_begin_updating() instead, since
|
||||
* this allows GTK+ to adjust system parameters to get maximally
|
||||
* this allows GTK to adjust system parameters to get maximally
|
||||
* smooth animations.
|
||||
*/
|
||||
void
|
||||
|
||||
+1
-1
@@ -298,7 +298,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
|
||||
* @width: The width of the region to draw
|
||||
* @height: The height of the region to draw
|
||||
*
|
||||
* This is the main way to draw GL content in GTK+. It takes a render buffer ID
|
||||
* This is the main way to draw GL content in GTK. It takes a render buffer ID
|
||||
* (@source_type == #GL_RENDERBUFFER) or a texture id (@source_type == #GL_TEXTURE)
|
||||
* and draws it onto @cr with an OVER operation, respecting the current clip.
|
||||
* The top left corner of the rectangle specified by @x, @y, @width and @height
|
||||
|
||||
+1
-1
@@ -145,7 +145,7 @@ struct _GdkSurface
|
||||
GdkSurface *parent;
|
||||
GdkSurface *transient_for;
|
||||
|
||||
gpointer user_data;
|
||||
gpointer widget;
|
||||
|
||||
gint x;
|
||||
gint y;
|
||||
|
||||
+4
-4
@@ -264,7 +264,7 @@ gdk_seat_get_capabilities (GdkSeat *seat)
|
||||
* commonly.
|
||||
*
|
||||
* Grabs are used for operations which need complete control over the
|
||||
* events corresponding to the given capabilities. For example in GTK+ this
|
||||
* events corresponding to the given capabilities. For example in GTK this
|
||||
* is used for Drag and Drop operations, popup menus and such.
|
||||
*
|
||||
* Note that if the event mask of a #GdkSurface has selected both button press
|
||||
@@ -350,7 +350,7 @@ gdk_seat_get_slaves (GdkSeat *seat,
|
||||
* Returns the master device that routes pointer events.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): a master #GdkDevice with pointer
|
||||
* capabilities. This object is owned by GTK+ and must not be freed.
|
||||
* capabilities. This object is owned by GTK and must not be freed.
|
||||
**/
|
||||
GdkDevice *
|
||||
gdk_seat_get_pointer (GdkSeat *seat)
|
||||
@@ -370,7 +370,7 @@ gdk_seat_get_pointer (GdkSeat *seat)
|
||||
* Returns the master device that routes keyboard events.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): a master #GdkDevice with keyboard
|
||||
* capabilities. This object is owned by GTK+ and must not be freed.
|
||||
* capabilities. This object is owned by GTK and must not be freed.
|
||||
**/
|
||||
GdkDevice *
|
||||
gdk_seat_get_keyboard (GdkSeat *seat)
|
||||
@@ -405,7 +405,7 @@ gdk_seat_device_removed (GdkSeat *seat,
|
||||
*
|
||||
* Returns the #GdkDisplay this seat belongs to.
|
||||
*
|
||||
* Returns: (transfer none): a #GdkDisplay. This object is owned by GTK+
|
||||
* Returns: (transfer none): a #GdkDisplay. This object is owned by GTK
|
||||
* and must not be freed.
|
||||
**/
|
||||
GdkDisplay *
|
||||
|
||||
+64
-89
@@ -61,7 +61,7 @@
|
||||
*
|
||||
* A #GdkSurface is a (usually) rectangular region on the screen.
|
||||
* It’s a low-level object, used to implement high-level objects such as
|
||||
* #GtkWidget and #GtkWindow on the GTK+ level. A #GtkWindow is a toplevel
|
||||
* #GtkWidget and #GtkWindow on the GTK level. A #GtkWindow is a toplevel
|
||||
* surface, the thing a user might think of as a “window” with a titlebar
|
||||
* and so on; a #GtkWindow may contain many sub-GdkSurfaces.
|
||||
*/
|
||||
@@ -99,6 +99,7 @@ enum {
|
||||
MOVED_TO_RECT,
|
||||
SIZE_CHANGED,
|
||||
RENDER,
|
||||
EVENT,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -321,6 +322,14 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
G_TYPE_BOOLEAN,
|
||||
G_TYPE_BOOLEAN);
|
||||
|
||||
/**
|
||||
* GdkSurface::size-changed:
|
||||
* @surface: the #GdkSurface
|
||||
* @width: the new width
|
||||
* @height: the new height
|
||||
*
|
||||
* Emitted when the size of @surface is changed.
|
||||
*/
|
||||
signals[SIZE_CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("size-changed"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
@@ -334,6 +343,15 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
G_TYPE_INT,
|
||||
G_TYPE_INT);
|
||||
|
||||
/**
|
||||
* GdkSurface::render:
|
||||
* @surface: the #GdkSurface
|
||||
* @region: the region that needs to be redrawn
|
||||
*
|
||||
* Emitted when part of the surface needs to be redrawn.
|
||||
*
|
||||
* Returns: %TRUE to indicate that the signal has been handled
|
||||
*/
|
||||
signals[RENDER] =
|
||||
g_signal_new (g_intern_static_string ("render"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
@@ -345,6 +363,27 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
G_TYPE_BOOLEAN,
|
||||
1,
|
||||
CAIRO_GOBJECT_TYPE_REGION);
|
||||
|
||||
/**
|
||||
* GdkSurface::event:
|
||||
* @surface: the #GdkSurface
|
||||
* @event: an input event
|
||||
*
|
||||
* Emitted when GDK receives an input event for @surface.
|
||||
*
|
||||
* Returns: %TRUE to indicate that the event has been handled
|
||||
*/
|
||||
signals[EVENT] =
|
||||
g_signal_new (g_intern_static_string ("event"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
g_signal_accumulator_true_handled,
|
||||
NULL,
|
||||
NULL,
|
||||
G_TYPE_BOOLEAN,
|
||||
1,
|
||||
GDK_TYPE_EVENT);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1003,43 +1042,17 @@ gdk_surface_destroy (GdkSurface *surface)
|
||||
g_object_unref (surface);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_set_user_data:
|
||||
* @surface: a #GdkSurface
|
||||
* @user_data: (allow-none) (type GObject.Object): user data
|
||||
*
|
||||
* For most purposes this function is deprecated in favor of
|
||||
* g_object_set_data(). However, for historical reasons GTK+ stores
|
||||
* the #GtkWidget that owns a #GdkSurface as user data on the
|
||||
* #GdkSurface. So, custom widget implementations should use
|
||||
* this function for that. If GTK+ receives an event for a #GdkSurface,
|
||||
* and the user data for the surface is non-%NULL, GTK+ will assume the
|
||||
* user data is a #GtkWidget, and forward the event to that widget.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gdk_surface_set_user_data (GdkSurface *surface,
|
||||
gpointer user_data)
|
||||
gdk_surface_set_widget (GdkSurface *surface,
|
||||
gpointer widget)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
|
||||
surface->user_data = user_data;
|
||||
surface->widget = widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_get_user_data:
|
||||
* @surface: a #GdkSurface
|
||||
* @data: (out): return location for user data
|
||||
*
|
||||
* Retrieves the user data for @surface, which is normally the widget
|
||||
* that @surface belongs to. See gdk_surface_set_user_data().
|
||||
*
|
||||
**/
|
||||
void
|
||||
gdk_surface_get_user_data (GdkSurface *surface,
|
||||
gpointer *data)
|
||||
gpointer
|
||||
gdk_surface_get_widget (GdkSurface *surface)
|
||||
{
|
||||
*data = surface->user_data;
|
||||
return surface->widget;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1226,49 +1239,6 @@ gdk_surface_peek_children (GdkSurface *surface)
|
||||
return surface->children;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gdk_surface_get_children_with_user_data:
|
||||
* @surface: a #GdkSurface
|
||||
* @user_data: user data to look for
|
||||
*
|
||||
* Gets the list of children of @surface known to GDK with a
|
||||
* particular @user_data set on it.
|
||||
*
|
||||
* The returned list must be freed, but the elements in the
|
||||
* list need not be.
|
||||
*
|
||||
* The list is returned in (relative) stacking order, i.e. the
|
||||
* lowest surface is first.
|
||||
*
|
||||
* Returns: (transfer container) (element-type GdkSurface):
|
||||
* list of child surfaces inside @surface
|
||||
**/
|
||||
GList *
|
||||
gdk_surface_get_children_with_user_data (GdkSurface *surface,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkSurface *child;
|
||||
GList *res, *l;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
return NULL;
|
||||
|
||||
res = NULL;
|
||||
for (l = surface->children; l != NULL; l = l->next)
|
||||
{
|
||||
child = l->data;
|
||||
|
||||
if (child->user_data == user_data)
|
||||
res = g_list_prepend (res, child);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gdk_surface_is_visible:
|
||||
* @surface: a #GdkSurface
|
||||
@@ -2722,7 +2692,7 @@ gdk_surface_move (GdkSurface *surface,
|
||||
* @height: new height of the surface
|
||||
*
|
||||
* Resizes @surface; for toplevel surfaces, asks the window manager to resize
|
||||
* the surface. The window manager may not allow the resize. When using GTK+,
|
||||
* the surface. The window manager may not allow the resize. When using GTK,
|
||||
* use gtk_window_resize() instead of this low-level GDK function.
|
||||
*
|
||||
* Surfaces may not be resized below 1x1.
|
||||
@@ -4128,7 +4098,7 @@ gdk_surface_create_similar_surface (GdkSurface * surface,
|
||||
* @surface: a #GdkSurface
|
||||
* @timestamp: timestamp of the event triggering the surface focus
|
||||
*
|
||||
* Sets keyboard focus to @surface. In most cases, gtk_window_present()
|
||||
* Sets keyboard focus to @surface. In most cases, gtk_window_present_with_time()
|
||||
* should be used on a #GtkWindow, rather than calling this function.
|
||||
*
|
||||
**/
|
||||
@@ -4294,7 +4264,7 @@ gdk_surface_set_geometry_hints (GdkSurface *surface,
|
||||
* If you haven’t explicitly set the icon name for the surface
|
||||
* (using gdk_surface_set_icon_name()), the icon name will be set to
|
||||
* @title as well. @title must be in UTF-8 encoding (as with all
|
||||
* user-readable strings in GDK/GTK+). @title may not be %NULL.
|
||||
* user-readable strings in GDK and GTK). @title may not be %NULL.
|
||||
**/
|
||||
void
|
||||
gdk_surface_set_title (GdkSurface *surface,
|
||||
@@ -4308,7 +4278,7 @@ gdk_surface_set_title (GdkSurface *surface,
|
||||
* @surface: a toplevel #GdkSurface
|
||||
* @role: a string indicating its role
|
||||
*
|
||||
* When using GTK+, typically you should use gtk_window_set_role() instead
|
||||
* When using GTK, typically you should use gtk_window_set_role() instead
|
||||
* of this low-level function.
|
||||
*
|
||||
* The window manager and session manager use a surface’s role to
|
||||
@@ -4334,7 +4304,7 @@ gdk_surface_set_role (GdkSurface *surface,
|
||||
* @surface: a toplevel #GdkSurface
|
||||
* @startup_id: a string with startup-notification identifier
|
||||
*
|
||||
* When using GTK+, typically you should use gtk_window_set_startup_id()
|
||||
* When using GTK, typically you should use gtk_window_set_startup_id()
|
||||
* instead of this low-level function.
|
||||
**/
|
||||
void
|
||||
@@ -4519,9 +4489,9 @@ gdk_surface_iconify (GdkSurface *surface)
|
||||
* @surface: a toplevel #GdkSurface
|
||||
*
|
||||
* Attempt to deiconify (unminimize) @surface. On X11 the window manager may
|
||||
* choose to ignore the request to deiconify. When using GTK+,
|
||||
* choose to ignore the request to deiconify. When using GTK,
|
||||
* use gtk_window_deiconify() instead of the #GdkSurface variant. Or better yet,
|
||||
* you probably want to use gtk_window_present(), which raises the surface, focuses it,
|
||||
* you probably want to use gtk_window_present_with_time(), which raises the surface, focuses it,
|
||||
* unminimizes it, and puts it on the current desktop.
|
||||
*
|
||||
**/
|
||||
@@ -5292,7 +5262,7 @@ gdk_surface_get_unscaled_size (GdkSurface *surface,
|
||||
*
|
||||
* This function only works for toplevel surfaces.
|
||||
*
|
||||
* GTK+ will update this property automatically if
|
||||
* GTK will update this property automatically if
|
||||
* the @surface background is opaque, as we know where the opaque regions
|
||||
* are. If your surface background is not opaque, please update this
|
||||
* property in your #GtkWidget::style-updated handler.
|
||||
@@ -5328,14 +5298,14 @@ gdk_surface_set_opaque_region (GdkSurface *surface,
|
||||
* @top: The top extent
|
||||
* @bottom: The bottom extent
|
||||
*
|
||||
* Newer GTK+ windows using client-side decorations use extra geometry
|
||||
* Newer GTK windows using client-side decorations use extra geometry
|
||||
* around their frames for effects like shadows and invisible borders.
|
||||
* Window managers that want to maximize windows or snap to edges need
|
||||
* to know where the extents of the actual frame lie, so that users
|
||||
* don’t feel like windows are snapping against random invisible edges.
|
||||
*
|
||||
* Note that this property is automatically updated by GTK+, so this
|
||||
* function should only be used by applications which do not use GTK+
|
||||
* Note that this property is automatically updated by GTK, so this
|
||||
* function should only be used by applications which do not use GTK
|
||||
* to create toplevel surfaces.
|
||||
*/
|
||||
void
|
||||
@@ -5462,12 +5432,17 @@ gdk_synthesize_surface_state (GdkSurface *surface,
|
||||
gboolean
|
||||
gdk_surface_handle_event (GdkEvent *event)
|
||||
{
|
||||
gboolean handled = FALSE;
|
||||
if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
|
||||
{
|
||||
g_signal_emit (gdk_event_get_surface (event), signals[SIZE_CHANGED], 0,
|
||||
event->configure.width, event->configure.height);
|
||||
return TRUE;
|
||||
handled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_signal_emit (gdk_event_get_surface (event), signals[EVENT], 0, event, &handled);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return handled;
|
||||
}
|
||||
|
||||
@@ -491,9 +491,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_focus (GdkSurface *surface,
|
||||
guint32 timestamp);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_set_user_data (GdkSurface *surface,
|
||||
gpointer user_data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_surface_get_accept_focus (GdkSurface *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_set_accept_focus (GdkSurface *surface,
|
||||
@@ -595,9 +592,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
GdkCursor *gdk_surface_get_device_cursor (GdkSurface *surface,
|
||||
GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_get_user_data (GdkSurface *surface,
|
||||
gpointer *data);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_get_geometry (GdkSurface *surface,
|
||||
gint *x,
|
||||
gint *y,
|
||||
@@ -666,9 +660,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
GList * gdk_surface_get_children (GdkSurface *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GList * gdk_surface_peek_children (GdkSurface *surface);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GList * gdk_surface_get_children_with_user_data (GdkSurface *surface,
|
||||
gpointer user_data);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_set_icon_list (GdkSurface *surface,
|
||||
|
||||
+3
-3
@@ -200,7 +200,7 @@ typedef enum
|
||||
* @GDK_HYPER_MASK: the Hyper modifier
|
||||
* @GDK_META_MASK: the Meta modifier
|
||||
* @GDK_MODIFIER_RESERVED_29_MASK: A reserved bit flag; do not use in your own code
|
||||
* @GDK_RELEASE_MASK: not used in GDK itself. GTK+ uses it to differentiate
|
||||
* @GDK_RELEASE_MASK: not used in GDK itself. GTK uses it to differentiate
|
||||
* between (keyval, modifiers) pairs from key press and release events.
|
||||
* @GDK_MODIFIER_MASK: a mask covering all modifier types.
|
||||
*
|
||||
@@ -454,7 +454,7 @@ typedef enum {
|
||||
* GdkSurfaceTypeHint:
|
||||
* @GDK_SURFACE_TYPE_HINT_NORMAL: Normal toplevel window.
|
||||
* @GDK_SURFACE_TYPE_HINT_DIALOG: Dialog window.
|
||||
* @GDK_SURFACE_TYPE_HINT_MENU: Window used to implement a menu; GTK+ uses
|
||||
* @GDK_SURFACE_TYPE_HINT_MENU: Window used to implement a menu; GTK uses
|
||||
* this hint only for torn-off menus, see #GtkTearoffMenuItem.
|
||||
* @GDK_SURFACE_TYPE_HINT_TOOLBAR: Window used to implement toolbars.
|
||||
* @GDK_SURFACE_TYPE_HINT_SPLASHSCREEN: Window used to display a splash
|
||||
@@ -514,7 +514,7 @@ typedef enum
|
||||
*
|
||||
* An enumeration describing the way in which a device
|
||||
* axis (valuator) maps onto the predefined valuator
|
||||
* types that GTK+ understands.
|
||||
* types that GTK understands.
|
||||
*
|
||||
* Note that the X and Y axes are not really needed; pointer devices
|
||||
* report their location via the x/y members of events regardless. Whether
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
*
|
||||
* A macro that should be defined before including the gdk.h header.
|
||||
* If it is defined, no compiler warnings will be produced for uses
|
||||
* of deprecated GDK and GTK+ APIs.
|
||||
* of deprecated GDK and GTK APIs.
|
||||
*/
|
||||
|
||||
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
#define GDK_VERSION_3_92 (G_ENCODE_VERSION (3, 92))
|
||||
#define GDK_VERSION_3_94 (G_ENCODE_VERSION (3, 94))
|
||||
|
||||
/**
|
||||
* GDK_VERSION_4_0:
|
||||
*
|
||||
@@ -137,6 +138,13 @@
|
||||
# define GDK_AVAILABLE_IN_4_0 _GDK_EXTERN
|
||||
#endif
|
||||
|
||||
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_92
|
||||
# define GDK_DEPRECATED_IN_4_0 GDK_DEPRECATED
|
||||
# define GDK_DEPRECATED_IN_4_0_FOR(f) GDK_DEPRECATED_FOR(f)
|
||||
#else
|
||||
# define GDK_DEPRECATED_IN_4_0 _GDK_EXTERN
|
||||
# define GDK_DEPRECATED_IN_4_0_FOR(f) _GDK_EXTERN
|
||||
#endif
|
||||
|
||||
#endif /* __GDK_VERSION_MACROS_H__ */
|
||||
|
||||
|
||||
@@ -1008,7 +1008,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||
.pNext = NULL,
|
||||
.pApplicationName = g_get_application_name (),
|
||||
.applicationVersion = 0,
|
||||
.pEngineName = "GTK+",
|
||||
.pEngineName = "GTK",
|
||||
.engineVersion = VK_MAKE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION, GDK_MICRO_VERSION),
|
||||
.apiVersion = VK_API_VERSION_1_0
|
||||
},
|
||||
|
||||
@@ -160,6 +160,7 @@ gdkx11_inc = include_directories('x11')
|
||||
gdkwayland_inc = include_directories('wayland')
|
||||
|
||||
wlinc = include_directories('.')
|
||||
win32rcinc = include_directories('win32/rc')
|
||||
|
||||
gdk_gen_headers = [gdkenum_h, gdkmarshal_h, gdkconfig, gdkversionmacros]
|
||||
|
||||
|
||||
@@ -78,14 +78,6 @@
|
||||
* ]|
|
||||
*/
|
||||
|
||||
typedef struct _GdkPredicate GdkPredicate;
|
||||
|
||||
struct _GdkPredicate
|
||||
{
|
||||
GdkEventFunc func;
|
||||
gpointer data;
|
||||
};
|
||||
|
||||
/* non-GDK previous error handler */
|
||||
typedef int (*GdkXErrorHandler) (Display *, XErrorEvent *);
|
||||
static GdkXErrorHandler _gdk_old_error_handler;
|
||||
|
||||
+243
-75
@@ -141,6 +141,30 @@ dump_framebuffer (const char *filename, int w, int h)
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
static void G_GNUC_UNUSED
|
||||
dump_node (GskRenderNode *node,
|
||||
const char *filename)
|
||||
{
|
||||
const int surface_width = ceilf (node->bounds.size.width);
|
||||
const int surface_height = ceilf (node->bounds.size.height);
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
surface_width,
|
||||
surface_height);
|
||||
|
||||
cr = cairo_create (surface);
|
||||
cairo_save (cr);
|
||||
cairo_translate (cr, -node->bounds.origin.x, -node->bounds.origin.y);
|
||||
gsk_render_node_draw (node, cr);
|
||||
cairo_restore (cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
cairo_surface_write_to_png (surface, filename);
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
font_has_color_glyphs (const PangoFont *font)
|
||||
{
|
||||
@@ -249,6 +273,11 @@ node_supports_transform (GskRenderNode *node)
|
||||
case GSK_OPACITY_NODE:
|
||||
case GSK_COLOR_MATRIX_NODE:
|
||||
case GSK_TEXTURE_NODE:
|
||||
case GSK_TRANSFORM_NODE:
|
||||
case GSK_CROSS_FADE_NODE:
|
||||
case GSK_LINEAR_GRADIENT_NODE:
|
||||
case GSK_DEBUG_NODE:
|
||||
case GSK_TEXT_NODE:
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
@@ -765,64 +794,102 @@ render_transform_node (GskGLRenderer *self,
|
||||
GskRenderNode *node,
|
||||
RenderOpBuilder *builder)
|
||||
{
|
||||
const float scale = ops_get_scale (builder);
|
||||
const GskMatrixCategory category = gsk_transform_node_get_category (node);
|
||||
const graphene_matrix_t *node_transform = gsk_transform_node_peek_transform (node);
|
||||
GskRenderNode *child = gsk_transform_node_get_child (node);
|
||||
graphene_matrix_t transform, transformed_mv;
|
||||
|
||||
graphene_matrix_init_from_matrix (&transform, gsk_transform_node_peek_transform (node));
|
||||
graphene_matrix_multiply (&transform, builder->current_modelview, &transformed_mv);
|
||||
graphene_matrix_translate (&transformed_mv,
|
||||
&(graphene_point3d_t) { builder->dx * scale, builder->dy * scale, 0});
|
||||
|
||||
/* We just added the offset to the new modelview matrix, so the following
|
||||
* cases dont' have to care about builder->dx/dy! */
|
||||
|
||||
ops_push_modelview (builder, &transformed_mv);
|
||||
if (ops_modelview_is_simple (builder) ||
|
||||
node_supports_transform (child))
|
||||
switch (category)
|
||||
{
|
||||
const float dx = builder->dx;
|
||||
const float dy = builder->dy;
|
||||
|
||||
builder->dx = 0;
|
||||
builder->dy = 0;
|
||||
case GSK_MATRIX_CATEGORY_IDENTITY:
|
||||
gsk_gl_renderer_add_render_ops (self, child, builder);
|
||||
builder->dx = dx;
|
||||
builder->dy = dy;
|
||||
}
|
||||
else
|
||||
{
|
||||
const float min_x = node->bounds.origin.x;
|
||||
const float min_y = node->bounds.origin.y;
|
||||
const float max_x = min_x + node->bounds.size.width;
|
||||
const float max_y = min_y + node->bounds.size.height;
|
||||
const GskQuadVertex vertex_data[GL_N_VERTICES] = {
|
||||
{ { min_x, min_y }, { 0, 1 }, },
|
||||
{ { min_x, max_y }, { 0, 0 }, },
|
||||
{ { max_x, min_y }, { 1, 1 }, },
|
||||
break;
|
||||
|
||||
{ { max_x, max_y }, { 1, 0 }, },
|
||||
{ { min_x, max_y }, { 0, 0 }, },
|
||||
{ { max_x, min_y }, { 1, 1 }, },
|
||||
};
|
||||
int texture_id;
|
||||
gboolean is_offscreen;
|
||||
/* For non-trivial transforms, we draw everything on a texture and then
|
||||
* draw the texture transformed. */
|
||||
/* TODO: We should compute a modelview containing only the "non-trivial"
|
||||
* part (e.g. the rotation) and use that. We want to keep the scale
|
||||
* for the texture.
|
||||
*/
|
||||
add_offscreen_ops (self, builder,
|
||||
&node->bounds,
|
||||
child,
|
||||
&texture_id, &is_offscreen,
|
||||
RESET_CLIP | RESET_OPACITY);
|
||||
ops_set_texture (builder, texture_id);
|
||||
ops_set_program (builder, &self->blit_program);
|
||||
ops_draw (builder, vertex_data);
|
||||
case GSK_MATRIX_CATEGORY_2D_TRANSLATE:
|
||||
{
|
||||
const float dx = graphene_matrix_get_value (node_transform, 3, 0);
|
||||
const float dy = graphene_matrix_get_value (node_transform, 3, 1);
|
||||
|
||||
ops_offset (builder, dx, dy);
|
||||
gsk_gl_renderer_add_render_ops (self, child, builder);
|
||||
ops_offset (builder, -dx, -dy);
|
||||
}
|
||||
break;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_2D_AFFINE:
|
||||
{
|
||||
ops_push_modelview (builder, node_transform, category);
|
||||
gsk_gl_renderer_add_render_ops (self, child, builder);
|
||||
ops_pop_modelview (builder);
|
||||
}
|
||||
break;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_UNKNOWN:
|
||||
case GSK_MATRIX_CATEGORY_ANY:
|
||||
case GSK_MATRIX_CATEGORY_INVERTIBLE:
|
||||
default:
|
||||
{
|
||||
const float min_x = child->bounds.origin.x;
|
||||
const float min_y = child->bounds.origin.y;
|
||||
const float max_x = min_x + child->bounds.size.width;
|
||||
const float max_y = min_y + child->bounds.size.height;
|
||||
int texture_id;
|
||||
gboolean is_offscreen;
|
||||
|
||||
ops_push_modelview (builder, node_transform, category);
|
||||
|
||||
if (node_supports_transform (child))
|
||||
{
|
||||
gsk_gl_renderer_add_render_ops (self, child, builder);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* For non-trivial transforms, we draw everything on a texture and then
|
||||
* draw the texture transformed. */
|
||||
/* TODO: We should compute a modelview containing only the "non-trivial"
|
||||
* part (e.g. the rotation) and use that. We want to keep the scale
|
||||
* for the texture.
|
||||
*/
|
||||
add_offscreen_ops (self, builder,
|
||||
&child->bounds,
|
||||
child,
|
||||
&texture_id, &is_offscreen,
|
||||
RESET_CLIP | RESET_OPACITY);
|
||||
ops_set_texture (builder, texture_id);
|
||||
ops_set_program (builder, &self->blit_program);
|
||||
|
||||
if (is_offscreen)
|
||||
{
|
||||
const GskQuadVertex offscreen_vertex_data[GL_N_VERTICES] = {
|
||||
{ { min_x, min_y }, { 0, 1 }, },
|
||||
{ { min_x, max_y }, { 0, 0 }, },
|
||||
{ { max_x, min_y }, { 1, 1 }, },
|
||||
|
||||
{ { max_x, max_y }, { 1, 0 }, },
|
||||
{ { min_x, max_y }, { 0, 0 }, },
|
||||
{ { max_x, min_y }, { 1, 1 }, },
|
||||
};
|
||||
|
||||
ops_draw (builder, offscreen_vertex_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
const GskQuadVertex onscreen_vertex_data[GL_N_VERTICES] = {
|
||||
{ { min_x, min_y }, { 0, 0 }, },
|
||||
{ { min_x, max_y }, { 0, 1 }, },
|
||||
{ { max_x, min_y }, { 1, 0 }, },
|
||||
|
||||
{ { max_x, max_y }, { 1, 1 }, },
|
||||
{ { min_x, max_y }, { 0, 1 }, },
|
||||
{ { max_x, min_y }, { 1, 0 }, },
|
||||
};
|
||||
|
||||
ops_draw (builder, onscreen_vertex_data);
|
||||
}
|
||||
}
|
||||
|
||||
ops_pop_modelview (builder);
|
||||
}
|
||||
}
|
||||
ops_pop_modelview (builder);
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -902,31 +969,126 @@ render_clip_node (GskGLRenderer *self,
|
||||
ops_pop_clip (builder);
|
||||
}
|
||||
|
||||
static inline void
|
||||
get_inner_rect (const GskRoundedRect *rect,
|
||||
graphene_rect_t *out)
|
||||
{
|
||||
const float left = MAX (rect->corner[GSK_CORNER_TOP_LEFT].width,
|
||||
rect->corner[GSK_CORNER_BOTTOM_LEFT].width);
|
||||
const float top = MAX (rect->corner[GSK_CORNER_TOP_LEFT].height,
|
||||
rect->corner[GSK_CORNER_TOP_RIGHT].height);
|
||||
|
||||
out->origin.x = rect->bounds.origin.x + left;
|
||||
out->origin.y = rect->bounds.origin.y + top;
|
||||
|
||||
out->size.width = rect->bounds.size.width - left -
|
||||
MAX (rect->corner[GSK_CORNER_TOP_RIGHT].width,
|
||||
rect->corner[GSK_CORNER_BOTTOM_RIGHT].width);
|
||||
|
||||
out->size.height = rect->bounds.size.height - top -
|
||||
MAX (rect->corner[GSK_CORNER_BOTTOM_LEFT].height,
|
||||
rect->corner[GSK_CORNER_BOTTOM_RIGHT].height);
|
||||
}
|
||||
|
||||
/* Best effort intersection of two rounded rectangles */
|
||||
static gboolean
|
||||
gsk_rounded_rect_intersection (const GskRoundedRect *self,
|
||||
const GskRoundedRect *other,
|
||||
gsk_rounded_rect_intersection (const GskRoundedRect *outer,
|
||||
const GskRoundedRect *inner,
|
||||
GskRoundedRect *out_intersection)
|
||||
{
|
||||
const graphene_rect_t *self_bounds = &self->bounds;
|
||||
const graphene_rect_t *other_bounds = &other->bounds;
|
||||
const graphene_rect_t *outer_bounds = &outer->bounds;
|
||||
const graphene_rect_t *inner_bounds = &inner->bounds;
|
||||
graphene_rect_t outer_inner;
|
||||
graphene_rect_t inner_inner;
|
||||
gboolean contained_x;
|
||||
gboolean contained_y;
|
||||
|
||||
if (graphene_rect_contains_rect (self_bounds, other_bounds))
|
||||
if (graphene_rect_contains_rect (outer_bounds, inner_bounds))
|
||||
{
|
||||
*out_intersection = *other;
|
||||
*out_intersection = *inner;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* TODO: There are a few cases here that we can express using a single
|
||||
* rounded rectangle, which are even interesting in every day usage.
|
||||
* For example, a partially scrolled-away rounded rectangle
|
||||
* might just work.
|
||||
*/
|
||||
get_inner_rect (outer, &outer_inner);
|
||||
get_inner_rect (inner, &inner_inner);
|
||||
|
||||
contained_x = outer_inner.origin.x <= inner_inner.origin.x &&
|
||||
(outer_inner.origin.x + outer_inner.size.width) > (inner_inner.origin.x +
|
||||
inner_inner.size.width);
|
||||
|
||||
contained_y = outer_inner.origin.y <= inner_inner.origin.y &&
|
||||
(outer_inner.origin.y + outer_inner.size.height) > (inner_inner.origin.y +
|
||||
inner_inner.size.height);
|
||||
|
||||
if (contained_x && !contained_y)
|
||||
{
|
||||
/* The intersection is @inner, but cut-off and with the cut-off corners
|
||||
* set to size 0 */
|
||||
*out_intersection = *inner;
|
||||
|
||||
if (inner_bounds->origin.y < outer_bounds->origin.y)
|
||||
{
|
||||
/* Set top corners to 0 */
|
||||
graphene_rect_intersection (outer_bounds, inner_bounds, &out_intersection->bounds);
|
||||
graphene_size_init (&out_intersection->corner[GSK_CORNER_TOP_LEFT], 0, 0);
|
||||
graphene_size_init (&out_intersection->corner[GSK_CORNER_TOP_RIGHT], 0, 0);
|
||||
graphene_size_init_from_size (&out_intersection->corner[GSK_CORNER_BOTTOM_LEFT],
|
||||
&inner->corner[GSK_CORNER_BOTTOM_LEFT]);
|
||||
graphene_size_init_from_size (&out_intersection->corner[GSK_CORNER_BOTTOM_RIGHT],
|
||||
&inner->corner[GSK_CORNER_BOTTOM_RIGHT]);
|
||||
return TRUE;
|
||||
}
|
||||
else if (inner_bounds->origin.y + inner_bounds->size.height >
|
||||
outer_bounds->origin.y + outer_bounds->size.height)
|
||||
{
|
||||
/* Set bottom corners to 0 */
|
||||
graphene_rect_intersection (outer_bounds, inner_bounds, &out_intersection->bounds);
|
||||
graphene_size_init (&out_intersection->corner[GSK_CORNER_BOTTOM_LEFT], 0, 0);
|
||||
graphene_size_init (&out_intersection->corner[GSK_CORNER_BOTTOM_RIGHT], 0, 0);
|
||||
graphene_size_init_from_size (&out_intersection->corner[GSK_CORNER_TOP_LEFT],
|
||||
&inner->corner[GSK_CORNER_TOP_LEFT]);
|
||||
graphene_size_init_from_size (&out_intersection->corner[GSK_CORNER_TOP_RIGHT],
|
||||
&inner->corner[GSK_CORNER_TOP_RIGHT]);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (!contained_x && contained_y)
|
||||
{
|
||||
/* The intersection is @inner, but cut-off and with the cut-off corners
|
||||
* set to size 0 */
|
||||
*out_intersection = *inner;
|
||||
|
||||
if (inner_bounds->origin.x < outer_bounds->origin.x)
|
||||
{
|
||||
/* Set left corners to 0 */
|
||||
graphene_rect_intersection (outer_bounds, inner_bounds, &out_intersection->bounds);
|
||||
graphene_size_init (&out_intersection->corner[GSK_CORNER_TOP_LEFT], 0, 0);
|
||||
graphene_size_init (&out_intersection->corner[GSK_CORNER_BOTTOM_LEFT], 0, 0);
|
||||
graphene_size_init_from_size (&out_intersection->corner[GSK_CORNER_TOP_RIGHT],
|
||||
&inner->corner[GSK_CORNER_TOP_RIGHT]);
|
||||
graphene_size_init_from_size (&out_intersection->corner[GSK_CORNER_BOTTOM_RIGHT],
|
||||
&inner->corner[GSK_CORNER_BOTTOM_RIGHT]);
|
||||
return TRUE;
|
||||
}
|
||||
else if (inner_bounds->origin.x + inner_bounds->size.width >
|
||||
outer_bounds->origin.x + outer_bounds->size.width)
|
||||
{
|
||||
/* Set right corners to 0 */
|
||||
graphene_rect_intersection (outer_bounds, inner_bounds, &out_intersection->bounds);
|
||||
graphene_size_init (&out_intersection->corner[GSK_CORNER_TOP_RIGHT], 0, 0);
|
||||
graphene_size_init (&out_intersection->corner[GSK_CORNER_BOTTOM_RIGHT], 0, 0);
|
||||
graphene_size_init_from_size (&out_intersection->corner[GSK_CORNER_TOP_LEFT],
|
||||
&inner->corner[GSK_CORNER_TOP_LEFT]);
|
||||
graphene_size_init_from_size (&out_intersection->corner[GSK_CORNER_BOTTOM_LEFT],
|
||||
&inner->corner[GSK_CORNER_BOTTOM_LEFT]);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Actually not possible or just too much work. */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static inline void
|
||||
render_rounded_clip_node (GskGLRenderer *self,
|
||||
GskRenderNode *node,
|
||||
@@ -1254,7 +1416,7 @@ render_outset_shadow_node (GskGLRenderer *self,
|
||||
op.op = OP_CLEAR;
|
||||
ops_add (builder, &op);
|
||||
prev_projection = ops_set_projection (builder, &item_proj);
|
||||
ops_push_modelview (builder, &identity);
|
||||
ops_set_modelview (builder, &identity, GSK_MATRIX_CATEGORY_IDENTITY);
|
||||
prev_viewport = ops_set_viewport (builder, &GRAPHENE_RECT_INIT (0, 0, texture_width, texture_height));
|
||||
|
||||
/* Draw outline */
|
||||
@@ -2280,7 +2442,8 @@ gsk_gl_renderer_add_render_ops (GskGLRenderer *self,
|
||||
|
||||
/* This can still happen, even if the render nodes are created using
|
||||
* GtkSnapshot, so let's juse be safe. */
|
||||
if (node->bounds.size.width == 0.0f || node->bounds.size.height == 0.0f)
|
||||
if (node->bounds.size.width == 0.0f || node->bounds.size.height == 0.0f ||
|
||||
isnan (node->bounds.size.width) || isnan (node->bounds.size.height))
|
||||
return;
|
||||
|
||||
/* Check whether the render node is entirely out of the current
|
||||
@@ -2316,7 +2479,7 @@ gsk_gl_renderer_add_render_ops (GskGLRenderer *self,
|
||||
break;
|
||||
|
||||
case GSK_DEBUG_NODE:
|
||||
gsk_gl_renderer_add_render_ops (self,
|
||||
gsk_gl_renderer_add_render_ops (self,
|
||||
gsk_debug_node_get_child (node),
|
||||
builder);
|
||||
break;
|
||||
@@ -2406,8 +2569,8 @@ add_offscreen_ops (GskGLRenderer *self,
|
||||
guint flags)
|
||||
{
|
||||
const float scale = ops_get_scale (builder);
|
||||
const float width = bounds->size.width * scale;
|
||||
const float height = bounds->size.height * scale;
|
||||
const float width = ceilf (bounds->size.width * scale);
|
||||
const float height = ceilf (bounds->size.height * scale);
|
||||
const float dx = builder->dx;
|
||||
const float dy = builder->dy;
|
||||
int render_target;
|
||||
@@ -2471,7 +2634,7 @@ add_offscreen_ops (GskGLRenderer *self,
|
||||
op.op = OP_CLEAR;
|
||||
ops_add (builder, &op);
|
||||
prev_projection = ops_set_projection (builder, &item_proj);
|
||||
ops_push_modelview (builder, &identity);
|
||||
ops_set_modelview (builder, &identity, GSK_MATRIX_CATEGORY_IDENTITY);
|
||||
prev_viewport = ops_set_viewport (builder,
|
||||
&GRAPHENE_RECT_INIT (bounds->origin.x * scale,
|
||||
bounds->origin.y * scale,
|
||||
@@ -2731,12 +2894,13 @@ gsk_gl_renderer_do_render (GskRenderer *renderer,
|
||||
render_op_builder.current_viewport = *viewport;
|
||||
render_op_builder.current_opacity = 1.0f;
|
||||
render_op_builder.render_ops = self->render_ops;
|
||||
ops_push_modelview (&render_op_builder, &modelview);
|
||||
ops_set_modelview (&render_op_builder, &modelview,
|
||||
scale_factor == 1 ? GSK_MATRIX_CATEGORY_IDENTITY : GSK_MATRIX_CATEGORY_2D_AFFINE);
|
||||
|
||||
/* Initial clip is self->render_region! */
|
||||
if (self->render_region != NULL)
|
||||
{
|
||||
GskRoundedRect transformed_render_region = { 0, };
|
||||
graphene_rect_t transformed_render_region;
|
||||
cairo_rectangle_int_t render_extents;
|
||||
|
||||
cairo_region_get_extents (self->render_region, &render_extents);
|
||||
@@ -2746,8 +2910,12 @@ gsk_gl_renderer_do_render (GskRenderer *renderer,
|
||||
render_extents.y,
|
||||
render_extents.width,
|
||||
render_extents.height),
|
||||
&transformed_render_region.bounds);
|
||||
ops_push_clip (&render_op_builder, &transformed_render_region);
|
||||
&transformed_render_region);
|
||||
ops_push_clip (&render_op_builder,
|
||||
&GSK_ROUNDED_RECT_INIT (transformed_render_region.origin.x,
|
||||
transformed_render_region.origin.y,
|
||||
transformed_render_region.size.width,
|
||||
transformed_render_region.size.height));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+125
-71
@@ -63,63 +63,55 @@ static void
|
||||
extract_matrix_metadata (const graphene_matrix_t *m,
|
||||
OpsMatrixMetadata *md)
|
||||
{
|
||||
graphene_vec3_t col1;
|
||||
graphene_vec3_t col2;
|
||||
switch (md->category)
|
||||
{
|
||||
case GSK_MATRIX_CATEGORY_IDENTITY:
|
||||
md->scale_x = 1;
|
||||
md->scale_y = 1;
|
||||
break;
|
||||
|
||||
/* Translate */
|
||||
md->translate_x = graphene_matrix_get_value (m, 3, 0);
|
||||
md->translate_y = graphene_matrix_get_value (m, 3, 1);
|
||||
case GSK_MATRIX_CATEGORY_2D_TRANSLATE:
|
||||
md->translate_x = graphene_matrix_get_value (m, 3, 0);
|
||||
md->translate_y = graphene_matrix_get_value (m, 3, 1);
|
||||
md->scale_x = 1;
|
||||
md->scale_y = 1;
|
||||
break;
|
||||
|
||||
/* Scale */
|
||||
graphene_vec3_init (&col1,
|
||||
graphene_matrix_get_value (m, 0, 0),
|
||||
graphene_matrix_get_value (m, 1, 0),
|
||||
graphene_matrix_get_value (m, 2, 0));
|
||||
case GSK_MATRIX_CATEGORY_UNKNOWN:
|
||||
case GSK_MATRIX_CATEGORY_ANY:
|
||||
case GSK_MATRIX_CATEGORY_INVERTIBLE:
|
||||
case GSK_MATRIX_CATEGORY_2D_AFFINE:
|
||||
{
|
||||
graphene_vec3_t col1;
|
||||
graphene_vec3_t col2;
|
||||
|
||||
graphene_vec3_init (&col2,
|
||||
graphene_matrix_get_value (m, 0, 1),
|
||||
graphene_matrix_get_value (m, 1, 1),
|
||||
graphene_matrix_get_value (m, 2, 1));
|
||||
md->translate_x = graphene_matrix_get_value (m, 3, 0);
|
||||
md->translate_y = graphene_matrix_get_value (m, 3, 1);
|
||||
|
||||
md->scale_x = graphene_vec3_length (&col1);
|
||||
md->scale_y = graphene_vec3_length (&col2);
|
||||
graphene_vec3_init (&col1,
|
||||
graphene_matrix_get_value (m, 0, 0),
|
||||
graphene_matrix_get_value (m, 1, 0),
|
||||
graphene_matrix_get_value (m, 2, 0));
|
||||
|
||||
/* A simple matrix (in our case) is one that doesn't do anything but scale
|
||||
* and/or translate.
|
||||
*
|
||||
* For orher matrices, we fall back to offscreen drawing.
|
||||
*/
|
||||
md->simple = TRUE;
|
||||
{
|
||||
static const guchar check_zero[4][4] = {
|
||||
{ 0, 1, 0, 1 }, /* If any of the values marked as '1' here is non-zero, */
|
||||
{ 1, 0, 0, 1 }, /* We have to resort to offscreen drawing later on. */
|
||||
{ 1, 1, 0, 1 },
|
||||
{ 0, 0, 0, 0 },
|
||||
};
|
||||
int x, y;
|
||||
graphene_vec3_init (&col2,
|
||||
graphene_matrix_get_value (m, 0, 1),
|
||||
graphene_matrix_get_value (m, 1, 1),
|
||||
graphene_matrix_get_value (m, 2, 1));
|
||||
|
||||
for (x = 0; x < 4; x ++)
|
||||
for (y = 0; y < 4; y ++)
|
||||
if (check_zero[y][x] &&
|
||||
graphene_matrix_get_value (m, y, x) != 0.0f)
|
||||
{
|
||||
md->simple = FALSE;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
md->only_translation = (md->simple && md->scale_x == 1 && md->scale_y == 1);
|
||||
md->scale_x = graphene_vec3_length (&col1);
|
||||
md->scale_y = graphene_vec3_length (&col2);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ops_transform_bounds_modelview (const RenderOpBuilder *builder,
|
||||
const graphene_rect_t *src,
|
||||
graphene_rect_t *dst)
|
||||
{
|
||||
const float scale = ops_get_scale (builder);
|
||||
const MatrixStackEntry *head;
|
||||
|
||||
g_assert (builder->mv_stack != NULL);
|
||||
@@ -127,34 +119,32 @@ ops_transform_bounds_modelview (const RenderOpBuilder *builder,
|
||||
|
||||
head = &g_array_index (builder->mv_stack, MatrixStackEntry, builder->mv_stack->len - 1);
|
||||
|
||||
if (head->metadata.only_translation)
|
||||
switch (head->metadata.category)
|
||||
{
|
||||
case GSK_MATRIX_CATEGORY_IDENTITY:
|
||||
*dst = *src;
|
||||
graphene_rect_offset (dst,
|
||||
head->metadata.translate_x,
|
||||
head->metadata.translate_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_2D_TRANSLATE:
|
||||
*dst = *src;
|
||||
dst->origin.x += head->metadata.translate_x;
|
||||
dst->origin.y += head->metadata.translate_y;
|
||||
break;
|
||||
|
||||
/* TODO: Handle scale */
|
||||
case GSK_MATRIX_CATEGORY_2D_AFFINE:
|
||||
case GSK_MATRIX_CATEGORY_UNKNOWN:
|
||||
case GSK_MATRIX_CATEGORY_ANY:
|
||||
case GSK_MATRIX_CATEGORY_INVERTIBLE:
|
||||
default:
|
||||
graphene_matrix_transform_bounds (builder->current_modelview,
|
||||
src,
|
||||
dst);
|
||||
|
||||
}
|
||||
|
||||
graphene_rect_offset (dst, builder->dx * scale, builder->dy * scale);
|
||||
}
|
||||
|
||||
gboolean
|
||||
ops_modelview_is_simple (const RenderOpBuilder *builder)
|
||||
{
|
||||
const MatrixStackEntry *head;
|
||||
|
||||
g_assert (builder->mv_stack != NULL);
|
||||
g_assert (builder->mv_stack->len >= 1);
|
||||
|
||||
head = &g_array_index (builder->mv_stack, MatrixStackEntry, builder->mv_stack->len - 1);
|
||||
|
||||
return head->metadata.simple;
|
||||
dst->origin.x += builder->dx * head->metadata.scale_x;
|
||||
dst->origin.y += builder->dy * head->metadata.scale_y;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -303,8 +293,8 @@ ops_has_clip (RenderOpBuilder *self)
|
||||
}
|
||||
|
||||
static void
|
||||
ops_set_modelview (RenderOpBuilder *builder,
|
||||
const graphene_matrix_t *modelview)
|
||||
ops_set_modelview_internal (RenderOpBuilder *builder,
|
||||
const graphene_matrix_t *modelview)
|
||||
{
|
||||
RenderOp op;
|
||||
|
||||
@@ -338,9 +328,12 @@ ops_set_modelview (RenderOpBuilder *builder,
|
||||
builder->current_program_state->modelview = *modelview;
|
||||
}
|
||||
|
||||
/* This sets the modelview to the given one without looking at the
|
||||
* one that's currently set */
|
||||
void
|
||||
ops_push_modelview (RenderOpBuilder *builder,
|
||||
const graphene_matrix_t *mv)
|
||||
ops_set_modelview (RenderOpBuilder *builder,
|
||||
const graphene_matrix_t *mv,
|
||||
GskMatrixCategory mv_category)
|
||||
{
|
||||
MatrixStackEntry *entry;
|
||||
|
||||
@@ -353,10 +346,64 @@ ops_push_modelview (RenderOpBuilder *builder,
|
||||
entry = &g_array_index (builder->mv_stack, MatrixStackEntry, builder->mv_stack->len - 1);
|
||||
|
||||
entry->matrix = *mv;
|
||||
entry->metadata.category = mv_category;
|
||||
|
||||
entry->metadata.dx_before = builder->dx;
|
||||
entry->metadata.dy_before = builder->dy;
|
||||
extract_matrix_metadata (mv, &entry->metadata);
|
||||
|
||||
builder->dx = 0;
|
||||
builder->dy = 0;
|
||||
builder->current_modelview = &entry->matrix;
|
||||
ops_set_modelview (builder, mv);
|
||||
ops_set_modelview_internal (builder, &entry->matrix);
|
||||
}
|
||||
|
||||
/* This sets the given modelview to the one we get when multiplying
|
||||
* the given modelview with the current one. */
|
||||
void
|
||||
ops_push_modelview (RenderOpBuilder *builder,
|
||||
const graphene_matrix_t *mv,
|
||||
GskMatrixCategory mv_category)
|
||||
{
|
||||
float scale = ops_get_scale (builder);
|
||||
MatrixStackEntry *entry;
|
||||
|
||||
if (G_UNLIKELY (builder->mv_stack == NULL))
|
||||
builder->mv_stack = g_array_new (FALSE, TRUE, sizeof (MatrixStackEntry));
|
||||
|
||||
g_assert (builder->mv_stack != NULL);
|
||||
|
||||
g_array_set_size (builder->mv_stack, builder->mv_stack->len + 1);
|
||||
entry = &g_array_index (builder->mv_stack, MatrixStackEntry, builder->mv_stack->len - 1);
|
||||
|
||||
if (G_LIKELY (builder->mv_stack->len >= 2))
|
||||
{
|
||||
const MatrixStackEntry *cur;
|
||||
|
||||
cur = &g_array_index (builder->mv_stack, MatrixStackEntry, builder->mv_stack->len - 2);
|
||||
/* Multiply given matrix with current modelview */
|
||||
|
||||
graphene_matrix_multiply (mv, &cur->matrix, &entry->matrix);
|
||||
graphene_matrix_translate (&entry->matrix,
|
||||
&(graphene_point3d_t) { builder->dx * scale, builder->dy * scale, 0});
|
||||
|
||||
entry->metadata.category = MIN (mv_category, cur->metadata.category);
|
||||
}
|
||||
else
|
||||
{
|
||||
entry->matrix = *mv;
|
||||
entry->metadata.category = mv_category;
|
||||
}
|
||||
|
||||
entry->metadata.dx_before = builder->dx;
|
||||
entry->metadata.dy_before = builder->dy;
|
||||
|
||||
extract_matrix_metadata (mv, &entry->metadata);
|
||||
|
||||
builder->dx = 0;
|
||||
builder->dy = 0;
|
||||
builder->current_modelview = &entry->matrix;
|
||||
ops_set_modelview_internal (builder, &entry->matrix);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -368,6 +415,10 @@ ops_pop_modelview (RenderOpBuilder *builder)
|
||||
g_assert (builder->mv_stack);
|
||||
g_assert (builder->mv_stack->len >= 1);
|
||||
|
||||
head = &g_array_index (builder->mv_stack, MatrixStackEntry, builder->mv_stack->len - 1);
|
||||
builder->dx = head->metadata.dx_before;
|
||||
builder->dy = head->metadata.dy_before;
|
||||
|
||||
builder->mv_stack->len --;
|
||||
head = &g_array_index (builder->mv_stack, MatrixStackEntry, builder->mv_stack->len - 1);
|
||||
m = &head->matrix;
|
||||
@@ -375,7 +426,7 @@ ops_pop_modelview (RenderOpBuilder *builder)
|
||||
if (builder->mv_stack->len >= 1)
|
||||
{
|
||||
builder->current_modelview = m;
|
||||
ops_set_modelview (builder, m);
|
||||
ops_set_modelview_internal (builder, m);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -684,6 +735,9 @@ ops_draw (RenderOpBuilder *builder,
|
||||
builder->buffer_size += sizeof (GskQuadVertex) * GL_N_VERTICES;
|
||||
}
|
||||
|
||||
/* The offset is only valid for the current modelview.
|
||||
* Setting a new modelview will add the offset to that matrix
|
||||
* and reset the internal offset to 0. */
|
||||
void
|
||||
ops_offset (RenderOpBuilder *builder,
|
||||
float x,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "gskgldriverprivate.h"
|
||||
#include "gskroundedrectprivate.h"
|
||||
#include "gskglrendererprivate.h"
|
||||
#include "gskrendernodeprivate.h"
|
||||
|
||||
#define GL_N_VERTICES 6
|
||||
#define GL_N_PROGRAMS 11
|
||||
@@ -21,8 +22,10 @@ typedef struct
|
||||
float scale_x;
|
||||
float scale_y;
|
||||
|
||||
guint simple : 1;
|
||||
guint only_translation : 1;
|
||||
float dx_before;
|
||||
float dy_before;
|
||||
|
||||
GskMatrixCategory category;
|
||||
} OpsMatrixMetadata;
|
||||
|
||||
typedef struct
|
||||
@@ -277,9 +280,12 @@ void ops_dump_framebuffer (RenderOpBuilder *builder,
|
||||
|
||||
void ops_finish (RenderOpBuilder *builder);
|
||||
void ops_push_modelview (RenderOpBuilder *builder,
|
||||
const graphene_matrix_t *mv);
|
||||
const graphene_matrix_t *mv,
|
||||
GskMatrixCategory mv_category);
|
||||
void ops_set_modelview (RenderOpBuilder *builder,
|
||||
const graphene_matrix_t *mv,
|
||||
GskMatrixCategory mv_category);
|
||||
void ops_pop_modelview (RenderOpBuilder *builder);
|
||||
gboolean ops_modelview_is_simple (const RenderOpBuilder *builder);
|
||||
float ops_get_scale (const RenderOpBuilder *builder);
|
||||
|
||||
void ops_set_program (RenderOpBuilder *builder,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
#include "gskglshadowcacheprivate.h"
|
||||
|
||||
#define MAX_UNUSED_FRAMES (16 * 5) /* 5 seconds? */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GskRoundedRect outline;
|
||||
@@ -13,7 +15,7 @@ typedef struct
|
||||
float blur_radius;
|
||||
|
||||
int texture_id;
|
||||
guint used : 1;
|
||||
int unused_frames;
|
||||
} CacheItem;
|
||||
|
||||
static gboolean
|
||||
@@ -67,7 +69,7 @@ gsk_gl_shadow_cache_begin_frame (GskGLShadowCache *self,
|
||||
{
|
||||
CacheItem *item = &g_array_index (self->textures, CacheItem, i);
|
||||
|
||||
if (!item->used)
|
||||
if (item->unused_frames > MAX_UNUSED_FRAMES)
|
||||
{
|
||||
gsk_gl_driver_destroy_texture (gl_driver, item->texture_id);
|
||||
g_array_remove_index_fast (self->textures, i);
|
||||
@@ -76,7 +78,7 @@ gsk_gl_shadow_cache_begin_frame (GskGLShadowCache *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
item->used = FALSE;
|
||||
item->unused_frames ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,7 +115,7 @@ gsk_gl_shadow_cache_get_texture_id (GskGLShadowCache *self,
|
||||
if (item == NULL)
|
||||
return 0;
|
||||
|
||||
item->used = TRUE;
|
||||
item->unused_frames = 0;
|
||||
|
||||
g_assert (item->texture_id != 0);
|
||||
|
||||
@@ -137,6 +139,6 @@ gsk_gl_shadow_cache_commit (GskGLShadowCache *self,
|
||||
|
||||
item->outline = *shadow_rect;
|
||||
item->blur_radius = blur_radius;
|
||||
item->used = TRUE;
|
||||
item->unused_frames = 0;
|
||||
item->texture_id = texture_id;
|
||||
}
|
||||
|
||||
+5
-39
@@ -42,6 +42,7 @@
|
||||
|
||||
#include "gskdebugprivate.h"
|
||||
#include "gskrendererprivate.h"
|
||||
#include "gskrendernodeparserprivate.h"
|
||||
|
||||
#include <graphene-gobject.h>
|
||||
|
||||
@@ -328,19 +329,11 @@ gsk_render_node_diff (GskRenderNode *node1,
|
||||
GBytes *
|
||||
gsk_render_node_serialize (GskRenderNode *node)
|
||||
{
|
||||
GVariant *node_variant, *variant;
|
||||
GBytes *result;
|
||||
char *str;
|
||||
|
||||
node_variant = gsk_render_node_serialize_node (node);
|
||||
|
||||
variant = g_variant_new ("(suuv)",
|
||||
GSK_RENDER_NODE_SERIALIZATION_ID,
|
||||
(guint32) GSK_RENDER_NODE_SERIALIZATION_VERSION,
|
||||
(guint32) gsk_render_node_get_node_type (node),
|
||||
node_variant);
|
||||
|
||||
result = g_variant_get_data_as_bytes (variant);
|
||||
g_variant_unref (variant);
|
||||
str = gsk_render_node_serialize_to_string (node);
|
||||
result = g_bytes_new_take (str, strlen (str));
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -397,36 +390,9 @@ GskRenderNode *
|
||||
gsk_render_node_deserialize (GBytes *bytes,
|
||||
GError **error)
|
||||
{
|
||||
char *id_string;
|
||||
guint32 version, node_type;
|
||||
GVariant *variant, *node_variant;
|
||||
GskRenderNode *node = NULL;
|
||||
|
||||
variant = g_variant_new_from_bytes (G_VARIANT_TYPE ("(suuv)"), bytes, FALSE);
|
||||
|
||||
g_variant_get (variant, "(suuv)", &id_string, &version, &node_type, &node_variant);
|
||||
|
||||
if (!g_str_equal (id_string, GSK_RENDER_NODE_SERIALIZATION_ID))
|
||||
{
|
||||
g_set_error (error, GSK_SERIALIZATION_ERROR, GSK_SERIALIZATION_UNSUPPORTED_FORMAT,
|
||||
"Data not in GskRenderNode serialization format.");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (version != GSK_RENDER_NODE_SERIALIZATION_VERSION)
|
||||
{
|
||||
g_set_error (error, GSK_SERIALIZATION_ERROR, GSK_SERIALIZATION_UNSUPPORTED_VERSION,
|
||||
"Format version %u not supported.", version);
|
||||
goto out;
|
||||
}
|
||||
|
||||
node = gsk_render_node_deserialize_node (node_type, node_variant, error);
|
||||
|
||||
out:
|
||||
g_free (id_string);
|
||||
g_variant_unref (node_variant);
|
||||
g_variant_unref (variant);
|
||||
node = gsk_render_node_deserialize_from_string ((const char *)g_bytes_get_data (bytes, NULL));
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
+24
-3
@@ -2547,9 +2547,30 @@ gsk_transform_node_new_with_category (GskRenderNode *child,
|
||||
graphene_matrix_init_from_matrix (&self->transform, transform);
|
||||
self->category = category;
|
||||
|
||||
graphene_matrix_transform_bounds (&self->transform,
|
||||
&child->bounds,
|
||||
&self->render_node.bounds);
|
||||
switch (category)
|
||||
{
|
||||
case GSK_MATRIX_CATEGORY_IDENTITY:
|
||||
graphene_rect_init_from_rect (&self->render_node.bounds, &child->bounds);
|
||||
break;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_2D_TRANSLATE:
|
||||
{
|
||||
graphene_rect_init_from_rect (&self->render_node.bounds, &child->bounds);
|
||||
self->render_node.bounds.origin.x += graphene_matrix_get_value (transform, 3, 0);
|
||||
self->render_node.bounds.origin.y += graphene_matrix_get_value (transform, 3, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case GSK_MATRIX_CATEGORY_2D_AFFINE:
|
||||
case GSK_MATRIX_CATEGORY_ANY:
|
||||
case GSK_MATRIX_CATEGORY_UNKNOWN:
|
||||
case GSK_MATRIX_CATEGORY_INVERTIBLE:
|
||||
default:
|
||||
graphene_matrix_transform_bounds (&self->transform,
|
||||
&child->bounds,
|
||||
&self->render_node.bounds);
|
||||
}
|
||||
|
||||
return &self->render_node;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
|
||||
#ifndef __GSK_RENDER_NODE_PARSER_PRIVATE_H__
|
||||
#define __GSK_RENDER_NODE_PARSER_PRIVATE_H__
|
||||
|
||||
#include "gskrendernode.h"
|
||||
|
||||
GskRenderNode * gsk_render_node_deserialize_from_string (const char *string);
|
||||
char * gsk_render_node_serialize_to_string (GskRenderNode *root);
|
||||
|
||||
#endif
|
||||
@@ -535,3 +535,24 @@ gsk_rounded_rect_equal (gconstpointer rect1,
|
||||
&& graphene_size_equal (&self1->corner[2], &self2->corner[2])
|
||||
&& graphene_size_equal (&self1->corner[3], &self2->corner[3]);
|
||||
}
|
||||
|
||||
char *
|
||||
gsk_rounded_rect_to_string (const GskRoundedRect *self)
|
||||
{
|
||||
return g_strdup_printf ("GskRoundedRect %p: Bounds: (%f, %f, %f, %f)"
|
||||
" Corners: (%f, %f) (%f, %f) (%f, %f) (%f, %f)",
|
||||
self,
|
||||
self->bounds.origin.x,
|
||||
self->bounds.origin.y,
|
||||
self->bounds.size.width,
|
||||
self->bounds.size.height,
|
||||
self->corner[0].width,
|
||||
self->corner[0].height,
|
||||
self->corner[1].width,
|
||||
self->corner[1].height,
|
||||
self->corner[2].width,
|
||||
self->corner[2].height,
|
||||
self->corner[3].width,
|
||||
self->corner[3].height);
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ void gsk_rounded_rect_to_float (const GskRounde
|
||||
|
||||
gboolean gsk_rounded_rect_equal (gconstpointer rect1,
|
||||
gconstpointer rect2);
|
||||
char * gsk_rounded_rect_to_string (const GskRoundedRect *self);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ gsk_private_sources = files([
|
||||
'gskdebug.c',
|
||||
'gskprivate.c',
|
||||
'gskprofiler.c',
|
||||
'gskrendernodeparser.c',
|
||||
'gl/gskshaderbuilder.c',
|
||||
'gl/gskglprofiler.c',
|
||||
'gl/gskglrenderer.c',
|
||||
|
||||
+119
-92
@@ -26,6 +26,8 @@
|
||||
#include "gtkpango.h"
|
||||
#include "gtkentryaccessible.h"
|
||||
#include "gtkentryprivate.h"
|
||||
#include "gtksearchentryprivate.h"
|
||||
#include "gtkpasswordentry.h"
|
||||
#include "gtktextprivate.h"
|
||||
#include "gtkcomboboxaccessible.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
@@ -407,7 +409,7 @@ gtk_entry_accessible_get_attributes (AtkObject *accessible)
|
||||
GtkWidget *widget;
|
||||
AtkAttributeSet *attributes;
|
||||
AtkAttribute *placeholder_text;
|
||||
const gchar *text;
|
||||
char *text = NULL;
|
||||
|
||||
attributes = ATK_OBJECT_CLASS (gtk_entry_accessible_parent_class)->get_attributes (accessible);
|
||||
|
||||
@@ -415,13 +417,15 @@ gtk_entry_accessible_get_attributes (AtkObject *accessible)
|
||||
if (widget == NULL)
|
||||
return attributes;
|
||||
|
||||
text = gtk_entry_get_placeholder_text (GTK_ENTRY (widget));
|
||||
if (GTK_IS_ENTRY (widget) || GTK_IS_SEARCH_ENTRY (widget))
|
||||
g_object_get (widget, "placeholder-text", &text, NULL);
|
||||
|
||||
if (text == NULL)
|
||||
return attributes;
|
||||
|
||||
placeholder_text = g_malloc (sizeof (AtkAttribute));
|
||||
placeholder_text->name = g_strdup ("placeholder-text");
|
||||
placeholder_text->value = g_strdup (text);
|
||||
placeholder_text->value = text;
|
||||
|
||||
attributes = g_slist_append (attributes, placeholder_text);
|
||||
|
||||
@@ -432,7 +436,7 @@ static void
|
||||
gtk_entry_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkEntry *entry;
|
||||
GtkWidget *widget;
|
||||
GtkEntryAccessible *gtk_entry_accessible;
|
||||
gint start_pos, end_pos;
|
||||
|
||||
@@ -440,19 +444,19 @@ gtk_entry_accessible_initialize (AtkObject *obj,
|
||||
|
||||
gtk_entry_accessible = GTK_ENTRY_ACCESSIBLE (obj);
|
||||
|
||||
entry = GTK_ENTRY (data);
|
||||
gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start_pos, &end_pos);
|
||||
widget = GTK_WIDGET (data);
|
||||
gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), &start_pos, &end_pos);
|
||||
gtk_entry_accessible->priv->cursor_position = end_pos;
|
||||
gtk_entry_accessible->priv->selection_bound = start_pos;
|
||||
|
||||
/* Set up signal callbacks */
|
||||
g_signal_connect_after (entry, "insert-text", G_CALLBACK (insert_text_cb), NULL);
|
||||
g_signal_connect (entry, "delete-text", G_CALLBACK (delete_text_cb), NULL);
|
||||
g_signal_connect_after (widget, "insert-text", G_CALLBACK (insert_text_cb), NULL);
|
||||
g_signal_connect (widget, "delete-text", G_CALLBACK (delete_text_cb), NULL);
|
||||
|
||||
if (gtk_entry_get_visibility (entry))
|
||||
obj->role = ATK_ROLE_TEXT;
|
||||
else
|
||||
if (GTK_IS_PASSWORD_ENTRY (widget))
|
||||
obj->role = ATK_ROLE_PASSWORD_TEXT;
|
||||
else
|
||||
obj->role = ATK_ROLE_TEXT;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -655,19 +659,20 @@ static gint
|
||||
gtk_entry_accessible_get_n_children (AtkObject* obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkEntry *entry;
|
||||
gint count = 0;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return 0;
|
||||
|
||||
entry = GTK_ENTRY (widget);
|
||||
if (GTK_IS_ENTRY (widget))
|
||||
{
|
||||
if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY) != GTK_IMAGE_EMPTY)
|
||||
count++;
|
||||
if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_SECONDARY) != GTK_IMAGE_EMPTY)
|
||||
count++;
|
||||
}
|
||||
|
||||
if (gtk_entry_get_icon_storage_type (entry, GTK_ENTRY_ICON_PRIMARY) != GTK_IMAGE_EMPTY)
|
||||
count++;
|
||||
if (gtk_entry_get_icon_storage_type (entry, GTK_ENTRY_ICON_SECONDARY) != GTK_IMAGE_EMPTY)
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -678,29 +683,29 @@ gtk_entry_accessible_ref_child (AtkObject *obj,
|
||||
GtkEntryAccessible *accessible = GTK_ENTRY_ACCESSIBLE (obj);
|
||||
GtkEntryAccessiblePrivate *priv = accessible->priv;
|
||||
GtkWidget *widget;
|
||||
GtkEntry *entry;
|
||||
GtkEntryIconPosition pos;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
entry = GTK_ENTRY (widget);
|
||||
if (!GTK_IS_ENTRY (widget))
|
||||
return NULL;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (gtk_entry_get_icon_storage_type (entry, GTK_ENTRY_ICON_PRIMARY) != GTK_IMAGE_EMPTY)
|
||||
if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY) != GTK_IMAGE_EMPTY)
|
||||
pos = GTK_ENTRY_ICON_PRIMARY;
|
||||
else if (gtk_entry_get_icon_storage_type (entry, GTK_ENTRY_ICON_SECONDARY) != GTK_IMAGE_EMPTY)
|
||||
else if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_SECONDARY) != GTK_IMAGE_EMPTY)
|
||||
pos = GTK_ENTRY_ICON_SECONDARY;
|
||||
else
|
||||
return NULL;
|
||||
break;
|
||||
case 1:
|
||||
if (gtk_entry_get_icon_storage_type (entry, GTK_ENTRY_ICON_PRIMARY) == GTK_IMAGE_EMPTY)
|
||||
if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_PRIMARY) == GTK_IMAGE_EMPTY)
|
||||
return NULL;
|
||||
if (gtk_entry_get_icon_storage_type (entry, GTK_ENTRY_ICON_SECONDARY) == GTK_IMAGE_EMPTY)
|
||||
if (gtk_entry_get_icon_storage_type (GTK_ENTRY (widget), GTK_ENTRY_ICON_SECONDARY) == GTK_IMAGE_EMPTY)
|
||||
return NULL;
|
||||
pos = GTK_ENTRY_ICON_SECONDARY;
|
||||
break;
|
||||
@@ -752,10 +757,8 @@ gtk_entry_accessible_init (GtkEntryAccessible *entry)
|
||||
entry->priv->selection_bound = 0;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gtk_entry_accessible_get_text (AtkText *atk_text,
|
||||
gint start_pos,
|
||||
gint end_pos)
|
||||
static GtkText *
|
||||
get_text (AtkText *atk_text)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
@@ -763,59 +766,82 @@ gtk_entry_accessible_get_text (AtkText *atk_text,
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
return gtk_text_get_display_text (gtk_entry_get_text_widget (GTK_ENTRY (widget)), start_pos, end_pos);
|
||||
if (GTK_IS_ENTRY (widget))
|
||||
return gtk_entry_get_text_widget (GTK_ENTRY (widget));
|
||||
else if (GTK_IS_SEARCH_ENTRY (widget))
|
||||
return gtk_search_entry_get_text_widget (GTK_SEARCH_ENTRY (widget));
|
||||
else
|
||||
return NULL; // FIXME;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gtk_entry_accessible_get_text_before_offset (AtkText *text,
|
||||
gtk_entry_accessible_get_text (AtkText *atk_text,
|
||||
gint start_pos,
|
||||
gint end_pos)
|
||||
{
|
||||
GtkText *text;
|
||||
|
||||
text = get_text (atk_text);
|
||||
|
||||
if (text == NULL)
|
||||
return NULL;
|
||||
|
||||
return gtk_text_get_display_text (text, start_pos, end_pos);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gtk_entry_accessible_get_text_before_offset (AtkText *atk_text,
|
||||
gint offset,
|
||||
AtkTextBoundary boundary_type,
|
||||
gint *start_offset,
|
||||
gint *end_offset)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkText *text;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||
if (widget == NULL)
|
||||
text = get_text (atk_text);
|
||||
|
||||
if (text == NULL)
|
||||
return NULL;
|
||||
|
||||
return _gtk_pango_get_text_before (gtk_text_get_layout (gtk_entry_get_text_widget (GTK_ENTRY (widget))),
|
||||
return _gtk_pango_get_text_before (gtk_text_get_layout (text),
|
||||
boundary_type, offset,
|
||||
start_offset, end_offset);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gtk_entry_accessible_get_text_at_offset (AtkText *text,
|
||||
gtk_entry_accessible_get_text_at_offset (AtkText *atk_text,
|
||||
gint offset,
|
||||
AtkTextBoundary boundary_type,
|
||||
gint *start_offset,
|
||||
gint *end_offset)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkText *text;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||
if (widget == NULL)
|
||||
text = get_text (atk_text);
|
||||
|
||||
if (text == NULL)
|
||||
return NULL;
|
||||
|
||||
return _gtk_pango_get_text_at (gtk_text_get_layout (gtk_entry_get_text_widget (GTK_ENTRY (widget))),
|
||||
return _gtk_pango_get_text_at (gtk_text_get_layout (text),
|
||||
boundary_type, offset,
|
||||
start_offset, end_offset);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gtk_entry_accessible_get_text_after_offset (AtkText *text,
|
||||
gtk_entry_accessible_get_text_after_offset (AtkText *atk_text,
|
||||
gint offset,
|
||||
AtkTextBoundary boundary_type,
|
||||
gint *start_offset,
|
||||
gint *end_offset)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkText *text;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||
if (widget == NULL)
|
||||
text = get_text (atk_text);
|
||||
|
||||
if (text == NULL)
|
||||
return NULL;
|
||||
|
||||
return _gtk_pango_get_text_after (gtk_text_get_layout (gtk_entry_get_text_widget (GTK_ENTRY (widget))),
|
||||
return _gtk_pango_get_text_after (gtk_text_get_layout (text),
|
||||
boundary_type, offset,
|
||||
start_offset, end_offset);
|
||||
}
|
||||
@@ -823,21 +849,22 @@ gtk_entry_accessible_get_text_after_offset (AtkText *text,
|
||||
static gint
|
||||
gtk_entry_accessible_get_character_count (AtkText *atk_text)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
gchar *text;
|
||||
glong char_count;
|
||||
GtkText *text;
|
||||
char *display_text;
|
||||
int char_count;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text));
|
||||
if (widget == NULL)
|
||||
text = get_text (atk_text);
|
||||
|
||||
if (text == NULL)
|
||||
return 0;
|
||||
|
||||
text = gtk_text_get_display_text (gtk_entry_get_text_widget (GTK_ENTRY (widget)), 0, -1);
|
||||
display_text = gtk_text_get_display_text (text, 0, -1);
|
||||
|
||||
char_count = 0;
|
||||
if (text)
|
||||
if (display_text)
|
||||
{
|
||||
char_count = g_utf8_strlen (text, -1);
|
||||
g_free (text);
|
||||
char_count = g_utf8_strlen (display_text, -1);
|
||||
g_free (display_text);
|
||||
}
|
||||
|
||||
return char_count;
|
||||
@@ -885,23 +912,24 @@ add_text_attribute (AtkAttributeSet *attributes,
|
||||
}
|
||||
|
||||
static AtkAttributeSet *
|
||||
gtk_entry_accessible_get_run_attributes (AtkText *text,
|
||||
gtk_entry_accessible_get_run_attributes (AtkText *atk_text,
|
||||
gint offset,
|
||||
gint *start_offset,
|
||||
gint *end_offset)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkText *text;
|
||||
AtkAttributeSet *attributes;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||
if (widget == NULL)
|
||||
text = get_text (atk_text);
|
||||
|
||||
if (text == NULL)
|
||||
return NULL;
|
||||
|
||||
attributes = NULL;
|
||||
attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_DIRECTION,
|
||||
gtk_widget_get_direction (widget));
|
||||
gtk_widget_get_direction (GTK_WIDGET (text)));
|
||||
attributes = _gtk_pango_get_run_attributes (attributes,
|
||||
gtk_text_get_layout (gtk_entry_get_text_widget (GTK_ENTRY (widget))),
|
||||
gtk_text_get_layout (text),
|
||||
offset,
|
||||
start_offset,
|
||||
end_offset);
|
||||
@@ -910,28 +938,29 @@ gtk_entry_accessible_get_run_attributes (AtkText *text,
|
||||
}
|
||||
|
||||
static AtkAttributeSet *
|
||||
gtk_entry_accessible_get_default_attributes (AtkText *text)
|
||||
gtk_entry_accessible_get_default_attributes (AtkText *atk_text)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkText *text;
|
||||
AtkAttributeSet *attributes;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||
if (widget == NULL)
|
||||
text = get_text (atk_text);
|
||||
|
||||
if (text == NULL)
|
||||
return NULL;
|
||||
|
||||
attributes = NULL;
|
||||
attributes = add_text_attribute (attributes, ATK_TEXT_ATTR_DIRECTION,
|
||||
gtk_widget_get_direction (widget));
|
||||
gtk_widget_get_direction (GTK_WIDGET (text)));
|
||||
attributes = _gtk_pango_get_default_attributes (attributes,
|
||||
gtk_text_get_layout (gtk_entry_get_text_widget (GTK_ENTRY (widget))));
|
||||
gtk_text_get_layout (text));
|
||||
attributes = _gtk_style_context_get_attributes (attributes,
|
||||
gtk_widget_get_style_context (widget));
|
||||
gtk_widget_get_style_context (GTK_WIDGET (text)));
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_entry_accessible_get_character_extents (AtkText *text,
|
||||
gtk_entry_accessible_get_character_extents (AtkText *atk_text,
|
||||
gint offset,
|
||||
gint *x,
|
||||
gint *y,
|
||||
@@ -939,8 +968,6 @@ gtk_entry_accessible_get_character_extents (AtkText *text,
|
||||
gint *height,
|
||||
AtkCoordType coords)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkEntry *entry;
|
||||
GtkText *textw;
|
||||
PangoRectangle char_rect;
|
||||
gchar *entry_text;
|
||||
@@ -949,12 +976,10 @@ gtk_entry_accessible_get_character_extents (AtkText *text,
|
||||
gint x_surface, y_surface;
|
||||
GtkAllocation allocation;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||
if (widget == NULL)
|
||||
return;
|
||||
textw = get_text (atk_text);
|
||||
|
||||
entry = GTK_ENTRY (widget);
|
||||
textw = gtk_entry_get_text_widget (entry);
|
||||
if (textw == NULL)
|
||||
return;
|
||||
|
||||
gtk_text_get_layout_offsets (textw, &x_layout, &y_layout);
|
||||
entry_text = gtk_text_get_display_text (textw, 0, -1);
|
||||
@@ -964,9 +989,9 @@ gtk_entry_accessible_get_character_extents (AtkText *text,
|
||||
pango_layout_index_to_pos (gtk_text_get_layout (textw), index, &char_rect);
|
||||
pango_extents_to_pixels (&char_rect, NULL);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
gtk_widget_get_allocation (GTK_WIDGET (textw), &allocation);
|
||||
|
||||
surface = gtk_widget_get_surface (widget);
|
||||
surface = gtk_widget_get_surface (GTK_WIDGET (textw));
|
||||
gdk_surface_get_origin (surface, &x_surface, &y_surface);
|
||||
|
||||
*x = x_surface + allocation.x + x_layout + char_rect.x;
|
||||
@@ -990,8 +1015,6 @@ gtk_entry_accessible_get_offset_at_point (AtkText *atk_text,
|
||||
gint y,
|
||||
AtkCoordType coords)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkEntry *entry;
|
||||
GtkText *textw;
|
||||
gchar *text;
|
||||
gint index, x_layout, y_layout;
|
||||
@@ -1000,16 +1023,14 @@ gtk_entry_accessible_get_offset_at_point (AtkText *atk_text,
|
||||
GdkSurface *surface;
|
||||
glong offset;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text));
|
||||
if (widget == NULL)
|
||||
return -1;
|
||||
textw = get_text (atk_text);
|
||||
|
||||
entry = GTK_ENTRY (widget);
|
||||
textw = gtk_entry_get_text_widget (entry);
|
||||
if (textw == NULL)
|
||||
return 1;
|
||||
|
||||
gtk_text_get_layout_offsets (textw, &x_layout, &y_layout);
|
||||
|
||||
surface = gtk_widget_get_surface (widget);
|
||||
surface = gtk_widget_get_surface (GTK_WIDGET (textw));
|
||||
gdk_surface_get_origin (surface, &x_surface, &y_surface);
|
||||
|
||||
x_local = x - x_layout - x_surface;
|
||||
@@ -1158,21 +1179,22 @@ static gunichar
|
||||
gtk_entry_accessible_get_character_at_offset (AtkText *atk_text,
|
||||
gint offset)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkText *textw;
|
||||
gchar *text;
|
||||
gchar *index;
|
||||
gunichar result;
|
||||
|
||||
result = '\0';
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text));
|
||||
if (widget == NULL)
|
||||
textw = get_text (atk_text);
|
||||
|
||||
if (textw == NULL)
|
||||
return 0;
|
||||
|
||||
if (!gtk_text_get_visibility (textw))
|
||||
return result;
|
||||
|
||||
if (!gtk_entry_get_visibility (GTK_ENTRY (widget)))
|
||||
return result;
|
||||
|
||||
text = gtk_text_get_display_text (gtk_entry_get_text_widget (GTK_ENTRY (widget)), 0, -1);
|
||||
text = gtk_text_get_display_text (textw, 0, -1);
|
||||
if (offset < g_utf8_strlen (text, -1))
|
||||
{
|
||||
index = g_utf8_offset_to_pointer (text, offset);
|
||||
@@ -1218,7 +1240,7 @@ gtk_entry_accessible_set_text_contents (AtkEditableText *text,
|
||||
if (!gtk_editable_get_editable (GTK_EDITABLE (widget)))
|
||||
return;
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (widget), string);
|
||||
gtk_editable_set_text (GTK_EDITABLE (widget), string);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1400,14 +1422,19 @@ delete_text_cb (GtkEditable *editable,
|
||||
gint end)
|
||||
{
|
||||
GtkEntryAccessible *accessible;
|
||||
GtkText *textw;
|
||||
|
||||
accessible = GTK_ENTRY_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (editable)));
|
||||
|
||||
textw = get_text (ATK_TEXT (accessible));
|
||||
if (textw == NULL)
|
||||
return;
|
||||
|
||||
if (end < 0)
|
||||
{
|
||||
gchar *text;
|
||||
|
||||
text = gtk_text_get_display_text (gtk_entry_get_text_widget (GTK_ENTRY (editable)), 0, -1);
|
||||
text = gtk_text_get_display_text (textw, 0, -1);
|
||||
end = g_utf8_strlen (text, -1);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
@@ -626,7 +626,11 @@ gtk_icon_view_item_accessible_grab_focus (AtkComponent *component)
|
||||
_gtk_icon_view_set_cursor_item (GTK_ICON_VIEW (item->widget), item->item, NULL);
|
||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (item->widget));
|
||||
if (gtk_widget_is_toplevel (toplevel))
|
||||
gtk_window_present (GTK_WINDOW (toplevel));
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_window_present (GTK_WINDOW (toplevel));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1179,7 +1179,11 @@ gtk_tree_view_accessible_grab_cell_focus (GtkCellAccessibleParent *parent,
|
||||
gdk_x11_get_server_time (gtk_widget_get_surface (widget)));
|
||||
else
|
||||
#endif
|
||||
gtk_window_present (GTK_WINDOW (toplevel));
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_window_present (GTK_WINDOW (toplevel));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -608,9 +608,12 @@ gtk_widget_accessible_grab_focus (AtkComponent *component)
|
||||
gtk_window_present_with_time (GTK_WINDOW (toplevel),
|
||||
gdk_x11_get_server_time (gtk_widget_get_surface (widget)));
|
||||
#else
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_window_present (GTK_WINDOW (toplevel));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
#endif
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
#include <gtk/a11y/gtkstackaccessible.h>
|
||||
#include <gtk/a11y/gtkstatusbaraccessible.h>
|
||||
#include <gtk/a11y/gtkswitchaccessible.h>
|
||||
#include <gtk/a11y/gtktextaccessible.h>
|
||||
#include <gtk/a11y/gtktextcellaccessible.h>
|
||||
#include <gtk/a11y/gtktextviewaccessible.h>
|
||||
#include <gtk/a11y/gtktogglebuttonaccessible.h>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <winuser.h>
|
||||
#include <winver.h>
|
||||
|
||||
GTK_ICON ICON "gtk.ico"
|
||||
@@ -18,9 +19,9 @@ VS_VERSION_INFO VERSIONINFO
|
||||
VALUE "CompanyName", "The GTK developer community"
|
||||
VALUE "FileDescription", "GIMP Toolkit"
|
||||
VALUE "FileVersion", "@GTK_VERSION@.0"
|
||||
VALUE "InternalName", "libgtk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@"
|
||||
VALUE "LegalCopyright", "Copyright © 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2011."
|
||||
VALUE "OriginalFilename", "libgtk-win32-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll"
|
||||
VALUE "InternalName", "libgtk-win32-@GTK_API_VERSION@"
|
||||
VALUE "LegalCopyright", "Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GTK+ Team and others 1997-2011."
|
||||
VALUE "OriginalFilename", "libgtk-win32-@GTK_API_VERSION@.dll"
|
||||
VALUE "ProductName", "GTK+"
|
||||
VALUE "ProductVersion", "@GTK_VERSION@"
|
||||
END
|
||||
@@ -30,3 +31,5 @@ VS_VERSION_INFO VERSIONINFO
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST libgtk4.manifest
|
||||
@@ -1002,7 +1002,9 @@ gtk_about_dialog_activate_link (GtkAboutDialog *about,
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -2409,7 +2411,9 @@ gtk_show_about_dialog (GtkWindow *parent,
|
||||
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-2
@@ -1076,9 +1076,11 @@ gtk_accel_label_set_use_underline (GtkAccelLabel *accel_label,
|
||||
* gtk_accel_label_get_use_underline:
|
||||
* @accel_label: a #GtkAccelLabel
|
||||
*
|
||||
* Returns: Whether the accel label interprets underscores in it's
|
||||
* GtkAccelLabel:label property as mnemonic indicators.
|
||||
* Returns whether the accel label interprets underscores in it's
|
||||
* label property as mnemonic indicators.
|
||||
* See gtk_accel_label_set_use_underline() and gtk_label_set_use_underline();
|
||||
*
|
||||
* Returns: whether the accel label uses mnemonic underlines
|
||||
*/
|
||||
gboolean
|
||||
gtk_accel_label_get_use_underline (GtkAccelLabel *accel_label)
|
||||
|
||||
@@ -364,7 +364,7 @@ gtk_cell_renderer_combo_editing_done (GtkCellEditable *combo,
|
||||
if (gtk_combo_box_get_has_entry (GTK_COMBO_BOX (combo)))
|
||||
{
|
||||
entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo)));
|
||||
new_text = g_strdup (gtk_entry_get_text (entry));
|
||||
new_text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (entry)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -466,8 +466,7 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell,
|
||||
|
||||
g_object_get (cell_text, "text", &text, NULL);
|
||||
if (text)
|
||||
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo))),
|
||||
text);
|
||||
gtk_editable_set_text (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (combo))), text);
|
||||
g_free (text);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -273,7 +273,7 @@ gtk_cell_renderer_spin_focus_changed (GtkWidget *widget,
|
||||
{
|
||||
path = g_object_get_data (G_OBJECT (widget), GTK_CELL_RENDERER_SPIN_PATH);
|
||||
|
||||
new_text = gtk_entry_get_text (GTK_ENTRY (widget));
|
||||
new_text = gtk_editable_get_text (GTK_EDITABLE (widget));
|
||||
g_signal_emit_by_name (data, "edited", path, new_text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1798,7 +1798,7 @@ gtk_cell_renderer_text_editing_done (GtkCellEditable *entry,
|
||||
return;
|
||||
|
||||
path = g_object_get_data (G_OBJECT (entry), GTK_CELL_RENDERER_TEXT_PATH);
|
||||
new_text = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
new_text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
g_signal_emit (data, text_cell_renderer_signals[EDITED], 0, path, new_text);
|
||||
}
|
||||
@@ -1905,10 +1905,10 @@ gtk_cell_renderer_text_start_editing (GtkCellRenderer *cell,
|
||||
|
||||
gtk_entry_set_has_frame (GTK_ENTRY (priv->entry), FALSE);
|
||||
gtk_entry_set_alignment (GTK_ENTRY (priv->entry), xalign);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (priv->entry), 5);
|
||||
gtk_editable_set_width_chars (GTK_EDITABLE (priv->entry), 5);
|
||||
|
||||
if (priv->text)
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->entry), priv->text);
|
||||
gtk_editable_set_text (GTK_EDITABLE (priv->entry), priv->text);
|
||||
g_object_set_data_full (G_OBJECT (priv->entry), I_(GTK_CELL_RENDERER_TEXT_PATH), g_strdup (path), g_free);
|
||||
|
||||
gtk_editable_select_region (GTK_EDITABLE (priv->entry), 0, -1);
|
||||
|
||||
@@ -557,8 +557,9 @@ gtk_check_button_set_inconsistent (GtkCheckButton *check_button,
|
||||
* gtk_check_button_get_inconsistent:
|
||||
* @check_button: a #GtkCheckButton
|
||||
*
|
||||
* Returns: %TRUE if @check_button is currently in an 'in between' state,
|
||||
* %FALSE otherwise.
|
||||
* Returns whether the check button is in an inconsistent state.
|
||||
*
|
||||
* Returns: %TRUE if @check_button is currently in an 'in between' state, %FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
gtk_check_button_get_inconsistent (GtkCheckButton *check_button)
|
||||
|
||||
@@ -555,7 +555,9 @@ gtk_color_button_clicked (GtkButton *b,
|
||||
|
||||
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (priv->cs_dialog), &priv->rgba);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_window_present (GTK_WINDOW (priv->cs_dialog));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -105,7 +105,7 @@ entry_set_rgba (GtkColorEditor *editor,
|
||||
scale_round (color->red, 255),
|
||||
scale_round (color->green, 255),
|
||||
scale_round (color->blue, 255));
|
||||
gtk_entry_set_text (GTK_ENTRY (editor->priv->entry), text);
|
||||
gtk_editable_set_text (GTK_EDITABLE (editor->priv->entry), text);
|
||||
editor->priv->text_changed = FALSE;
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
+1
-1
@@ -2424,7 +2424,7 @@ gtk_combo_box_entry_active_changed (GtkComboBox *combo_box,
|
||||
g_signal_emit (combo_box, combo_box_signals[FORMAT_ENTRY_TEXT], 0,
|
||||
path_str, &text);
|
||||
|
||||
gtk_entry_set_text (entry, text);
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), text);
|
||||
|
||||
g_signal_handlers_unblock_by_func (entry,
|
||||
gtk_combo_box_entry_contents_changed,
|
||||
|
||||
@@ -583,7 +583,7 @@ gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box)
|
||||
GtkWidget *entry;
|
||||
|
||||
entry = gtk_bin_get_child (GTK_BIN (combo_box));
|
||||
text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||
text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (entry)));
|
||||
}
|
||||
else if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo_box), &iter))
|
||||
{
|
||||
|
||||
+1
-11
@@ -128,7 +128,6 @@ struct _GtkContainerPrivate
|
||||
enum {
|
||||
ADD,
|
||||
REMOVE,
|
||||
SET_FOCUS_CHILD,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -304,15 +303,6 @@ gtk_container_class_init (GtkContainerClass *class)
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
GTK_TYPE_WIDGET);
|
||||
container_signals[SET_FOCUS_CHILD] =
|
||||
g_signal_new (I_("set-focus-child"),
|
||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GtkContainerClass, set_focus_child),
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
GTK_TYPE_WIDGET);
|
||||
|
||||
if (GtkContainer_private_offset != 0)
|
||||
g_type_class_adjust_private_offset (class, &GtkContainer_private_offset);
|
||||
@@ -1569,7 +1559,7 @@ gtk_container_set_focus_child (GtkContainer *container,
|
||||
if (child)
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
g_signal_emit (container, container_signals[SET_FOCUS_CHILD], 0, child);
|
||||
GTK_CONTAINER_GET_CLASS (container)->set_focus_child (container, child);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-3
@@ -41,8 +41,9 @@ gtk_drag_dest_realized (GtkWidget *widget)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_drag_dest_hierarchy_changed (GtkWidget *widget,
|
||||
GtkWidget *previous_toplevel)
|
||||
gtk_drag_dest_hierarchy_changed (GtkWidget *widget,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
||||
@@ -85,7 +86,7 @@ gtk_drag_dest_set_internal (GtkWidget *widget,
|
||||
|
||||
g_signal_connect (widget, "realize",
|
||||
G_CALLBACK (gtk_drag_dest_realized), site);
|
||||
g_signal_connect (widget, "hierarchy-changed",
|
||||
g_signal_connect (widget, "notify::root",
|
||||
G_CALLBACK (gtk_drag_dest_hierarchy_changed), site);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (widget), I_("gtk-drag-dest"),
|
||||
|
||||
+3
-2
@@ -516,6 +516,7 @@ gtk_editable_get_text (GtkEditable *editable)
|
||||
/**
|
||||
* gtk_editable_set_text:
|
||||
* @editable: a #GtkEditable
|
||||
* @text: the text to set
|
||||
*
|
||||
* Sets the text in the editable to the given value,
|
||||
* replacing the current contents.
|
||||
@@ -911,7 +912,7 @@ gtk_editable_finish_delegate (GtkEditable *editable)
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_editable_set_property:
|
||||
* gtk_editable_delegate_set_property:
|
||||
* @object: a #GObject
|
||||
* @prop_id: a property ID
|
||||
* @value: value to set
|
||||
@@ -969,7 +970,7 @@ gtk_editable_delegate_set_property (GObject *object,
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_editable_get_property:
|
||||
* gtk_editable_delegate_get_property:
|
||||
* @object: a #GObject
|
||||
* @prop_id: a property ID
|
||||
* @value: value to set
|
||||
|
||||
+18
-128
@@ -1113,7 +1113,7 @@ gtk_entry_get_property (GObject *object,
|
||||
break;
|
||||
|
||||
case PROP_TEXT_LENGTH:
|
||||
g_value_set_uint (value, gtk_entry_buffer_get_length (get_buffer (entry)));
|
||||
g_value_set_uint (value, gtk_entry_get_text_length (entry));
|
||||
break;
|
||||
|
||||
case PROP_PROGRESS_FRACTION:
|
||||
@@ -1835,6 +1835,7 @@ GtkWidget*
|
||||
gtk_entry_new_with_buffer (GtkEntryBuffer *buffer)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ENTRY_BUFFER (buffer), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_ENTRY, "buffer", buffer, NULL);
|
||||
}
|
||||
|
||||
@@ -1882,25 +1883,6 @@ gtk_entry_set_buffer (GtkEntry *entry,
|
||||
gtk_text_set_buffer (GTK_TEXT (priv->text), buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_set_text:
|
||||
* @entry: a #GtkEntry
|
||||
* @text: the new text
|
||||
*
|
||||
* Sets the text in the widget to the given
|
||||
* value, replacing the current contents.
|
||||
*
|
||||
* See gtk_entry_buffer_set_text().
|
||||
*/
|
||||
void
|
||||
gtk_entry_set_text (GtkEntry *entry,
|
||||
const gchar *text)
|
||||
{
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
|
||||
gtk_editable_set_text (GTK_EDITABLE (priv->text), text);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_set_visibility:
|
||||
* @entry: a #GtkEntry
|
||||
@@ -2050,29 +2032,6 @@ gtk_entry_get_overwrite_mode (GtkEntry *entry)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_get_text:
|
||||
* @entry: a #GtkEntry
|
||||
*
|
||||
* Retrieves the contents of the entry widget.
|
||||
* See also gtk_editable_get_chars().
|
||||
*
|
||||
* This is equivalent to getting @entry's #GtkEntryBuffer and calling
|
||||
* gtk_entry_buffer_get_text() on it.
|
||||
*
|
||||
* Returns: a pointer to the contents of the widget as a
|
||||
* string. This string points to internally allocated
|
||||
* storage in the widget and must not be freed, modified or
|
||||
* stored.
|
||||
**/
|
||||
const gchar*
|
||||
gtk_entry_get_text (GtkEntry *entry)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
||||
|
||||
return gtk_entry_buffer_get_text (get_buffer (entry));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_set_max_length:
|
||||
* @entry: a #GtkEntry
|
||||
@@ -2092,8 +2051,11 @@ void
|
||||
gtk_entry_set_max_length (GtkEntry *entry,
|
||||
gint max)
|
||||
{
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
|
||||
g_return_if_fail (GTK_IS_ENTRY (entry));
|
||||
gtk_entry_buffer_set_max_length (get_buffer (entry), max);
|
||||
|
||||
gtk_text_set_max_length (GTK_TEXT (priv->text), max);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2112,9 +2074,11 @@ gtk_entry_set_max_length (GtkEntry *entry,
|
||||
gint
|
||||
gtk_entry_get_max_length (GtkEntry *entry)
|
||||
{
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0);
|
||||
|
||||
return gtk_entry_buffer_get_max_length (get_buffer (entry));
|
||||
return gtk_text_get_max_length (GTK_TEXT (priv->text));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2134,9 +2098,11 @@ gtk_entry_get_max_length (GtkEntry *entry)
|
||||
guint16
|
||||
gtk_entry_get_text_length (GtkEntry *entry)
|
||||
{
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0);
|
||||
|
||||
return gtk_entry_buffer_get_length (get_buffer (entry));
|
||||
return gtk_text_get_text_length (GTK_TEXT (priv->text));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2182,83 +2148,6 @@ gtk_entry_get_activates_default (GtkEntry *entry)
|
||||
return gtk_text_get_activates_default (GTK_TEXT (priv->text));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_set_width_chars:
|
||||
* @entry: a #GtkEntry
|
||||
* @n_chars: width in chars
|
||||
*
|
||||
* Changes the size request of the entry to be about the right size
|
||||
* for @n_chars characters. Note that it changes the size
|
||||
* request, the size can still be affected by
|
||||
* how you pack the widget into containers. If @n_chars is -1, the
|
||||
* size reverts to the default entry size.
|
||||
**/
|
||||
void
|
||||
gtk_entry_set_width_chars (GtkEntry *entry,
|
||||
gint n_chars)
|
||||
{
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
|
||||
g_return_if_fail (GTK_IS_ENTRY (entry));
|
||||
|
||||
gtk_editable_set_width_chars (GTK_EDITABLE (priv->text), n_chars);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_get_width_chars:
|
||||
* @entry: a #GtkEntry
|
||||
*
|
||||
* Gets the value set by gtk_entry_set_width_chars().
|
||||
*
|
||||
* Returns: number of chars to request space for, or negative if unset
|
||||
**/
|
||||
gint
|
||||
gtk_entry_get_width_chars (GtkEntry *entry)
|
||||
{
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0);
|
||||
|
||||
return gtk_editable_get_width_chars (GTK_EDITABLE (priv->text));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_set_max_width_chars:
|
||||
* @entry: a #GtkEntry
|
||||
* @n_chars: the new desired maximum width, in characters
|
||||
*
|
||||
* Sets the desired maximum width in characters of @entry.
|
||||
*/
|
||||
void
|
||||
gtk_entry_set_max_width_chars (GtkEntry *entry,
|
||||
gint n_chars)
|
||||
{
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
|
||||
g_return_if_fail (GTK_IS_ENTRY (entry));
|
||||
|
||||
gtk_editable_set_max_width_chars (GTK_EDITABLE (priv->text), n_chars);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_get_max_width_chars:
|
||||
* @entry: a #GtkEntry
|
||||
*
|
||||
* Retrieves the desired maximum width of @entry, in characters.
|
||||
* See gtk_entry_set_max_width_chars().
|
||||
*
|
||||
* Returns: the maximum width of the entry, in characters
|
||||
*/
|
||||
gint
|
||||
gtk_entry_get_max_width_chars (GtkEntry *entry)
|
||||
{
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0);
|
||||
|
||||
return gtk_editable_get_max_width_chars (GTK_EDITABLE (priv->text));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_entry_set_has_frame:
|
||||
* @entry: a #GtkEntry
|
||||
@@ -3363,11 +3252,11 @@ void
|
||||
gtk_entry_set_placeholder_text (GtkEntry *entry,
|
||||
const gchar *text)
|
||||
{
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
|
||||
g_return_if_fail (GTK_IS_ENTRY (entry));
|
||||
|
||||
//FIXME
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_PLACEHOLDER_TEXT]);
|
||||
gtk_text_set_placeholder_text (GTK_TEXT (priv->text), text);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3384,10 +3273,11 @@ gtk_entry_set_placeholder_text (GtkEntry *entry,
|
||||
const gchar *
|
||||
gtk_entry_get_placeholder_text (GtkEntry *entry)
|
||||
{
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
||||
|
||||
//FIXME
|
||||
return NULL;
|
||||
return gtk_text_get_placeholder_text (GTK_TEXT (priv->text));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -184,27 +184,6 @@ void gtk_entry_set_activates_default (GtkEntry *entry,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_entry_get_activates_default (GtkEntry *entry);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_entry_set_width_chars (GtkEntry *entry,
|
||||
gint n_chars);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_entry_get_width_chars (GtkEntry *entry);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_entry_set_max_width_chars (GtkEntry *entry,
|
||||
gint n_chars);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_entry_get_max_width_chars (GtkEntry *entry);
|
||||
|
||||
/* Somewhat more convenient than the GtkEditable generic functions
|
||||
*/
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_entry_set_text (GtkEntry *entry,
|
||||
const gchar *text);
|
||||
/* returns a reference to the text */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const gchar* gtk_entry_get_text (GtkEntry *entry);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_entry_set_alignment (GtkEntry *entry,
|
||||
gfloat xalign);
|
||||
|
||||
+13
-13
@@ -1184,7 +1184,7 @@ gtk_entry_completion_complete (GtkEntryCompletion *completion)
|
||||
|
||||
g_free (completion->priv->case_normalized_key);
|
||||
|
||||
tmp = g_utf8_normalize (gtk_entry_get_text (GTK_ENTRY (completion->priv->entry)),
|
||||
tmp = g_utf8_normalize (gtk_editable_get_text (GTK_EDITABLE (completion->priv->entry)),
|
||||
-1, G_NORMALIZE_ALL);
|
||||
completion->priv->case_normalized_key = g_utf8_casefold (tmp, -1);
|
||||
g_free (tmp);
|
||||
@@ -1565,7 +1565,7 @@ gtk_entry_completion_match_selected (GtkEntryCompletion *completion,
|
||||
gchar *str = NULL;
|
||||
|
||||
gtk_tree_model_get (model, iter, completion->priv->text_column, &str, -1);
|
||||
gtk_entry_set_text (GTK_ENTRY (completion->priv->entry), str ? str : "");
|
||||
gtk_editable_set_text (GTK_EDITABLE (completion->priv->entry), str ? str : "");
|
||||
|
||||
/* move cursor to the end */
|
||||
gtk_editable_set_position (GTK_EDITABLE (completion->priv->entry), -1);
|
||||
@@ -1673,7 +1673,7 @@ gtk_entry_completion_real_insert_prefix (GtkEntryCompletion *completion,
|
||||
|
||||
prefix_len = g_utf8_strlen (prefix, -1);
|
||||
|
||||
key = gtk_entry_get_text (GTK_ENTRY (completion->priv->entry));
|
||||
key = gtk_editable_get_text (GTK_EDITABLE (completion->priv->entry));
|
||||
key_len = g_utf8_strlen (key, -1);
|
||||
|
||||
if (prefix_len > key_len)
|
||||
@@ -2005,7 +2005,7 @@ gtk_entry_completion_timeout (gpointer data)
|
||||
completion->priv->completion_timeout = 0;
|
||||
|
||||
if (completion->priv->filter_model &&
|
||||
g_utf8_strlen (gtk_entry_get_text (GTK_ENTRY (completion->priv->entry)), -1)
|
||||
g_utf8_strlen (gtk_editable_get_text (GTK_EDITABLE (completion->priv->entry)), -1)
|
||||
>= completion->priv->minimum_key_length)
|
||||
{
|
||||
gint matches;
|
||||
@@ -2160,8 +2160,8 @@ gtk_entry_completion_key_pressed (GtkEventControllerKey *controller,
|
||||
if (completion->priv->inline_selection &&
|
||||
completion->priv->completion_prefix)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (completion->priv->entry),
|
||||
completion->priv->completion_prefix);
|
||||
gtk_editable_set_text (GTK_EDITABLE (completion->priv->entry),
|
||||
completion->priv->completion_prefix);
|
||||
gtk_editable_set_position (GTK_EDITABLE (widget), -1);
|
||||
}
|
||||
}
|
||||
@@ -2189,7 +2189,7 @@ gtk_entry_completion_key_pressed (GtkEventControllerKey *controller,
|
||||
model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model));
|
||||
|
||||
if (completion->priv->completion_prefix == NULL)
|
||||
completion->priv->completion_prefix = g_strdup (gtk_entry_get_text (GTK_ENTRY (completion->priv->entry)));
|
||||
completion->priv->completion_prefix = g_strdup (gtk_editable_get_text (GTK_EDITABLE (completion->priv->entry)));
|
||||
|
||||
g_signal_emit_by_name (completion, "cursor-on-match", model,
|
||||
&child_iter, &entry_set);
|
||||
@@ -2206,8 +2206,8 @@ gtk_entry_completion_key_pressed (GtkEventControllerKey *controller,
|
||||
if (completion->priv->inline_selection &&
|
||||
completion->priv->completion_prefix)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (completion->priv->entry),
|
||||
completion->priv->completion_prefix);
|
||||
gtk_editable_set_text (GTK_EDITABLE (completion->priv->entry),
|
||||
completion->priv->completion_prefix);
|
||||
gtk_editable_set_position (GTK_EDITABLE (widget), -1);
|
||||
}
|
||||
}
|
||||
@@ -2238,10 +2238,10 @@ gtk_entry_completion_key_pressed (GtkEventControllerKey *controller,
|
||||
if (keyval == GDK_KEY_Escape)
|
||||
{
|
||||
if (completion->priv->completion_prefix)
|
||||
gtk_entry_set_text (GTK_ENTRY (completion->priv->entry),
|
||||
completion->priv->completion_prefix);
|
||||
gtk_editable_set_text (GTK_EDITABLE (completion->priv->entry),
|
||||
completion->priv->completion_prefix);
|
||||
else
|
||||
gtk_entry_set_text (GTK_ENTRY (completion->priv->entry), "");
|
||||
gtk_editable_set_text (GTK_EDITABLE (completion->priv->entry), "");
|
||||
}
|
||||
|
||||
/* Move the cursor to the end for Right/Esc */
|
||||
@@ -2312,7 +2312,7 @@ keypress_completion_out:
|
||||
completion->priv->text_column, &str,
|
||||
-1);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (widget), str);
|
||||
gtk_editable_set_text (GTK_EDITABLE (widget), str);
|
||||
|
||||
/* move the cursor to the end */
|
||||
gtk_editable_set_position (GTK_EDITABLE (widget), -1);
|
||||
|
||||
@@ -54,7 +54,7 @@ typedef struct _GtkEntryCompletionPrivate GtkEntryCompletionPrivate;
|
||||
* Note that @key is normalized and case-folded (see g_utf8_normalize()
|
||||
* and g_utf8_casefold()). If this is not appropriate, match functions
|
||||
* have access to the unmodified key via
|
||||
* `gtk_entry_get_text (GTK_ENTRY (gtk_entry_completion_get_entry ()))`.
|
||||
* `gtk_editable_get_text (GTK_EDITABLE (gtk_entry_completion_get_entry ()))`.
|
||||
*
|
||||
* Returns: %TRUE if @iter should be displayed as a possible completion
|
||||
* for @key
|
||||
|
||||
@@ -17,7 +17,20 @@
|
||||
* Author(s): Carlos Garnacho <carlosg@gnome.org>
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gtkeventcontrollerlegacy
|
||||
* @Short_description: Event controller for miscellaneous events
|
||||
* @Title: GtkEventControllerLegacy
|
||||
* @See_also: #GtkEventController
|
||||
*
|
||||
* #GtkEventControllerLegacy is an event controller that gives you
|
||||
* direct access to the event stream. It should only be used as a
|
||||
* last resort if none of the other event controllers or gestures
|
||||
* do the job.
|
||||
**/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkeventcontrollerlegacy.h"
|
||||
#include "gtkeventcontrollerprivate.h"
|
||||
#include "gtkmarshalers.h"
|
||||
@@ -67,11 +80,10 @@ gtk_event_controller_legacy_class_init (GtkEventControllerLegacyClass *klass)
|
||||
* @controller: the object which received the signal.
|
||||
* @event: the #GdkEvent which triggered this signal
|
||||
*
|
||||
* The GTK+ main loop will emit this signal for each GDK event delivered
|
||||
* to @controller.
|
||||
* Emitted for each GDK event delivered to @controller.
|
||||
*
|
||||
* Returns: %TRUE to stop other handlers from being invoked for the event
|
||||
* and the emission of this signal. %FALSE to propagate the event further.
|
||||
* and the emission of this signal. %FALSE to propagate the event further.
|
||||
*/
|
||||
signals[EVENT] =
|
||||
g_signal_new (I_("event"),
|
||||
@@ -91,6 +103,13 @@ gtk_event_controller_legacy_init (GtkEventControllerLegacy *controller)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_event_controller_legacy_new:
|
||||
*
|
||||
* Creates a new legacy event controller.
|
||||
*
|
||||
* Returns: the newly created event controller.
|
||||
*/
|
||||
GtkEventController *
|
||||
gtk_event_controller_legacy_new (void)
|
||||
{
|
||||
|
||||
@@ -2705,7 +2705,11 @@ open_dialog (GtkFileChooserButton *button)
|
||||
|
||||
gtk_widget_set_sensitive (priv->combo_box, FALSE);
|
||||
if (priv->dialog)
|
||||
gtk_window_present (GTK_WINDOW (priv->dialog));
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_window_present (GTK_WINDOW (priv->dialog));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
else
|
||||
gtk_native_dialog_show (GTK_NATIVE_DIALOG (priv->native));
|
||||
}
|
||||
|
||||
@@ -806,7 +806,7 @@ insert_text_callback (GtkFileChooserEntry *chooser_entry,
|
||||
(new_text_length > 0 &&
|
||||
*position <= 1 &&
|
||||
gtk_entry_get_text_length (GTK_ENTRY (chooser_entry)) >= 2 &&
|
||||
gtk_entry_get_text (GTK_ENTRY (chooser_entry))[1] == ':'))
|
||||
gtk_editable_get_text (GTK_EDITABLE (chooser_entry))[1] == ':'))
|
||||
{
|
||||
gtk_widget_error_bell (GTK_WIDGET (chooser_entry));
|
||||
g_signal_stop_emission_by_name (chooser_entry, "insert_text");
|
||||
@@ -825,7 +825,7 @@ delete_text_callback (GtkFileChooserEntry *chooser_entry,
|
||||
/* If deleting a drive letter, delete the colon, too */
|
||||
if (start_pos == 0 && end_pos == 1 &&
|
||||
gtk_entry_get_text_length (GTK_ENTRY (chooser_entry)) >= 2 &&
|
||||
gtk_entry_get_text (GTK_ENTRY (chooser_entry))[1] == ':')
|
||||
gtk_editable_get_text (GTK_EDITABLE (chooser_entry))[1] == ':')
|
||||
{
|
||||
g_signal_handlers_block_by_func (chooser_entry,
|
||||
G_CALLBACK (delete_text_callback),
|
||||
@@ -913,7 +913,7 @@ _gtk_file_chooser_entry_get_current_folder (GtkFileChooserEntry *chooser_entry)
|
||||
g_return_val_if_fail (GTK_IS_FILE_CHOOSER_ENTRY (chooser_entry), NULL);
|
||||
|
||||
return gtk_file_chooser_get_directory_for_text (chooser_entry,
|
||||
gtk_entry_get_text (GTK_ENTRY (chooser_entry)));
|
||||
gtk_editable_get_text (GTK_EDITABLE (chooser_entry)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -935,7 +935,7 @@ _gtk_file_chooser_entry_get_file_part (GtkFileChooserEntry *chooser_entry)
|
||||
|
||||
g_return_val_if_fail (GTK_IS_FILE_CHOOSER_ENTRY (chooser_entry), NULL);
|
||||
|
||||
text = gtk_entry_get_text (GTK_ENTRY (chooser_entry));
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (chooser_entry));
|
||||
last_slash = strrchr (text, G_DIR_SEPARATOR);
|
||||
if (last_slash)
|
||||
return last_slash + 1;
|
||||
@@ -1044,7 +1044,7 @@ _gtk_file_chooser_entry_select_filename (GtkFileChooserEntry *chooser_entry)
|
||||
|
||||
if (chooser_entry->action == GTK_FILE_CHOOSER_ACTION_SAVE)
|
||||
{
|
||||
str = gtk_entry_get_text (GTK_ENTRY (chooser_entry));
|
||||
str = gtk_editable_get_text (GTK_EDITABLE (chooser_entry));
|
||||
ext = g_strrstr (str, ".");
|
||||
|
||||
if (ext)
|
||||
|
||||
@@ -623,7 +623,9 @@ show_dialog (GtkFileChooserNative *self)
|
||||
G_CALLBACK (dialog_update_preview_cb),
|
||||
self);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_window_present (GTK_WINDOW (self->dialog));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+42
-34
@@ -452,8 +452,8 @@ static void gtk_file_chooser_widget_dispose (GObject *obj
|
||||
static void gtk_file_chooser_widget_realize (GtkWidget *widget);
|
||||
static void gtk_file_chooser_widget_map (GtkWidget *widget);
|
||||
static void gtk_file_chooser_widget_unmap (GtkWidget *widget);
|
||||
static void gtk_file_chooser_widget_hierarchy_changed (GtkWidget *widget,
|
||||
GtkWidget *previous_toplevel);
|
||||
static void gtk_file_chooser_widget_root (GtkWidget *widget);
|
||||
static void gtk_file_chooser_widget_unroot (GtkWidget *widget);
|
||||
static void gtk_file_chooser_widget_style_updated (GtkWidget *widget);
|
||||
static void gtk_file_chooser_widget_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display);
|
||||
@@ -969,7 +969,7 @@ new_folder_popover_active (GtkWidget *button,
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->new_folder_name_entry), "");
|
||||
gtk_editable_set_text (GTK_EDITABLE (priv->new_folder_name_entry), "");
|
||||
gtk_widget_set_sensitive (priv->new_folder_create_button, FALSE);
|
||||
gtk_file_chooser_error_stack_set_error (GTK_FILE_CHOOSER_ERROR_STACK (priv->new_folder_error_stack),
|
||||
FALSE,
|
||||
@@ -1098,14 +1098,14 @@ check_valid_child_name (GtkFileChooserWidget *impl,
|
||||
}
|
||||
|
||||
static void
|
||||
new_folder_name_changed (GtkEntry *entry,
|
||||
new_folder_name_changed (GtkEditable *editable,
|
||||
GtkFileChooserWidget *impl)
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
|
||||
check_valid_child_name (impl,
|
||||
priv->current_folder,
|
||||
gtk_entry_get_text (entry),
|
||||
gtk_editable_get_text (editable),
|
||||
TRUE,
|
||||
NULL,
|
||||
priv->new_folder_error_stack,
|
||||
@@ -1121,7 +1121,7 @@ new_folder_create_clicked (GtkButton *button,
|
||||
GFile *file;
|
||||
const gchar *name;
|
||||
|
||||
name = gtk_entry_get_text (GTK_ENTRY (priv->new_folder_name_entry));
|
||||
name = gtk_editable_get_text (GTK_EDITABLE (priv->new_folder_name_entry));
|
||||
file = g_file_get_child_for_display_name (priv->current_folder, name, &error);
|
||||
|
||||
gtk_popover_popdown (GTK_POPOVER (priv->new_folder_popover));
|
||||
@@ -1570,7 +1570,7 @@ rename_file_name_changed (GtkEntry *entry,
|
||||
|
||||
check_valid_child_name (impl,
|
||||
priv->current_folder,
|
||||
gtk_entry_get_text (entry),
|
||||
gtk_editable_get_text (GTK_EDITABLE (entry)),
|
||||
file_type == G_FILE_TYPE_DIRECTORY,
|
||||
priv->rename_file_source_file,
|
||||
priv->rename_file_error_stack,
|
||||
@@ -1594,7 +1594,7 @@ rename_file_rename_clicked (GtkButton *button,
|
||||
|
||||
gtk_popover_popdown (GTK_POPOVER (priv->rename_file_popover));
|
||||
|
||||
new_name = gtk_entry_get_text (GTK_ENTRY (priv->rename_file_name_entry));
|
||||
new_name = gtk_editable_get_text (GTK_EDITABLE (priv->rename_file_name_entry));
|
||||
dest = g_file_get_parent (priv->rename_file_source_file);
|
||||
|
||||
if (dest)
|
||||
@@ -1638,7 +1638,7 @@ rename_selected_cb (GtkTreeModel *model,
|
||||
rect.x, rect.y, &rect.x, &rect.y);
|
||||
|
||||
filename = g_file_get_basename (priv->rename_file_source_file);
|
||||
gtk_entry_set_text (GTK_ENTRY(priv->rename_file_name_entry), filename);
|
||||
gtk_editable_set_text (GTK_EDITABLE (priv->rename_file_name_entry), filename);
|
||||
g_free (filename);
|
||||
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (priv->rename_file_popover), &rect);
|
||||
@@ -2507,7 +2507,7 @@ location_entry_setup (GtkFileChooserWidget *impl)
|
||||
_gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (priv->location_entry), priv->action);
|
||||
_gtk_file_chooser_entry_set_file_filter (GTK_FILE_CHOOSER_ENTRY (priv->location_entry),
|
||||
priv->current_filter);
|
||||
gtk_entry_set_width_chars (GTK_ENTRY (priv->location_entry), 45);
|
||||
gtk_editable_set_width_chars (GTK_EDITABLE (priv->location_entry), 45);
|
||||
gtk_entry_set_activates_default (GTK_ENTRY (priv->location_entry), TRUE);
|
||||
gtk_widget_set_hexpand (priv->location_entry, TRUE);
|
||||
}
|
||||
@@ -3573,31 +3573,38 @@ toplevel_set_focus_cb (GtkWindow *window,
|
||||
* was last focused at the time our “should_respond” method gets called.
|
||||
*/
|
||||
static void
|
||||
gtk_file_chooser_widget_hierarchy_changed (GtkWidget *widget,
|
||||
GtkWidget *previous_toplevel)
|
||||
gtk_file_chooser_widget_root (GtkWidget *widget)
|
||||
{
|
||||
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (widget);
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
GtkWidget *toplevel;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->root (widget);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
||||
g_assert (priv->toplevel_set_focus_id == 0);
|
||||
priv->toplevel_set_focus_id = g_signal_connect (toplevel, "set-focus",
|
||||
G_CALLBACK (toplevel_set_focus_cb), impl);
|
||||
priv->toplevel_last_focus_widget = gtk_window_get_focus (GTK_WINDOW (toplevel));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_file_chooser_widget_unroot (GtkWidget *widget)
|
||||
{
|
||||
GtkFileChooserWidget *impl = GTK_FILE_CHOOSER_WIDGET (widget);
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
GtkWidget *toplevel;
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
||||
if (previous_toplevel &&
|
||||
priv->toplevel_set_focus_id != 0)
|
||||
if (toplevel && priv->toplevel_set_focus_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (previous_toplevel,
|
||||
priv->toplevel_set_focus_id);
|
||||
g_signal_handler_disconnect (toplevel, priv->toplevel_set_focus_id);
|
||||
priv->toplevel_set_focus_id = 0;
|
||||
priv->toplevel_last_focus_widget = NULL;
|
||||
}
|
||||
|
||||
if (gtk_widget_is_toplevel (toplevel))
|
||||
{
|
||||
g_assert (priv->toplevel_set_focus_id == 0);
|
||||
priv->toplevel_set_focus_id = g_signal_connect (toplevel, "set-focus",
|
||||
G_CALLBACK (toplevel_set_focus_cb), impl);
|
||||
priv->toplevel_last_focus_widget = gtk_window_get_focus (GTK_WINDOW (toplevel));
|
||||
}
|
||||
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->unroot (widget);
|
||||
}
|
||||
|
||||
/* Changes the icons wherever it is needed */
|
||||
@@ -5120,7 +5127,7 @@ update_chooser_entry (GtkFileChooserWidget *impl)
|
||||
if (change_entry && !priv->auto_selecting_first_row)
|
||||
{
|
||||
g_signal_handlers_block_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->location_entry), priv->browse_files_last_selected_name);
|
||||
gtk_editable_set_text (GTK_EDITABLE (priv->location_entry), priv->browse_files_last_selected_name);
|
||||
g_signal_handlers_unblock_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
|
||||
|
||||
if (priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
|
||||
@@ -5154,7 +5161,7 @@ update_chooser_entry (GtkFileChooserWidget *impl)
|
||||
priv->browse_files_last_selected_name = NULL;
|
||||
|
||||
g_signal_handlers_block_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->location_entry), "");
|
||||
gtk_editable_set_text (GTK_EDITABLE (priv->location_entry), "");
|
||||
g_signal_handlers_unblock_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
|
||||
return;
|
||||
}
|
||||
@@ -5168,7 +5175,7 @@ update_chooser_entry (GtkFileChooserWidget *impl)
|
||||
int len;
|
||||
gboolean clear_entry;
|
||||
|
||||
entry_text = gtk_entry_get_text (GTK_ENTRY (priv->location_entry));
|
||||
entry_text = gtk_editable_get_text (GTK_EDITABLE (priv->location_entry));
|
||||
len = strlen (entry_text);
|
||||
if (len != 0)
|
||||
{
|
||||
@@ -5192,7 +5199,7 @@ update_chooser_entry (GtkFileChooserWidget *impl)
|
||||
if (clear_entry)
|
||||
{
|
||||
g_signal_handlers_block_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->location_entry), "");
|
||||
gtk_editable_set_text (GTK_EDITABLE (priv->location_entry), "");
|
||||
g_signal_handlers_unblock_by_func (priv->location_entry, G_CALLBACK (location_entry_changed_cb), impl);
|
||||
}
|
||||
}
|
||||
@@ -5382,7 +5389,7 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
|
||||
priv->current_folder);
|
||||
|
||||
if (data->clear_entry)
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->location_entry), "");
|
||||
gtk_editable_set_text (GTK_EDITABLE (priv->location_entry), "");
|
||||
}
|
||||
|
||||
/* Create a new list model. This is slightly evil; we store the result value
|
||||
@@ -5491,7 +5498,7 @@ gtk_file_chooser_widget_set_current_name (GtkFileChooser *chooser,
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
|
||||
|
||||
pending_select_files_free (impl);
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->location_entry), name);
|
||||
gtk_editable_set_text (GTK_EDITABLE (priv->location_entry), name);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
@@ -5504,7 +5511,7 @@ gtk_file_chooser_widget_get_current_name (GtkFileChooser *chooser)
|
||||
priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER,
|
||||
NULL);
|
||||
|
||||
return g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->location_entry)));
|
||||
return g_strdup (gtk_editable_get_text (GTK_EDITABLE (priv->location_entry)));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -5685,7 +5692,7 @@ check_save_entry (GtkFileChooserWidget *impl,
|
||||
|
||||
chooser_entry = GTK_FILE_CHOOSER_ENTRY (priv->location_entry);
|
||||
|
||||
if (strlen (gtk_entry_get_text (GTK_ENTRY (chooser_entry))) == 0)
|
||||
if (strlen (gtk_editable_get_text (GTK_EDITABLE (chooser_entry))) == 0)
|
||||
{
|
||||
*file_ret = NULL;
|
||||
*is_well_formed_ret = TRUE;
|
||||
@@ -7790,7 +7797,7 @@ location_set_user_text (GtkFileChooserWidget *impl,
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = impl->priv;
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->location_entry), path);
|
||||
gtk_editable_set_text (GTK_EDITABLE (priv->location_entry), path);
|
||||
gtk_editable_set_position (GTK_EDITABLE (priv->location_entry), -1);
|
||||
}
|
||||
|
||||
@@ -7994,7 +8001,8 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
widget_class->realize = gtk_file_chooser_widget_realize;
|
||||
widget_class->map = gtk_file_chooser_widget_map;
|
||||
widget_class->unmap = gtk_file_chooser_widget_unmap;
|
||||
widget_class->hierarchy_changed = gtk_file_chooser_widget_hierarchy_changed;
|
||||
widget_class->root = gtk_file_chooser_widget_root;
|
||||
widget_class->unroot = gtk_file_chooser_widget_unroot;
|
||||
widget_class->style_updated = gtk_file_chooser_widget_style_updated;
|
||||
widget_class->display_changed = gtk_file_chooser_widget_display_changed;
|
||||
widget_class->measure = gtk_file_chooser_widget_measure;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
/**
|
||||
* SECTION:gtkfilterlistmodel
|
||||
* @title: GtkFilterListModel
|
||||
* @short_description: a #GListModel that filters its items
|
||||
* @short_description: A list model that filters its items
|
||||
* @see_also: #GListModel
|
||||
*
|
||||
* #GtkFilterListModel is a list model that filters a given other
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
/**
|
||||
* SECTION:gtkflattenlistmodel
|
||||
* @title: GtkFlattenListModel
|
||||
* @short_description: a #GListModel that flattens a given listmodel
|
||||
* @short_description: A list model that flattens a list of lists
|
||||
* @see_also: #GListModel
|
||||
*
|
||||
* #GtkFlattenListModel is a list model that takes a list model containing
|
||||
|
||||
@@ -995,7 +995,9 @@ gtk_font_button_clicked (GtkButton *button,
|
||||
gtk_font_chooser_set_font_desc (font_dialog, priv->font_desc);
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_window_present (GTK_WINDOW (priv->font_dialog));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -420,7 +420,7 @@ output_cb (GtkSpinButton *spin,
|
||||
adjustment = gtk_spin_button_get_adjustment (spin);
|
||||
value = gtk_adjustment_get_value (adjustment);
|
||||
text = g_strdup_printf ("%2.4g", value);
|
||||
gtk_spin_button_set_text (spin, text);
|
||||
gtk_editable_set_text (GTK_EDITABLE (spin), text);
|
||||
g_free (text);
|
||||
|
||||
return TRUE;
|
||||
@@ -844,7 +844,7 @@ gtk_font_chooser_widget_init (GtkFontChooserWidget *fontchooser)
|
||||
priv->language = pango_language_get_default ();
|
||||
|
||||
/* Set default preview text */
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->preview), priv->preview_text);
|
||||
gtk_editable_set_text (GTK_EDITABLE (priv->preview), priv->preview_text);
|
||||
|
||||
gtk_font_chooser_widget_update_preview_attributes (fontchooser);
|
||||
|
||||
@@ -2366,7 +2366,7 @@ gtk_font_chooser_widget_set_preview_text (GtkFontChooserWidget *fontchooser,
|
||||
g_free (priv->preview_text);
|
||||
priv->preview_text = g_strdup (text);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->preview), text);
|
||||
gtk_editable_set_text (GTK_EDITABLE (priv->preview), text);
|
||||
|
||||
g_object_notify (G_OBJECT (fontchooser), "preview-text");
|
||||
|
||||
|
||||
+4
-3
@@ -1755,11 +1755,12 @@ surface_state_changed (GtkWidget *widget)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_header_bar_hierarchy_changed (GtkWidget *widget,
|
||||
GtkWidget *previous_toplevel)
|
||||
gtk_header_bar_root (GtkWidget *widget)
|
||||
{
|
||||
GtkHeaderBar *bar = GTK_HEADER_BAR (widget);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_header_bar_parent_class)->root (widget);
|
||||
|
||||
_gtk_header_bar_update_window_buttons (bar);
|
||||
}
|
||||
|
||||
@@ -1779,7 +1780,7 @@ gtk_header_bar_class_init (GtkHeaderBarClass *class)
|
||||
widget_class->measure = gtk_header_bar_measure;
|
||||
widget_class->realize = gtk_header_bar_realize;
|
||||
widget_class->unrealize = gtk_header_bar_unrealize;
|
||||
widget_class->hierarchy_changed = gtk_header_bar_hierarchy_changed;
|
||||
widget_class->root = gtk_header_bar_root;
|
||||
|
||||
container_class->add = gtk_header_bar_add;
|
||||
container_class->remove = gtk_header_bar_remove;
|
||||
|
||||
+7
-58
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "gtkimcontextime.h"
|
||||
#include "gtkimmoduleprivate.h"
|
||||
#include "gtkroot.h"
|
||||
|
||||
#include "imm-extra.h"
|
||||
|
||||
@@ -121,9 +122,6 @@ gtk_im_context_ime_message_filter (GdkWin32Display *display,
|
||||
static void get_window_position (GdkSurface *win,
|
||||
gint *x,
|
||||
gint *y);
|
||||
static void cb_client_widget_hierarchy_changed (GtkWidget *widget,
|
||||
GtkWidget *widget2,
|
||||
GtkIMContextIME *context_ime);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkIMContextIME, gtk_im_context_ime, GTK_TYPE_IM_CONTEXT,
|
||||
gtk_im_module_ensure_extension_point ();
|
||||
@@ -157,7 +155,6 @@ static void
|
||||
gtk_im_context_ime_init (GtkIMContextIME *context_ime)
|
||||
{
|
||||
context_ime->client_surface = NULL;
|
||||
context_ime->toplevel = NULL;
|
||||
context_ime->use_preedit = TRUE;
|
||||
context_ime->preediting = FALSE;
|
||||
context_ime->opened = FALSE;
|
||||
@@ -687,7 +684,6 @@ gtk_im_context_ime_focus_in (GtkIMContext *context)
|
||||
{
|
||||
gdk_win32_display_add_filter (gdk_surface_get_display (toplevel),
|
||||
gtk_im_context_ime_message_filter, context_ime);
|
||||
context_ime->toplevel = toplevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -696,19 +692,6 @@ gtk_im_context_ime_focus_in (GtkIMContext *context)
|
||||
return;
|
||||
}
|
||||
|
||||
/* trace reparenting (probably no need) */
|
||||
gdk_surface_get_user_data (context_ime->client_surface, (gpointer) & widget);
|
||||
if (GTK_IS_WIDGET (widget))
|
||||
{
|
||||
g_signal_connect (widget, "hierarchy-changed",
|
||||
G_CALLBACK (cb_client_widget_hierarchy_changed),
|
||||
context_ime);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* warning? */
|
||||
}
|
||||
|
||||
/* restore preedit context */
|
||||
ImmSetConversionStatus (himc,
|
||||
context_ime->priv->conversion_mode,
|
||||
@@ -794,15 +777,6 @@ gtk_im_context_ime_focus_out (GtkIMContext *context)
|
||||
context_ime->preediting = FALSE;
|
||||
}
|
||||
|
||||
/* remove signal handler */
|
||||
gdk_surface_get_user_data (context_ime->client_surface, (gpointer) & widget);
|
||||
if (GTK_IS_WIDGET (widget))
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func
|
||||
(G_OBJECT (widget),
|
||||
G_CALLBACK (cb_client_widget_hierarchy_changed), context_ime);
|
||||
}
|
||||
|
||||
/* remove event fileter */
|
||||
toplevel = gdk_surface_get_toplevel (context_ime->client_surface);
|
||||
if (GDK_IS_SURFACE (toplevel))
|
||||
@@ -810,7 +784,6 @@ gtk_im_context_ime_focus_out (GtkIMContext *context)
|
||||
gdk_win32_display_remove_filter (gdk_surface_get_display (toplevel),
|
||||
gtk_im_context_ime_message_filter,
|
||||
context_ime);
|
||||
context_ime->toplevel = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -906,9 +879,9 @@ gtk_im_context_ime_set_preedit_font (GtkIMContext *context)
|
||||
if (!context_ime->client_surface)
|
||||
return;
|
||||
|
||||
gdk_surface_get_user_data (context_ime->client_surface, (gpointer) &widget);
|
||||
if (!GTK_IS_WIDGET (widget))
|
||||
return;
|
||||
widget = gtk_root_get_for_surface (context_ime->client_surface);
|
||||
if (!widget)
|
||||
return
|
||||
|
||||
hwnd = gdk_win32_surface_get_impl_hwnd (context_ime->client_surface);
|
||||
himc = ImmGetContext (hwnd);
|
||||
@@ -1017,6 +990,7 @@ gtk_im_context_ime_message_filter (GdkWin32Display *display,
|
||||
GtkIMContextIME *context_ime;
|
||||
HWND hwnd;
|
||||
HIMC himc;
|
||||
GdkSurface *toplevel;
|
||||
GdkWin32MessageFilterReturn retval = GDK_WIN32_MESSAGE_FILTER_CONTINUE;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_IM_CONTEXT_IME (data), retval);
|
||||
@@ -1026,7 +1000,8 @@ gtk_im_context_ime_message_filter (GdkWin32Display *display,
|
||||
if (!context_ime->focus)
|
||||
return retval;
|
||||
|
||||
if (gdk_win32_surface_get_impl_hwnd (context_ime->toplevel) != msg->hwnd)
|
||||
toplevel = gdk_surface_get_toplevel (context_ime->client_surface);
|
||||
if (gdk_win32_surface_get_impl_hwnd (toplevel) != msg->hwnd)
|
||||
return retval;
|
||||
|
||||
hwnd = gdk_win32_surface_get_impl_hwnd (context_ime->client_surface);
|
||||
@@ -1163,29 +1138,3 @@ get_window_position (GdkSurface *surface, gint *x, gint *y)
|
||||
if (parent && parent != toplevel)
|
||||
get_window_position (parent, x, y);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* probably, this handler isn't needed.
|
||||
*/
|
||||
static void
|
||||
cb_client_widget_hierarchy_changed (GtkWidget *widget,
|
||||
GtkWidget *widget2,
|
||||
GtkIMContextIME *context_ime)
|
||||
{
|
||||
GdkSurface *new_toplevel;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
g_return_if_fail (GTK_IS_IM_CONTEXT_IME (context_ime));
|
||||
|
||||
if (!context_ime->client_surface)
|
||||
return;
|
||||
if (!context_ime->focus)
|
||||
return;
|
||||
|
||||
new_toplevel = gdk_surface_get_toplevel (context_ime->client_surface);
|
||||
if (context_ime->toplevel == new_toplevel)
|
||||
return;
|
||||
|
||||
context_ime->toplevel = new_toplevel;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ struct _GtkIMContextIME
|
||||
GtkIMContext object;
|
||||
|
||||
GdkSurface *client_surface;
|
||||
GdkSurface *toplevel;
|
||||
guint use_preedit : 1;
|
||||
guint preediting : 1;
|
||||
guint opened : 1;
|
||||
|
||||
@@ -1476,7 +1476,7 @@ gtk_im_context_simple_add_table (GtkIMContextSimple *context_simple,
|
||||
G_UNLOCK (global_tables);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* gtk_im_context_simple_add_compose_file:
|
||||
* @context_simple: A #GtkIMContextSimple
|
||||
* @compose_file: The path of compose file
|
||||
|
||||
+7
-22
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "gtkimcontextxim.h"
|
||||
#include "gtkimmoduleprivate.h"
|
||||
#include "gtkroot.h"
|
||||
|
||||
#include "gtk/gtkintl.h"
|
||||
|
||||
@@ -1520,38 +1521,22 @@ update_in_toplevel (GtkIMContextXIM *context_xim)
|
||||
*/
|
||||
static void
|
||||
on_client_widget_hierarchy_changed (GtkWidget *widget,
|
||||
GtkWidget *old_toplevel,
|
||||
GParamSpec *pspec,
|
||||
GtkIMContextXIM *context_xim)
|
||||
{
|
||||
update_in_toplevel (context_xim);
|
||||
}
|
||||
|
||||
/* Finds the GtkWidget that owns the window, or if none, the
|
||||
* widget owning the nearest parent that has a widget.
|
||||
*/
|
||||
static GtkWidget *
|
||||
widget_for_window (GdkSurface *window)
|
||||
{
|
||||
while (window)
|
||||
{
|
||||
gpointer user_data;
|
||||
gdk_surface_get_user_data (window, &user_data);
|
||||
if (user_data)
|
||||
return user_data;
|
||||
|
||||
window = gdk_surface_get_parent (window);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Called when context_xim->client_surface changes; takes care of
|
||||
* removing and/or setting up our watches for the toplevel
|
||||
*/
|
||||
static void
|
||||
update_client_widget (GtkIMContextXIM *context_xim)
|
||||
{
|
||||
GtkWidget *new_client_widget = widget_for_window (context_xim->client_surface);
|
||||
GtkWidget *new_client_widget = NULL;
|
||||
|
||||
if (context_xim->client_surface)
|
||||
new_client_widget = gtk_root_get_for_surface (context_xim->client_surface);
|
||||
|
||||
if (new_client_widget != context_xim->client_widget)
|
||||
{
|
||||
@@ -1564,7 +1549,7 @@ update_client_widget (GtkIMContextXIM *context_xim)
|
||||
context_xim->client_widget = new_client_widget;
|
||||
if (context_xim->client_widget)
|
||||
{
|
||||
g_signal_connect (context_xim->client_widget, "hierarchy-changed",
|
||||
g_signal_connect (context_xim->client_widget, "notify::root",
|
||||
G_CALLBACK (on_client_widget_hierarchy_changed),
|
||||
context_xim);
|
||||
}
|
||||
|
||||
+3
-1
@@ -1151,7 +1151,9 @@ gtk_info_bar_set_revealed (GtkInfoBar *info_bar,
|
||||
* gtk_info_bar_get_revealed:
|
||||
* @info_bar: a #GtkInfoBar
|
||||
*
|
||||
* Returns: the current value of the #GtkInfoBar:revealed property.
|
||||
* Returns whether the info bar is currently revealed.
|
||||
*
|
||||
* Returns: the current value of the #GtkInfoBar:revealed property
|
||||
*/
|
||||
gboolean
|
||||
gtk_info_bar_get_revealed (GtkInfoBar *info_bar)
|
||||
|
||||
@@ -1,295 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkinvisibleprivate.h"
|
||||
|
||||
#include "gtkintl.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkroot.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:gtkinvisible
|
||||
* @Short_description: A widget which is not displayed
|
||||
* @Title: GtkInvisible
|
||||
*
|
||||
* The #GtkInvisible widget is used internally in GTK+, and is probably not
|
||||
* very useful for application developers.
|
||||
*
|
||||
* It is used for reliable pointer grabs and selection handling in the code
|
||||
* for drag-and-drop.
|
||||
*/
|
||||
|
||||
|
||||
struct _GtkInvisiblePrivate
|
||||
{
|
||||
GdkDisplay *display;
|
||||
gboolean has_user_ref_count;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DISPLAY,
|
||||
LAST_ARG
|
||||
};
|
||||
|
||||
static void gtk_invisible_destroy (GtkWidget *widget);
|
||||
static void gtk_invisible_realize (GtkWidget *widget);
|
||||
static void gtk_invisible_style_updated (GtkWidget *widget);
|
||||
static void gtk_invisible_show (GtkWidget *widget);
|
||||
static void gtk_invisible_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_invisible_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_invisible_constructed (GObject *object);
|
||||
|
||||
static GdkDisplay *
|
||||
gtk_invisible_root_get_display (GtkRoot *root)
|
||||
{
|
||||
GtkInvisible *invisible = GTK_INVISIBLE (root);
|
||||
|
||||
return invisible->priv->display;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_invisible_root_interface_init (GtkRootInterface *iface)
|
||||
{
|
||||
iface->get_display = gtk_invisible_root_get_display;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkInvisible, gtk_invisible, GTK_TYPE_WIDGET,
|
||||
G_ADD_PRIVATE (GtkInvisible)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ROOT,
|
||||
gtk_invisible_root_interface_init))
|
||||
|
||||
static void
|
||||
gtk_invisible_class_init (GtkInvisibleClass *class)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
gobject_class = (GObjectClass*) class;
|
||||
|
||||
widget_class->realize = gtk_invisible_realize;
|
||||
widget_class->style_updated = gtk_invisible_style_updated;
|
||||
widget_class->show = gtk_invisible_show;
|
||||
widget_class->destroy = gtk_invisible_destroy;
|
||||
|
||||
gobject_class->set_property = gtk_invisible_set_property;
|
||||
gobject_class->get_property = gtk_invisible_get_property;
|
||||
gobject_class->constructed = gtk_invisible_constructed;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_DISPLAY,
|
||||
g_param_spec_object ("display",
|
||||
P_("Display"),
|
||||
P_("The display where this window will be displayed"),
|
||||
GDK_TYPE_DISPLAY,
|
||||
GTK_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_invisible_init (GtkInvisible *invisible)
|
||||
{
|
||||
GtkInvisiblePrivate *priv;
|
||||
|
||||
invisible->priv = gtk_invisible_get_instance_private (invisible);
|
||||
priv = invisible->priv;
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (invisible), TRUE);
|
||||
|
||||
g_object_ref_sink (invisible);
|
||||
|
||||
priv->has_user_ref_count = TRUE;
|
||||
priv->display = gdk_display_get_default ();
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_invisible_destroy (GtkWidget *widget)
|
||||
{
|
||||
GtkInvisible *invisible = GTK_INVISIBLE (widget);
|
||||
GtkInvisiblePrivate *priv = invisible->priv;
|
||||
|
||||
if (priv->has_user_ref_count)
|
||||
{
|
||||
priv->has_user_ref_count = FALSE;
|
||||
g_object_unref (invisible);
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_invisible_parent_class)->destroy (widget);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_invisible_new_for_display:
|
||||
* @display: a #GdkDisplay which identifies on which
|
||||
* the new #GtkInvisible will be created.
|
||||
*
|
||||
* Creates a new #GtkInvisible object for a specified display.
|
||||
*
|
||||
* Returns: a newly created #GtkInvisible object
|
||||
**/
|
||||
GtkWidget*
|
||||
gtk_invisible_new_for_display (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_INVISIBLE, "display", display, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_invisible_new:
|
||||
*
|
||||
* Creates a new #GtkInvisible.
|
||||
*
|
||||
* Returns: a new #GtkInvisible.
|
||||
**/
|
||||
GtkWidget*
|
||||
gtk_invisible_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_INVISIBLE, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_invisible_set_display:
|
||||
* @invisible: a #GtkInvisible.
|
||||
* @display: a #GdkDisplay.
|
||||
*
|
||||
* Sets the #GdkDisplay where the #GtkInvisible object will be displayed.
|
||||
**/
|
||||
void
|
||||
gtk_invisible_set_display (GtkInvisible *invisible,
|
||||
GdkDisplay *display)
|
||||
{
|
||||
GtkInvisiblePrivate *priv;
|
||||
GtkWidget *widget;
|
||||
GdkDisplay *previous_display;
|
||||
gboolean was_realized;
|
||||
|
||||
g_return_if_fail (GTK_IS_INVISIBLE (invisible));
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
|
||||
priv = invisible->priv;
|
||||
|
||||
if (display == priv->display)
|
||||
return;
|
||||
|
||||
widget = GTK_WIDGET (invisible);
|
||||
|
||||
previous_display = priv->display;
|
||||
was_realized = gtk_widget_get_realized (widget);
|
||||
|
||||
if (was_realized)
|
||||
gtk_widget_unrealize (widget);
|
||||
|
||||
priv->display = display;
|
||||
if (display != previous_display)
|
||||
_gtk_widget_propagate_display_changed (widget, previous_display);
|
||||
g_object_notify (G_OBJECT (invisible), "display");
|
||||
|
||||
if (was_realized)
|
||||
gtk_widget_realize (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_invisible_realize (GtkWidget *widget)
|
||||
{
|
||||
GdkSurface *surface;
|
||||
|
||||
surface = gdk_surface_new_temp (gtk_widget_get_display (widget));
|
||||
gtk_widget_set_surface (widget, surface);
|
||||
gtk_widget_register_surface (widget, surface);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_invisible_parent_class)->realize (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_invisible_style_updated (GtkWidget *widget)
|
||||
{
|
||||
/* Don't chain up to parent implementation */
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_invisible_show (GtkWidget *widget)
|
||||
{
|
||||
_gtk_widget_set_visible_flag (widget, TRUE);
|
||||
gtk_widget_map (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_invisible_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkInvisible *invisible = GTK_INVISIBLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
gtk_invisible_set_display (invisible, g_value_get_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_invisible_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkInvisible *invisible = GTK_INVISIBLE (object);
|
||||
GtkInvisiblePrivate *priv = invisible->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
g_value_set_object (value, priv->display);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* We use a constructor here so that we can realize the invisible on
|
||||
* the correct display after the “display” property has been set
|
||||
*/
|
||||
static void
|
||||
gtk_invisible_constructed (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (gtk_invisible_parent_class)->constructed (object);
|
||||
|
||||
gtk_widget_realize (GTK_WIDGET (object));
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_INVISIBLE_H__
|
||||
#define __GTK_INVISIBLE_H__
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_INVISIBLE (gtk_invisible_get_type ())
|
||||
#define GTK_INVISIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_INVISIBLE, GtkInvisible))
|
||||
#define GTK_INVISIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_INVISIBLE, GtkInvisibleClass))
|
||||
#define GTK_IS_INVISIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_INVISIBLE))
|
||||
#define GTK_IS_INVISIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_INVISIBLE))
|
||||
#define GTK_INVISIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_INVISIBLE, GtkInvisibleClass))
|
||||
|
||||
|
||||
typedef struct _GtkInvisible GtkInvisible;
|
||||
typedef struct _GtkInvisiblePrivate GtkInvisiblePrivate;
|
||||
typedef struct _GtkInvisibleClass GtkInvisibleClass;
|
||||
|
||||
struct _GtkInvisible
|
||||
{
|
||||
GtkWidget widget;
|
||||
|
||||
/*< private >*/
|
||||
GtkInvisiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkInvisibleClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gtk_reserved1) (void);
|
||||
void (*_gtk_reserved2) (void);
|
||||
void (*_gtk_reserved3) (void);
|
||||
void (*_gtk_reserved4) (void);
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_invisible_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget* gtk_invisible_new (void);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget* gtk_invisible_new_for_display(GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_invisible_set_display (GtkInvisible *invisible,
|
||||
GdkDisplay *display);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_INVISIBLE_H__ */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user