Compare commits

..

1 Commits

Author SHA1 Message Date
Matthias Clasen
5bbe811090 wip: Unbox css values
Keep css values unboxed in the values structs, for faster access
to these values, where it makes sense.
2022-09-14 00:08:36 -04:00
900 changed files with 25980 additions and 31335 deletions

View File

@@ -192,7 +192,6 @@ macos:
only:
- branches@GNOME/gtk
stage: build
allow_failure: true
tags:
- macos
needs: []

79
NEWS
View File

@@ -1,82 +1,3 @@
Overview of Changes in 4.9.1, dd-mm-yyyy
========================================
Note that deprecations are an early outlook
at changes that will appear in an eventual
GTK 5 release, which is still far away.
* GtkTreeView, GtkIconView, GtkComboBox and
auxiliary classes have been deprecated
* GtkEntryCompletion has been deprecated
* GtkStyleContext has been deprecated
* gtk_render_ and gtk_snapshot_render_ APIs
have been deprecated
* GtkAppChooser widgets hae been deprecated
* GtkMountOperation:
- Fix the dialog to look reasonable
- Make it work under non-X11
* GtkStringSorter:
- Support different collation methods
* Accessibility:
- Introduce GtkAccessibleRange and implement it
* Debugging:
- Unify formatting for debug output
- Make make debug options available in
non-debug builds
* Translation updates:
Abkhazian
Basque
Bulgarian
Croatian
Friulian
Georgian
German
Hungarian
Russian
Turkish
Overview of Changes in 4.8.1, 16-09-2022
========================================
* Input:
- Fix problems with input method interactions that caused
dead keys not to work
- Accept single-key compose sequences (these are used with
some keyboard layouts)
* GtkColumnView:
- Flip column order in right-to-left context
* GtkGridView:
- Fix problems with rubberbanding
* GtkFileChooser:
- Fix positioning of popovers in the places view
- Make ~ and . keyboard shortcuts work again
* gsk:
- Make glyph upload more similar to icons
* Make file transfer via portals work, this fixes file
copy/paste and dnd in flatpaks
* Translation updates:
Catalan
Chinese (China)
Chinese (Taiwan)
Latvian
Overview of Changes in 4.8.0, 06-09-2022
========================================

View File

@@ -0,0 +1,45 @@
#!/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_bindir = sys.argv[5]
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
gtk_mediamodule_dir = os.path.join(gtk_moduledir, 'media')
print('Compiling GSettings schemas...')
glib_compile_schemas = subprocess.check_output(['pkg-config',
'--variable=glib_compile_schemas',
'gio-2.0']).strip()
if not os.path.exists(glib_compile_schemas):
# pkg-config variables only available since GLib 2.62.0.
glib_compile_schemas = 'glib-compile-schemas'
subprocess.call([glib_compile_schemas,
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
print('Updating icon cache...')
update_icon_cache = os.path.join(gtk_bindir, 'gtk4-update-icon-cache')
subprocess.call([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)
gio_querymodules = subprocess.check_output(['pkg-config',
'--variable=gio_querymodules',
'gio-2.0']).strip()
if not os.path.exists(gio_querymodules):
# pkg-config variables only available since GLib 2.62.0.
gio_querymodules = 'gio-querymodules'
subprocess.call([gio_querymodules, gtk_printmodule_dir])
print('Updating module cache for media backends...')
os.makedirs(gtk_mediamodule_dir, exist_ok=True)
subprocess.call([gio_querymodules, gtk_mediamodule_dir])

View File

@@ -21,8 +21,6 @@
#include "constraint-editor.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
struct _ConstraintEditor
{
GtkWidget parent_instance;

View File

@@ -21,8 +21,6 @@
#include "guide-editor.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
struct _GuideEditor
{
GtkWidget parent_instance;

View File

@@ -11,8 +11,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum
{
ICON_NAME_COL,

View File

@@ -1,16 +1,20 @@
/* Theming/CSS Accordion
*
* A simple accordion demo written using CSS transitions and multiple backgrounds
*
*/
#include <gtk/gtk.h>
static void
destroy_provider (GtkWidget *window,
GtkStyleProvider *provider)
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
{
gtk_style_context_remove_provider_for_display (gtk_widget_get_display (window), provider);
GtkWidget *child;
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
apply_css (child, provider);
}
GtkWidget *
@@ -20,8 +24,8 @@ do_css_accordion (GtkWidget *do_widget)
if (!window)
{
GtkWidget *container, *styled_box, *child;
GtkCssProvider *provider;
GtkWidget *container, *child;
GtkStyleProvider *provider;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "CSS Accordion");
@@ -29,13 +33,10 @@ do_css_accordion (GtkWidget *do_widget)
gtk_window_set_default_size (GTK_WINDOW (window), 600, 300);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
styled_box = gtk_frame_new (NULL);
gtk_window_set_child (GTK_WINDOW (window), styled_box);
gtk_widget_add_css_class (styled_box, "accordion");
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
gtk_widget_set_valign (container, GTK_ALIGN_CENTER);
gtk_frame_set_child (GTK_FRAME (styled_box), container);
gtk_window_set_child (GTK_WINDOW (window), container);
child = gtk_button_new_with_label ("This");
gtk_box_append (GTK_BOX (container), child);
@@ -55,16 +56,10 @@ do_css_accordion (GtkWidget *do_widget)
child = gtk_button_new_with_label (":-)");
gtk_box_append (GTK_BOX (container), child);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/css_accordion/css_accordion.css");
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/css_accordion/css_accordion.css");
gtk_style_context_add_provider_for_display (gtk_widget_get_display (window),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_signal_connect (window, "destroy",
G_CALLBACK (destroy_provider), provider);
g_object_unref (provider);
apply_css (window, provider);
}
if (!gtk_widget_get_visible (window))

View File

@@ -1,13 +1,13 @@
.accordion, .accordion * {
all: unset;
@import url("resource://css_accordion/reset.css");
* {
transition-property: color, background-color, border-color, background-image, padding, border-width;
transition-duration: 1s;
font: 20px Cantarell;
}
.accordion {
window {
background: linear-gradient(153deg, #151515, #151515 5px, transparent 5px) 0 0,
linear-gradient(333deg, #151515, #151515 5px, transparent 5px) 10px 5px,
linear-gradient(153deg, #222, #222 5px, transparent 5px) 0 5px,
@@ -18,7 +18,7 @@
background-size: 20px 20px;
}
.accordion button {
button {
color: black;
background-color: #bbb;
border-style: solid;
@@ -28,25 +28,25 @@
padding: 12px 4px;
}
.accordion button:first-child {
button:first-child {
border-radius: 5px 0 0 5px;
}
.accordion button:last-child {
button:last-child {
border-radius: 0 5px 5px 0;
border-width: 2px;
}
.accordion button:hover {
button:hover {
padding: 12px 48px;
background-color: #4870bc;
}
.accordion button *:hover {
button *:hover {
color: white;
}
.accordion button:hover:active,
.accordion button:active {
button:hover:active,
button:active {
background-color: #993401;
}

View File

@@ -6,8 +6,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,

View File

@@ -6,8 +6,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,

View File

@@ -7,8 +7,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,

View File

@@ -5,8 +5,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,

View File

@@ -24,6 +24,7 @@
</gresource>
<gresource prefix="/css_accordion">
<file>css_accordion.css</file>
<file>reset.css</file>
</gresource>
<gresource prefix="/css_basics">
<file>css_basics.css</file>

View File

@@ -11,7 +11,6 @@
#include <gtk/gtk.h>
G_DECLARE_FINAL_TYPE (CanvasItem, canvas_item, CANVAS, ITEM, GtkWidget)
struct _CanvasItem {
@@ -25,9 +24,6 @@ struct _CanvasItem {
double delta;
GtkWidget *editor;
GtkStyleProvider *provider;
char *css_class;
};
struct _CanvasItemClass {
@@ -38,41 +34,32 @@ G_DEFINE_TYPE (CanvasItem, canvas_item, GTK_TYPE_WIDGET)
static int n_items = 0;
static void
unstyle_item (CanvasItem *item)
{
if (item->provider)
{
gtk_style_context_remove_provider_for_display (gtk_widget_get_display (item->label), item->provider);
g_clear_object (&item->provider);
}
if (item->css_class)
{
gtk_widget_remove_css_class (item->label, item->css_class);
g_clear_pointer (&item->css_class, g_free);
}
}
static void
set_color (CanvasItem *item,
GdkRGBA *color)
{
char *css;
char *str;
GtkStyleContext *context;
GtkCssProvider *provider;
const char *name;
unstyle_item (item);
const char *old_class;
str = gdk_rgba_to_string (color);
name = gtk_widget_get_name (item->label);
css = g_strdup_printf ("#%s { background: %s; }", name, str);
css = g_strdup_printf ("* { background: %s; }", str);
context = gtk_widget_get_style_context (item->label);
provider = g_object_get_data (G_OBJECT (context), "style-provider");
if (provider)
gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (provider));
old_class = (const char *)g_object_get_data (G_OBJECT (item->label), "css-class");
if (old_class)
gtk_widget_remove_css_class (item->label, old_class);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider_for_display (gtk_widget_get_display (item->label), GTK_STYLE_PROVIDER (provider), 700);
item->provider = GTK_STYLE_PROVIDER (provider);
gtk_style_context_add_provider (gtk_widget_get_style_context (item->label), GTK_STYLE_PROVIDER (provider), 800);
g_object_set_data_full (G_OBJECT (context), "style-provider", provider, g_object_unref);
g_free (str);
g_free (css);
@@ -82,10 +69,21 @@ static void
set_css (CanvasItem *item,
const char *class)
{
unstyle_item (item);
GtkStyleContext *context;
GtkCssProvider *provider;
const char *old_class;
context = gtk_widget_get_style_context (item->label);
provider = g_object_get_data (G_OBJECT (context), "style-provider");
if (provider)
gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (provider));
old_class = (const char *)g_object_get_data (G_OBJECT (item->label), "css-class");
if (old_class)
gtk_widget_remove_css_class (item->label, old_class);
g_object_set_data_full (G_OBJECT (item->label), "css-class", g_strdup (class), g_free);
gtk_widget_add_css_class (item->label, class);
item->css_class = g_strdup (class);
}
static gboolean
@@ -724,7 +722,6 @@ do_dnd (GtkWidget *do_widget)
int i;
int x, y;
GtkCssProvider *provider;
GString *css;
button = gtk_color_button_new ();
g_object_unref (g_object_ref_sink (button));
@@ -736,18 +733,6 @@ do_dnd (GtkWidget *do_widget)
800);
g_object_unref (provider);
css = g_string_new ("");
for (i = 0; colors[i]; i++)
g_string_append_printf (css, ".canvasitem.%s { background: %s; }\n", colors[i], colors[i]);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css->str, css->len);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
g_object_unref (provider);
g_string_free (css, TRUE);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@@ -14,8 +14,6 @@
#include <string.h>
#include <stdlib.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
typedef struct
{
int number;

View File

@@ -8,8 +8,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* Creates a tree model containing the completions */
static GtkTreeModel *
create_completion_model (void)

View File

@@ -9,8 +9,6 @@
#include <gtk/gtk.h>
#include <stdlib.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum {
WIDTH_COLUMN,
HEIGHT_COLUMN,

View File

@@ -21,75 +21,6 @@
#include "script-names.h"
#include "language-names.h"
/* {{{ ScriptLang object */
G_DECLARE_FINAL_TYPE (ScriptLang, script_lang, SCRIPT, LANG, GObject)
struct _ScriptLang
{
GObject parent;
char *langname;
unsigned int script_index;
unsigned int lang_index;
hb_tag_t lang_tag;
};
struct _ScriptLangClass
{
GObjectClass parent_class;
};
G_DEFINE_TYPE (ScriptLang, script_lang, G_TYPE_OBJECT)
static void
script_lang_init (ScriptLang *self)
{
}
static void
script_lang_finalize (GObject *object)
{
ScriptLang *self = SCRIPT_LANG (object);
g_free (self->langname);
G_OBJECT_CLASS (script_lang_parent_class)->finalize (object);
}
static void
script_lang_class_init (ScriptLangClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = script_lang_finalize;
}
static ScriptLang *
script_lang_new (const char *langname,
unsigned int script_index,
unsigned int lang_index,
hb_tag_t lang_tag)
{
ScriptLang *self;
self = g_object_new (script_lang_get_type (), NULL);
self->langname = g_strdup (langname);
self->script_index = script_index;
self->lang_index = lang_index;
self->lang_tag = lang_tag;
return self;
}
static char *
script_lang_get_langname (ScriptLang *self)
{
return g_strdup (self->langname);
}
/* }}} */
#define MAKE_TAG(a,b,c,d) (unsigned int)(((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
@@ -163,10 +94,6 @@ demo_free (gpointer data)
g_clear_pointer (&demo->axes, g_hash_table_unref);
g_clear_pointer (&demo->text, g_free);
gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (demo->provider));
g_object_unref (demo->provider);
g_free (demo);
}
@@ -544,6 +471,8 @@ update_display (void)
GString *s;
char *text;
gboolean has_feature;
GtkTreeIter iter;
GtkTreeModel *model;
PangoFontDescription *desc;
GList *l;
PangoAttrList *attrs;
@@ -646,13 +575,14 @@ update_display (void)
features = g_string_free (s, FALSE);
if (gtk_drop_down_get_selected (GTK_DROP_DOWN (demo->script_lang)) != 0)
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (demo->script_lang), &iter))
{
ScriptLang *selected;
hb_tag_t lang_tag;
selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (demo->script_lang));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (demo->script_lang));
gtk_tree_model_get (model, &iter, 3, &lang_tag, -1);
lang = pango_language_from_string (hb_language_to_string (hb_ot_tag_to_language (selected->lang_tag)));
lang = pango_language_from_string (hb_language_to_string (hb_ot_tag_to_language (lang_tag)));
}
else
lang = NULL;
@@ -809,30 +739,40 @@ tag_pair_equal (gconstpointer a, gconstpointer b)
return pair_a->script_tag == pair_b->script_tag && pair_a->lang_tag == pair_b->lang_tag;
}
static GtkOrdering
script_sort (const void *item1,
const void *item2,
void *data)
static int
script_sort_func (GtkTreeModel *model,
GtkTreeIter *a,
GtkTreeIter *b,
gpointer user_data)
{
ScriptLang *a = (ScriptLang *)item1;
ScriptLang *b = (ScriptLang *)item2;
char *sa, *sb;
int ret;
return strcmp (a->langname, b->langname);
gtk_tree_model_get (model, a, 0, &sa, -1);
gtk_tree_model_get (model, b, 0, &sb, -1);
ret = strcmp (sa, sb);
g_free (sa);
g_free (sb);
return ret;
}
static void
update_script_combo (void)
{
GListStore *store;
GtkSortListModel *sortmodel;
GtkListStore *store;
hb_font_t *hb_font;
int i, j, k;
PangoFont *pango_font;
GHashTable *tags;
GHashTableIter iter;
TagPair *pair;
char *lang;
hb_tag_t active;
GtkTreeIter active_iter;
gboolean have_active = FALSE;
lang = gtk_font_chooser_get_language (GTK_FONT_CHOOSER (demo->font));
@@ -842,7 +782,7 @@ update_script_combo (void)
g_free (lang);
store = g_list_store_new (script_lang_get_type ());
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
pango_font = get_pango_font ();
hb_font = pango_font_get_hb_font (pango_font);
@@ -866,19 +806,19 @@ update_script_combo (void)
hb_face = hb_font_get_face (hb_font);
for (guint i = 0; i < 2; i++)
for (i= 0; i < 2; i++)
{
hb_tag_t scripts[80];
unsigned int script_count = G_N_ELEMENTS (scripts);
hb_ot_layout_table_get_script_tags (hb_face, tables[i], 0, &script_count, scripts);
for (guint j = 0; j < script_count; j++)
for (j = 0; j < script_count; j++)
{
hb_tag_t languages[80];
unsigned int language_count = G_N_ELEMENTS (languages);
hb_ot_layout_script_get_language_tags (hb_face, tables[i], j, 0, &language_count, languages);
for (guint k = 0; k < language_count; k++)
for (k = 0; k < language_count; k++)
{
pair = g_new (TagPair, 1);
pair->script_tag = scripts[j];
@@ -898,6 +838,7 @@ update_script_combo (void)
{
const char *langname;
char langbuf[5];
GtkTreeIter tree_iter;
if (pair->lang_tag == 0 && pair->script_tag == 0)
langname = NC_("Language", "None");
@@ -914,31 +855,31 @@ update_script_combo (void)
}
}
g_list_store_append (store, script_lang_new (langname,
pair->script_index,
pair->lang_index,
pair->lang_tag));
gtk_list_store_insert_with_values (store, &tree_iter, -1,
0, langname,
1, pair->script_index,
2, pair->lang_index,
3, pair->lang_tag,
-1);
if (pair->lang_tag == active)
{
have_active = TRUE;
active_iter = tree_iter;
}
}
g_hash_table_destroy (tags);
sortmodel = gtk_sort_list_model_new (G_LIST_MODEL (store),
GTK_SORTER (gtk_custom_sorter_new (script_sort, NULL, NULL)));
gtk_drop_down_set_model (GTK_DROP_DOWN (demo->script_lang), G_LIST_MODEL (sortmodel));
for (guint i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (sortmodel)); i++)
{
ScriptLang *item = g_list_model_get_item (G_LIST_MODEL (sortmodel), i);
g_object_unref (item);
if (item->lang_tag == active)
{
gtk_drop_down_set_selected (GTK_DROP_DOWN (demo->script_lang), i);
break;
}
}
g_object_unref (sortmodel);
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (store),
script_sort_func, NULL, NULL);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
gtk_combo_box_set_model (GTK_COMBO_BOX (demo->script_lang), GTK_TREE_MODEL (store));
if (have_active)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (demo->script_lang), &active_iter);
else
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (demo->script_lang), 0);
}
static char *
@@ -963,19 +904,27 @@ static void
update_features (void)
{
int i, j;
GtkTreeModel *model;
GtkTreeIter iter;
guint script_index, lang_index;
hb_tag_t lang_tag;
PangoFont *pango_font;
hb_font_t *hb_font;
GList *l;
ScriptLang *selected;
/* set feature presence checks from the font features */
if (gtk_drop_down_get_selected (GTK_DROP_DOWN (demo->script_lang)) == 0)
if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (demo->script_lang), &iter))
return;
selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (demo->script_lang));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (demo->script_lang));
gtk_tree_model_get (model, &iter,
1, &script_index,
2, &lang_index,
3, &lang_tag,
-1);
if (selected->lang_tag == 0) /* None is selected */
if (lang_tag == 0) /* None is selected */
{
for (l = demo->feature_items; l; l = l->next)
{
@@ -1016,8 +965,8 @@ update_features (void)
hb_ot_layout_language_get_feature_tags (hb_face,
tables[i],
selected->script_index,
selected->lang_index,
script_index,
lang_index,
0,
&count,
features);
@@ -1039,8 +988,8 @@ update_features (void)
hb_ot_layout_language_find_feature (hb_face,
tables[i],
selected->script_index,
selected->lang_index,
script_index,
lang_index,
features[j],
&feature_index);
@@ -1372,9 +1321,10 @@ free_instance (gpointer data)
}
static void
add_instance (hb_face_t *face,
unsigned int index,
GtkStringList *strings)
add_instance (hb_face_t *face,
unsigned int index,
GtkWidget *combo,
int pos)
{
Instance *instance;
hb_ot_name_id_t name_id;
@@ -1390,20 +1340,20 @@ add_instance (hb_face_t *face,
instance->index = index;
g_hash_table_add (demo->instances, instance);
gtk_string_list_append (GTK_STRING_LIST (strings), instance->name);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), instance->name);
}
static void
unset_instance (GtkAdjustment *adjustment)
{
if (demo->instance_combo)
gtk_drop_down_set_selected (GTK_DROP_DOWN (demo->instance_combo), 0);
gtk_combo_box_set_active (GTK_COMBO_BOX (demo->instance_combo), 0);
}
static void
instance_changed (GtkDropDown *combo)
instance_changed (GtkComboBox *combo)
{
const char *text;
char *text;
Instance *instance;
Instance ikey;
int i;
@@ -1415,12 +1365,11 @@ instance_changed (GtkDropDown *combo)
hb_font_t *hb_font;
hb_face_t *hb_face;
text = gtk_string_list_get_string (GTK_STRING_LIST (gtk_drop_down_get_model (combo)),
gtk_drop_down_get_selected (combo));
text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo));
if (text[0] == '\0')
goto out;
ikey.name = (char *) text;
ikey.name = text;
instance = g_hash_table_lookup (demo->instances, &ikey);
if (!instance)
{
@@ -1461,6 +1410,7 @@ instance_changed (GtkDropDown *combo)
}
out:
g_free (text);
g_clear_object (&pango_font);
g_free (ai);
g_free (coords);
@@ -1570,7 +1520,6 @@ update_font_variations (void)
{
GtkWidget *label;
GtkWidget *combo;
GtkStringList *strings;
label = gtk_label_new ("Instance");
gtk_label_set_xalign (GTK_LABEL (label), 0);
@@ -1578,28 +1527,26 @@ update_font_variations (void)
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_grid_attach (GTK_GRID (demo->variations_grid), label, 0, -1, 1, 1);
strings = gtk_string_list_new (NULL);
combo = gtk_drop_down_new (G_LIST_MODEL (strings), NULL);
combo = gtk_combo_box_text_new ();
gtk_widget_set_halign (combo, GTK_ALIGN_START);
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE);
gtk_string_list_append (strings, "");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "");
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
add_instance (hb_face, i, strings);
add_instance (hb_face, i, combo, i);
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
{
if (matches_instance (hb_face, i, n_axes, design_coords))
{
gtk_drop_down_set_selected (GTK_DROP_DOWN (combo), i + 1);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i + 1);
break;
}
}
gtk_grid_attach (GTK_GRID (demo->variations_grid), combo, 1, -1, 3, 1);
g_signal_connect (combo, "notify::selecte", G_CALLBACK (instance_changed), NULL);
g_signal_connect (combo, "changed", G_CALLBACK (instance_changed), NULL);
demo->instance_combo = combo;
}
@@ -1746,7 +1693,6 @@ do_font_features (GtkWidget *do_widget)
GtkBuilder *builder;
GtkBuilderScope *scope;
GtkEventController *controller;
GtkExpression *expression;
builder = gtk_builder_new ();
@@ -1780,9 +1726,6 @@ do_font_features (GtkWidget *do_widget)
demo->description = GTK_WIDGET (gtk_builder_get_object (builder, "description"));
demo->font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
demo->script_lang = GTK_WIDGET (gtk_builder_get_object (builder, "script_lang"));
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, G_CALLBACK (script_lang_get_langname), NULL, NULL);
gtk_drop_down_set_expression (GTK_DROP_DOWN (demo->script_lang), expression);
gtk_expression_unref (expression);
demo->feature_list = GTK_WIDGET (gtk_builder_get_object (builder, "feature_list"));
demo->stack = GTK_WIDGET (gtk_builder_get_object (builder, "stack"));
demo->entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
@@ -1801,8 +1744,8 @@ do_font_features (GtkWidget *do_widget)
demo->swin = GTK_WIDGET (gtk_builder_get_object (builder, "swin"));
demo->provider = gtk_css_provider_new ();
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (demo->provider), 800);
gtk_style_context_add_provider (gtk_widget_get_style_context (demo->swin),
GTK_STYLE_PROVIDER (demo->provider), 800);
basic_value_changed (demo->size_adjustment, demo->size_entry);
basic_value_changed (demo->letterspacing_adjustment, demo->letterspacing_entry);
@@ -1880,5 +1823,3 @@ do_font_features (GtkWidget *do_widget)
return window;
}
/* vim:set foldmethod=marker expandtab: */

View File

@@ -259,10 +259,16 @@
<object class="GtkBox" id="feature_list">
<property name="orientation">vertical</property>
<child>
<object class="GtkDropDown" id="script_lang">
<object class="GtkComboBox" id="script_lang">
<property name="tooltip-text" translatable="yes">Language System</property>
<property name="margin-top">10</property>
<signal name="notify::selected" handler="font_features_script_changed" swapped="no"/>
<signal name="changed" handler="font_features_script_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>

View File

@@ -43,6 +43,7 @@ update_image (void)
cairo_t *cr;
GdkPixbuf *pixbuf;
GdkPixbuf *pixbuf2;
const char *hint;
cairo_font_options_t *fopt;
cairo_hint_style_t hintstyle;
cairo_hint_metrics_t hintmetrics;
@@ -57,23 +58,18 @@ update_image (void)
fopt = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
switch (gtk_drop_down_get_selected (GTK_DROP_DOWN (hinting)))
hint = gtk_combo_box_get_active_id (GTK_COMBO_BOX (hinting));
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
if (hint)
{
case 0:
hintstyle = CAIRO_HINT_STYLE_NONE;
break;
case 1:
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
break;
case 2:
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
break;
case 3:
hintstyle = CAIRO_HINT_STYLE_FULL;
break;
default:
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
break;
if (strcmp (hint, "none") == 0)
hintstyle = CAIRO_HINT_STYLE_NONE;
else if (strcmp (hint, "slight") == 0)
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
else if (strcmp (hint, "medium") == 0)
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
else if (strcmp (hint, "full") == 0)
hintstyle = CAIRO_HINT_STYLE_FULL;
}
cairo_font_options_set_hint_style (fopt, hintstyle);
@@ -422,7 +418,7 @@ do_fontrendering (GtkWidget *do_widget)
g_signal_connect (down_button, "clicked", G_CALLBACK (scale_down), NULL);
g_signal_connect (entry, "notify::text", G_CALLBACK (update_image), NULL);
g_signal_connect (font_button, "notify::font-desc", G_CALLBACK (update_image), NULL);
g_signal_connect (hinting, "notify::selected", G_CALLBACK (update_image), NULL);
g_signal_connect (hinting, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (anti_alias, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (hint_metrics, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (text_radio, "notify::active", G_CALLBACK (update_image), NULL);

View File

@@ -116,18 +116,15 @@
</object>
</child>
<child>
<object class="GtkDropDown" id="hinting">
<object class="GtkComboBoxText" id="hinting">
<property name="active">0</property>
<property name="valign">center</property>
<property name="model">
<object class="GtkStringList">
<items>
<item translatable="yes">None</item>
<item translatable="yes">Slight</item>
<item translatable="yes">Medium</item>
<item translatable="yes">Full</item>
</items>
</object>
</property>
<items>
<item translatable="yes" id="none">None</item>
<item translatable="yes" id="slight">Slight</item>
<item translatable="yes" id="medium">Medium</item>
<item translatable="yes" id="full">Full</item>
</items>
</object>
</child>
<layout>

View File

@@ -144,6 +144,7 @@ make_shader_stack (const char *name,
GtkTextBuffer *buffer;
GBytes *bytes;
GtkEventController *controller;
GtkCssProvider *provider;
GdkPaintable *paintable;
stack = gtk_shader_stack_new ();
@@ -234,6 +235,12 @@ make_shader_stack (const char *name,
g_signal_connect (buffer, "changed", G_CALLBACK (text_changed), button);
g_object_set_data (G_OBJECT (button), "the-stack", stack);
g_signal_connect (button, "clicked", G_CALLBACK (apply_text), buffer);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
gtk_style_context_add_provider (gtk_widget_get_style_context (button),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
gtk_widget_add_css_class (button, "small");
@@ -267,21 +274,11 @@ make_shader_stack (const char *name,
return vbox;
}
static void
remove_provider (gpointer data)
{
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
g_object_unref (provider);
}
static GtkWidget *
create_gltransition_window (GtkWidget *do_widget)
{
GtkWidget *window, *headerbar, *scale, *outer_grid, *grid, *background;
GdkPaintable *paintable;
GtkCssProvider *provider;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
@@ -336,14 +333,6 @@ create_gltransition_window (GtkWidget *do_widget)
make_shader_stack ("Kaleidoscope", "/gltransition/kaleidoscope.glsl", 3, scale),
1, 1, 1, 1);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
return window;
}

View File

@@ -9,8 +9,6 @@
#include <gtk/gtk.h>
#include <string.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
#define FOLDER_NAME "/iconview/gnome-fs-directory.png"

View File

@@ -8,8 +8,6 @@
#include <gtk/gtk.h>
#include <string.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum
{
COL_TEXT,

View File

@@ -7,8 +7,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
static GtkTreeModel *model = NULL;
static guint timeout = 0;

View File

@@ -422,10 +422,6 @@ do_listview_settings (GtkWidget *do_widget)
gtk_column_view_column_set_sorter (name_column, sorter);
g_object_unref (sorter);
sorter = GTK_SORTER (gtk_string_sorter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "type")));
gtk_column_view_column_set_sorter (type_column, sorter);
g_object_unref (sorter);
g_object_unref (builder);
}

View File

@@ -10,6 +10,7 @@
#include "script-names.h"
#include "unicode-names.h"
#define UCD_TYPE_ITEM (ucd_item_get_type ())
G_DECLARE_FINAL_TYPE (UcdItem, ucd_item, UCD, ITEM, GObject)
@@ -337,15 +338,6 @@ create_ucd_view (GtkWidget *label)
static GtkWidget *window;
static void
remove_provider (gpointer data)
{
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
g_object_unref (provider);
}
GtkWidget *
do_listview_ucd (GtkWidget *do_widget)
{
@@ -368,7 +360,7 @@ do_listview_ucd (GtkWidget *do_widget)
gtk_widget_add_css_class (label, "enormous");
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "label.enormous { font-size: 80px; }", -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (provider), 800);
gtk_style_context_add_provider (gtk_widget_get_style_context (label), GTK_STYLE_PROVIDER (provider), 800);
gtk_widget_set_hexpand (label, TRUE);
gtk_box_append (GTK_BOX (box), label);
@@ -378,8 +370,6 @@ do_listview_ucd (GtkWidget *do_widget)
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), listview);
gtk_box_prepend (GTK_BOX (box), sw);
gtk_window_set_child (GTK_WINDOW (window), box);
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
}
if (!gtk_widget_get_visible (window))

View File

@@ -8,7 +8,6 @@
#include "config.h"
#include <gtk/gtk.h>
/* Create an object for the pegs that get moved around in the game.
*
* We implement the GdkPaintable interface for them, so we can use GtkPicture
@@ -360,15 +359,6 @@ drop_drop (GtkDropTarget *target,
return TRUE;
}
static void
remove_provider (gpointer data)
{
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
g_object_unref (provider);
}
static void
create_board (GtkWidget *window)
{
@@ -385,9 +375,6 @@ create_board (GtkWidget *window)
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
grid = gtk_grid_new ();
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
@@ -406,6 +393,9 @@ create_board (GtkWidget *window)
continue;
image = gtk_image_new ();
gtk_style_context_add_provider (gtk_widget_get_style_context (image),
GTK_STYLE_PROVIDER (provider),
800);
gtk_widget_add_css_class (image, "solitaire-field");
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
if (x != 3 || y != 3)
@@ -449,7 +439,7 @@ create_board (GtkWidget *window)
}
}
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
g_object_unref (provider);
}
static void

View File

@@ -123,14 +123,8 @@ do_pickers (GtkWidget *do_widget)
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
picker = gtk_app_chooser_button_new ("x-scheme-handler/mailto");
gtk_app_chooser_button_set_show_dialog_item (GTK_APP_CHOOSER_BUTTON (picker), TRUE);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
gtk_grid_attach (GTK_GRID (table), picker, 1, 3, 1, 1);
}

View File

@@ -16,6 +16,7 @@ enum {
NUM_PROPERTIES
};
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
static void
pixbuf_paintable_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
@@ -36,6 +37,7 @@ pixbuf_paintable_snapshot (GdkPaintable *paintable,
g_object_unref (texture);
}
G_GNUC_END_IGNORE_DEPRECATIONS;
static int
pixbuf_paintable_get_intrinsic_width (GdkPaintable *paintable)

View File

@@ -16,6 +16,24 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
/* Convenience function to create a combo box holding a number of strings
*/
GtkWidget *
create_combo_box (const char **strings)
{
GtkWidget *combo_box;
const char **str;
combo_box = gtk_combo_box_text_new ();
for (str = strings; *str; str++)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), *str);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
return combo_box;
}
static void
add_row (GtkGrid *table,
int row,
@@ -23,7 +41,7 @@ add_row (GtkGrid *table,
const char *label_text,
const char **options)
{
GtkWidget *dropdown;
GtkWidget *combo_box;
GtkWidget *label;
label = gtk_label_new_with_mnemonic (label_text);
@@ -32,12 +50,12 @@ add_row (GtkGrid *table,
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (table, label, 0, row, 1, 1);
dropdown = gtk_drop_down_new_from_strings (options);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), dropdown);
gtk_widget_set_halign (dropdown, GTK_ALIGN_END);
gtk_widget_set_valign (dropdown, GTK_ALIGN_BASELINE);
gtk_size_group_add_widget (size_group, dropdown);
gtk_grid_attach (table, dropdown, 1, row, 1, 1);
combo_box = create_combo_box (options);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo_box);
gtk_widget_set_halign (combo_box, GTK_ALIGN_END);
gtk_widget_set_valign (combo_box, GTK_ALIGN_BASELINE);
gtk_size_group_add_widget (size_group, combo_box);
gtk_grid_attach (table, combo_box, 1, row, 1, 1);
}
static void

View File

@@ -11,7 +11,6 @@
#include <stdlib.h> /* for exit() */
#include "paintable.h"
static void easter_egg_callback (GtkWidget *button, gpointer data);
static void
@@ -430,11 +429,11 @@ attach_widgets (GtkTextView *text_view)
}
else if (i == 1)
{
const char *options[] = {
"Option 1", "Option 2", "Option 3", NULL
};
widget = gtk_combo_box_text_new ();
widget = gtk_drop_down_new_from_strings (options);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 1");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 2");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 3");
}
else if (i == 2)
{

View File

@@ -10,8 +10,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* TreeItem structure */
typedef struct _TreeItem TreeItem;
struct _TreeItem

View File

@@ -664,7 +664,6 @@ on_record_button_toggled (GtkToggleButton *button,
gtk_widget_add_css_class (GTK_WIDGET (button), "destructive-action");
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
on_page_combo_changed (GtkComboBox *combo,
gpointer user_data)
@@ -706,7 +705,6 @@ on_page_combo_changed (GtkComboBox *combo,
default:;
}
}
G_GNUC_END_IGNORE_DEPRECATIONS
static void
on_range_from_changed (GtkSpinButton *from)
@@ -845,7 +843,6 @@ page_changed_cb (GtkWidget *stack, GParamSpec *pspec, gpointer data)
}
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
populate_model (GtkTreeStore *store)
{
@@ -963,7 +960,6 @@ row_separator_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
return is_sep;
}
G_GNUC_END_IGNORE_DEPRECATIONS
static void
update_title_header (GtkListBoxRow *row,
@@ -1582,7 +1578,6 @@ osd_frame_pressed (GtkGestureClick *gesture,
return GDK_EVENT_STOP;
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static gboolean
page_combo_separator_func (GtkTreeModel *model,
GtkTreeIter *iter,
@@ -1597,7 +1592,6 @@ page_combo_separator_func (GtkTreeModel *model,
return res;
}
G_GNUC_END_IGNORE_DEPRECATIONS
static void
toggle_format (GSimpleAction *action,
@@ -1850,7 +1844,6 @@ update_buttons (GtkWidget *iv, GtkIconSize size)
gtk_widget_set_sensitive (button, size != GTK_ICON_SIZE_INHERIT);
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
increase_icon_size (GtkWidget *iv)
{
@@ -1901,7 +1894,6 @@ reset_icon_size (GtkWidget *iv)
gtk_widget_queue_resize (iv);
}
G_GNUC_END_IGNORE_DEPRECATIONS
static char *
scale_format_value_blank (GtkScale *scale, double value, gpointer user_data)
@@ -2278,12 +2270,10 @@ activate (GApplication *app)
g_object_set_data (G_OBJECT (window), "selection_flowbox", widget2);
g_signal_connect_swapped (widget, "clicked", G_CALLBACK (populate_flowbox), widget2);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
widget = (GtkWidget *)gtk_builder_get_object (builder, "charletree");
populate_model ((GtkTreeStore *)gtk_tree_view_get_model (GTK_TREE_VIEW (widget)));
gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (widget), row_separator_func, NULL, NULL);
gtk_tree_view_expand_all (GTK_TREE_VIEW (widget));
G_GNUC_END_IGNORE_DEPRECATIONS
widget = GTK_WIDGET (gtk_builder_get_object (builder, "munsell"));
widget2 = GTK_WIDGET (gtk_builder_get_object (builder, "cchooser"));
@@ -2291,7 +2281,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
populate_colors (widget, widget2);
g_signal_connect (widget2, "notify::rgba", G_CALLBACK (rgba_changed), widget);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
widget = (GtkWidget *)gtk_builder_get_object (builder, "page_combo");
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (widget), page_combo_separator_func, NULL, NULL);
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "range_from_spin");
@@ -2302,7 +2291,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_object_set_data (G_OBJECT (widget), "range_to_spin", widget3);
g_object_set_data (G_OBJECT (widget2), "range_to_spin", widget3);
g_object_set_data (G_OBJECT (widget), "print_button", widget4);
G_GNUC_END_IGNORE_DEPRECATIONS
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "tooltextview");

View File

@@ -3345,12 +3345,10 @@ bad things might happen.</property>
<attribute name="display-hint">circular-buttons</attribute>
<item>
<attribute name="verb-icon">printer-symbolic</attribute>
<attribute name="label" translatable="yes">Print all the things!</attribute>
<attribute name="action">win.print</attribute>
</item>
<item>
<attribute name="verb-icon">emblem-shared-symbolic</attribute>
<attribute name="label" translatable="yes">Share all the things!</attribute>
<attribute name="action">app.share</attribute>
</item>
</section>
@@ -3365,17 +3363,14 @@ bad things might happen.</property>
<attribute name="label" translatable="yes">Edit</attribute>
<item>
<attribute name="verb-icon">edit-cut-symbolic</attribute>
<attribute name="label" translatable="yes">Cut</attribute>
<attribute name="action">app.cut</attribute>
</item>
<item>
<attribute name="verb-icon">edit-copy-symbolic</attribute>
<attribute name="label" translatable="yes">Copy</attribute>
<attribute name="action">app.copy</attribute>
</item>
<item>
<attribute name="verb-icon">edit-paste-symbolic</attribute>
<attribute name="label" translatable="yes">Paste</attribute>
<attribute name="action">app.paste</attribute>
</item>
</section>

View File

@@ -12,8 +12,8 @@ SYNOPSIS
--------
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
| **gtk4-builder-tool** validate [OPTIONS...] <FILE>
| **gtk4-builder-tool** enumerate [OPTIONS...] <FILE>
| **gtk4-builder-tool** validate <FILE>
| **gtk4-builder-tool** enumerate <FILE>
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
| **gtk4-builder-tool** screenshot [OPTIONS...] <FILE>
@@ -33,20 +33,12 @@ Validation
The ``validate`` command validates the given UI definition file and reports
errors to ``stderr``.
``--deprecations``
Warn about uses of deprecated types in the UI definition file.
Enumeration
^^^^^^^^^^^
The ``enumerate`` command prints all the named objects that are present in the UI
The ``enumerate`` command lists all the named objects that are present in the UI
definition file.
``--callbacks``
Print the names of callbacks as well.
Preview
^^^^^^^

View File

@@ -1,74 +0,0 @@
Title: Preparing for GTK 5
Slug: gtk-migrating-4-to-5
GTK 5 will be a major new version of GTK that breaks both API and
ABI compared to GTK 4.x. GTK 5 does not exist yet, so we cannot
be entirely sure what will be involved in a migration from GTK 4
to GTK 5. But we can already give some preliminary hints about
the likely changes, and how to prepare for them in code that is
using GTK 4.
### Do not use deprecated symbols
As always, functions and types that are known to go away in the
next major version of GTK are being marked as deprecated in GTK 4.
Removing the use of deprecated APIs is the most important step
to prepare your code for the next major version of GTK. Often,
deprecation notes will include hints about replacement APIs to
help you with this.
Sometimes, it is helpful to have some background information about
the motivation and goals of larger API changes.
## Cell renderers are going away
Cell renderers were introduced in GTK 2 to support rendering of
"big data" UIs, in particular treeviews. Over the years, more
"data-like" widgets have started to use them, and cell renderers
have grown into a shadowy, alternative rendering infrastructure
that duplicates much of what widgets do, while duplicating the
code and adding their own dose of bugs.
In GTK 4, replacement widgets for GtkTreeView, GtkIconView and
GtkComboBox have appeared: GtkListView, GtkColumnView, GtkGridView
and GtkDropDown. For GTK 5, we will take the next step and remove
all cell renderer-based widgets.
## Themed rendering APIs are going away
The old GTK 2 era rendering APIs for theme components like
gtk_render_frame() or gtk_render_check() have not been used by
GTK itself even in later GTK 3, but they have been kepy around
for the benefit of "external drawing" users - applications that
want their controls to look like GTK without using widgets.
Supporting this is increasingly getting in the way of making
the GTK CSS machinery fast and correct. One notable problem is
that temporary style changes (using gtk_style_context_save())
is breaking animations. Therefore, these APIs will be going away
in GTK 5, together with their more modern GtkSnapshot variants
like gtk_snapshot_render_background() or gtk_snapshot_render_focus().
The best way to render parts of your widget using CSS styling
is to use subwidgets. For example, to show a piece of text with
fonts, effects and shadows according to the current CSS style,
use a GtkLabel.
If you have a need for custom drawing that fits into the current
(dark or light) theme, e.g. for rendering a graph, you can still
get the current style foreground color, using
[method@Gtk.Widget.get_style_color].
## Local stylesheets are going away
The cascading part of GTK's CSS implementation is complicated by
the existence of local stylesheets (i.e. those added with
gtk_style_context_add_provider()). And local stylesheets are
unintuitive in that they do not apply to the whole subtree of
widgets, but just to the one widget where the stylesheet was
added.
GTK 5 will no longer provide this functionality. The recommendations
is to use a global stylesheet (i.e. gtk_style_context_add_provider_for_display())
and rely on style classes to make your CSS apply only where desired.

View File

@@ -10,10 +10,6 @@ to determine paths to look for certain files. The [X11](#x11-envar),
[Broadway](#broadway-envar) GDK backends use some additional
environment variables.
Note that environment variables are generally used for debugging
purposes. They are not guaranteed to be API stable, and should not
be used for end-user configuration and customization.
### `GTK_DEBUG`
This variable can be set to a list of debug options, which cause GTK to
@@ -79,9 +75,6 @@ A number of keys are influencing behavior instead of just logging:
`snapshot`
: Include debug render nodes in the generated snapshots
`invert-text-dir`
: Invert the text direction, compared to the locale
The special value `all` can be used to turn on all debug options.
The special value `help` can be used to obtain a list of all
supported debug options.
@@ -92,7 +85,8 @@ Specifies a list of directories to search when GTK is looking for
dynamically loaded objects such as input method modules and print
backends. If the path to the dynamically loaded object is given as
an absolute path name, then GTK loads it directly. Otherwise, GTK
goes in turn through the directories in `GTK_PATH`, followed
goes in turn through the directories in `GTK_PATH`, followed by
the directory `.gtk-4.0` in the user's home directory, followed
by the system default directory, which is `libdir/gtk-4.0/modules`.
(If `GTK_EXE_PREFIX` is defined, `libdir` is `$GTK_EXE_PREFIX/lib`.
Otherwise it is the libdir specified when GTK was configured, usually
@@ -211,33 +205,24 @@ A number of options affect behavior instead of logging:
`gl-disable`
: Disable OpenGL support
`gl-software`
: Force OpenGL software rendering
`gl-texture-rect`
: Use the OpenGL texture rectangle extension, if available
`gl-legacy`
: Use a legacy OpenGL context
`gl-gles`
: Use a GLES OpenGL context
`gl-egl`
: Use an EGL context on X11 or Windows
`gl-glx`
: Use GLX on X11
`gl-wgl`
: Use WGL on Windows
`vulkan-disable`
: Disable Vulkan support
`vulkan-validate`
: Load the Vulkan validation layer, if available
`default-settings`
: Force default values for xsettings
`high-depth`
: Use high bit depth rendering if possible
The special value `all` can be used to turn on all debug options. The special
value `help` can be used to obtain a list of all supported debug options.

View File

@@ -1,13 +1,6 @@
Title: Tree and List Widget Overview
Slug: gtk-treeview
This document describes the `GtkTreeView` widget and auxiliary
classes, like tree models and cell renderers. All of these have
been deprecated and will be removed in GTK 5. Their replacements
are described in the [List Widget Overview](section-list-widget.html).
## Introduction
To create a tree or list in GTK, use the `GtkTreeModel` interface in
conjunction with the `GtkTreeView` widget. This widget is designed around
a _Model/View/Controller_ design and consists of four major parts:

View File

@@ -7,7 +7,7 @@ the default.
More information about GTK on Windows, including detailed build
instructions, binary downloads, etc, can be found
[online](https://www.gtk.org/docs/installations/windows/).
[online](https://wiki.gnome.org/Projects/GTK/Win32).
## Windows-specific environment variables

View File

@@ -350,8 +350,7 @@ quit_activated (GSimpleAction *action,
}
static void
combo_changed (GtkDropDown *combo,
GParamSpec *pspec,
combo_changed (GtkComboBox *combo,
gpointer user_data)
{
GtkDialog *dialog = user_data;
@@ -360,7 +359,7 @@ combo_changed (GtkDropDown *combo,
char **accels;
char *str;
action = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_drop_down_get_selected_item (combo)));
action = gtk_combo_box_get_active_id (combo);
if (!action)
return;
@@ -389,7 +388,7 @@ response (GtkDialog *dialog,
gpointer user_data)
{
GtkEntry *entry = g_object_get_data (user_data, "entry");
GtkDropDown *combo = g_object_get_data (user_data, "combo");
GtkComboBox *combo = g_object_get_data (user_data, "combo");
const char *action;
const char *str;
char **accels;
@@ -400,7 +399,7 @@ response (GtkDialog *dialog,
return;
}
action = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_drop_down_get_selected_item (combo)));
action = gtk_combo_box_get_active_id (combo);
if (!action)
return;
@@ -425,7 +424,6 @@ edit_accels (GSimpleAction *action,
char **actions;
GtkWidget *dialog;
int i;
GtkStringList *strings;
dialog = gtk_dialog_new_with_buttons ("Accelerators",
NULL,
@@ -437,8 +435,7 @@ edit_accels (GSimpleAction *action,
gtk_window_set_application (GTK_WINDOW (dialog), app);
actions = gtk_application_list_action_descriptions (app);
strings = gtk_string_list_new (NULL);
combo = gtk_drop_down_new (G_LIST_MODEL (strings), NULL);
combo = gtk_combo_box_text_new ();
g_object_set (gtk_dialog_get_content_area (GTK_DIALOG (dialog)),
"margin-top", 10,
"margin-bottom", 10,
@@ -449,8 +446,8 @@ edit_accels (GSimpleAction *action,
gtk_box_append (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), combo);
for (i = 0; actions[i]; i++)
gtk_string_list_append (strings, actions[i]);
g_signal_connect (combo, "notify::selected", G_CALLBACK (combo_changed), dialog);
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), actions[i], actions[i]);
g_signal_connect (combo, "changed", G_CALLBACK (combo_changed), dialog);
entry = gtk_entry_new ();
gtk_widget_set_hexpand (entry, TRUE);
@@ -461,7 +458,7 @@ edit_accels (GSimpleAction *action,
g_object_set_data (G_OBJECT (dialog), "combo", combo);
g_object_set_data (G_OBJECT (dialog), "entry", entry);
gtk_drop_down_set_selected (GTK_DROP_DOWN (combo), 0);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
gtk_widget_show (dialog);
}

View File

@@ -13,7 +13,7 @@
#include "gdkbroadway-server.h"
#include "gdkprivate-broadway.h"
#include "gdkprivate.h"
#include "gdk-private.h"
#include <gdk/gdktextureprivate.h>
@@ -34,7 +34,7 @@
#ifdef G_OS_WIN32
#include <windows.h>
#endif
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
typedef struct BroadwayInput BroadwayInput;

View File

@@ -84,7 +84,6 @@ gdk_broadway_device_query_state (GdkDevice *device,
gint32 device_root_x, device_root_y;
guint32 mouse_toplevel_id;
guint32 mask32;
int origin_x, origin_y;
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
return;
@@ -98,12 +97,10 @@ gdk_broadway_device_query_state (GdkDevice *device,
&device_root_y,
&mask32);
gdk_surface_get_origin (surface, &origin_x, &origin_y);
if (win_x)
*win_x = device_root_x - origin_x;
*win_x = device_root_x;
if (win_y)
*win_y = device_root_y - origin_y;
*win_y = device_root_y;
if (mask)
*mask = mask32;
}

View File

@@ -32,7 +32,7 @@
#include "gdkdevice-broadway.h"
#include "gdkdeviceprivate.h"
#include <gdk/gdktextureprivate.h>
#include "gdkprivate.h"
#include "gdk-private.h"
#include <glib.h>
#include <glib/gprintf.h>
@@ -213,7 +213,7 @@ _gdk_broadway_display_open (const char *display_name)
broadway_display->server = _gdk_broadway_server_new (display, display_name, &error);
if (broadway_display->server == NULL)
{
GDK_DEBUG (MISC, "Unable to init Broadway server: %s", error->message);
GDK_NOTE (MISC, g_message ("Unable to init Broadway server: %s\n", error->message));
g_error_free (error);
return NULL;
}

View File

@@ -262,8 +262,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
message->key.state,
FALSE,
&translated,
&translated,
NULL);
&translated);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);

View File

@@ -483,34 +483,6 @@ connection_closed (GDBusConnection *connection,
static void
finish_registration (void)
{
gdk_content_register_serializer (G_TYPE_FILE,
"application/vnd.portal.filetransfer",
portal_file_serializer,
NULL,
NULL);
gdk_content_register_serializer (GDK_TYPE_FILE_LIST,
"application/vnd.portal.filetransfer",
portal_file_serializer,
NULL,
NULL);
gdk_content_register_deserializer ("application/vnd.portal.filetransfer",
GDK_TYPE_FILE_LIST,
portal_file_deserializer,
NULL,
NULL);
gdk_content_register_deserializer ("application/vnd.portal.filetransfer",
G_TYPE_FILE,
portal_file_deserializer,
NULL,
NULL);
/* FIXME: I missed up and used the wrong mime type here when
* I implemented my own protocol. Keep these around for a while
* so we can interoperate with existing flatpaks using GTK 4.6
*/
gdk_content_register_serializer (G_TYPE_FILE,
"application/vnd.portal.files",
portal_file_serializer,

45
gdk/gdk-autocleanup.h Normal file
View File

@@ -0,0 +1,45 @@
/* 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/>.
*/
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GI_SCANNER__
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkAppLaunchContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkClipboard, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentProvider, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkCursor, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDevice, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplay, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplayManager, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrag, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameClock, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkMonitor, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkSeat, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPopupLayout, gdk_popup_layout_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkVulkanContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentFormats, gdk_content_formats_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkEvent, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameTimings, gdk_frame_timings_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkRGBA, gdk_rgba_free)
#endif

View File

@@ -28,13 +28,12 @@
#include "gdkresources.h"
#include "gdkconstructorprivate.h"
#include "gdkdebugprivate.h"
#include "gdkconstructor.h"
#include "gdkdebug.h"
#include "gdkdisplay.h"
#include "gdkglcontextprivate.h"
#include <glib/gi18n-lib.h>
#include "gdkprivate.h"
#include <glib/gprintf.h>
#include "gdkintl.h"
#include "gdk-private.h"
#include <string.h>
#include <stdlib.h>
@@ -117,17 +116,19 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "vulkan", GDK_DEBUG_VULKAN, "Information about Vulkan" },
{ "selection", GDK_DEBUG_SELECTION, "Information about selections" },
{ "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" },
{ "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)", TRUE },
{ "portals", GDK_DEBUG_PORTALS, "Force the use of portals", TRUE },
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support", TRUE },
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL", TRUE },
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context", TRUE },
{ "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API", TRUE },
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows", TRUE },
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11", TRUE },
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows", TRUE },
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support", TRUE },
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer", TRUE },
{ "nograbs", GDK_DEBUG_NOGRABS, "Disable pointer and keyboard grabs (X11)" },
{ "portals", GDK_DEBUG_PORTALS, "Force the use of portals" },
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
{ "gl-software", GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" },
{ "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" },
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" },
{ "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API" },
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" },
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" },
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" },
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE },
};
@@ -257,12 +258,16 @@ gdk_parse_debug_var (const char *variable,
fprintf (stderr, "Supported %s values:\n", variable);
for (i = 0; i < nkeys; i++) {
if (debug_enabled || keys[i].always_enabled)
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
fprintf (stderr, " %s%*s%s", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
if (!debug_enabled && !keys[i].always_enabled)
fprintf (stderr, " [unavailable]");
fprintf (stderr, "\n");
}
fprintf (stderr, " %s%*s%s\n", "all", max_width - 3, " ", "Enable all values");
fprintf (stderr, " %s%*s%s\n", "help", max_width - 4, " ", "Print this help");
fprintf (stderr, "\nMultiple values can be given, separated by : or space.\n");
if (!debug_enabled)
fprintf (stderr, "Values marked as [unavailable] are only accessible if GTK is built with G_ENABLE_DEBUG.\n");
}
if (invert)
@@ -293,11 +298,11 @@ gdk_pre_parse (void)
G_N_ELEMENTS (gdk_debug_keys));
/* These are global */
if (_gdk_debug_flags & GDK_DEBUG_GL_EGL)
if (GDK_DEBUG_CHECK (GL_EGL))
gdk_gl_backend_use (GDK_GL_EGL);
else if (_gdk_debug_flags & GDK_DEBUG_GL_GLX)
else if (GDK_DEBUG_CHECK (GL_GLX))
gdk_gl_backend_use (GDK_GL_GLX);
else if (_gdk_debug_flags & GDK_DEBUG_GL_WGL)
else if (GDK_DEBUG_CHECK (GL_WGL))
gdk_gl_backend_use (GDK_GL_WGL);
#ifndef G_HAS_CONSTRUCTORS
@@ -356,7 +361,7 @@ gdk_running_in_sandbox (void)
gboolean
gdk_should_use_portal (void)
{
if (gdk_display_get_debug_flags (NULL) & GDK_DEBUG_PORTALS)
if (GDK_DISPLAY_DEBUG_CHECK (NULL, PORTALS))
return TRUE;
if (gdk_running_in_sandbox ())

View File

@@ -76,6 +76,8 @@
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkvulkancontext.h>
#include <gdk/gdk-autocleanup.h>
#undef __GDK_H_INSIDE__
#endif /* __GDK_H__ */

View File

@@ -22,7 +22,7 @@
#include "gdkapplaunchcontextprivate.h"
#include "gdkdisplay.h"
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
/**

View File

@@ -54,7 +54,6 @@ GDK_AVAILABLE_IN_ALL
void gdk_app_launch_context_set_icon_name (GdkAppLaunchContext *context,
const char *icon_name);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkAppLaunchContext, g_object_unref)
G_END_DECLS

View File

@@ -26,10 +26,10 @@
#include "gdkcontentproviderprivate.h"
#include "gdkcontentserializer.h"
#include "gdkdisplay.h"
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
#include "gdkpipeiostreamprivate.h"
#include "gdktexture.h"
#include "gdkprivate.h"
#include "gdk-private.h"
#include <gobject/gvaluecollector.h>

View File

@@ -120,8 +120,6 @@ GDK_AVAILABLE_IN_ALL
void gdk_clipboard_set_texture (GdkClipboard *clipboard,
GdkTexture *texture);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkClipboard, g_object_unref)
G_END_DECLS
#endif /* __GDK_CLIPBOARD_H__ */

View File

@@ -16,8 +16,6 @@ G_BEGIN_DECLS
#mesondefine GDK_WINDOWING_WAYLAND
#mesondefine GDK_WINDOWING_WIN32
#mesondefine GDK_RENDERING_CAIRO
#mesondefine GDK_RENDERING_GL
#mesondefine GDK_RENDERING_VULKAN
G_END_DECLS

View File

@@ -25,7 +25,6 @@
#include "filetransferportalprivate.h"
#include "gdktexture.h"
#include "gdkrgbaprivate.h"
#include "gdkprivate.h"
#include "loaders/gdkpngprivate.h"
#include "loaders/gdktiffprivate.h"
@@ -355,14 +354,12 @@ gdk_content_deserializer_return_success (GdkContentDeserializer *deserializer)
{
g_return_if_fail (GDK_IS_CONTENT_DESERIALIZER (deserializer));
g_return_if_fail (!deserializer->returned);
guint source_id;
deserializer->returned = TRUE;
source_id = g_idle_add_full (deserializer->priority,
gdk_content_deserializer_emit_callback,
deserializer,
g_object_unref);
gdk_source_set_static_name_by_id (source_id, "[gtk] gdk_content_deserializer_emit_callback");
g_idle_add_full (deserializer->priority,
gdk_content_deserializer_emit_callback,
deserializer,
g_object_unref);
/* NB: the idle will destroy our reference */
}

View File

@@ -106,8 +106,6 @@ GDK_AVAILABLE_IN_ALL
void gdk_content_formats_builder_add_gtype (GdkContentFormatsBuilder *builder,
GType type);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentFormats, gdk_content_formats_unref)
/* dunno where else to put this */
#define GDK_TYPE_FILE_LIST (gdk_file_list_get_type ())
GDK_AVAILABLE_IN_ALL

View File

@@ -22,8 +22,8 @@
#include "gdkclipboard.h"
#include "gdkcontentformats.h"
#include <glib/gi18n-lib.h>
#include "gdkprivate.h"
#include "gdkintl.h"
#include "gdk-private.h"
/**
* GdkContentProvider:

View File

@@ -111,9 +111,6 @@ GDK_AVAILABLE_IN_ALL
gboolean gdk_content_provider_get_value (GdkContentProvider *provider,
GValue *value,
GError **error);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentProvider, g_object_unref)
G_END_DECLS
#endif /* __GDK_CONTENT_PROVIDER_H__ */

View File

@@ -24,10 +24,10 @@
#include "gdkcontentformats.h"
#include "gdkcontentserializer.h"
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
#include "gdkcontentproviderimpl.h"
#include "gdkprivate.h"
#include "gdk-private.h"
#define GDK_TYPE_CONTENT_PROVIDER_VALUE (gdk_content_provider_value_get_type ())
#define GDK_CONTENT_PROVIDER_VALUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_CONTENT_PROVIDER_VALUE, GdkContentProviderValue))

View File

@@ -30,7 +30,6 @@
#include "loaders/gdktiffprivate.h"
#include "loaders/gdkjpegprivate.h"
#include "gdkmemorytextureprivate.h"
#include "gdkprivate.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <string.h>
@@ -361,14 +360,12 @@ gdk_content_serializer_return_success (GdkContentSerializer *serializer)
{
g_return_if_fail (GDK_IS_CONTENT_SERIALIZER (serializer));
g_return_if_fail (!serializer->returned);
guint source_id;
serializer->returned = TRUE;
source_id = g_idle_add_full (serializer->priority,
gdk_content_serializer_emit_callback,
serializer,
g_object_unref);
gdk_source_set_static_name_by_id (source_id, "[gtk] gdk_content_serializer_emit_callback");
g_idle_add_full (serializer->priority,
gdk_content_serializer_emit_callback,
serializer,
g_object_unref);
/* NB: the idle will destroy our reference */
}
@@ -879,7 +876,7 @@ file_text_serializer (GdkContentSerializer *serializer)
g_string_append (str, path);
g_free (path);
if (l->next)
g_string_append (str, "\n");
g_string_append (str, " ");
}
path = g_string_free (str, FALSE);
}

View File

@@ -30,7 +30,7 @@
#include "gdkcursor.h"
#include "gdkcursorprivate.h"
#include "gdktexture.h"
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
#include <math.h>
#include <errno.h>

View File

@@ -64,7 +64,6 @@ int gdk_cursor_get_hotspot_x (GdkCursor *cursor);
GDK_AVAILABLE_IN_ALL
int gdk_cursor_get_hotspot_y (GdkCursor *cursor);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkCursor, g_object_unref)
G_END_DECLS

View File

@@ -21,7 +21,6 @@
#include <glib.h>
#include "gdktypes.h"
#include <glib/gstdio.h>
G_BEGIN_DECLS
@@ -41,6 +40,8 @@ typedef enum {
GDK_DEBUG_NOGRABS = 1 << 11,
GDK_DEBUG_PORTALS = 1 << 12,
GDK_DEBUG_GL_DISABLE = 1 << 13,
GDK_DEBUG_GL_SOFTWARE = 1 << 14,
GDK_DEBUG_GL_TEXTURE_RECT = 1 << 15,
GDK_DEBUG_GL_LEGACY = 1 << 16,
GDK_DEBUG_GL_GLES = 1 << 17,
GDK_DEBUG_GL_DEBUG = 1 << 18,
@@ -59,27 +60,22 @@ GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display);
void gdk_display_set_debug_flags (GdkDisplay *display,
GdkDebugFlags flags);
#define gdk_debug_message(format, ...) g_fprintf (stderr, format "\n", ##__VA_ARGS__)
#ifdef G_ENABLE_DEBUG
#define GDK_DISPLAY_DEBUG_CHECK(display,type) \
G_UNLIKELY (gdk_display_get_debug_flags (display) & GDK_DEBUG_##type)
#define GDK_DISPLAY_DEBUG(display,type,...) \
G_STMT_START { \
#define GDK_DISPLAY_NOTE(display,type,action) G_STMT_START { \
if (GDK_DISPLAY_DEBUG_CHECK (display,type)) \
gdk_debug_message (__VA_ARGS__); \
} G_STMT_END
{ action; }; } G_STMT_END
#else /* !G_ENABLE_DEBUG */
#define GDK_DISPLAY_DEBUG_CHECK(display,type) 0
#define GDK_DISPLAY_DEBUG(display,type,...)
#define GDK_DISPLAY_NOTE(display,type,action)
#endif /* G_ENABLE_DEBUG */
#define GDK_DEBUG_CHECK(type) GDK_DISPLAY_DEBUG_CHECK (NULL,type)
#define GDK_DEBUG(type,...) GDK_DISPLAY_DEBUG (NULL,type,__VA_ARGS__)
#define GDK_NOTE(type,action) GDK_DISPLAY_NOTE (NULL,type,action)
#endif

View File

@@ -22,7 +22,7 @@
#include "gdkdeviceprivate.h"
#include "gdkdevicetool.h"
#include "gdkdisplayprivate.h"
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
#include "gdkkeysprivate.h"
/**

View File

@@ -126,9 +126,6 @@ GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
GDK_AVAILABLE_IN_4_2
guint32 gdk_device_get_timestamp (GdkDevice *device);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDevice, g_object_unref)
G_END_DECLS
#endif /* __GDK_DEVICE_H__ */

View File

@@ -21,7 +21,7 @@
#include "gdkdevicetoolprivate.h"
#include "gdkenumtypes.h"
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
/**
* GdkDeviceTool:

View File

@@ -24,8 +24,8 @@
#include "gdkdisplay.h"
#include "gdkdisplayprivate.h"
#include <glib/gi18n-lib.h>
#include "gdkprivate.h"
#include "gdkintl.h"
#include "gdk-private.h"
#include "gdkapplaunchcontext.h"
#include "gdkclipboardprivate.h"
@@ -1233,7 +1233,7 @@ gdk_display_init_gl (GdkDisplay *self)
before = GDK_PROFILER_CURRENT_TIME;
if (gdk_display_get_debug_flags (self) & GDK_DEBUG_GL_DISABLE)
if (GDK_DISPLAY_DEBUG_CHECK (self, GL_DISABLE))
{
g_set_error_literal (&priv->gl_error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
@@ -1729,31 +1729,28 @@ gdk_display_init_egl (GdkDisplay *self,
if (priv->egl_config_high_depth == NULL)
priv->egl_config_high_depth = priv->egl_config;
#ifdef G_ENABLE_DEBUG
if (GDK_DISPLAY_DEBUG_CHECK (self, OPENGL))
{
GDK_DISPLAY_NOTE (self, OPENGL, {
char *ext = describe_extensions (priv->egl_display);
char *std_cfg = describe_egl_config (priv->egl_display, priv->egl_config);
char *hd_cfg = describe_egl_config (priv->egl_display, priv->egl_config_high_depth);
gdk_debug_message ("EGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Version: %s\n"
" - Client APIs: %s\n"
" - Extensions:\n"
"\t%s\n"
" - Selected fbconfig: %s\n"
" high depth: %s",
major, minor,
eglQueryString (priv->egl_display, EGL_VENDOR),
eglQueryString (priv->egl_display, EGL_VERSION),
eglQueryString (priv->egl_display, EGL_CLIENT_APIS),
ext, std_cfg,
priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg);
g_message ("EGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Version: %s\n"
" - Client APIs: %s\n"
" - Extensions:\n"
"\t%s\n"
" - Selected fbconfig: %s\n"
" high depth: %s",
major, minor,
eglQueryString (priv->egl_display, EGL_VENDOR),
eglQueryString (priv->egl_display, EGL_VERSION),
eglQueryString (priv->egl_display, EGL_CLIENT_APIS),
ext, std_cfg,
priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg);
g_free (hd_cfg);
g_free (std_cfg);
g_free (ext);
}
#endif
});
gdk_profiler_end_mark (start_time, "init EGL", NULL);

View File

@@ -136,7 +136,7 @@ gboolean gdk_display_get_setting (GdkDisplay *display,
const char *name,
GValue *value);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplay, g_object_unref)
G_END_DECLS

View File

@@ -28,7 +28,7 @@
#include "gdkdisplaymanagerprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkkeysprivate.h"
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h"
@@ -420,7 +420,7 @@ gdk_display_manager_open_display (GdkDisplayManager *manager,
(any && strstr (allowed_backends, gdk_backends[j].name)) ||
g_str_equal (backend, gdk_backends[j].name))
{
GDK_DEBUG (MISC, "Trying %s backend", gdk_backends[j].name);
GDK_NOTE (MISC, g_message ("Trying %s backend", gdk_backends[j].name));
display = gdk_backends[j].open_display (name);
if (display)
break;

View File

@@ -34,6 +34,7 @@
G_BEGIN_DECLS
#define GDK_TYPE_DISPLAY_MANAGER (gdk_display_manager_get_type ())
#define GDK_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY_MANAGER, GdkDisplayManager))
#define GDK_IS_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DISPLAY_MANAGER))
@@ -57,7 +58,6 @@ GdkDisplay * gdk_display_manager_open_display (GdkDisplayManager *m
GDK_AVAILABLE_IN_ALL
void gdk_set_allowed_backends (const char *backends);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplayManager, g_object_unref)
G_END_DECLS

View File

@@ -22,7 +22,7 @@
#include "gdksurface.h"
#include "gdkcursor.h"
#include "gdkmonitor.h"
#include "gdkdebugprivate.h"
#include "gdkdebug.h"
#include "gdksurfaceprivate.h"
#include "gdkkeysprivate.h"
#include "gdkdeviceprivate.h"

View File

@@ -42,7 +42,7 @@
#include "gdkdragprivate.h"
#include "gdkdisplay.h"
#include "gdksurface.h"
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
#include "gdkcontentformats.h"
#include "gdkcontentprovider.h"
#include "gdkcontentserializer.h"

View File

@@ -99,8 +99,6 @@ GdkContentProvider *
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_drag_get_surface (GdkDrag *drag);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrag, g_object_unref)
G_END_DECLS
#endif /* __GDK_DND_H__ */

View File

@@ -19,9 +19,9 @@
#include "config.h"
#include "gdkprivate.h"
#include "gdk-private.h"
#include "gdkdragsurfaceprivate.h"
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
/**
* GdkDragSurface:

View File

@@ -22,8 +22,8 @@
#include "gdkdrawcontextprivate.h"
#include "gdkdebugprivate.h"
#include <glib/gi18n-lib.h>
#include "gdkdebug.h"
#include "gdkintl.h"
#include "gdkprofilerprivate.h"
#include "gdksurfaceprivate.h"
@@ -364,7 +364,7 @@ gdk_draw_context_begin_frame_full (GdkDrawContext *context,
return;
}
if (gdk_display_get_debug_flags (priv->display) & GDK_DEBUG_HIGH_DEPTH)
if (GDK_DISPLAY_DEBUG_CHECK (priv->display, HIGH_DEPTH))
prefers_high_depth = TRUE;
priv->frame_region = cairo_region_copy (region);

View File

@@ -52,8 +52,6 @@ gboolean gdk_draw_context_is_in_frame (GdkDrawContext
GDK_AVAILABLE_IN_ALL
const cairo_region_t * gdk_draw_context_get_frame_region (GdkDrawContext *context);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
G_END_DECLS
#endif /* __GDK_DRAW_CONTEXT__ */

View File

@@ -49,7 +49,7 @@
#include "gdkdragprivate.h"
#include "gdkenumtypes.h"
#include "gdkeventsprivate.h"
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
#include "gdkpipeiostreamprivate.h"
#include "gdksurface.h"

View File

@@ -31,6 +31,8 @@
G_BEGIN_DECLS
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrop, g_object_unref)
#define GDK_TYPE_DROP (gdk_drop_get_type ())
#define GDK_DROP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DROP, GdkDrop))
#define GDK_IS_DROP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DROP))
@@ -83,8 +85,6 @@ const GValue * gdk_drop_read_value_finish (GdkDrop
GAsyncResult *result,
GError **error);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrop, g_object_unref)
G_END_DECLS
#endif /* __GDK_DROP_H__ */

View File

@@ -0,0 +1,41 @@
/*** BEGIN file-header ***/
#include "config.h"
#include "gdk.h"
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GType
@enum_name@_get_type (void)
{
static gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const G@Type@Value values[] = {
/*** END value-header ***/
/*** BEGIN value-production ***/
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
/*** END value-production ***/
/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
GType g_define_type_id =
g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/*** END value-tail ***/
/*** BEGIN file-tail ***/
/**/
/*** END file-tail ***/

View File

@@ -0,0 +1,29 @@
/*** BEGIN file-header ***/
#ifndef __GDK_ENUM_TYPES_H__
#define __GDK_ENUM_TYPES_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <glib-object.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GDK_AVAILABLE_IN_ALL GType @enum_name@_get_type (void) G_GNUC_CONST;
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/
/*** BEGIN file-tail ***/
G_END_DECLS
#endif /* __GDK_ENUM_TYPES_H__ */
/*** END file-tail ***/

View File

@@ -28,10 +28,10 @@
#include "gdkdragprivate.h"
#include "gdkdropprivate.h"
#include "gdkeventsprivate.h"
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
#include "gdkkeysprivate.h"
#include "gdkkeysyms.h"
#include "gdkprivate.h"
#include "gdk-private.h"
#include <gobject/gvaluecollector.h>
@@ -402,15 +402,12 @@ gdk_event_alloc (GdkEventType event_type,
GdkEvent *event = (GdkEvent *) g_type_create_instance (gdk_event_types[event_type]);
#ifdef G_ENABLE_DEBUG
if (GDK_DEBUG_CHECK (EVENTS))
{
char *str = g_enum_to_string (GDK_TYPE_EVENT_TYPE, event_type);
gdk_debug_message ("Allocating a new %s for event type %s",
g_type_name (gdk_event_types[event_type]), str);
g_free (str);
}
#endif
GDK_NOTE (EVENTS, {
char *str = g_enum_to_string (GDK_TYPE_EVENT_TYPE, event_type);
g_message ("Allocating a new %s for event type %s",
g_type_name (gdk_event_types[event_type]), str);
g_free (str);
});
event->event_type = event_type;
event->surface = surface != NULL ? g_object_ref (surface) : NULL;
@@ -1517,16 +1514,6 @@ gdk_button_event_get_button (GdkEvent *event)
* An event related to a key-based device.
*/
static void
gdk_key_event_finalize (GdkEvent *event)
{
GdkKeyEvent *self = (GdkKeyEvent *) event;
g_free (self->compose_sequence);
GDK_EVENT_SUPER (event)->finalize (event);
}
static GdkModifierType
gdk_key_event_get_state (GdkEvent *event)
{
@@ -1538,7 +1525,7 @@ gdk_key_event_get_state (GdkEvent *event)
static const GdkEventTypeInfo gdk_key_event_info = {
sizeof (GdkKeyEvent),
NULL,
gdk_key_event_finalize,
NULL,
gdk_key_event_get_state,
NULL,
NULL,
@@ -1562,10 +1549,6 @@ GDK_DEFINE_EVENT_TYPE (GdkKeyEvent, gdk_key_event,
* @is_modifier: whether the event is a modifiers only event
* @translated: the translated key data for the given @state
* @no_lock: the translated key data without the given @state
* @compose_sequence: (transfer none) (nullable):
* The compose sequence string, either partial or only the
* final composed string, if that can be determined at event
* creation time. Used by selected IM modules.
*
* Creates a new `GdkKeyEvent`.
*
@@ -1580,8 +1563,7 @@ gdk_key_event_new (GdkEventType type,
GdkModifierType state,
gboolean is_modifier,
GdkTranslatedKey *translated,
GdkTranslatedKey *no_lock,
char *compose_sequence)
GdkTranslatedKey *no_lock)
{
g_return_val_if_fail (type == GDK_KEY_PRESS ||
type == GDK_KEY_RELEASE, NULL);
@@ -1594,7 +1576,6 @@ gdk_key_event_new (GdkEventType type,
self->key_is_modifier = is_modifier;
self->translated[0] = *translated;
self->translated[1] = *no_lock;
self->compose_sequence = g_strdup (compose_sequence);
return event;
}
@@ -1625,26 +1606,6 @@ gdk_key_event_get_translated_key (GdkEvent *event,
return &(self->translated[0]);
}
/*< private >
* gdk_key_event_get_compose_sequence:
* @event: (type GdkKeyEvent): a key event
*
* Extracts the compose sequence string from a key event.
*
* Returns: (transfer none): the compose sequence string
*/
char *
gdk_key_event_get_compose_sequence (GdkEvent *event)
{
GdkKeyEvent *self = (GdkKeyEvent *) event;
g_return_val_if_fail (GDK_IS_EVENT (event), 0);
g_return_val_if_fail (GDK_IS_EVENT_TYPE (event, GDK_KEY_PRESS) ||
GDK_IS_EVENT_TYPE (event, GDK_KEY_RELEASE), FALSE);
return self->compose_sequence;
}
/**
* gdk_key_event_get_keyval:
* @event: (type GdkKeyEvent): a key event
@@ -1812,7 +1773,7 @@ gdk_key_event_matches (GdkEvent *event,
guint ev_keyval;
int layout;
int level;
GdkModifierType ignored_modifiers;
GdkModifierType consumed_modifiers;
GdkModifierType shift_group_mask;
gboolean group_mod_is_accel_mod = FALSE;
const GdkModifierType mask = GDK_CONTROL_MASK |
@@ -1831,23 +1792,7 @@ gdk_key_event_matches (GdkEvent *event,
ev_keyval = self->translated[1].keyval;
layout = self->translated[1].layout;
level = self->translated[1].level;
/*
* If a modifier is currently active (e.g. Shift is pressed) and was marked
* as consumed, we ignore it for the purposes of matching shortcuts.
* For example, when Ctrl+Shift+[plus/equals key] is translated into
* Ctrl+plus on a keyboard where Shift+equals is the plus sign, we want
* shortcuts for either <Control><Shift>plus or <Control>plus to match.
* (See https://bugzilla.gnome.org/show_bug.cgi?id=100439)
*
* If a modifier is *not* currently active, the X11 backend can sometimes
* mark it as consumed where the Wayland and Windows backends do not.
* In this case, we still want to pay attention to its state.
* For example, when Ctrl+x is translated into Ctrl+x, we only want to
* trigger shortcuts for <Control>x, not for <Control><Shift>x.
* (See https://gitlab.gnome.org/GNOME/gtk/-/issues/5095)
*/
ignored_modifiers = (self->translated[1].consumed & state);
consumed_modifiers = self->translated[1].consumed;
/* if the group-toggling modifier is part of the default accel mod
* mask, and it is active, disable it for matching
@@ -1859,7 +1804,7 @@ gdk_key_event_matches (GdkEvent *event,
if (mask & shift_group_mask)
group_mod_is_accel_mod = TRUE;
if ((modifiers & ~ignored_modifiers & mask) == (state & ~ignored_modifiers & mask))
if ((modifiers & ~consumed_modifiers & mask) == (state & ~consumed_modifiers & mask))
{
/* modifier match */
GdkKeymapKey *keys;

View File

@@ -38,6 +38,7 @@
G_BEGIN_DECLS
#define GDK_TYPE_EVENT (gdk_event_get_type ())
#define GDK_TYPE_EVENT_SEQUENCE (gdk_event_sequence_get_type ())
@@ -550,9 +551,6 @@ gboolean gdk_key_event_get_match (GdkEvent *event,
guint *keyval,
GdkModifierType *modifiers);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkEvent, gdk_event_unref)
G_END_DECLS
#endif /* __GDK_EVENTS_H__ */

View File

@@ -259,9 +259,6 @@ typedef struct {
* @keycode: the raw code of the key that was pressed or released.
* @translated: the result of translating @keycode. First with the full
* @state, then while ignoring Caps Lock.
* @compose_sequence: optional string for use by selected IM modules.
* Contains either partial compose sequences or the final composed
* string of the keystroke sequence.
*
* Describes a key press or key release event.
*/
@@ -273,7 +270,6 @@ struct _GdkKeyEvent
guint32 keycode;
gboolean key_is_modifier;
GdkTranslatedKey translated[2];
char *compose_sequence;
};
/*
@@ -474,8 +470,7 @@ GdkEvent * gdk_key_event_new (GdkEventType type,
GdkModifierType modifiers,
gboolean is_modifier,
GdkTranslatedKey *translated,
GdkTranslatedKey *no_lock,
char *compose_sequence);
GdkTranslatedKey *no_lock);
GdkEvent * gdk_focus_event_new (GdkSurface *surface,
GdkDevice *device,
@@ -602,8 +597,6 @@ GdkEvent * gdk_grab_broken_event_new (GdkSurface *surface,
GdkTranslatedKey * gdk_key_event_get_translated_key (GdkEvent *event,
gboolean no_lock);
char * gdk_key_event_get_compose_sequence (GdkEvent *event);
typedef enum
{
/* Following flag is set for events on the event queue during
@@ -633,6 +626,7 @@ void _gdk_event_queue_flush (GdkDisplay *display);
double * gdk_event_dup_axes (GdkEvent *event);
G_END_DECLS
#endif /* __GDK_EVENTS_PRIVATE_H__ */

View File

@@ -106,8 +106,6 @@ void gdk_frame_clock_get_refresh_info (GdkFrameClock *frame_clock,
GDK_AVAILABLE_IN_ALL
double gdk_frame_clock_get_fps (GdkFrameClock *frame_clock);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameClock, g_object_unref)
G_END_DECLS
#endif /* __GDK_FRAME_CLOCK_H__ */

View File

@@ -26,9 +26,9 @@
#include "gdkframeclockidleprivate.h"
#include "gdkdebugprivate.h"
#include "gdkdebug.h"
#include "gdkframeclockprivate.h"
#include "gdkprivate.h"
#include "gdk-private.h"
#include "gdkprofilerprivate.h"
#ifdef G_OS_WIN32
@@ -123,7 +123,6 @@ get_sleep_serial (void)
{
sleep_source = g_source_new (&sleep_source_funcs, sizeof (GSource));
g_source_set_static_name (sleep_source, "[gtk] sleep serial");
g_source_set_priority (sleep_source, G_PRIORITY_HIGH);
g_source_attach (sleep_source, NULL);
g_source_unref (sleep_source);

View File

@@ -51,8 +51,6 @@ gint64 gdk_frame_timings_get_refresh_interval (GdkFrameTimings *timin
GDK_AVAILABLE_IN_ALL
gint64 gdk_frame_timings_get_predicted_presentation_time (GdkFrameTimings *timings);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameTimings, gdk_frame_timings_unref)
G_END_DECLS
#endif /* __GDK_FRAME_TIMINGS_H__ */

View File

@@ -76,14 +76,14 @@
#include "gdkglcontextprivate.h"
#include "gdkdebugprivate.h"
#include "gdkdebug.h"
#include "gdkdisplayprivate.h"
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
#include "gdkmemoryformatprivate.h"
#include "gdkmemorytextureprivate.h"
#include "gdkprofilerprivate.h"
#include "gdkprivate.h"
#include "gdk-private.h"
#ifdef GDK_WINDOWING_WIN32
# include "gdk/win32/gdkwin32.h"
@@ -193,7 +193,7 @@ gdk_gl_context_dispose (GObject *gobject)
if (eglGetCurrentContext () == priv->egl_context)
eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
GDK_DISPLAY_DEBUG (display, OPENGL, "Destroying EGL context");
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Destroying EGL context"));
eglDestroyContext (egl_display, priv->egl_context);
priv->egl_context = NULL;
@@ -339,13 +339,13 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
context_attribs[i++] = EGL_NONE;
g_assert (i < N_EGL_ATTRS);
GDK_DISPLAY_DEBUG (display, OPENGL,
"Creating EGL context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)",
major, minor,
debug_bit ? "yes" : "no",
forward_bit ? "yes" : "no",
legacy ? "yes" : "no",
api == GDK_GL_API_GLES ? "yes" : "no");
GDK_DISPLAY_NOTE (display, OPENGL,
g_message ("Creating EGL context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)",
major, minor,
debug_bit ? "yes" : "no",
forward_bit ? "yes" : "no",
legacy ? "yes" : "no",
api == GDK_GL_API_GLES ? "yes" : "no"));
ctx = eglCreateContext (egl_display,
egl_config,
@@ -355,7 +355,7 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
if (ctx == NULL)
return 0;
GDK_DISPLAY_DEBUG (display, OPENGL, "Created EGL context[%p]", ctx);
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Created EGL context[%p]", ctx));
priv->egl_context = ctx;
gdk_gl_context_set_is_legacy (context, legacy);
@@ -395,8 +395,8 @@ gdk_gl_context_realize_egl (GdkGLContext *context,
return 0;
}
prefer_legacy = (gdk_display_get_debug_flags(display) & GDK_DEBUG_GL_LEGACY) ||
(share != NULL && gdk_gl_context_is_legacy (share));
prefer_legacy = (GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY) ||
(share != NULL && gdk_gl_context_is_legacy (share)));
if (preferred_api == GDK_GL_API_GL)
{
@@ -1265,7 +1265,7 @@ gdk_gl_context_is_api_allowed (GdkGLContext *self,
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
if (gdk_display_get_debug_flags (gdk_gl_context_get_display (self)) & GDK_DEBUG_GL_GLES)
if (GDK_DISPLAY_DEBUG_CHECK (gdk_gl_context_get_display (self), GL_GLES))
{
if (!(api & GDK_GL_API_GLES))
{
@@ -1485,7 +1485,9 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
gboolean gl_debug = FALSE;
#ifdef G_ENABLE_DEBUG
GdkDisplay *display;
#endif
if (!gdk_gl_context_is_realized (context))
return;
@@ -1498,10 +1500,16 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
priv->has_debug_output = epoxy_has_gl_extension ("GL_ARB_debug_output") ||
epoxy_has_gl_extension ("GL_KHR_debug");
#ifdef G_ENABLE_DEBUG
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
gl_debug = (gdk_display_get_debug_flags (display) & GDK_DEBUG_GL_DEBUG) != 0;
gl_debug = GDK_DISPLAY_DEBUG_CHECK (display, GL_DEBUG);
#endif
if (priv->has_debug_output && gl_debug)
if (priv->has_debug_output
#ifndef G_ENABLE_CONSISTENCY_CHECKS
&& gl_debug
#endif
)
{
gdk_gl_context_make_current (context);
glEnable (GL_DEBUG_OUTPUT);
@@ -1533,20 +1541,20 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
priv->has_half_float = gdk_gl_context_check_version (context, 3, 0, 3, 0) ||
epoxy_has_gl_extension ("OES_vertex_half_float");
GDK_DISPLAY_DEBUG (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), OPENGL,
"%s version: %d.%d (%s)\n"
"* GLSL version: %s\n"
"* Extensions checked:\n"
" - GL_KHR_debug: %s\n"
" - GL_EXT_unpack_subimage: %s\n"
" - OES_vertex_half_float: %s",
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
priv->gl_version / 10, priv->gl_version % 10,
priv->is_legacy ? "legacy" : "core",
glGetString (GL_SHADING_LANGUAGE_VERSION),
priv->has_khr_debug ? "yes" : "no",
priv->has_unpack_subimage ? "yes" : "no",
priv->has_half_float ? "yes" : "no");
GDK_DISPLAY_NOTE (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), OPENGL,
g_message ("%s version: %d.%d (%s)\n"
"* GLSL version: %s\n"
"* Extensions checked:\n"
" - GL_KHR_debug: %s\n"
" - GL_EXT_unpack_subimage: %s\n"
" - OES_vertex_half_float: %s",
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
priv->gl_version / 10, priv->gl_version % 10,
priv->is_legacy ? "legacy" : "core",
glGetString (GL_SHADING_LANGUAGE_VERSION),
priv->has_khr_debug ? "yes" : "no",
priv->has_unpack_subimage ? "yes" : "no",
priv->has_half_float ? "yes" : "no"));
priv->extensions_checked = TRUE;
}
@@ -1836,8 +1844,8 @@ gdk_gl_backend_use (GdkGLBackend backend_type)
the_gl_backend_type = backend_type;
/* This is important!!!11eleven
* (But really: How do I print a message in 2 categories?) */
GDK_DEBUG (OPENGL, "Using OpenGL backend %s", gl_backend_names[the_gl_backend_type]);
GDK_DEBUG (MISC, "Using OpenGL backend %s", gl_backend_names[the_gl_backend_type]);
GDK_NOTE (OPENGL, g_print ("Using OpenGL backend %s\n", gl_backend_names[the_gl_backend_type]));
GDK_NOTE (MISC, g_message ("Using Opengl backend %s", gl_backend_names[the_gl_backend_type]));
}
g_assert (the_gl_backend_type == backend_type);

View File

@@ -114,8 +114,6 @@ GdkGLContext * gdk_gl_context_get_current (void);
GDK_AVAILABLE_IN_ALL
void gdk_gl_context_clear_current (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLContext, g_object_unref)
G_END_DECLS
#endif /* __GDK_GL_CONTEXT_H__ */

View File

@@ -36,6 +36,8 @@ G_BEGIN_DECLS
typedef struct _GdkGLTexture GdkGLTexture;
typedef struct _GdkGLTextureClass GdkGLTextureClass;
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLTexture, g_object_unref)
GDK_AVAILABLE_IN_ALL
GType gdk_gl_texture_get_type (void) G_GNUC_CONST;
@@ -50,7 +52,6 @@ GdkTexture * gdk_gl_texture_new (GdkGLContext
GDK_AVAILABLE_IN_ALL
void gdk_gl_texture_release (GdkGLTexture *self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLTexture, g_object_unref)
G_END_DECLS

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 Benjamin Otte <otte@gnome.org>
/* GDK - The GIMP Drawing Kit
* 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
@@ -15,23 +15,16 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GRAPH_RENDERER_H__
#define __GRAPH_RENDERER_H__
/*
* 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 <gtk/gtkwidget.h>
#include "graphdata.h"
#ifndef __GDKINTL_H__
#define __GDKINTL_H__
G_BEGIN_DECLS
#include <glib/gi18n-lib.h>
typedef struct _GraphRenderer GraphRenderer;
G_DECLARE_FINAL_TYPE (GraphRenderer, graph_renderer, GRAPH, RENDERER, GtkWidget);
GraphRenderer *graph_renderer_new (void);
void graph_renderer_set_data (GraphRenderer *self,
GraphData *data);
G_END_DECLS
#endif /* __GRAPH_RENDERER_H__ */
#endif

103
gdk/gdkkeynames.c Normal file
View File

@@ -0,0 +1,103 @@
/* GDK - The GIMP Drawing Kit
* 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 "gdkkeysyms.h"
/* Key handling not part of the keymap */
#include "keyname-table.h"
#include <glib/gprintf.h>
#include <stdlib.h>
#include <string.h>
#define GDK_NUM_KEYS G_N_ELEMENTS (gdk_keys_by_keyval)
static int
gdk_keys_keyval_compare (const void *pkey, const void *pbase)
{
return (*(int *) pkey) - ((gdk_key *) pbase)->keyval;
}
static char *
_gdk_keyval_name (guint keyval)
{
static char buf[100];
gdk_key *found;
/* Check for directly encoded 24-bit UCS characters: */
if ((keyval & 0xff000000) == 0x01000000)
{
g_sprintf (buf, "U+%.04X", (keyval & 0x00ffffff));
return buf;
}
found = bsearch (&keyval, gdk_keys_by_keyval,
GDK_NUM_KEYS, sizeof (gdk_key),
gdk_keys_keyval_compare);
if (found != NULL)
{
while ((found > gdk_keys_by_keyval) &&
((found - 1)->keyval == keyval))
found--;
return (char *) (keynames + found->offset);
}
else if (keyval != 0)
{
g_sprintf (buf, "%#x", keyval);
return buf;
}
return NULL;
}
static int
gdk_keys_name_compare (const void *pkey, const void *pbase)
{
return strcmp ((const char *) pkey,
(const char *) (keynames + ((const gdk_key *) pbase)->offset));
}
static guint
_gdk_keyval_from_name (const char *keyval_name)
{
gdk_key *found;
g_return_val_if_fail (keyval_name != NULL, 0);
if (strncmp (keyval_name,"XF86", 4) == 0)
keyval_name += 4;
found = bsearch (keyval_name, gdk_keys_by_name,
GDK_NUM_KEYS, sizeof (gdk_key),
gdk_keys_name_compare);
if (found != NULL)
return found->keyval;
else
return GDK_KEY_VoidSymbol;
}

View File

@@ -29,11 +29,6 @@
#include "gdkdisplay.h"
#include "gdkdisplaymanagerprivate.h"
#include "keynamesprivate.h"
#include <glib/gprintf.h>
#include <stdlib.h>
#include <string.h>
enum {
PROP_0,
PROP_DISPLAY,
@@ -619,73 +614,7 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
consumed_modifiers);
}
static int
gdk_keys_keyval_compare (const void *pkey, const void *pbase)
{
return (*(int *) pkey) - ((gdk_key *) pbase)->keyval;
}
static char *
_gdk_keyval_name (guint keyval)
{
static char buf[100];
gdk_key *found;
/* Check for directly encoded 24-bit UCS characters: */
if ((keyval & 0xff000000) == 0x01000000)
{
g_sprintf (buf, "U+%.04X", (keyval & 0x00ffffff));
return buf;
}
found = bsearch (&keyval,
gdk_keys_by_keyval, G_N_ELEMENTS (gdk_keys_by_keyval),
sizeof (gdk_key),
gdk_keys_keyval_compare);
if (found != NULL)
{
while ((found > gdk_keys_by_keyval) &&
((found - 1)->keyval == keyval))
found--;
return (char *) (keynames + found->offset);
}
else if (keyval != 0)
{
g_sprintf (buf, "%#x", keyval);
return buf;
}
return NULL;
}
static int
gdk_keys_name_compare (const void *pkey, const void *pbase)
{
return strcmp ((const char *) pkey,
(const char *) (keynames + ((const gdk_key *) pbase)->offset));
}
static guint
_gdk_keyval_from_name (const char *keyval_name)
{
gdk_key *found;
g_return_val_if_fail (keyval_name != NULL, 0);
if (strncmp (keyval_name,"XF86", 4) == 0)
keyval_name += 4;
found = bsearch (keyval_name,
gdk_keys_by_name, G_N_ELEMENTS (gdk_keys_by_name),
sizeof (gdk_key),
gdk_keys_name_compare);
if (found != NULL)
return found->keyval;
else
return GDK_KEY_VoidSymbol;
}
#include "gdkkeynames.c"
/**
* gdk_keyval_name:

View File

@@ -87,8 +87,6 @@ GdkSubpixelLayout gdk_monitor_get_subpixel_layout (GdkMonitor *monitor);
GDK_AVAILABLE_IN_ALL
gboolean gdk_monitor_is_valid (GdkMonitor *monitor);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkMonitor, g_object_unref)
G_END_DECLS
#endif /* __GDK_MONITOR_H__ */

View File

@@ -22,7 +22,7 @@
#include "gdkpaintable.h"
#include "gdksnapshotprivate.h"
#include "gdkprivate.h"
#include "gdk-private.h"
/* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
void gtk_snapshot_push_debug (GdkSnapshot *snapshot,

View File

@@ -19,7 +19,7 @@
#include "gdkpango.h"
#include <glib/gi18n-lib.h>
#include "gdkintl.h"
#include <math.h>
#include <pango/pangocairo.h>

View File

@@ -19,8 +19,8 @@
#include "config.h"
#include "gdkprivate.h"
#include <glib/gi18n-lib.h>
#include "gdk-private.h"
#include "gdkintl.h"
#include "gdkpopupprivate.h"
/**

View File

@@ -146,7 +146,6 @@ void gdk_popup_layout_get_shadow_width (GdkPopupLayout
int *top,
int *bottom);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPopupLayout, gdk_popup_layout_unref)
G_END_DECLS

Some files were not shown because too many files have changed in this diff Show More