Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 937ccf152b |
+1
-3
@@ -58,7 +58,6 @@ style-check-diff:
|
||||
- "${CI_PROJECT_DIR}/_build/report*.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report*.html"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.node"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
|
||||
@@ -173,7 +172,7 @@ macos:
|
||||
needs: []
|
||||
before_script:
|
||||
- bash .gitlab-ci/show-info-osx.sh
|
||||
- pip3 install --user meson==0.60.3
|
||||
- pip3 install --user meson==0.59
|
||||
- pip3 install --user ninja
|
||||
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
|
||||
- export MESON_FORCE_BACKTRACE=1
|
||||
@@ -346,7 +345,6 @@ reference:
|
||||
- _reference
|
||||
|
||||
publish-docs:
|
||||
image: fedora:latest
|
||||
stage: publish
|
||||
needs: ['reference']
|
||||
script:
|
||||
|
||||
@@ -19,6 +19,7 @@ flatpak build ${builddir} meson \
|
||||
--buildtype=release \
|
||||
-Dx11-backend=true \
|
||||
-Dwayland-backend=true \
|
||||
-Dprint-backends=file \
|
||||
-Dbuild-tests=false \
|
||||
-Dbuild-examples=false \
|
||||
-Dintrospection=disabled \
|
||||
|
||||
@@ -185,8 +185,6 @@ ul.images li {
|
||||
<li><img alt="ref" src="{{ failure.image_data.ref }}" /></li>
|
||||
<li><img alt="out" src="{{ failure.image_data.out }}" /></li>
|
||||
<li><img alt="diff" src="{{ failure.image_data.diff }}" /></li>
|
||||
<li><a href="{{ failure.image_data.refnode }}">ref node</a></li>
|
||||
<li><a href="{{ failure.image_data.outnode }}">out node</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
@@ -313,8 +311,6 @@ for line in args.infile:
|
||||
image_data = {
|
||||
'ref': os.path.join(args.reftest_output_dir, '{}.ref.png'.format(basename)),
|
||||
'out': os.path.join(args.reftest_output_dir, '{}.out.png'.format(basename)),
|
||||
'refnode': os.path.join(args.reftest_output_dir, '{}.ref.node'.format(basename)),
|
||||
'outnode': os.path.join(args.reftest_output_dir, '{}.out.node'.format(basename)),
|
||||
'diff': os.path.join(args.reftest_output_dir, '{}.diff.png'.format(basename)),
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
|
||||
@echo on
|
||||
|
||||
:: FIXME: make warnings fatal
|
||||
pip3 install --upgrade --user meson==0.60.3 || goto :error
|
||||
pip3 install --upgrade --user meson==0.59 || goto :error
|
||||
meson -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
|
||||
ninja -C _build || goto :error
|
||||
|
||||
|
||||
@@ -1,84 +1,3 @@
|
||||
Overview of Changes in 4.7.1, 12-07-2022
|
||||
========================================
|
||||
|
||||
* GtkInscription:
|
||||
- A new label-like widget for use in list views
|
||||
|
||||
* GtkColorChooser:
|
||||
- Style improvements
|
||||
|
||||
* GtkFontChooser:
|
||||
- Improve support for OpenType features a bit
|
||||
|
||||
* GtkLabel:
|
||||
- Allow selectable labels to be activated via mnemonic
|
||||
|
||||
* GtkTextView:
|
||||
- Implement GetCharacterExtents for accessibility
|
||||
|
||||
* GtkStack:
|
||||
- Fix a poblem with stack page accessibility
|
||||
|
||||
* GtkListView:
|
||||
- Cull listitems that are out of view
|
||||
- Make all our list models implement ::n-items and
|
||||
::item-type properties
|
||||
|
||||
* Translations:
|
||||
- Stop translating property nicks and blurbs
|
||||
- Fix extracting translations from ui files
|
||||
|
||||
* Debugging:
|
||||
- Support GTK_DEBUG=invert-text-dir
|
||||
- Allow inspecting inspectors
|
||||
- Replace GTK_USE_PORTAL with GDK_DEBUG=portals
|
||||
- Improve responsiveness of the inspector
|
||||
|
||||
* CSS:
|
||||
- Allow fractional letterspacing
|
||||
|
||||
* Theme:
|
||||
- Improve legibility of selectable labels
|
||||
|
||||
* Demos:
|
||||
- Improve the font features demo
|
||||
- Add demos for GtkInscription
|
||||
|
||||
* Wayland:
|
||||
- Freeze popups when hidden
|
||||
- Only send smooth scroll events for tablet tools
|
||||
- Make scaled cursor image have the right size
|
||||
- Fix problems with the activation protocol
|
||||
- Don't force the HighContrast icon theme
|
||||
- Support xdg_toplevel.bounds
|
||||
|
||||
* X11:
|
||||
- Always update the shadoe size
|
||||
|
||||
* Windows:
|
||||
- Improve touchpad support by using DirectManipulation
|
||||
- Add more directories to the builtin hicolor icon theme
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
Catalan
|
||||
Chinese (China)
|
||||
Galician
|
||||
German
|
||||
Lithuanian
|
||||
Nepali
|
||||
Occitan
|
||||
Persian
|
||||
Polish
|
||||
Portuguese
|
||||
Russian
|
||||
Serbian
|
||||
Spanish
|
||||
Swedish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.7.0, 07-05-2022
|
||||
========================================
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dtests=false"
|
||||
"-Dtests=false",
|
||||
"-Dbenchmarks=false"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
@@ -104,8 +105,8 @@
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2",
|
||||
"sha256": "475d589d51a7f8b3ba2ba4eda022b170e562ca3b760ee922c146b6c65856ef39"
|
||||
"url": "https://boostorg.jfrog.io/artifactory/main/release/1.69.0/source/boost_1_69_0.tar.bz2",
|
||||
"sha256": "8f32d4617390d1c2d16f26a27ab60d97807b35440d45891fa340fc2648b04406"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -185,7 +186,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Denable_vulkan=no",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dtests=false"
|
||||
"-Dtests=false",
|
||||
"-Dbenchmarks=false"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
@@ -114,7 +115,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Denable_vulkan=no",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dtests=false"
|
||||
"-Dtests=false",
|
||||
"-Dbenchmarks=false"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
@@ -114,7 +115,7 @@
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dvulkan=disabled",
|
||||
"-Denable_vulkan=no",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
|
||||
@@ -361,11 +361,11 @@ save_cb (GtkWidget *button,
|
||||
}
|
||||
|
||||
static void
|
||||
constraint_editor_window_dispose (GObject *object)
|
||||
constraint_editor_window_finalize (GObject *object)
|
||||
{
|
||||
gtk_widget_dispose_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_WINDOW_TYPE);
|
||||
//ConstraintEditorWindow *self = (ConstraintEditorWindow *)object;
|
||||
|
||||
G_OBJECT_CLASS (constraint_editor_window_parent_class)->dispose (object);
|
||||
G_OBJECT_CLASS (constraint_editor_window_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static int child_counter;
|
||||
@@ -497,7 +497,7 @@ constraint_editor_window_class_init (ConstraintEditorWindowClass *class)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
object_class->dispose = constraint_editor_window_dispose;
|
||||
object_class->finalize = constraint_editor_window_finalize;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
"/org/gtk/gtk4/constraint-editor/constraint-editor-window.ui");
|
||||
|
||||
@@ -607,11 +607,10 @@ constraint_editor_dispose (GObject *object)
|
||||
{
|
||||
ConstraintEditor *self = (ConstraintEditor *)object;
|
||||
|
||||
g_clear_pointer (&self->grid, gtk_widget_unparent);
|
||||
g_clear_object (&self->model);
|
||||
g_clear_object (&self->constraint);
|
||||
|
||||
gtk_widget_dispose_template (GTK_WIDGET (object), CONSTRAINT_EDITOR_TYPE);
|
||||
|
||||
G_OBJECT_CLASS (constraint_editor_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -294,10 +294,9 @@ guide_editor_dispose (GObject *object)
|
||||
{
|
||||
GuideEditor *self = (GuideEditor *)object;
|
||||
|
||||
g_clear_pointer (&self->grid, gtk_widget_unparent);
|
||||
g_clear_object (&self->guide);
|
||||
|
||||
gtk_widget_dispose_template (GTK_WIDGET (self), GUIDE_EDITOR_TYPE);
|
||||
|
||||
G_OBJECT_CLASS (guide_editor_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -504,8 +504,6 @@ demo_application_window_dispose (GObject *object)
|
||||
|
||||
demo_application_window_store_state (window);
|
||||
|
||||
gtk_widget_dispose_template (GTK_WIDGET (window), demo_application_window_get_type ());
|
||||
|
||||
G_OBJECT_CLASS (demo_application_window_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -341,13 +341,16 @@ do_clipboard (GtkWidget *do_widget)
|
||||
GtkWidget *button;
|
||||
|
||||
scope = gtk_builder_cscope_new ();
|
||||
gtk_builder_cscope_add_callback (scope, copy_button_clicked);
|
||||
gtk_builder_cscope_add_callback (scope, paste_button_clicked);
|
||||
gtk_builder_cscope_add_callback (scope, source_changed_cb);
|
||||
gtk_builder_cscope_add_callback (scope, text_changed_cb);
|
||||
gtk_builder_cscope_add_callback (scope, open_file_cb);
|
||||
gtk_builder_cscope_add_callback (scope, on_drop);
|
||||
gtk_builder_cscope_add_callback (scope, drag_prepare);
|
||||
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
|
||||
"copy_button_clicked", G_CALLBACK (copy_button_clicked),
|
||||
"paste_button_clicked", G_CALLBACK (paste_button_clicked),
|
||||
"source_changed_cb", G_CALLBACK (source_changed_cb),
|
||||
"text_changed_cb", G_CALLBACK (text_changed_cb),
|
||||
"open_file_cb", G_CALLBACK (open_file_cb),
|
||||
"on_drop", G_CALLBACK (on_drop),
|
||||
"drag_prepare", G_CALLBACK (drag_prepare),
|
||||
NULL);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
gtk_builder_add_from_resource (builder, "/clipboard/clipboard.ui", NULL);
|
||||
|
||||
@@ -329,7 +329,6 @@
|
||||
<file>pickers.c</file>
|
||||
<file>printing.c</file>
|
||||
<file>revealer.c</file>
|
||||
<file>read_more.c</file>
|
||||
<file>rotated_text.c</file>
|
||||
<file>scale.c</file>
|
||||
<file>search_entry.c</file>
|
||||
@@ -376,7 +375,7 @@
|
||||
<file>glarea-gles.vs.glsl</file>
|
||||
</gresource>
|
||||
<gresource prefix="/font_features">
|
||||
<file>font_features.ui</file>
|
||||
<file>font-features.ui</file>
|
||||
<file>fontplane.c</file>
|
||||
</gresource>
|
||||
<gresource prefix="/spinbutton">
|
||||
|
||||
@@ -37,8 +37,7 @@ demo3_widget_dispose (GObject *object)
|
||||
Demo3Widget *self = DEMO3_WIDGET (object);
|
||||
|
||||
g_clear_object (&self->paintable);
|
||||
|
||||
gtk_widget_dispose_template (GTK_WIDGET (self), DEMO3_TYPE_WIDGET);
|
||||
g_clear_pointer (&self->menu, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (demo3_widget_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@@ -90,9 +90,12 @@ do_errorstates (GtkWidget *do_widget)
|
||||
toplevel = GTK_WIDGET (gtk_widget_get_root (do_widget));
|
||||
|
||||
scope = gtk_builder_cscope_new ();
|
||||
gtk_builder_cscope_add_callback (scope, validate_more_details);
|
||||
gtk_builder_cscope_add_callback (scope, mode_switch_state_set);
|
||||
gtk_builder_cscope_add_callback (scope, level_scale_value_changed);
|
||||
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
|
||||
"validate_more_details", G_CALLBACK (validate_more_details),
|
||||
"mode_switch_state_set", G_CALLBACK (mode_switch_state_set),
|
||||
"level_scale_value_changed", G_CALLBACK (level_scale_value_changed),
|
||||
NULL);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
gtk_builder_expose_object (builder, "toplevel", G_OBJECT (toplevel));
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="default-width">600</property>
|
||||
<property name="default-height">500</property>
|
||||
<property name="title">Font Explorer</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<child>
|
||||
<object class="GtkButton" id="reset">
|
||||
<property name="receives-default">1</property>
|
||||
<property name="tooltip-text">Reset</property>
|
||||
<property name="icon-name">view-refresh-symbolic</property>
|
||||
<signal name="clicked" handler="font_features_reset_features" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="receives-default">1</property>
|
||||
<property name="font">Sans 12</property>
|
||||
<property name="level">family|style|size|variations|features</property>
|
||||
<signal name="font-set" handler="font_features_font_changed" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander">
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Font Features</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="feature_list">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="script_lang">
|
||||
<property name="margin-top">10</property>
|
||||
<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>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander">
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="variations_heading">
|
||||
<property name="label" translatable="yes">Font Variations</property>
|
||||
<property name="xalign">0</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="variations_grid">
|
||||
<property name="column-spacing">10</property>
|
||||
<property name="row-spacing">10</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="view"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="margin-start">20</property>
|
||||
<property name="margin-end">20</property>
|
||||
<property name="margin-top">20</property>
|
||||
<property name="margin-bottom">20</property>
|
||||
<property name="spacing">20</property>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">label</property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel" id="label">
|
||||
<property name="wrap">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="selectable">1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">entry</property>
|
||||
<property name="child">
|
||||
<object class="GtkEntry" id="entry">
|
||||
<property name="text">Grumpy wizards make toxic brew for the evil Queen and Jack. A quick movement of the enemy will jeopardize six gunboats. The job of waxing linoleum frequently peeves chintzy kids. My girl wove six dozen plaid jackets before she quit. Twelve ziggurats quickly jumped a finch box.
|
||||
|
||||
Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика. Наш банк вчера же выплатил Ф.Я. Эйхгольду комиссию за ценные вещи. Эх, чужак, общий съём цен шляп (юфть) – вдрызг! В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
|
||||
|
||||
Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός</property>
|
||||
<signal name="activate" handler="font_features_stop_edit"/>
|
||||
<property name="valign">start</property>
|
||||
<property name="width-chars">50</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="settings">
|
||||
<property name="wrap">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="width-chars">50</property>
|
||||
<property name="max-width-chars">50</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<style>
|
||||
<class name="monospace"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="description">
|
||||
<property name="wrap">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="width-chars">50</property>
|
||||
<property name="max-width-chars">50</property>
|
||||
<property name="hexpand">1</property>
|
||||
<style>
|
||||
<class name="monospace"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="edit_toggle">
|
||||
<property name="icon-name">document-edit-symbolic</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">end</property>
|
||||
<signal name="toggled" handler="font_features_toggle_edit"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
+264
-715
File diff suppressed because it is too large
Load Diff
@@ -1,65 +0,0 @@
|
||||
--- demos/gtk-demo/font_features.c
|
||||
+++ demos/gtk-demo/font_features.c
|
||||
@@ -434,7 +434,7 @@ static void
|
||||
update_display (void)
|
||||
{
|
||||
GString *s;
|
||||
- const char *text;
|
||||
+ char *text;
|
||||
gboolean has_feature;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
@@ -452,8 +452,12 @@ update_display (void)
|
||||
gboolean do_waterfall;
|
||||
GString *waterfall;
|
||||
char *palette;
|
||||
+ GtkTextBuffer *buffer;
|
||||
+ GtkTextIter start_iter, end_iter;
|
||||
|
||||
- text = gtk_editable_get_text (GTK_EDITABLE (demo->the_entry));
|
||||
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (demo->the_entry));
|
||||
+ gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
|
||||
+ text = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE);
|
||||
text_len = strlen (text);
|
||||
|
||||
do_waterfall = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (demo->waterfall_toggle));
|
||||
@@ -631,6 +635,8 @@ update_display (void)
|
||||
pango2_font_description_free (desc);
|
||||
g_free (features);
|
||||
pango2_attr_list_unref (attrs);
|
||||
+
|
||||
+ g_free (text);
|
||||
}
|
||||
|
||||
static Pango2Font *
|
||||
@@ -1603,8 +1609,12 @@ font_features_toggle_edit (void)
|
||||
{
|
||||
if (strcmp (gtk_stack_get_visible_child_name (GTK_STACK (demo->stack)), "entry") != 0)
|
||||
{
|
||||
+ GtkTextBuffer *buffer;
|
||||
+ GtkTextIter start, end;
|
||||
g_free (demo->text);
|
||||
- demo->text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (demo->the_entry)));
|
||||
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (demo->the_entry));
|
||||
+ gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||
+ demo->text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (demo->stack), "entry");
|
||||
gtk_widget_grab_focus (demo->the_entry);
|
||||
gtk_adjustment_set_value (gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (demo->swin)), 0);
|
||||
@@ -1632,7 +1642,7 @@ entry_key_press (GtkEventController *controller,
|
||||
{
|
||||
if (keyval == GDK_KEY_Escape)
|
||||
{
|
||||
- gtk_editable_set_text (GTK_EDITABLE (entry), demo->text);
|
||||
+ gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (demo->the_entry)), demo->text, -1);
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
|
||||
@@ -1701,7 +1711,6 @@ do_font_features (GtkWidget *do_widget)
|
||||
basic_value_changed (demo->line_height_adjustment, demo->line_height_entry);
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
- g_object_set_data_full (G_OBJECT (demo->the_entry), "controller", g_object_ref (controller), g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), demo->the_entry);
|
||||
gtk_widget_add_controller (demo->the_entry, controller);
|
||||
|
||||
@@ -1,454 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkAdjustment" id="size_adjustment">
|
||||
<property name="lower">7</property>
|
||||
<property name="upper">100</property>
|
||||
<property name="value">14</property>
|
||||
<property name="step_increment">0.5</property>
|
||||
<property name="page_increment">10</property>
|
||||
<signal name="value-changed" handler="basic_value_changed" object="size_entry" swapped="false"/>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="letterspacing_adjustment">
|
||||
<property name="lower">-1024</property>
|
||||
<property name="upper">8192</property>
|
||||
<property name="value">0</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">512</property>
|
||||
<signal name="value-changed" handler="basic_value_changed" object="letterspacing_entry" swapped="false"/>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="line_height_adjustment">
|
||||
<property name="lower">0.75</property>
|
||||
<property name="upper">2.5</property>
|
||||
<property name="value">1.0</property>
|
||||
<property name="step_increment">0.1</property>
|
||||
<property name="page_increment">1</property>
|
||||
<signal name="value-changed" handler="basic_value_changed" object="line_height_entry" swapped="false"/>
|
||||
</object>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="default-width">600</property>
|
||||
<property name="default-height">500</property>
|
||||
<property name="title">Font Explorer</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<child>
|
||||
<object class="GtkButton" id="reset">
|
||||
<property name="receives-default">1</property>
|
||||
<property name="tooltip-text">Reset</property>
|
||||
<property name="icon-name">view-refresh-symbolic</property>
|
||||
<signal name="clicked" handler="font_features_reset_basic" swapped="no"/>
|
||||
<signal name="clicked" handler="font_features_reset_features" swapped="no"/>
|
||||
<signal name="clicked" handler="font_features_reset_variations" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="receives-default">1</property>
|
||||
<property name="font">Sans 12</property>
|
||||
<property name="level">family|style</property>
|
||||
<signal name="font-set" handler="font_features_font_changed" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="column-spacing">10</property>
|
||||
<property name="row-spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Size</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="size_scale">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="width-request">100</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="adjustment">size_adjustment</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="size_entry">
|
||||
<property name="width-chars">4</property>
|
||||
<property name="max-width-chars">4</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="activate" handler="basic_entry_activated"
|
||||
object="size_adjustment" swapped="false"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Letterspacing</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="width-request">100</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="adjustment">letterspacing_adjustment</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="letterspacing_entry">
|
||||
<property name="width-chars">4</property>
|
||||
<property name="max-width-chars">4</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="activate" handler="basic_entry_activated"
|
||||
object="letterspacing_adjustment" swapped="false"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Line Height</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="width-request">100</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="adjustment">line_height_adjustment</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="line_height_entry">
|
||||
<property name="width-chars">4</property>
|
||||
<property name="max-width-chars">4</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="activate" handler="basic_entry_activated"
|
||||
object="line_height_adjustment" swapped="false"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Foreground</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="foreground">
|
||||
<property name="valign">baseline</property>
|
||||
<property name="rgba">black</property>
|
||||
<signal name="notify::rgba" handler="color_set_cb"/>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Background</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkColorButton" id="background">
|
||||
<property name="valign">baseline</property>
|
||||
<property name="rgba">white</property>
|
||||
<signal name="notify::rgba" handler="color_set_cb"/>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">object-flip-vertical-symbolic</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
<signal name="clicked" handler="swap_colors"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">3</property>
|
||||
<property name="row-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander">
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">OpenType Features</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<style>
|
||||
<class name="title-4"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="feature_list">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="script_lang">
|
||||
<property name="tooltip-text" translatable="yes">Language System</property>
|
||||
<property name="margin-top">10</property>
|
||||
<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>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander">
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="variations_heading">
|
||||
<property name="label" translatable="yes">Variation Axes</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<style>
|
||||
<class name="title-4"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="variations_grid">
|
||||
<property name="column-spacing">10</property>
|
||||
<property name="row-spacing">10</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="view"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="margin-start">20</property>
|
||||
<property name="margin-end">20</property>
|
||||
<property name="margin-top">20</property>
|
||||
<property name="margin-bottom">20</property>
|
||||
<property name="spacing">20</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="swin">
|
||||
<property name="hscrollbar-policy">automatic</property>
|
||||
<property name="vscrollbar-policy">automatic</property>
|
||||
<property name="propagate-natural-height">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<style>
|
||||
<class name="font_features_background"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">label</property>
|
||||
<property name="child">
|
||||
<object class="GtkLabel" id="label">
|
||||
<property name="wrap">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="selectable">1</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">entry</property>
|
||||
<property name="child">
|
||||
<object class="GtkTextView" id="entry">
|
||||
<property name="buffer">
|
||||
<object class="GtkTextBuffer">
|
||||
<property name="text">Grumpy wizards make toxic brew for the evil Queen and Jack. A quick movement of the enemy will jeopardize six gunboats. The job of waxing linoleum frequently peeves chintzy kids. My girl wove six dozen plaid jackets before she quit. Twelve ziggurats quickly jumped a finch box.
|
||||
|
||||
Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика. Наш банк вчера же выплатил Ф.Я. Эйхгольду комиссию за ценные вещи. Эх, чужак, общий съём цен шляп (юфть) – вдрызг! В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
|
||||
|
||||
Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="valign">fill</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="settings">
|
||||
<property name="wrap">1</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="width-chars">50</property>
|
||||
<property name="max-width-chars">50</property>
|
||||
<property name="hexpand">1</property>
|
||||
<style>
|
||||
<class name="monospace"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Alphabet</property>
|
||||
<signal name="clicked" handler="set_text_alphabet"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Paragraph</property>
|
||||
<signal name="clicked" handler="set_text_paragraph"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="description">
|
||||
<property name="wrap">1</property>
|
||||
<property name="wrap-mode">char</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="width-chars">50</property>
|
||||
<property name="max-width-chars">50</property>
|
||||
<property name="hexpand">1</property>
|
||||
<style>
|
||||
<class name="monospace"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<property name="valign">end</property>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="plain_toggle">
|
||||
<property name="label" translatable="yes">Plain</property>
|
||||
<property name="active">1</property>
|
||||
<property name="valign">baseline</property>
|
||||
<signal name="toggled" handler="font_features_toggle_plain"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="waterfall_toggle">
|
||||
<property name="label" translatable="yes">Waterfall</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="group">plain_toggle</property>
|
||||
<signal name="toggled" handler="font_features_toggle_plain"/>
|
||||
<signal name="notify::active" handler="font_features_notify_waterfall"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="edit_toggle">
|
||||
<property name="group">waterfall_toggle</property>
|
||||
<property name="icon-name">document-edit-symbolic</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">end</property>
|
||||
<signal name="clicked" handler="font_features_toggle_edit"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -23,7 +23,7 @@ do_headerbar (GtkWidget *do_widget)
|
||||
{
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Welcome to the Hotel California");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Welcome to Facebook - Log in, sign up or learn more");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
@@ -31,7 +31,6 @@ do_headerbar (GtkWidget *do_widget)
|
||||
header = gtk_header_bar_new ();
|
||||
|
||||
button = gtk_button_new_from_icon_name ("mail-send-receive-symbolic");
|
||||
gtk_widget_set_tooltip_text (button, "Check out");
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
|
||||
@@ -66,9 +66,11 @@ do_links (GtkWidget *do_widget)
|
||||
"as hyperlinks, which can be clicked "
|
||||
"or activated via <a href=\"keynav\">keynav</a> "
|
||||
"and they work fine with other markup, like when "
|
||||
"linking to <a href=\"http://www.flathub.org/\"><b>"
|
||||
"<span letter_spacing=\"1024\" underline=\"none\" color=\"pink\" background=\"darkslategray\">Flathub</span>"
|
||||
"</b></a>.");
|
||||
"searching on <a href=\"http://www.google.com/\">"
|
||||
"<span color=\"#0266C8\">G</span><span color=\"#F90101\">o</span>"
|
||||
"<span color=\"#F2B50F\">o</span><span color=\"#0266C8\">g</span>"
|
||||
"<span color=\"#00933B\">l</span><span color=\"#F90101\">e</span>"
|
||||
"</a>.");
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
gtk_label_set_max_width_chars (GTK_LABEL (label), 40);
|
||||
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
|
||||
|
||||
@@ -260,19 +260,12 @@ gtk_message_row_state_flags_changed (GtkWidget *widget,
|
||||
GTK_WIDGET_CLASS (gtk_message_row_parent_class)->state_flags_changed (widget, previous_state_flags);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_message_row_dispose (GObject *obj)
|
||||
{
|
||||
gtk_widget_dispose_template (GTK_WIDGET (obj), GTK_TYPE_MESSAGE_ROW);
|
||||
G_OBJECT_CLASS (gtk_message_row_parent_class)->dispose (obj);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_message_row_finalize (GObject *obj)
|
||||
{
|
||||
GtkMessageRowPrivate *priv = GTK_MESSAGE_ROW (obj)->priv;
|
||||
g_object_unref (priv->message);
|
||||
G_OBJECT_CLASS (gtk_message_row_parent_class)->finalize (obj);
|
||||
G_OBJECT_CLASS (gtk_message_row_parent_class)->finalize(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -281,7 +274,6 @@ gtk_message_row_class_init (GtkMessageRowClass *klass)
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = gtk_message_row_dispose;
|
||||
object_class->finalize = gtk_message_row_finalize;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/listbox/listbox.ui");
|
||||
|
||||
@@ -42,7 +42,8 @@ do_listbox_controls (GtkWidget *do_widget)
|
||||
GtkBuilder *builder;
|
||||
|
||||
scope = gtk_builder_cscope_new ();
|
||||
gtk_builder_cscope_add_callback (scope, row_activated);
|
||||
gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope),
|
||||
"row_activated", G_CALLBACK (row_activated));
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
|
||||
|
||||
@@ -356,10 +356,10 @@ do_listview_settings (GtkWidget *do_widget)
|
||||
g_type_ensure (SETTINGS_TYPE_KEY);
|
||||
|
||||
scope = gtk_builder_cscope_new ();
|
||||
gtk_builder_cscope_add_callback (scope, search_enabled);
|
||||
gtk_builder_cscope_add_callback (scope, search_changed);
|
||||
gtk_builder_cscope_add_callback (scope, stop_search);
|
||||
gtk_builder_cscope_add_callback (scope, item_value_changed);
|
||||
gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope), "search_enabled", (GCallback)search_enabled);
|
||||
gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope), "search_changed", (GCallback)search_changed);
|
||||
gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope), "stop_search", (GCallback)stop_search);
|
||||
gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope), "item_value_changed", (GCallback)item_value_changed);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Lists/Words
|
||||
* #Keywords: GtkListView, GtkFilterListModel, GtkInscription
|
||||
* #Keywords: GtkListView, GtkFilterListModel
|
||||
*
|
||||
* This demo shows filtering a long list - of words.
|
||||
*
|
||||
@@ -17,9 +17,10 @@ const char *factory_text =
|
||||
"<interface>\n"
|
||||
" <template class='GtkListItem'>\n"
|
||||
" <property name='child'>\n"
|
||||
" <object class='GtkInscription'>\n"
|
||||
" <object class='GtkLabel'>\n"
|
||||
" <property name='ellipsize'>end</property>\n"
|
||||
" <property name='xalign'>0</property>\n"
|
||||
" <binding name='text'>\n"
|
||||
" <binding name='label'>\n"
|
||||
" <lookup name='string' type='GtkStringObject'>\n"
|
||||
" <lookup name='item'>GtkListItem</lookup>\n"
|
||||
" </lookup>\n"
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
<lookup name="item">GtkListItem</lookup>
|
||||
</binding>
|
||||
<property name="child">
|
||||
<object class="GtkInscription">
|
||||
<property name="hexpand">1</property>
|
||||
<binding name="text">
|
||||
<object class="GtkLabel">
|
||||
<property name="halign">start</property>
|
||||
<binding name="label">
|
||||
<lookup name="title" type="GtkDemo">
|
||||
<lookup name="item">expander</lookup>
|
||||
</lookup>
|
||||
|
||||
@@ -73,7 +73,6 @@ demos = files([
|
||||
'peg_solitaire.c',
|
||||
'pickers.c',
|
||||
'printing.c',
|
||||
'read_more.c',
|
||||
'revealer.c',
|
||||
'rotated_text.c',
|
||||
'scale.c',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* #Keywords: GtkColorChooser, GtkFontChooser, GtkApplicationChooser
|
||||
*
|
||||
* These widgets are mainly intended for use in preference dialogs.
|
||||
* They allow to select colors, fonts and applications.
|
||||
* They allow to select colors, fonts, directories and applications.
|
||||
*
|
||||
* This demo shows both the default appearance for these dialogs,
|
||||
* as well as some of the customizations that are possible.
|
||||
|
||||
@@ -1,239 +0,0 @@
|
||||
/* Read More
|
||||
* #Keywords: GtkInscription
|
||||
*
|
||||
* A simple implementation of a widget that can either
|
||||
* display a lot of text or just the first few lines with a
|
||||
* "Read More" button.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define READ_TYPE_MORE (read_more_get_type ())
|
||||
G_DECLARE_FINAL_TYPE(ReadMore, read_more, READ, MORE, GtkWidget)
|
||||
|
||||
struct _ReadMore {
|
||||
GtkWidget parent_instance;
|
||||
|
||||
GtkWidget *label;
|
||||
GtkWidget *inscription;
|
||||
GtkWidget *box;
|
||||
gboolean show_more;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ReadMore, read_more, GTK_TYPE_WIDGET)
|
||||
|
||||
static GtkSizeRequestMode
|
||||
read_more_get_request_mode (GtkWidget *widget)
|
||||
{
|
||||
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
int for_size,
|
||||
int *minimum,
|
||||
int *natural,
|
||||
int *minimum_baseline,
|
||||
int *natural_baseline)
|
||||
{
|
||||
ReadMore *self = READ_MORE (widget);
|
||||
int label_min, label_nat, label_min_baseline, label_nat_baseline;
|
||||
int box_min, box_nat, box_min_baseline, box_nat_baseline;
|
||||
int min_check;
|
||||
|
||||
if (self->show_more)
|
||||
min_check = G_MAXINT;
|
||||
else if (for_size >= 0)
|
||||
gtk_widget_measure (self->box, 1 - orientation, -1, &min_check, NULL, NULL, NULL);
|
||||
else
|
||||
min_check = -1;
|
||||
|
||||
if (min_check > for_size)
|
||||
{
|
||||
gtk_widget_measure (self->label,
|
||||
orientation,
|
||||
for_size,
|
||||
minimum, natural,
|
||||
minimum_baseline, natural_baseline);
|
||||
return;
|
||||
}
|
||||
|
||||
else if (for_size >= 0)
|
||||
gtk_widget_measure (self->label, 1 - orientation, -1, &min_check, NULL, NULL, NULL);
|
||||
else
|
||||
min_check = -1;
|
||||
|
||||
if (min_check > for_size)
|
||||
{
|
||||
gtk_widget_measure (self->box,
|
||||
orientation,
|
||||
for_size,
|
||||
minimum, natural,
|
||||
minimum_baseline, natural_baseline);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_widget_measure (self->label,
|
||||
orientation,
|
||||
for_size,
|
||||
&label_min, &label_nat,
|
||||
&label_min_baseline, &label_nat_baseline);
|
||||
gtk_widget_measure (self->box,
|
||||
orientation,
|
||||
for_size,
|
||||
&box_min, &box_nat,
|
||||
&box_min_baseline, &box_nat_baseline);
|
||||
|
||||
*minimum = MIN (label_min, box_min);
|
||||
*natural = MIN (label_nat, box_nat);
|
||||
|
||||
/* FIXME: Figure out baselines! */
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
int height,
|
||||
int baseline)
|
||||
{
|
||||
ReadMore *self = READ_MORE (widget);
|
||||
gboolean show_more;
|
||||
|
||||
if (self->show_more)
|
||||
{
|
||||
show_more = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
int needed;
|
||||
|
||||
/* check to see if we have enough space to show all text */
|
||||
gtk_widget_measure (self->label,
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
width,
|
||||
&needed, NULL, NULL, NULL);
|
||||
|
||||
show_more = needed <= height;
|
||||
}
|
||||
|
||||
gtk_widget_set_child_visible (self->label, show_more);
|
||||
gtk_widget_set_child_visible (self->box, !show_more);
|
||||
|
||||
if (show_more)
|
||||
gtk_widget_size_allocate (self->label, &(GtkAllocation) { 0, 0, width, height }, baseline);
|
||||
else
|
||||
gtk_widget_size_allocate (self->box, &(GtkAllocation) { 0, 0, width, height }, baseline);
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_dispose (GObject *object)
|
||||
{
|
||||
ReadMore *self = READ_MORE (object);
|
||||
|
||||
g_clear_pointer (&self->label, gtk_widget_unparent);
|
||||
g_clear_pointer (&self->box, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (read_more_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_class_init (ReadMoreClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
widget_class->get_request_mode = read_more_get_request_mode;
|
||||
widget_class->measure = read_more_measure;
|
||||
widget_class->size_allocate = read_more_allocate;
|
||||
|
||||
object_class->dispose = read_more_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_clicked (GtkButton *button,
|
||||
ReadMore *self)
|
||||
{
|
||||
self->show_more = TRUE;
|
||||
gtk_widget_queue_resize (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_init (ReadMore *self)
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
self->label = gtk_label_new (NULL);
|
||||
gtk_label_set_xalign (GTK_LABEL (self->label), 0.0);
|
||||
gtk_label_set_yalign (GTK_LABEL (self->label), 0.0);
|
||||
gtk_label_set_wrap (GTK_LABEL (self->label), TRUE);
|
||||
gtk_label_set_width_chars (GTK_LABEL (self->label), 3);
|
||||
gtk_label_set_max_width_chars (GTK_LABEL (self->label), 30);
|
||||
gtk_widget_set_parent (self->label, GTK_WIDGET (self));
|
||||
|
||||
self->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_vexpand (self->box, FALSE);
|
||||
gtk_widget_set_parent (self->box, GTK_WIDGET (self));
|
||||
|
||||
self->inscription = gtk_inscription_new (NULL);
|
||||
gtk_inscription_set_xalign (GTK_INSCRIPTION (self->inscription), 0.0);
|
||||
gtk_inscription_set_yalign (GTK_INSCRIPTION (self->inscription), 0.0);
|
||||
gtk_inscription_set_min_lines (GTK_INSCRIPTION (self->inscription), 3);
|
||||
gtk_inscription_set_nat_chars (GTK_INSCRIPTION (self->inscription), 30);
|
||||
gtk_widget_set_vexpand (self->inscription, TRUE);
|
||||
gtk_box_append (GTK_BOX (self->box), self->inscription);
|
||||
|
||||
button = gtk_button_new_with_label ("Read More");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (read_more_clicked), self);
|
||||
gtk_box_append (GTK_BOX (self->box), button);
|
||||
}
|
||||
|
||||
static void
|
||||
read_more_set_text (ReadMore *self,
|
||||
const char *text)
|
||||
{
|
||||
gtk_label_set_label (GTK_LABEL (self->label), text);
|
||||
gtk_inscription_set_text (GTK_INSCRIPTION (self->inscription), text);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
read_more_new (const char *text)
|
||||
{
|
||||
ReadMore *self = g_object_new (READ_TYPE_MORE, NULL);
|
||||
|
||||
read_more_set_text (self, text);
|
||||
|
||||
return GTK_WIDGET (self);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_read_more (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *readmore;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Read More");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
readmore = read_more_new (
|
||||
"I'd just like to interject for a moment. What you're referring to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.\n"
|
||||
"\n"
|
||||
"Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called \"Linux\", and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.\n"
|
||||
"\n"
|
||||
"There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called \"Linux\" distributions are really distributions of GNU/Linux.");
|
||||
gtk_window_set_child (GTK_WINDOW (window), readmore);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -137,7 +137,7 @@ insert_text (GtkTextView *view)
|
||||
|
||||
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
|
||||
icon = gtk_icon_theme_lookup_icon (icon_theme,
|
||||
"drive-harddisk",
|
||||
"face-cool",
|
||||
NULL,
|
||||
32, 1,
|
||||
gtk_widget_get_direction (widget),
|
||||
@@ -239,6 +239,8 @@ insert_text (GtkTextView *view)
|
||||
|
||||
gtk_text_buffer_insert (buffer, &iter, "The buffer can have images in it: ", -1);
|
||||
gtk_text_buffer_insert_paintable (buffer, &iter, GDK_PAINTABLE (icon));
|
||||
gtk_text_buffer_insert_paintable (buffer, &iter, GDK_PAINTABLE (icon));
|
||||
|
||||
gtk_text_buffer_insert_paintable (buffer, &iter, nuclear);
|
||||
|
||||
gtk_text_buffer_insert (buffer, &iter, " for example.\n\n", -1);
|
||||
@@ -439,12 +441,11 @@ attach_widgets (GtkTextView *text_view)
|
||||
{
|
||||
widget = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, NULL);
|
||||
gtk_range_set_range (GTK_RANGE (widget), 0, 100);
|
||||
gtk_widget_set_size_request (widget, 100, -1);
|
||||
gtk_widget_set_size_request (widget, 70, -1);
|
||||
}
|
||||
else if (i == 3)
|
||||
{
|
||||
widget = gtk_entry_new ();
|
||||
gtk_editable_set_width_chars (GTK_EDITABLE (widget), 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -409,14 +409,6 @@ icon_browser_window_init (IconBrowserWindow *win)
|
||||
g_signal_connect (win->context_model, "notify::selected", G_CALLBACK (selected_name_changed), win);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_browser_window_dispose (GObject *object)
|
||||
{
|
||||
gtk_widget_dispose_template (GTK_WIDGET (object), ICON_BROWSER_WINDOW_TYPE);
|
||||
|
||||
G_OBJECT_CLASS (icon_browser_window_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_browser_window_finalize (GObject *object)
|
||||
{
|
||||
@@ -432,7 +424,6 @@ icon_browser_window_class_init (IconBrowserWindowClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->dispose = icon_browser_window_dispose;
|
||||
object_class->finalize = icon_browser_window_finalize;
|
||||
|
||||
g_type_ensure (IB_TYPE_ICON);
|
||||
|
||||
@@ -57,7 +57,6 @@ struct _NodeEditorWindow
|
||||
GtkWidget *testcase_cairo_checkbutton;
|
||||
GtkWidget *testcase_name_entry;
|
||||
GtkWidget *testcase_save_button;
|
||||
GtkWidget *scale_scale;
|
||||
|
||||
GtkWidget *renderer_listbox;
|
||||
GListStore *renderers;
|
||||
@@ -172,7 +171,6 @@ text_changed (GtkTextBuffer *buffer,
|
||||
GBytes *bytes;
|
||||
GtkTextIter iter;
|
||||
GtkTextIter start, end;
|
||||
float scale;
|
||||
|
||||
g_array_remove_range (self->errors, 0, self->errors->len);
|
||||
text = get_current_text (self->text_buffer);
|
||||
@@ -183,17 +181,6 @@ text_changed (GtkTextBuffer *buffer,
|
||||
|
||||
/* If this is too slow, go fix the parser performance */
|
||||
self->node = gsk_render_node_deserialize (bytes, deserialize_error_func, self);
|
||||
|
||||
scale = gtk_scale_button_get_value (GTK_SCALE_BUTTON (self->scale_scale));
|
||||
if (self->node && scale != 1.0)
|
||||
{
|
||||
GskRenderNode *node;
|
||||
|
||||
node = gsk_transform_node_new (self->node, gsk_transform_scale (NULL, scale, scale));
|
||||
gsk_render_node_unref (self->node);
|
||||
self->node = node;
|
||||
}
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
if (self->node)
|
||||
{
|
||||
@@ -290,14 +277,6 @@ text_changed (GtkTextBuffer *buffer,
|
||||
&start, &end);
|
||||
}
|
||||
|
||||
static void
|
||||
scale_changed (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
text_changed (self->text_buffer, self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
text_view_query_tooltip_cb (GtkWidget *widget,
|
||||
int x,
|
||||
@@ -873,14 +852,6 @@ dark_mode_cb (GtkToggleButton *button,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_dispose (GObject *object)
|
||||
{
|
||||
gtk_widget_dispose_template (GTK_WIDGET (object), NODE_EDITOR_WINDOW_TYPE);
|
||||
|
||||
G_OBJECT_CLASS (node_editor_window_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_finalize (GObject *object)
|
||||
{
|
||||
@@ -975,7 +946,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
object_class->dispose = node_editor_window_dispose;
|
||||
object_class->finalize = node_editor_window_finalize;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
@@ -992,7 +962,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_cairo_checkbutton);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_name_entry);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_save_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, scale_scale);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, text_view_query_tooltip_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, open_cb);
|
||||
@@ -1099,7 +1068,6 @@ node_editor_window_init (NodeEditorWindow *self)
|
||||
|
||||
self->text_buffer = gtk_text_buffer_new (self->tag_table);
|
||||
g_signal_connect (self->text_buffer, "changed", G_CALLBACK (text_changed), self);
|
||||
g_signal_connect (self->scale_scale, "notify::value", G_CALLBACK (scale_changed), self);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (self->text_view), self->text_buffer);
|
||||
|
||||
/* Default */
|
||||
|
||||
@@ -157,23 +157,6 @@
|
||||
<signal name="notify::active" handler="dark_mode_cb" swapped="0"/>
|
||||
</object>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkScaleButton" id="scale_scale">
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment">
|
||||
<property name="lower">1</property>
|
||||
<property name="value">1</property>
|
||||
<property name="upper">10</property>
|
||||
<property name="step-increment">0.1</property>
|
||||
<property name="page-increment">0.5</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="icons">zoom-in-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Scale the image</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
||||
@@ -2081,24 +2081,26 @@ activate (GApplication *app)
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
scope = gtk_builder_cscope_new ();
|
||||
gtk_builder_cscope_add_callback (scope, on_entry_icon_release);
|
||||
gtk_builder_cscope_add_callback (scope, on_scale_button_value_changed);
|
||||
gtk_builder_cscope_add_callback (scope, on_record_button_toggled);
|
||||
gtk_builder_cscope_add_callback (scope, on_page_combo_changed);
|
||||
gtk_builder_cscope_add_callback (scope, on_range_from_changed);
|
||||
gtk_builder_cscope_add_callback (scope, on_range_to_changed);
|
||||
gtk_builder_cscope_add_callback (scope, on_picture_drag_prepare);
|
||||
gtk_builder_cscope_add_callback (scope, on_picture_drop);
|
||||
gtk_builder_cscope_add_callback (scope, tab_close_cb);
|
||||
gtk_builder_cscope_add_callback (scope, increase_icon_size);
|
||||
gtk_builder_cscope_add_callback (scope, decrease_icon_size);
|
||||
gtk_builder_cscope_add_callback (scope, osd_frame_pressed);
|
||||
gtk_builder_cscope_add_callback (scope, age_entry_changed);
|
||||
gtk_builder_cscope_add_callback (scope, validate_more_details);
|
||||
gtk_builder_cscope_add_callback (scope, mode_switch_state_set);
|
||||
gtk_builder_cscope_add_callback (scope, level_scale_value_changed);
|
||||
gtk_builder_cscope_add_callback (scope, transition_speed_changed);
|
||||
gtk_builder_cscope_add_callback (scope, reset_icon_size);
|
||||
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
|
||||
"on_entry_icon_release", (GCallback)on_entry_icon_release,
|
||||
"on_scale_button_value_changed", (GCallback)on_scale_button_value_changed,
|
||||
"on_record_button_toggled", (GCallback)on_record_button_toggled,
|
||||
"on_page_combo_changed", (GCallback)on_page_combo_changed,
|
||||
"on_range_from_changed", (GCallback)on_range_from_changed,
|
||||
"on_range_to_changed", (GCallback)on_range_to_changed,
|
||||
"on_picture_drag_prepare", (GCallback)on_picture_drag_prepare,
|
||||
"on_picture_drop", (GCallback)on_picture_drop,
|
||||
"tab_close_cb", (GCallback)tab_close_cb,
|
||||
"increase_icon_size", (GCallback)increase_icon_size,
|
||||
"decrease_icon_size", (GCallback)decrease_icon_size,
|
||||
"reset_icon_size", (GCallback)reset_icon_size,
|
||||
"osd_frame_pressed", (GCallback)osd_frame_pressed,
|
||||
"age_entry_changed", (GCallback)age_entry_changed,
|
||||
"validate_more_details", (GCallback)validate_more_details,
|
||||
"mode_switch_state_set", (GCallback)mode_switch_state_set,
|
||||
"level_scale_value_changed", (GCallback)level_scale_value_changed,
|
||||
"transition_speed_changed", (GCallback)transition_speed_changed,
|
||||
NULL);
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
g_object_unref (scope);
|
||||
if (!gtk_builder_add_from_resource (builder, "/org/gtk/WidgetFactory4/widget-factory.ui", &error))
|
||||
|
||||
@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
website_url = "https://www.gtk.org"
|
||||
authors = "GTK Development Team"
|
||||
logo_url = "gtk-logo.svg"
|
||||
license = "LGPL-2.1-or-later"
|
||||
license = "GPL-2.1-or-later"
|
||||
description = "The GTK toolkit"
|
||||
devhelp = true
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
website_url = "https://www.gtk.org"
|
||||
authors = "GTK Development Team"
|
||||
logo_url = "gtk-logo.svg"
|
||||
license = "LGPL-2.1-or-later"
|
||||
license = "GPL-2.1-or-later"
|
||||
description = "The GTK toolkit"
|
||||
dependencies = ["Gdk-4.0"]
|
||||
devhelp = true
|
||||
|
||||
@@ -189,7 +189,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
message->pointer.state,
|
||||
message->scroll.dir == 0
|
||||
? GDK_SCROLL_UP
|
||||
: GDK_SCROLL_DOWN);
|
||||
: GDK_SCROLL_DOWN,
|
||||
FALSE);
|
||||
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
_gdk_windowing_got_event (display, node, event, message->base.serial);
|
||||
|
||||
@@ -117,7 +117,6 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "selection", GDK_DEBUG_SELECTION, "Information about selections" },
|
||||
{ "clipboard", GDK_DEBUG_CLIPBOARD, "Information about clipboards" },
|
||||
{ "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" },
|
||||
@@ -361,13 +360,21 @@ gdk_running_in_sandbox (void)
|
||||
gboolean
|
||||
gdk_should_use_portal (void)
|
||||
{
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (NULL, PORTALS))
|
||||
return TRUE;
|
||||
static const char *use_portal = NULL;
|
||||
|
||||
if (gdk_running_in_sandbox ())
|
||||
return TRUE;
|
||||
if (G_UNLIKELY (use_portal == NULL))
|
||||
{
|
||||
if (gdk_running_in_sandbox ())
|
||||
use_portal = "1";
|
||||
else
|
||||
{
|
||||
use_portal = g_getenv ("GTK_USE_PORTAL");
|
||||
if (!use_portal)
|
||||
use_portal = "";
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return use_portal[0] == '1';
|
||||
}
|
||||
|
||||
PangoDirection
|
||||
|
||||
+13
-14
@@ -38,20 +38,19 @@ typedef enum {
|
||||
GDK_DEBUG_CLIPBOARD = 1 << 10,
|
||||
/* flags below are influencing behavior */
|
||||
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,
|
||||
GDK_DEBUG_GL_EGL = 1 << 19,
|
||||
GDK_DEBUG_GL_GLX = 1 << 20,
|
||||
GDK_DEBUG_GL_WGL = 1 << 21,
|
||||
GDK_DEBUG_VULKAN_DISABLE = 1 << 22,
|
||||
GDK_DEBUG_VULKAN_VALIDATE = 1 << 23,
|
||||
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 24,
|
||||
GDK_DEBUG_HIGH_DEPTH = 1 << 25,
|
||||
GDK_DEBUG_GL_DISABLE = 1 << 12,
|
||||
GDK_DEBUG_GL_SOFTWARE = 1 << 13,
|
||||
GDK_DEBUG_GL_TEXTURE_RECT = 1 << 14,
|
||||
GDK_DEBUG_GL_LEGACY = 1 << 15,
|
||||
GDK_DEBUG_GL_GLES = 1 << 16,
|
||||
GDK_DEBUG_GL_DEBUG = 1 << 17,
|
||||
GDK_DEBUG_GL_EGL = 1 << 18,
|
||||
GDK_DEBUG_GL_GLX = 1 << 19,
|
||||
GDK_DEBUG_GL_WGL = 1 << 20,
|
||||
GDK_DEBUG_VULKAN_DISABLE = 1 << 21,
|
||||
GDK_DEBUG_VULKAN_VALIDATE = 1 << 22,
|
||||
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 23,
|
||||
GDK_DEBUG_HIGH_DEPTH = 1 << 24,
|
||||
} GdkDebugFlags;
|
||||
|
||||
extern guint _gdk_debug_flags;
|
||||
|
||||
+2
-7
@@ -66,15 +66,10 @@ typedef enum
|
||||
/**
|
||||
* GdkTimeCoord:
|
||||
* @time: The timestamp for this event
|
||||
* @flags: Flags indicating what axes are present, see [flags@Gdk.AxisFlags]
|
||||
* @axes: (array fixed-size=12): axis values, indexed by [enum@Gdk.AxisUse]
|
||||
* @flags: Flags indicating what axes are present
|
||||
* @axes: (array fixed-size=12): axis values
|
||||
*
|
||||
* A `GdkTimeCoord` stores a single event in a motion history.
|
||||
*
|
||||
* To check whether an axis is present, check whether the corresponding
|
||||
* flag from the [flags@Gdk.AxisFlags] enumeration is set in the @flags
|
||||
* To access individual axis values, use the values of the values of
|
||||
* the [enum@Gdk.AxisUse] enumerations as indices.
|
||||
*/
|
||||
struct _GdkTimeCoord
|
||||
{
|
||||
|
||||
+11
-1
@@ -920,6 +920,14 @@ gdk_event_get_pointer_emulated (GdkEvent *event)
|
||||
return tevent->pointer_emulated;
|
||||
}
|
||||
|
||||
case GDK_SCROLL:
|
||||
case GDK_SCROLL_SMOOTH:
|
||||
{
|
||||
GdkScrollEvent *sevent = (GdkScrollEvent *) event;
|
||||
|
||||
return sevent->pointer_emulated;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -2365,13 +2373,15 @@ gdk_scroll_event_new_discrete (GdkSurface *surface,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GdkScrollDirection direction)
|
||||
GdkScrollDirection direction,
|
||||
gboolean emulated)
|
||||
{
|
||||
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
|
||||
|
||||
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
|
||||
self->state = state;
|
||||
self->direction = direction;
|
||||
self->pointer_emulated = emulated;
|
||||
self->unit = GDK_SCROLL_UNIT_WHEEL;
|
||||
|
||||
return (GdkEvent *) self;
|
||||
|
||||
@@ -206,6 +206,8 @@ struct _GdkTouchEvent
|
||||
* %GDK_SCROLL_SMOOTH).
|
||||
* @delta_x: the x coordinate of the scroll delta
|
||||
* @delta_y: the y coordinate of the scroll delta
|
||||
* @pointer_emulated: whether the scroll event was the result of
|
||||
* a pointer emulation
|
||||
* @tool: a `GdkDeviceTool`
|
||||
* @history: (element-type GdkTimeCoord): array of times and deltas
|
||||
* for other scroll events that were compressed before delivering the
|
||||
@@ -229,6 +231,7 @@ struct _GdkScrollEvent
|
||||
GdkScrollDirection direction;
|
||||
double delta_x;
|
||||
double delta_y;
|
||||
gboolean pointer_emulated;
|
||||
gboolean is_stop;
|
||||
GdkDeviceTool *tool;
|
||||
GArray *history; /* <GdkTimeCoord> */
|
||||
@@ -493,7 +496,8 @@ GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GdkScrollDirection direction);
|
||||
GdkScrollDirection direction,
|
||||
gboolean emulated);
|
||||
|
||||
GdkEvent * gdk_touch_event_new (GdkEventType type,
|
||||
GdkEventSequence *sequence,
|
||||
|
||||
@@ -373,9 +373,6 @@ gdk_frame_clock_flush_idle (void *data)
|
||||
else
|
||||
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
|
||||
|
||||
g_clear_handle_id (&priv->paint_idle_id, g_source_remove);
|
||||
gdk_frame_clock_paint_idle (data);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
+238
-242
@@ -256,179 +256,181 @@ gdk_gl_context_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
#define N_EGL_ATTRS 16
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
static inline EGLenum
|
||||
gdk_api_to_egl_api (GdkGLAPI api)
|
||||
{
|
||||
switch (api)
|
||||
{
|
||||
case GDK_GL_API_GLES:
|
||||
return EGL_OPENGL_ES_API;
|
||||
case GDK_GL_API_GL:
|
||||
default:
|
||||
return EGL_OPENGL_API;
|
||||
}
|
||||
}
|
||||
#define N_EGL_ATTRS 16
|
||||
|
||||
static GdkGLAPI
|
||||
gdk_gl_context_create_egl_context (GdkGLContext *context,
|
||||
GdkGLAPI api,
|
||||
gboolean legacy)
|
||||
gdk_gl_context_real_realize (GdkGLContext *context,
|
||||
GError **error)
|
||||
{
|
||||
#ifdef HAVE_EGL
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
EGLDisplay egl_display = gdk_display_get_egl_display (display);
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
GdkGLContextPrivate *share_priv = gdk_gl_context_get_instance_private (share);
|
||||
EGLConfig egl_config;
|
||||
EGLContext ctx;
|
||||
EGLint context_attribs[N_EGL_ATTRS], i = 0, flags = 0;
|
||||
gboolean debug_bit, forward_bit;
|
||||
int min_major, min_minor, major = 0, minor = 0;
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
if (!gdk_gl_context_is_api_allowed (context, api, NULL))
|
||||
return 0;
|
||||
|
||||
/* We will use the default version matching the context status
|
||||
* unless the user requested a version which makes sense */
|
||||
gdk_gl_context_get_matching_version (api, legacy,
|
||||
display->have_egl_win32_libangle,
|
||||
&min_major, &min_minor);
|
||||
gdk_gl_context_get_clipped_version (context,
|
||||
min_major, min_minor,
|
||||
&major, &minor);
|
||||
|
||||
if (!eglBindAPI (gdk_api_to_egl_api (api)))
|
||||
return 0;
|
||||
|
||||
debug_bit = gdk_gl_context_get_debug_enabled (context);
|
||||
forward_bit = gdk_gl_context_get_forward_compatible (context);
|
||||
|
||||
if (display->have_egl_no_config_context)
|
||||
egl_config = NULL;
|
||||
else
|
||||
egl_config = gdk_display_get_egl_config (display);
|
||||
|
||||
if (debug_bit)
|
||||
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
|
||||
if (forward_bit)
|
||||
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||
|
||||
if (api == GDK_GL_API_GL)
|
||||
if (egl_display)
|
||||
{
|
||||
/* We want a core profile, unless in legacy mode */
|
||||
context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK;
|
||||
context_attribs[i++] = legacy
|
||||
? EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT
|
||||
: EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT;
|
||||
EGLConfig egl_config;
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
GdkGLContextPrivate *share_priv = gdk_gl_context_get_instance_private (share);
|
||||
EGLContext ctx;
|
||||
EGLint context_attribs[N_EGL_ATTRS];
|
||||
int major, minor, flags;
|
||||
gboolean debug_bit, forward_bit, legacy_bit;
|
||||
GdkGLAPI api;
|
||||
int i = 0;
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
|
||||
if (share != NULL)
|
||||
gdk_gl_context_get_required_version (share, &major, &minor);
|
||||
else
|
||||
gdk_gl_context_get_required_version (context, &major, &minor);
|
||||
|
||||
debug_bit = gdk_gl_context_get_debug_enabled (context);
|
||||
forward_bit = gdk_gl_context_get_forward_compatible (context);
|
||||
legacy_bit = GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY) ||
|
||||
(share != NULL && gdk_gl_context_is_legacy (share));
|
||||
|
||||
if (display->have_egl_no_config_context)
|
||||
egl_config = NULL;
|
||||
else
|
||||
egl_config = gdk_display_get_egl_config (display);
|
||||
|
||||
flags = 0;
|
||||
|
||||
if (debug_bit)
|
||||
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
|
||||
if (forward_bit)
|
||||
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||
|
||||
if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL) &&
|
||||
eglBindAPI (EGL_OPENGL_API))
|
||||
{
|
||||
/* We want a core profile, unless in legacy mode */
|
||||
context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
|
||||
context_attribs[i++] = legacy_bit
|
||||
? EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR
|
||||
: EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
|
||||
|
||||
/* Specify the version */
|
||||
context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION_KHR;
|
||||
context_attribs[i++] = legacy_bit ? 3 : major;
|
||||
context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION_KHR;
|
||||
context_attribs[i++] = legacy_bit ? 0 : minor;
|
||||
api = GDK_GL_API_GL;
|
||||
}
|
||||
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL) &&
|
||||
eglBindAPI (EGL_OPENGL_ES_API))
|
||||
{
|
||||
context_attribs[i++] = EGL_CONTEXT_CLIENT_VERSION;
|
||||
if (major == 3)
|
||||
context_attribs[i++] = 3;
|
||||
else
|
||||
context_attribs[i++] = 2;
|
||||
api = GDK_GL_API_GLES;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("The EGL implementation does not support any allowed APIs"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Specify the flags */
|
||||
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
|
||||
context_attribs[i++] = flags;
|
||||
|
||||
context_attribs[i++] = EGL_NONE;
|
||||
g_assert (i < N_EGL_ATTRS);
|
||||
|
||||
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_bit ? "yes" : "no",
|
||||
api == GDK_GL_API_GLES ? "yes" : "no"));
|
||||
|
||||
ctx = eglCreateContext (egl_display,
|
||||
egl_config,
|
||||
share != NULL ? share_priv->egl_context
|
||||
: EGL_NO_CONTEXT,
|
||||
context_attribs);
|
||||
|
||||
/* If context creation failed without the ES bit, let's try again with it */
|
||||
if (ctx == NULL && gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL) && eglBindAPI (EGL_OPENGL_ES_API))
|
||||
{
|
||||
i = 0;
|
||||
context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION;
|
||||
context_attribs[i++] = 2;
|
||||
context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION;
|
||||
context_attribs[i++] = 0;
|
||||
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
|
||||
context_attribs[i++] = flags & ~EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||
context_attribs[i++] = EGL_NONE;
|
||||
g_assert (i < N_EGL_ATTRS);
|
||||
|
||||
legacy_bit = FALSE;
|
||||
api = GDK_GL_API_GLES;
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL,
|
||||
g_message ("eglCreateContext failed, switching to OpenGL ES"));
|
||||
ctx = eglCreateContext (egl_display,
|
||||
egl_config,
|
||||
share != NULL ? share_priv->egl_context
|
||||
: EGL_NO_CONTEXT,
|
||||
context_attribs);
|
||||
}
|
||||
|
||||
/* If context creation failed without the legacy bit, let's try again with it */
|
||||
if (ctx == NULL && gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL) && eglBindAPI (EGL_OPENGL_API))
|
||||
{
|
||||
i = 0;
|
||||
context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
|
||||
context_attribs[i++] = EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR;
|
||||
context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION;
|
||||
context_attribs[i++] = 3;
|
||||
context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION;
|
||||
context_attribs[i++] = 0;
|
||||
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
|
||||
context_attribs[i++] = flags & ~EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||
context_attribs[i++] = EGL_NONE;
|
||||
g_assert (i < N_EGL_ATTRS);
|
||||
|
||||
legacy_bit = TRUE;
|
||||
api = GDK_GL_API_GL;
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL,
|
||||
g_message ("eglCreateContext failed, switching to legacy"));
|
||||
ctx = eglCreateContext (egl_display,
|
||||
egl_config,
|
||||
share != NULL ? share_priv->egl_context
|
||||
: EGL_NO_CONTEXT,
|
||||
context_attribs);
|
||||
}
|
||||
|
||||
if (ctx == NULL)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Unable to create a GL context"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Created EGL context[%p]", ctx));
|
||||
|
||||
priv->egl_context = ctx;
|
||||
|
||||
gdk_gl_context_set_is_legacy (context, legacy_bit);
|
||||
|
||||
if (epoxy_has_egl_extension (egl_display, "EGL_KHR_swap_buffers_with_damage"))
|
||||
priv->eglSwapBuffersWithDamage = (gpointer)epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageKHR");
|
||||
else if (epoxy_has_egl_extension (egl_display, "EGL_EXT_swap_buffers_with_damage"))
|
||||
priv->eglSwapBuffersWithDamage = (gpointer)epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageEXT");
|
||||
|
||||
gdk_profiler_end_mark (start_time, "realize GdkWaylandGLContext", NULL);
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
if (legacy || api == GDK_GL_API_GLES)
|
||||
flags &= ~EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||
|
||||
context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION;
|
||||
context_attribs[i++] = major;
|
||||
context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION;
|
||||
context_attribs[i++] = minor;
|
||||
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
|
||||
context_attribs[i++] = flags;
|
||||
|
||||
context_attribs[i++] = EGL_NONE;
|
||||
g_assert (i < N_EGL_ATTRS);
|
||||
|
||||
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,
|
||||
share ? share_priv->egl_context : EGL_NO_CONTEXT,
|
||||
context_attribs);
|
||||
|
||||
if (ctx == NULL)
|
||||
return 0;
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Created EGL context[%p]", ctx));
|
||||
|
||||
priv->egl_context = ctx;
|
||||
gdk_gl_context_set_is_legacy (context, legacy);
|
||||
|
||||
if (epoxy_has_egl_extension (egl_display, "EGL_KHR_swap_buffers_with_damage"))
|
||||
priv->eglSwapBuffersWithDamage = (gpointer) epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageKHR");
|
||||
else if (epoxy_has_egl_extension (egl_display, "EGL_EXT_swap_buffers_with_damage"))
|
||||
priv->eglSwapBuffersWithDamage = (gpointer) epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageEXT");
|
||||
|
||||
gdk_profiler_end_mark (start_time, "realize GdkWaylandGLContext", NULL);
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
static GdkGLAPI
|
||||
gdk_gl_context_realize_egl (GdkGLContext *context,
|
||||
GError **error)
|
||||
{
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
GdkGLAPI api, preferred_api;
|
||||
gboolean prefer_legacy;
|
||||
|
||||
if (share && gdk_gl_context_is_api_allowed (context,
|
||||
gdk_gl_context_get_api (share),
|
||||
NULL))
|
||||
preferred_api = gdk_gl_context_get_api (share);
|
||||
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
|
||||
preferred_api = GDK_GL_API_GL;
|
||||
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL))
|
||||
preferred_api = GDK_GL_API_GLES;
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("No GL API allowed."));
|
||||
return 0;
|
||||
}
|
||||
|
||||
prefer_legacy = (GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY) ||
|
||||
(share != NULL && gdk_gl_context_is_legacy (share)));
|
||||
|
||||
if (preferred_api == GDK_GL_API_GL)
|
||||
{
|
||||
if ((api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GL, prefer_legacy)) ||
|
||||
(api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GLES, FALSE)) ||
|
||||
(api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GL, TRUE)))
|
||||
return api;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GLES, FALSE)) ||
|
||||
(api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GL, prefer_legacy)) ||
|
||||
(api = gdk_gl_context_create_egl_context (context, GDK_GL_API_GL, TRUE)))
|
||||
return api;
|
||||
}
|
||||
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Unable to create a GL context"));
|
||||
return 0;
|
||||
}
|
||||
#endif /* HAVE_EGL */
|
||||
|
||||
static GdkGLAPI
|
||||
gdk_gl_context_default_realize (GdkGLContext *context,
|
||||
GError **error)
|
||||
{
|
||||
#ifdef HAVE_EGL
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
|
||||
if (gdk_display_get_egl_display (display))
|
||||
return gdk_gl_context_realize_egl (context, error);
|
||||
#endif
|
||||
|
||||
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
@@ -665,7 +667,7 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
|
||||
|
||||
klass->realize = gdk_gl_context_default_realize;
|
||||
klass->realize = gdk_gl_context_real_realize;
|
||||
klass->get_damage = gdk_gl_context_real_get_damage;
|
||||
klass->is_shared = gdk_gl_context_real_is_shared;
|
||||
klass->make_current = gdk_gl_context_real_make_current;
|
||||
@@ -952,48 +954,6 @@ gdk_gl_context_get_forward_compatible (GdkGLContext *context)
|
||||
return priv->forward_compatible;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_gl_context_get_matching_version (GdkGLAPI api,
|
||||
gboolean legacy,
|
||||
gboolean win32_libangle,
|
||||
int *major,
|
||||
int *minor)
|
||||
{
|
||||
int maj, min;
|
||||
|
||||
if (api == GDK_GL_API_GL)
|
||||
{
|
||||
if (legacy)
|
||||
{
|
||||
maj = GDK_GL_MIN_GL_LEGACY_VERSION_MAJOR;
|
||||
min = GDK_GL_MIN_GL_LEGACY_VERSION_MINOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
maj = GDK_GL_MIN_GL_VERSION_MAJOR;
|
||||
min = GDK_GL_MIN_GL_VERSION_MINOR;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (win32_libangle)
|
||||
{
|
||||
maj = GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MAJOR;
|
||||
min = GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MINOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
maj = GDK_GL_MIN_GLES_VERSION_MAJOR;
|
||||
min = GDK_GL_MIN_GLES_VERSION_MINOR;
|
||||
}
|
||||
}
|
||||
|
||||
if (major != NULL)
|
||||
*major = maj;
|
||||
if (minor != NULL)
|
||||
*minor = min;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_set_required_version:
|
||||
* @context: a `GdkGLContext`
|
||||
@@ -1004,10 +964,7 @@ gdk_gl_context_get_matching_version (GdkGLAPI api,
|
||||
*
|
||||
* Setting @major and @minor to zero will use the default values.
|
||||
*
|
||||
* Setting @major and @minor lower than the minimum versions required
|
||||
* by GTK will result in the context choosing the minimum version.
|
||||
*
|
||||
* The @context must not be realized or made current prior to calling
|
||||
* The `GdkGLContext` must not be realized or made current prior to calling
|
||||
* this function.
|
||||
*/
|
||||
void
|
||||
@@ -1016,12 +973,44 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
|
||||
int minor)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
gboolean force_gles = FALSE;
|
||||
int version, min_ver;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GdkDisplay *display;
|
||||
#endif
|
||||
|
||||
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
|
||||
g_return_if_fail (!gdk_gl_context_is_realized (context));
|
||||
|
||||
priv->major = major;
|
||||
priv->minor = minor;
|
||||
/* this will take care of the default */
|
||||
if (major == 0 && minor == 0)
|
||||
{
|
||||
priv->major = 0;
|
||||
priv->minor = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
version = (major * 100) + minor;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
force_gles = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES);
|
||||
#endif
|
||||
/* Enforce a minimum context version number of 3.2 for desktop GL,
|
||||
* and 2.0 for GLES
|
||||
*/
|
||||
if (gdk_gl_context_get_use_es (context) || force_gles)
|
||||
min_ver = 200;
|
||||
else
|
||||
min_ver = 302;
|
||||
|
||||
if (version < min_ver)
|
||||
{
|
||||
g_warning ("gdk_gl_context_set_required_version - GL context versions less than 3.2 are not supported.");
|
||||
version = min_ver;
|
||||
}
|
||||
priv->major = version / 100;
|
||||
priv->minor = version % 100;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -1060,10 +1049,7 @@ gdk_gl_context_check_version (GdkGLContext *self,
|
||||
* @major: (out) (nullable): return location for the major version to request
|
||||
* @minor: (out) (nullable): return location for the minor version to request
|
||||
*
|
||||
* Retrieves required OpenGL version set as a requirement for the @context
|
||||
* realization. It will not change even if a greater OpenGL version is supported
|
||||
* and used after the @context is realized. See
|
||||
* [method@Gdk.GLContext.get_version] for the real version in use.
|
||||
* Retrieves required OpenGL version.
|
||||
*
|
||||
* See [method@Gdk.GLContext.set_required_version].
|
||||
*/
|
||||
@@ -1073,32 +1059,47 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
|
||||
int *minor)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
gboolean force_gles = FALSE;
|
||||
GdkDisplay *display;
|
||||
int default_major, default_minor;
|
||||
int maj, min;
|
||||
|
||||
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
|
||||
|
||||
if (major != NULL)
|
||||
*major = priv->major;
|
||||
if (minor != NULL)
|
||||
*minor = priv->minor;
|
||||
}
|
||||
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
|
||||
void
|
||||
gdk_gl_context_get_clipped_version (GdkGLContext *context,
|
||||
int min_major,
|
||||
int min_minor,
|
||||
int *major,
|
||||
int *minor)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
int maj = min_major, min = min_minor;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
force_gles = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES);
|
||||
#endif
|
||||
|
||||
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
|
||||
/* libANGLE on Windows at least requires GLES 3.0+ */
|
||||
if (display->have_egl_win32_libangle)
|
||||
force_gles = TRUE;
|
||||
|
||||
if (priv->major > maj || (priv->major == maj && priv->minor > min))
|
||||
/* Default fallback values for uninitialised contexts; we
|
||||
* enforce a context version number of 3.2 for desktop GL,
|
||||
* and 2.0 for GLES
|
||||
*/
|
||||
if (gdk_gl_context_get_use_es (context) || force_gles)
|
||||
{
|
||||
maj = priv->major;
|
||||
min = priv->minor;
|
||||
default_major = display->have_egl_win32_libangle ? 3 : 2;
|
||||
default_minor = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
default_major = 3;
|
||||
default_minor = 2;
|
||||
}
|
||||
|
||||
if (priv->major > 0)
|
||||
maj = priv->major;
|
||||
else
|
||||
maj = default_major;
|
||||
|
||||
if (priv->minor > 0)
|
||||
min = priv->minor;
|
||||
else
|
||||
min = default_minor;
|
||||
|
||||
if (major != NULL)
|
||||
*major = maj;
|
||||
@@ -1335,9 +1336,7 @@ gdk_gl_context_set_use_es (GdkGLContext *context,
|
||||
*
|
||||
* Checks whether the @context is using an OpenGL or OpenGL ES profile.
|
||||
*
|
||||
* Returns: %TRUE if the `GdkGLContext` is using an OpenGL ES profile;
|
||||
* %FALSE if other profile is in use of if the @context has not yet
|
||||
* been realized.
|
||||
* Returns: %TRUE if the `GdkGLContext` is using an OpenGL ES profile
|
||||
*/
|
||||
gboolean
|
||||
gdk_gl_context_get_use_es (GdkGLContext *context)
|
||||
@@ -1668,10 +1667,6 @@ gdk_gl_context_get_shared_context (GdkGLContext *context)
|
||||
* Retrieves the OpenGL version of the @context.
|
||||
*
|
||||
* The @context must be realized prior to calling this function.
|
||||
*
|
||||
* If the @context has never been made current, the version cannot
|
||||
* be known and it will return 0 for both @major and @minor.
|
||||
*
|
||||
*/
|
||||
void
|
||||
gdk_gl_context_get_version (GdkGLContext *context,
|
||||
@@ -1850,3 +1845,4 @@ gdk_gl_backend_use (GdkGLBackend backend_type)
|
||||
|
||||
g_assert (the_gl_backend_type == backend_type);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,22 +33,6 @@ G_BEGIN_DECLS
|
||||
#define GDK_EGL_MIN_VERSION_MAJOR (1)
|
||||
#define GDK_EGL_MIN_VERSION_MINOR (4)
|
||||
|
||||
/* Minimum OpenGL versions supported by GTK.
|
||||
* Backends should make sure to never create a context of a previous version.
|
||||
*
|
||||
* The macros refer to OpenGL; OpenGL with OPENGL_COMPATIBILITY_PROFILE_BIT as
|
||||
* OPENGL_PROFILE_MASK; OpenGL ES; and OpenGL ES win32 Angle implementation,
|
||||
* respectively
|
||||
*/
|
||||
#define GDK_GL_MIN_GL_VERSION_MAJOR (3)
|
||||
#define GDK_GL_MIN_GL_VERSION_MINOR (2)
|
||||
#define GDK_GL_MIN_GL_LEGACY_VERSION_MAJOR (3)
|
||||
#define GDK_GL_MIN_GL_LEGACY_VERSION_MINOR (0)
|
||||
#define GDK_GL_MIN_GLES_VERSION_MAJOR (2)
|
||||
#define GDK_GL_MIN_GLES_VERSION_MINOR (0)
|
||||
#define GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MAJOR (3)
|
||||
#define GDK_GL_MIN_GLES_WIN32_ANGLE_VERSION_MINOR (0)
|
||||
|
||||
typedef enum {
|
||||
GDK_GL_NONE = 0,
|
||||
GDK_GL_EGL,
|
||||
@@ -133,16 +117,6 @@ gboolean gdk_gl_context_check_version (GdkGLContext
|
||||
int required_gl_minor,
|
||||
int required_gles_major,
|
||||
int required_gles_minor);
|
||||
void gdk_gl_context_get_clipped_version (GdkGLContext *context,
|
||||
int min_major,
|
||||
int min_minor,
|
||||
int *major,
|
||||
int *minor);
|
||||
void gdk_gl_context_get_matching_version (GdkGLAPI api,
|
||||
gboolean legacy,
|
||||
gboolean win32_libangle,
|
||||
int *major,
|
||||
int *minor);
|
||||
|
||||
gboolean gdk_gl_context_has_unpack_subimage (GdkGLContext *context);
|
||||
void gdk_gl_context_push_debug_group (GdkGLContext *context,
|
||||
|
||||
@@ -700,7 +700,8 @@ fill_scroll_event (GdkMacosDisplay *self,
|
||||
NULL,
|
||||
get_time_from_ns_event (nsevent),
|
||||
state,
|
||||
direction);
|
||||
direction,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled)
|
||||
|
||||
@@ -378,10 +378,7 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
|
||||
|
||||
existing = CGLGetCurrentContext ();
|
||||
|
||||
gdk_gl_context_get_clipped_version (context,
|
||||
GDK_GL_MIN_GL_VERSION_MAJOR,
|
||||
GDK_GL_MIN_GL_VERSION_MINOR,
|
||||
&major, &minor);
|
||||
gdk_gl_context_get_required_version (context, &major, &minor);
|
||||
|
||||
display = gdk_gl_context_get_display (context);
|
||||
shared = gdk_display_get_gl_context (display);
|
||||
|
||||
@@ -200,51 +200,23 @@ wl_cursor_destroy(struct wl_cursor *cursor)
|
||||
}
|
||||
|
||||
static struct wl_cursor *
|
||||
wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
|
||||
wl_cursor_create_from_xcursor_images(XcursorImages *images,
|
||||
struct wl_cursor_theme *theme,
|
||||
const char *name,
|
||||
unsigned int size,
|
||||
unsigned int scale)
|
||||
unsigned int load_size)
|
||||
{
|
||||
char *path;
|
||||
XcursorImages *images;
|
||||
struct cursor *cursor;
|
||||
struct cursor_image *image;
|
||||
int i, nbytes;
|
||||
unsigned int load_size;
|
||||
int load_scale = 1;
|
||||
|
||||
load_size = size * scale;
|
||||
|
||||
path = g_strconcat (theme->path, "/", name, NULL);
|
||||
images = xcursor_load_images (path, load_size);
|
||||
|
||||
if (!images)
|
||||
{
|
||||
g_free (path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (images->images[0]->width != load_size ||
|
||||
images->images[0]->height != load_size)
|
||||
{
|
||||
xcursor_images_destroy (images);
|
||||
images = xcursor_load_images (path, size);
|
||||
load_scale = scale;
|
||||
}
|
||||
|
||||
g_free (path);
|
||||
int i, size;
|
||||
|
||||
cursor = malloc(sizeof *cursor);
|
||||
if (!cursor) {
|
||||
xcursor_images_destroy (images);
|
||||
if (!cursor)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cursor->cursor.images =
|
||||
malloc(images->nimage * sizeof cursor->cursor.images[0]);
|
||||
if (!cursor->cursor.images) {
|
||||
free(cursor);
|
||||
xcursor_images_destroy (images);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -260,37 +232,22 @@ wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
|
||||
image->theme = theme;
|
||||
image->buffer = NULL;
|
||||
|
||||
image->image.width = images->images[i]->width * load_scale;
|
||||
image->image.height = images->images[i]->height * load_scale;
|
||||
image->image.hotspot_x = images->images[i]->xhot * load_scale;
|
||||
image->image.hotspot_y = images->images[i]->yhot * load_scale;
|
||||
image->image.width = images->images[i]->width;
|
||||
image->image.height = images->images[i]->height;
|
||||
image->image.hotspot_x = images->images[i]->xhot;
|
||||
image->image.hotspot_y = images->images[i]->yhot;
|
||||
image->image.delay = images->images[i]->delay;
|
||||
|
||||
nbytes = image->image.width * image->image.height * 4;
|
||||
image->offset = shm_pool_allocate(theme->pool, nbytes);
|
||||
size = image->image.width * image->image.height * 4;
|
||||
image->offset = shm_pool_allocate(theme->pool, size);
|
||||
if (image->offset < 0) {
|
||||
free(image);
|
||||
break;
|
||||
}
|
||||
|
||||
if (load_scale == 1) {
|
||||
/* copy pixels to shm pool */
|
||||
memcpy(theme->pool->data + image->offset,
|
||||
images->images[i]->pixels, nbytes);
|
||||
}
|
||||
else {
|
||||
/* scale image up while copying it */
|
||||
for (int y = 0; y < image->image.height; y++) {
|
||||
char *p = theme->pool->data + image->offset + y * image->image.width * 4;
|
||||
char *q = ((char *)images->images[i]->pixels) + (y / load_scale) * images->images[i]->width * 4;
|
||||
for (int x = 0; x < image->image.width; x++) {
|
||||
p[4 * x] = q[4 * (x/load_scale)];
|
||||
p[4 * x + 1] = q[4 * (x/load_scale) + 1];
|
||||
p[4 * x + 2] = q[4 * (x/load_scale) + 2];
|
||||
p[4 * x + 3] = q[4 * (x/load_scale) + 3];
|
||||
}
|
||||
}
|
||||
}
|
||||
/* copy pixels to shm pool */
|
||||
memcpy(theme->pool->data + image->offset,
|
||||
images->images[i]->pixels, size);
|
||||
cursor->total_delay += image->image.delay;
|
||||
cursor->cursor.images[i] = (struct wl_cursor_image *) image;
|
||||
}
|
||||
@@ -300,24 +257,27 @@ wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
|
||||
free(cursor->cursor.name);
|
||||
free(cursor->cursor.images);
|
||||
free(cursor);
|
||||
xcursor_images_destroy (images);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xcursor_images_destroy (images);
|
||||
|
||||
return &cursor->cursor;
|
||||
}
|
||||
|
||||
static void
|
||||
load_cursor(struct wl_cursor_theme *theme,
|
||||
const char *name,
|
||||
unsigned int size,
|
||||
unsigned int scale)
|
||||
load_cursor(struct wl_cursor_theme *theme, const char *name, unsigned int size)
|
||||
{
|
||||
XcursorImages *images;
|
||||
struct wl_cursor *cursor;
|
||||
char *path;
|
||||
|
||||
cursor = wl_cursor_create_from_xcursor_images(theme, name, size, scale);
|
||||
path = g_strconcat (theme->path, "/", name, NULL);
|
||||
images = xcursor_load_images (path, size);
|
||||
g_free (path);
|
||||
|
||||
if (!images)
|
||||
return;
|
||||
|
||||
cursor = wl_cursor_create_from_xcursor_images(images, theme, name, size);
|
||||
|
||||
if (cursor) {
|
||||
theme->cursor_count++;
|
||||
@@ -332,6 +292,8 @@ load_cursor(struct wl_cursor_theme *theme,
|
||||
theme->cursors[theme->cursor_count - 1] = cursor;
|
||||
}
|
||||
}
|
||||
|
||||
xcursor_images_destroy (images);
|
||||
}
|
||||
|
||||
/** Load a cursor theme to memory shared with the compositor
|
||||
@@ -411,7 +373,7 @@ wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme,
|
||||
return theme->cursors[i];
|
||||
}
|
||||
|
||||
load_cursor (theme, name, theme->size, scale);
|
||||
load_cursor (theme, name, size);
|
||||
|
||||
if (i < theme->cursor_count) {
|
||||
if (size == theme->cursors[i]->size &&
|
||||
|
||||
@@ -59,17 +59,13 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
|
||||
if (display->xdg_activation)
|
||||
{
|
||||
struct xdg_activation_token_v1 *token;
|
||||
struct wl_event_queue *event_queue;
|
||||
struct wl_surface *wl_surface = NULL;
|
||||
GdkWaylandSeat *seat;
|
||||
GdkSurface *focus_surface;
|
||||
AppLaunchData app_launch_data = { 0 };
|
||||
|
||||
event_queue = wl_display_create_queue (display->wl_display);
|
||||
|
||||
seat = GDK_WAYLAND_SEAT (gdk_display_get_default_seat (GDK_DISPLAY (display)));
|
||||
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
|
||||
token = xdg_activation_v1_get_activation_token (display->xdg_activation);
|
||||
wl_proxy_set_queue ((struct wl_proxy *) token, event_queue);
|
||||
|
||||
xdg_activation_token_v1_add_listener (token,
|
||||
&token_listener,
|
||||
@@ -77,21 +73,16 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
|
||||
xdg_activation_token_v1_set_serial (token,
|
||||
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
|
||||
gdk_wayland_seat_get_wl_seat (GDK_SEAT (seat)));
|
||||
|
||||
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
|
||||
if (focus_surface)
|
||||
wl_surface = gdk_wayland_surface_get_wl_surface (focus_surface);
|
||||
if (wl_surface)
|
||||
xdg_activation_token_v1_set_surface (token, wl_surface);
|
||||
|
||||
xdg_activation_token_v1_set_surface (token,
|
||||
gdk_wayland_surface_get_wl_surface (focus_surface));
|
||||
xdg_activation_token_v1_commit (token);
|
||||
|
||||
while (app_launch_data.token == NULL)
|
||||
wl_display_dispatch_queue (display->wl_display, event_queue);
|
||||
wl_display_roundtrip (display->wl_display);
|
||||
|
||||
xdg_activation_token_v1_destroy (token);
|
||||
id = app_launch_data.token;
|
||||
wl_event_queue_destroy (event_queue);
|
||||
}
|
||||
else if (display->gtk_shell_version >= 3)
|
||||
{
|
||||
|
||||
@@ -178,7 +178,6 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
if (c)
|
||||
{
|
||||
struct wl_cursor_image *image;
|
||||
int cursor_scale;
|
||||
|
||||
if (image_index >= c->image_count)
|
||||
{
|
||||
@@ -190,22 +189,12 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
|
||||
image = c->images[image_index];
|
||||
|
||||
cursor_scale = desired_scale;
|
||||
if ((image->width % cursor_scale != 0) ||
|
||||
(image->height % cursor_scale != 0))
|
||||
{
|
||||
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer"
|
||||
"multiple of scale (%d)", image->width, image->height,
|
||||
cursor_scale);
|
||||
cursor_scale = 1;
|
||||
}
|
||||
*hotspot_x = image->hotspot_x / desired_scale;
|
||||
*hotspot_y = image->hotspot_y / desired_scale;
|
||||
|
||||
*hotspot_x = image->hotspot_x / cursor_scale;
|
||||
*hotspot_y = image->hotspot_y / cursor_scale;
|
||||
|
||||
*width = image->width / cursor_scale;
|
||||
*height = image->height / cursor_scale;
|
||||
*scale = cursor_scale;
|
||||
*width = image->width / desired_scale;
|
||||
*height = image->height / desired_scale;
|
||||
*scale = desired_scale;
|
||||
|
||||
return wl_cursor_image_get_buffer (image);
|
||||
}
|
||||
|
||||
@@ -1394,7 +1394,8 @@ flush_discrete_scroll_event (GdkWaylandSeat *seat,
|
||||
NULL,
|
||||
seat->pointer_info.time,
|
||||
device_get_modifiers (seat->logical_pointer),
|
||||
direction);
|
||||
direction,
|
||||
TRUE);
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
}
|
||||
@@ -3998,6 +3999,17 @@ tablet_tool_handle_wheel (void *data,
|
||||
GDK_SCROLL_UNIT_WHEEL);
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
|
||||
/* Send discrete event */
|
||||
event = gdk_scroll_event_new_discrete (tablet->pointer_info.focus,
|
||||
tablet->stylus_device,
|
||||
tablet->current_tool->tool,
|
||||
tablet->pointer_info.time,
|
||||
device_get_modifiers (tablet->logical_device),
|
||||
clicks > 0 ? GDK_SCROLL_DOWN : GDK_SCROLL_UP,
|
||||
TRUE);
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -623,7 +623,7 @@ _gdk_wayland_display_open (const char *display_name)
|
||||
wl_registry_bind (display_wayland->wl_registry,
|
||||
display_wayland->xdg_wm_base_id,
|
||||
&xdg_wm_base_interface,
|
||||
MIN (display_wayland->xdg_wm_base_version, 4));
|
||||
MIN (display_wayland->xdg_wm_base_version, 3));
|
||||
xdg_wm_base_add_listener (display_wayland->xdg_wm_base,
|
||||
&xdg_wm_base_listener,
|
||||
display_wayland);
|
||||
@@ -2169,7 +2169,8 @@ gdk_wayland_display_get_setting (GdkDisplay *display,
|
||||
{
|
||||
if (strcmp (name, "gtk-decoration-layout") == 0)
|
||||
set_decoration_layout_from_entry (display, entry, value);
|
||||
else if (strcmp (name, "gtk-theme-name") == 0)
|
||||
else if (strcmp (name, "gtk-theme-name") == 0 ||
|
||||
strcmp (name, "gtk-icon-theme-name") == 0)
|
||||
set_theme_from_entry (display, entry, value);
|
||||
else
|
||||
set_value_from_entry (display, entry, value);
|
||||
|
||||
@@ -168,10 +168,6 @@ struct _GdkWaylandSurface
|
||||
|
||||
struct {
|
||||
GdkToplevelLayout *layout;
|
||||
|
||||
int bounds_width;
|
||||
int bounds_height;
|
||||
gboolean has_bounds;
|
||||
} toplevel;
|
||||
|
||||
struct {
|
||||
@@ -186,10 +182,6 @@ struct _GdkWaylandSurface
|
||||
int height;
|
||||
GdkToplevelState state;
|
||||
gboolean is_resizing;
|
||||
|
||||
int bounds_width;
|
||||
int bounds_height;
|
||||
gboolean has_bounds;
|
||||
} toplevel;
|
||||
|
||||
struct {
|
||||
@@ -1402,28 +1394,19 @@ configure_toplevel_geometry (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle monitor_geometry;
|
||||
int bounds_width, bounds_height;
|
||||
GdkToplevelSize size;
|
||||
GdkToplevelLayout *layout;
|
||||
GdkGeometry geometry;
|
||||
GdkSurfaceHints mask;
|
||||
|
||||
if (impl->toplevel.has_bounds)
|
||||
{
|
||||
bounds_width = impl->toplevel.bounds_width;
|
||||
bounds_height = impl->toplevel.bounds_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle monitor_geometry;
|
||||
|
||||
monitor = g_list_model_get_item (gdk_display_get_monitors (display), 0);
|
||||
gdk_monitor_get_geometry (monitor, &monitor_geometry);
|
||||
bounds_width = monitor_geometry.width;
|
||||
bounds_height = monitor_geometry.height;
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
monitor = g_list_model_get_item (gdk_display_get_monitors (display), 0);
|
||||
gdk_monitor_get_geometry (monitor, &monitor_geometry);
|
||||
g_object_unref (monitor);
|
||||
bounds_width = monitor_geometry.width;
|
||||
bounds_height = monitor_geometry.height;
|
||||
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
|
||||
@@ -1525,13 +1508,6 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
|
||||
is_resizing = impl->pending.toplevel.is_resizing;
|
||||
impl->pending.toplevel.is_resizing = FALSE;
|
||||
|
||||
if (impl->pending.toplevel.has_bounds)
|
||||
{
|
||||
impl->toplevel.bounds_width = impl->pending.toplevel.bounds_width;
|
||||
impl->toplevel.bounds_height = impl->pending.toplevel.bounds_height;
|
||||
impl->toplevel.has_bounds = TRUE;
|
||||
}
|
||||
|
||||
fixed_size =
|
||||
new_state & (GDK_TOPLEVEL_STATE_MAXIMIZED |
|
||||
GDK_TOPLEVEL_STATE_FULLSCREEN |
|
||||
@@ -1871,24 +1847,9 @@ xdg_toplevel_close (void *data,
|
||||
gdk_wayland_surface_handle_close (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_toplevel_configure_bounds (void *data,
|
||||
struct xdg_toplevel *xdg_toplevel,
|
||||
int32_t width,
|
||||
int32_t height)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (data);
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
impl->pending.toplevel.bounds_width = width;
|
||||
impl->pending.toplevel.bounds_height = height;
|
||||
impl->pending.toplevel.has_bounds = TRUE;
|
||||
}
|
||||
|
||||
static const struct xdg_toplevel_listener xdg_toplevel_listener = {
|
||||
xdg_toplevel_configure,
|
||||
xdg_toplevel_close,
|
||||
xdg_toplevel_configure_bounds,
|
||||
};
|
||||
|
||||
static void
|
||||
|
||||
@@ -548,12 +548,17 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
|
||||
* wglCreateContextAttribsARB() may only give us the GL context version
|
||||
* that we ask for here, and nothing more. So, improve things here by
|
||||
* asking for the GL version that is reported to us via epoxy_gl_version(),
|
||||
* rather than the default GL core 3.2 context.
|
||||
* rather than the default GL core 3.2 context. Save this up in our
|
||||
* GdkGLContext so that subsequent contexts that are shared with this
|
||||
* context are created likewise too.
|
||||
*/
|
||||
gdk_gl_context_get_clipped_version (context,
|
||||
display_win32->gl_version / 10,
|
||||
display_win32->gl_version % 10,
|
||||
&major, &minor);
|
||||
if (share != NULL)
|
||||
gdk_gl_context_get_required_version (share, &major, &minor);
|
||||
else
|
||||
{
|
||||
major = display_win32->gl_version / 10;
|
||||
minor = display_win32->gl_version % 10;
|
||||
}
|
||||
|
||||
if (surface != NULL)
|
||||
hdc = GDK_WIN32_SURFACE (surface)->hdc;
|
||||
@@ -621,6 +626,7 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
|
||||
|
||||
/* Ensure that any other context is created with a legacy bit set */
|
||||
gdk_gl_context_set_is_legacy (context, legacy_bit);
|
||||
gdk_gl_context_set_required_version (context, major, minor);
|
||||
|
||||
return GDK_GL_API_GL;
|
||||
}
|
||||
|
||||
@@ -167,10 +167,8 @@ DManipEventHandler_OnContentUpdated (IDirectManipulationViewportEventHandler *se
|
||||
{
|
||||
case GESTURE_PAN:
|
||||
{
|
||||
GdkWin32Surface *surface_win32;
|
||||
GdkModifierType state;
|
||||
uint32_t time;
|
||||
int scale;
|
||||
float pan_x;
|
||||
float pan_y;
|
||||
GdkEvent *event;
|
||||
@@ -178,16 +176,14 @@ DManipEventHandler_OnContentUpdated (IDirectManipulationViewportEventHandler *se
|
||||
pan_x = transform[4];
|
||||
pan_y = transform[5];
|
||||
|
||||
surface_win32 = GDK_WIN32_SURFACE (self->surface);
|
||||
scale = surface_win32->surface_scale;
|
||||
state = util_get_modifier_state ();
|
||||
time = (uint32_t) GetMessageTime ();
|
||||
|
||||
event = gdk_scroll_event_new (self->surface,
|
||||
self->device,
|
||||
NULL, time, state,
|
||||
(self->pan_x - pan_x) / scale,
|
||||
(self->pan_y - pan_y) / scale,
|
||||
self->pan_x - pan_x,
|
||||
self->pan_y - pan_y,
|
||||
FALSE,
|
||||
GDK_SCROLL_UNIT_SURFACE);
|
||||
_gdk_win32_append_event (event);
|
||||
@@ -359,8 +355,6 @@ reset_viewport (IDirectManipulationViewport *viewport)
|
||||
hr = IDirectManipulationContent_SyncContentTransform (content, identity,
|
||||
G_N_ELEMENTS (identity));
|
||||
HR_CHECK (hr);
|
||||
|
||||
IUnknown_Release (content);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -220,19 +220,6 @@ _gdk_win32_get_setting (const char *name,
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else if (strcmp ("gtk-overlay-scrolling", name) == 0)
|
||||
{
|
||||
DWORD val = 0;
|
||||
DWORD sz = sizeof (val);
|
||||
LSTATUS ret = 0;
|
||||
|
||||
ret = RegGetValueW (HKEY_CURRENT_USER, L"Control Panel\\Accessibility", L"DynamicScrollbars", RRF_RT_DWORD, NULL, &val, &sz);
|
||||
if (ret == ERROR_SUCCESS)
|
||||
{
|
||||
g_value_set_boolean (value, val != 0);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1655,7 +1655,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
NULL,
|
||||
xev->time,
|
||||
_gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group),
|
||||
direction);
|
||||
direction,
|
||||
FALSE);
|
||||
|
||||
}
|
||||
else
|
||||
@@ -1757,7 +1758,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
NULL,
|
||||
xev->time,
|
||||
state,
|
||||
direction);
|
||||
direction,
|
||||
FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+168
-143
@@ -213,7 +213,7 @@ gdk_x11_gl_context_glx_clear_current (GdkGLContext *context)
|
||||
static gboolean
|
||||
gdk_x11_gl_context_glx_make_current (GdkGLContext *context,
|
||||
gboolean surfaceless)
|
||||
|
||||
|
||||
{
|
||||
GdkX11GLContextGLX *self = GDK_X11_GL_CONTEXT_GLX (context);
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
@@ -302,6 +302,68 @@ gdk_x11_gl_context_glx_get_damage (GdkGLContext *context)
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_glx_parent_class)->get_damage (context);
|
||||
}
|
||||
|
||||
static GLXContext
|
||||
create_gl3_context (GdkDisplay *display,
|
||||
GLXFBConfig config,
|
||||
GdkGLContext *share,
|
||||
int profile,
|
||||
int flags,
|
||||
int major,
|
||||
int minor)
|
||||
{
|
||||
int attrib_list[] = {
|
||||
GLX_CONTEXT_PROFILE_MASK_ARB, profile,
|
||||
GLX_CONTEXT_MAJOR_VERSION_ARB, major,
|
||||
GLX_CONTEXT_MINOR_VERSION_ARB, minor,
|
||||
GLX_CONTEXT_FLAGS_ARB, flags,
|
||||
None,
|
||||
};
|
||||
GLXContext res;
|
||||
|
||||
GdkX11GLContextGLX *share_glx = NULL;
|
||||
|
||||
if (share != NULL)
|
||||
share_glx = GDK_X11_GL_CONTEXT_GLX (share);
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
res = glXCreateContextAttribsARB (gdk_x11_display_get_xdisplay (display),
|
||||
config,
|
||||
share_glx != NULL ? share_glx->glx_context : NULL,
|
||||
True,
|
||||
attrib_list);
|
||||
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
return NULL;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static GLXContext
|
||||
create_legacy_context (GdkDisplay *display,
|
||||
GLXFBConfig config,
|
||||
GdkGLContext *share)
|
||||
{
|
||||
GdkX11GLContextGLX *share_glx = NULL;
|
||||
GLXContext res;
|
||||
|
||||
if (share != NULL)
|
||||
share_glx = GDK_X11_GL_CONTEXT_GLX (share);
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
res = glXCreateNewContext (gdk_x11_display_get_xdisplay (display),
|
||||
config,
|
||||
GLX_RGBA_TYPE,
|
||||
share_glx != NULL ? share_glx->glx_context : NULL,
|
||||
TRUE);
|
||||
|
||||
if (gdk_x11_display_error_trap_pop (display))
|
||||
return NULL;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifdef HAVE_XDAMAGE
|
||||
static void
|
||||
bind_context_for_frame_fence (GdkX11GLContextGLX *self)
|
||||
@@ -445,111 +507,134 @@ on_surface_state_changed (GdkGLContext *context)
|
||||
*/
|
||||
finish_frame (context);
|
||||
}
|
||||
#endif /* HAVE_XDAMAGE */
|
||||
|
||||
#define N_GLX_ATTRS 16
|
||||
#endif
|
||||
|
||||
static GdkGLAPI
|
||||
gdk_x11_context_create_glx_context (GdkGLContext *context,
|
||||
GdkGLAPI api,
|
||||
gboolean legacy)
|
||||
gdk_x11_gl_context_glx_realize (GdkGLContext *context,
|
||||
GError **error)
|
||||
{
|
||||
GdkX11GLContextGLX *context_glx = GDK_X11_GL_CONTEXT_GLX (context);;
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
Display *dpy = gdk_x11_display_get_xdisplay (display);
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
GdkX11GLContextGLX *share_glx = NULL;
|
||||
GdkSurface *surface = gdk_gl_context_get_surface (context);
|
||||
GLXContext ctx;
|
||||
int context_attribs[N_GLX_ATTRS], i = 0, flags = 0;
|
||||
int min_major, min_minor, major, minor;
|
||||
gboolean debug_bit, compat_bit;
|
||||
GdkX11Display *display_x11;
|
||||
GdkDisplay *display;
|
||||
GdkX11GLContextGLX *context_glx;
|
||||
Display *dpy;
|
||||
GdkSurface *surface;
|
||||
GdkGLContext *share;
|
||||
gboolean debug_bit, compat_bit, legacy_bit;
|
||||
int major, minor, flags;
|
||||
GdkGLAPI api = 0;
|
||||
|
||||
if (!gdk_gl_context_is_api_allowed (context, api, NULL))
|
||||
return 0;
|
||||
|
||||
if (api == GDK_GL_API_GLES && legacy)
|
||||
return 0;
|
||||
|
||||
/* We will use the default version matching the context status
|
||||
* unless the user requested a version which makes sense */
|
||||
gdk_gl_context_get_matching_version (api, legacy, 0,
|
||||
&min_major, &min_minor);
|
||||
gdk_gl_context_get_clipped_version (context, min_major, min_minor,
|
||||
&major, &minor);
|
||||
display = gdk_gl_context_get_display (context);
|
||||
dpy = gdk_x11_display_get_xdisplay (display);
|
||||
context_glx = GDK_X11_GL_CONTEXT_GLX (context);
|
||||
display_x11 = GDK_X11_DISPLAY (display);
|
||||
share = gdk_display_get_gl_context (display);
|
||||
surface = gdk_gl_context_get_surface (context);
|
||||
|
||||
gdk_gl_context_get_required_version (context, &major, &minor);
|
||||
debug_bit = gdk_gl_context_get_debug_enabled (context);
|
||||
compat_bit = gdk_gl_context_get_forward_compatible (context);
|
||||
|
||||
/* If there is no glXCreateContextAttribsARB() then we default to legacy */
|
||||
legacy_bit = !display_x11->has_glx_create_context || GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY);
|
||||
|
||||
/* We cannot share legacy contexts with core profile ones, so the
|
||||
* shared context is the one that decides if we're going to create
|
||||
* a legacy context or not.
|
||||
*/
|
||||
if (share != NULL && gdk_gl_context_is_legacy (share))
|
||||
legacy_bit = TRUE;
|
||||
|
||||
flags = 0;
|
||||
if (debug_bit)
|
||||
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
|
||||
if (compat_bit)
|
||||
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
||||
|
||||
context_attribs[i++] = GLX_CONTEXT_PROFILE_MASK_ARB;
|
||||
if (api == GDK_GL_API_GL)
|
||||
if (legacy)
|
||||
context_attribs[i++] = GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||
else
|
||||
context_attribs[i++] = GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||
else if (api == GDK_GL_API_GLES)
|
||||
context_attribs[i++] = GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
|
||||
|
||||
context_attribs[i++] = GLX_CONTEXT_MAJOR_VERSION_ARB;
|
||||
context_attribs[i++] = major;
|
||||
context_attribs[i++] = GLX_CONTEXT_MINOR_VERSION_ARB;
|
||||
context_attribs[i++] = minor;
|
||||
context_attribs[i++] = GLX_CONTEXT_FLAGS_ARB;
|
||||
context_attribs[i++] = flags;
|
||||
|
||||
context_attribs[i++] = None;
|
||||
g_assert (i < N_GLX_ATTRS);
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL,
|
||||
g_message ("Creating GLX context version %d.%d (debug:%s, forward:%s, legacy:%s, es:%s)",
|
||||
major, minor,
|
||||
debug_bit ? "yes" : "no",
|
||||
compat_bit ? "yes" : "no",
|
||||
legacy ? "yes" : "no",
|
||||
api == GDK_GL_API_GLES ? "yes" : "no"));
|
||||
g_message ("Creating GLX context (GL version:%d.%d, debug:%s, forward:%s, legacy:%s, GL:%s, GLES:%s)",
|
||||
major, minor,
|
||||
debug_bit ? "yes" : "no",
|
||||
compat_bit ? "yes" : "no",
|
||||
legacy_bit ? "yes" : "no",
|
||||
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL) ? "yes" : "no",
|
||||
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL) ? "yes" : "no"));
|
||||
|
||||
if (share != NULL)
|
||||
share_glx = GDK_X11_GL_CONTEXT_GLX (share);
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
/* If we don't have access to GLX_ARB_create_context_profile, then
|
||||
* we have to fall back to the old GLX 1.3 API.
|
||||
/* If we have access to GLX_ARB_create_context_profile then we can ask for
|
||||
* a compatibility profile; if we don't, then we have to fall back to the
|
||||
* old GLX 1.3 API.
|
||||
*/
|
||||
if (legacy && !display_x11->has_glx_create_context)
|
||||
ctx = glXCreateNewContext (gdk_x11_display_get_xdisplay (display),
|
||||
display_x11->glx_config,
|
||||
GLX_RGBA_TYPE,
|
||||
share_glx != NULL ? share_glx->glx_context : NULL,
|
||||
TRUE);
|
||||
|
||||
if (legacy_bit && !GDK_X11_DISPLAY (display)->has_glx_create_context)
|
||||
{
|
||||
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating legacy GL context on request"));
|
||||
/* do it below */
|
||||
}
|
||||
else
|
||||
ctx = glXCreateContextAttribsARB (gdk_x11_display_get_xdisplay (display),
|
||||
display_x11->glx_config,
|
||||
share_glx != NULL ? share_glx->glx_context : NULL,
|
||||
True,
|
||||
context_attribs);
|
||||
{
|
||||
if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
|
||||
{
|
||||
int profile = legacy_bit ? GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB
|
||||
: GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||
|
||||
if (gdk_x11_display_error_trap_pop (display) || ctx == NULL)
|
||||
return 0;
|
||||
/* We need to tweak the version, otherwise we may end up requesting
|
||||
* a compatibility context with a minimum version of 3.2, which is
|
||||
* an error
|
||||
*/
|
||||
if (legacy_bit)
|
||||
{
|
||||
major = 3;
|
||||
minor = 0;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating GL3 context"));
|
||||
context_glx->glx_context = create_gl3_context (display,
|
||||
display_x11->glx_config,
|
||||
share,
|
||||
profile,
|
||||
flags, major, minor);
|
||||
api = GDK_GL_API_GL;
|
||||
}
|
||||
|
||||
if (context_glx->glx_context == NULL && !legacy_bit &&
|
||||
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL))
|
||||
{
|
||||
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating GL3 GLES context"));
|
||||
context_glx->glx_context = create_gl3_context (display,
|
||||
display_x11->glx_config,
|
||||
share,
|
||||
GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
|
||||
flags, major, minor);
|
||||
api = GDK_GL_API_GLES;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fall back to legacy in case the GL3 context creation failed */
|
||||
if (context_glx->glx_context == NULL &&
|
||||
gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
|
||||
{
|
||||
GDK_DISPLAY_NOTE (display, OPENGL, g_message ("Creating fallback legacy context"));
|
||||
context_glx->glx_context = create_legacy_context (display, display_x11->glx_config, share);
|
||||
legacy_bit = TRUE;
|
||||
api = GDK_GL_API_GL;
|
||||
}
|
||||
|
||||
if (context_glx->glx_context == NULL)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Unable to create a GL context"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Ensure that any other context is created with a legacy bit set */
|
||||
gdk_gl_context_set_is_legacy (context, legacy_bit);
|
||||
|
||||
GDK_DISPLAY_NOTE (display, OPENGL,
|
||||
g_message ("Realized GLX context[%p], %s, version: %d.%d",
|
||||
context_glx->glx_context,
|
||||
glXIsDirect (dpy, context_glx->glx_context) ? "direct" : "indirect",
|
||||
display_x11->glx_version / 10,
|
||||
|
||||
display_x11->glx_version % 10));
|
||||
|
||||
context_glx->glx_context = ctx;
|
||||
gdk_gl_context_set_is_legacy (context, legacy);
|
||||
|
||||
#ifdef HAVE_XDAMAGE
|
||||
if (display_x11->have_damage &&
|
||||
display_x11->has_async_glx_swap_buffers)
|
||||
@@ -578,70 +663,10 @@ gdk_x11_context_create_glx_context (GdkGLContext *context,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
static GdkGLAPI
|
||||
gdk_x11_gl_context_glx_realize (GdkGLContext *context,
|
||||
GError **error)
|
||||
{
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
GdkGLContext *share = gdk_display_get_gl_context (display);
|
||||
gboolean legacy;
|
||||
GdkGLAPI api, preferred_api;
|
||||
|
||||
if (share && gdk_gl_context_is_api_allowed (context,
|
||||
gdk_gl_context_get_api (share),
|
||||
NULL))
|
||||
preferred_api = gdk_gl_context_get_api (share);
|
||||
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GL, NULL))
|
||||
preferred_api = GDK_GL_API_GL;
|
||||
else if (gdk_gl_context_is_api_allowed (context, GDK_GL_API_GLES, NULL))
|
||||
preferred_api = GDK_GL_API_GLES;
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("No GL API allowed."));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If there is no glXCreateContextAttribsARB() then we default to legacy */
|
||||
legacy = !GDK_X11_DISPLAY (display)->has_glx_create_context;
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY))
|
||||
legacy = TRUE;
|
||||
|
||||
/* We cannot share legacy contexts with core profile ones, so the
|
||||
* shared context is the one that decides if we're going to create
|
||||
* a legacy context or not.
|
||||
*/
|
||||
if (share != NULL && gdk_gl_context_is_legacy (share))
|
||||
legacy = TRUE;
|
||||
|
||||
if (preferred_api == GDK_GL_API_GL)
|
||||
{
|
||||
if ((api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, legacy)) ||
|
||||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GLES, legacy)) ||
|
||||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, TRUE)))
|
||||
return api;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GLES, FALSE)) ||
|
||||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, legacy)) ||
|
||||
(api = gdk_x11_context_create_glx_context (context, GDK_GL_API_GL, TRUE)))
|
||||
return api;
|
||||
}
|
||||
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Unable to create a GL context"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef N_GLX_ATTRS
|
||||
|
||||
static void
|
||||
gdk_x11_gl_context_glx_dispose (GObject *gobject)
|
||||
{
|
||||
@@ -795,7 +820,7 @@ gdk_x11_display_create_glx_config (GdkX11Display *self,
|
||||
XFree (visinfo);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!visual_is_rgba (visinfo))
|
||||
{
|
||||
if (best_features < NO_ALPHA_VISUAL)
|
||||
@@ -869,7 +894,7 @@ gdk_x11_display_get_glx_version (GdkDisplay *display,
|
||||
|
||||
/*< private >
|
||||
* gdk_x11_display_init_glx:
|
||||
* @display_x11: an X11 display that has not been inited yet.
|
||||
* @display_x11: an X11 display that has not been inited yet.
|
||||
* @out_visual: set to the Visual to be used with the returned config
|
||||
* @out_depth: set to the depth to be used with the returned config
|
||||
* @error: Return location for error
|
||||
|
||||
@@ -280,7 +280,7 @@ compute_toplevel_size (GdkSurface *surface,
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
if (size.shadow.is_valid && update_geometry)
|
||||
{
|
||||
update_shadow_size (surface,
|
||||
size.shadow.left,
|
||||
@@ -2793,19 +2793,14 @@ gdk_x11_surface_get_frame_extents (GdkSurface *surface,
|
||||
impl = GDK_X11_SURFACE (surface);
|
||||
|
||||
/* Refine our fallback answer a bit using local information */
|
||||
rect->x = impl->abs_x;
|
||||
rect->y = impl->abs_y;
|
||||
rect->width = surface->width;
|
||||
rect->height = surface->height;
|
||||
rect->x = impl->abs_x * impl->surface_scale;
|
||||
rect->y = impl->abs_y * impl->surface_scale;
|
||||
rect->width = surface->width * impl->surface_scale;
|
||||
rect->height = surface->height * impl->surface_scale;
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface) || impl->override_redirect)
|
||||
return;
|
||||
|
||||
rect->x *= impl->surface_scale;
|
||||
rect->y *= impl->surface_scale;
|
||||
rect->width *= impl->surface_scale;
|
||||
rect->height *= impl->surface_scale;
|
||||
|
||||
nvroots = 0;
|
||||
vroots = NULL;
|
||||
|
||||
|
||||
@@ -68,23 +68,6 @@ parse_rect (GtkCssParser *parser,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_vec4 (GtkCssParser *parser,
|
||||
gpointer out_vec4)
|
||||
{
|
||||
double numbers[4];
|
||||
|
||||
if (!gtk_css_parser_consume_number (parser, &numbers[0]) ||
|
||||
!gtk_css_parser_consume_number (parser, &numbers[1]) ||
|
||||
!gtk_css_parser_consume_number (parser, &numbers[2]) ||
|
||||
!gtk_css_parser_consume_number (parser, &numbers[3]))
|
||||
return FALSE;
|
||||
|
||||
graphene_vec4_init (out_vec4, numbers[0], numbers[1], numbers[2], numbers[3]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_texture (GtkCssParser *parser,
|
||||
gpointer out_data)
|
||||
@@ -1507,20 +1490,23 @@ parse_color_matrix_node (GtkCssParser *parser)
|
||||
GskRenderNode *child = NULL;
|
||||
graphene_matrix_t matrix;
|
||||
GskTransform *transform = NULL;
|
||||
graphene_rect_t offset_rect = GRAPHENE_RECT_INIT (0, 0, 0, 0);
|
||||
graphene_vec4_t offset;
|
||||
const Declaration declarations[] = {
|
||||
{ "matrix", parse_transform, clear_transform, &transform },
|
||||
{ "offset", parse_vec4, NULL, &offset },
|
||||
{ "offset", parse_rect, NULL, &offset_rect },
|
||||
{ "child", parse_node, clear_node, &child }
|
||||
};
|
||||
GskRenderNode *result;
|
||||
|
||||
graphene_vec4_init (&offset, 0, 0, 0, 0);
|
||||
|
||||
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
|
||||
if (child == NULL)
|
||||
child = create_default_render_node ();
|
||||
|
||||
graphene_vec4_init (&offset,
|
||||
offset_rect.origin.x, offset_rect.origin.y,
|
||||
offset_rect.size.width, offset_rect.size.height);
|
||||
|
||||
gsk_transform_to_matrix (transform, &matrix);
|
||||
|
||||
result = gsk_color_matrix_node_new (child, &matrix, &offset);
|
||||
|
||||
@@ -37,11 +37,10 @@ gsk_vulkan_command_pool_new (GdkVulkanContext *context)
|
||||
static void
|
||||
gsk_vulkan_command_pool_free_buffers (GskVulkanCommandPool *self)
|
||||
{
|
||||
if (self->buffers->len != 0)
|
||||
vkFreeCommandBuffers (gdk_vulkan_context_get_device (self->vulkan),
|
||||
self->vk_command_pool,
|
||||
self->buffers->len,
|
||||
(VkCommandBuffer *) self->buffers->pdata);
|
||||
vkFreeCommandBuffers (gdk_vulkan_context_get_device (self->vulkan),
|
||||
self->vk_command_pool,
|
||||
self->buffers->len,
|
||||
(VkCommandBuffer *) self->buffers->pdata);
|
||||
|
||||
g_ptr_array_set_size (self->buffers, 0);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ gsk_vulkan_render_pass_new (GdkVulkanContext *context,
|
||||
.samples = VK_SAMPLE_COUNT_1_BIT,
|
||||
.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR,
|
||||
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
|
||||
.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
|
||||
.initialLayout = VK_IMAGE_LAYOUT_GENERAL,
|
||||
.finalLayout = final_layout
|
||||
}
|
||||
},
|
||||
|
||||
@@ -436,11 +436,7 @@ get_parent_context_ref (GtkAccessible *accessible)
|
||||
gtk_accessible_get_at_context (GTK_ACCESSIBLE (parent));
|
||||
|
||||
if (parent_context != NULL)
|
||||
{
|
||||
gtk_at_context_realize (parent_context);
|
||||
|
||||
res = gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (parent_context));
|
||||
}
|
||||
res = gtk_at_spi_context_to_ref (GTK_AT_SPI_CONTEXT (parent_context));
|
||||
}
|
||||
|
||||
if (res == NULL)
|
||||
|
||||
+1
-312
@@ -32,7 +32,6 @@
|
||||
#include "gtkatcontextprivate.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkeditable.h"
|
||||
#include "gtkinscriptionprivate.h"
|
||||
#include "gtklabelprivate.h"
|
||||
#include "gtkentryprivate.h"
|
||||
#include "gtksearchentryprivate.h"
|
||||
@@ -407,274 +406,6 @@ static const GDBusInterfaceVTable label_vtable = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
/* }}} */
|
||||
/* {{{ GtkInscription */
|
||||
|
||||
static void
|
||||
inscription_handle_method (GDBusConnection *connection,
|
||||
const gchar *sender,
|
||||
const gchar *object_path,
|
||||
const gchar *interface_name,
|
||||
const gchar *method_name,
|
||||
GVariant *parameters,
|
||||
GDBusMethodInvocation *invocation,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkATContext *self = user_data;
|
||||
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
|
||||
GtkWidget *widget = GTK_WIDGET (accessible);
|
||||
|
||||
if (g_strcmp0 (method_name, "GetCaretOffset") == 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(i)", 0));
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "SetCaretOffset") == 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", FALSE));
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetText") == 0)
|
||||
{
|
||||
int start, end;
|
||||
const char *text;
|
||||
int len;
|
||||
char *string;
|
||||
|
||||
g_variant_get (parameters, "(ii)", &start, &end);
|
||||
|
||||
text = gtk_inscription_get_text (GTK_INSCRIPTION (widget));
|
||||
len = g_utf8_strlen (text, -1);
|
||||
|
||||
start = CLAMP (start, 0, len);
|
||||
end = CLAMP (end, 0, len);
|
||||
|
||||
if (end <= start)
|
||||
string = g_strdup ("");
|
||||
else
|
||||
{
|
||||
const char *p, *q;
|
||||
p = g_utf8_offset_to_pointer (text, start);
|
||||
q = g_utf8_offset_to_pointer (text, end);
|
||||
string = g_strndup (p, q - p);
|
||||
}
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", string));
|
||||
g_free (string);
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetTextBeforeOffset") == 0)
|
||||
{
|
||||
PangoLayout *layout = gtk_inscription_get_layout (GTK_INSCRIPTION (widget));;
|
||||
int offset;
|
||||
AtspiTextBoundaryType boundary_type;
|
||||
char *string;
|
||||
int start, end;
|
||||
|
||||
g_variant_get (parameters, "(iu)", &offset, &boundary_type);
|
||||
|
||||
string = gtk_pango_get_text_before (layout, offset, boundary_type, &start, &end);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(sii)", string, start, end));
|
||||
g_free (string);
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetTextAtOffset") == 0)
|
||||
{
|
||||
PangoLayout *layout = gtk_inscription_get_layout (GTK_INSCRIPTION (widget));;
|
||||
int offset;
|
||||
AtspiTextBoundaryType boundary_type;
|
||||
char *string;
|
||||
int start, end;
|
||||
|
||||
g_variant_get (parameters, "(iu)", &offset, &boundary_type);
|
||||
|
||||
string = gtk_pango_get_text_at (layout, offset, boundary_type, &start, &end);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(sii)", string, start, end));
|
||||
g_free (string);
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetTextAfterOffset") == 0)
|
||||
{
|
||||
PangoLayout *layout = gtk_inscription_get_layout (GTK_INSCRIPTION (widget));;
|
||||
int offset;
|
||||
AtspiTextBoundaryType boundary_type;
|
||||
char *string;
|
||||
int start, end;
|
||||
|
||||
g_variant_get (parameters, "(iu)", &offset, &boundary_type);
|
||||
|
||||
string = gtk_pango_get_text_after (layout, offset, boundary_type, &start, &end);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(sii)", string, start, end));
|
||||
g_free (string);
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetCharacterAtOffset") == 0)
|
||||
{
|
||||
int offset;
|
||||
const char *text;
|
||||
gunichar ch = 0;
|
||||
|
||||
g_variant_get (parameters, "(i)", &offset);
|
||||
|
||||
text = gtk_inscription_get_text (GTK_INSCRIPTION (widget));
|
||||
|
||||
if (0 <= offset && offset < g_utf8_strlen (text, -1))
|
||||
ch = g_utf8_get_char (g_utf8_offset_to_pointer (text, offset));
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(i)", ch));
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetStringAtOffset") == 0)
|
||||
{
|
||||
PangoLayout *layout = gtk_inscription_get_layout (GTK_INSCRIPTION (widget));;
|
||||
int offset;
|
||||
AtspiTextGranularity granularity;
|
||||
char *string;
|
||||
int start, end;
|
||||
|
||||
g_variant_get (parameters, "(iu)", &offset, &granularity);
|
||||
|
||||
string = gtk_pango_get_string_at (layout, offset, granularity, &start, &end);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(sii)", string, start, end));
|
||||
g_free (string);
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetAttributes") == 0)
|
||||
{
|
||||
PangoLayout *layout = gtk_inscription_get_layout (GTK_INSCRIPTION (widget));;
|
||||
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("a{ss}"));
|
||||
int offset;
|
||||
int start, end;
|
||||
|
||||
g_variant_get (parameters, "(i)", &offset);
|
||||
|
||||
gtk_pango_get_run_attributes (layout, &builder, offset, &start, &end);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(a{ss}ii)", &builder, start, end));
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetAttributeValue") == 0)
|
||||
{
|
||||
PangoLayout *layout = gtk_inscription_get_layout (GTK_INSCRIPTION (widget));;
|
||||
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("a{ss}"));
|
||||
int offset;
|
||||
const char *name;
|
||||
int start, end;
|
||||
GVariant *attrs;
|
||||
const char *val;
|
||||
|
||||
g_variant_get (parameters, "(i&s)", &offset, &name);
|
||||
|
||||
gtk_pango_get_run_attributes (layout, &builder, offset, &start, &end);
|
||||
|
||||
attrs = g_variant_builder_end (&builder);
|
||||
if (!g_variant_lookup (attrs, name, "&s", &val))
|
||||
val = "";
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", val));
|
||||
g_variant_unref (attrs);
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetAttributeRun") == 0)
|
||||
{
|
||||
PangoLayout *layout = gtk_inscription_get_layout (GTK_INSCRIPTION (widget));;
|
||||
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("a{ss}"));
|
||||
int offset;
|
||||
gboolean include_defaults;
|
||||
int start, end;
|
||||
|
||||
g_variant_get (parameters, "(ib)", &offset, &include_defaults);
|
||||
|
||||
if (include_defaults)
|
||||
gtk_pango_get_default_attributes (layout, &builder);
|
||||
|
||||
gtk_pango_get_run_attributes (layout, &builder, offset, &start, &end);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(a{ss}ii)", &builder, start, end));
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetDefaultAttributes") == 0 ||
|
||||
g_strcmp0 (method_name, "GetDefaultAttributeSet") == 0)
|
||||
{
|
||||
PangoLayout *layout = gtk_inscription_get_layout (GTK_INSCRIPTION (widget));;
|
||||
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("a{ss}"));
|
||||
|
||||
gtk_pango_get_default_attributes (layout, &builder);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(a{ss})", &builder));
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetNSelections") == 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(i)", 0));
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetSelection") == 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No selections available");
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "AddSelection") == 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", FALSE));
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "RemoveSelection") == 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", FALSE));
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "SetSelection") == 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", FALSE));
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetCharacterExtents") == 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_error_literal (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "");
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetRangeExtents") == 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_error_literal (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "");
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetBoundedRanges") == 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_error_literal (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "");
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "ScrollSubstringTo") == 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_error_literal (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "");
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "ScrollSubstringToPoint") == 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_error_literal (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "");
|
||||
}
|
||||
}
|
||||
|
||||
static GVariant *
|
||||
inscription_get_property (GDBusConnection *connection,
|
||||
const gchar *sender,
|
||||
const gchar *object_path,
|
||||
const gchar *interface_name,
|
||||
const gchar *property_name,
|
||||
GError **error,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkATContext *self = user_data;
|
||||
GtkAccessible *accessible = gtk_at_context_get_accessible (self);
|
||||
GtkWidget *widget = GTK_WIDGET (accessible);
|
||||
|
||||
if (g_strcmp0 (property_name, "CharacterCount") == 0)
|
||||
{
|
||||
const char *text;
|
||||
int len;
|
||||
|
||||
text = gtk_inscription_get_text (GTK_INSCRIPTION (widget));
|
||||
len = g_utf8_strlen (text, -1);
|
||||
|
||||
return g_variant_new_int32 (len);
|
||||
}
|
||||
else if (g_strcmp0 (property_name, "CaretOffset") == 0)
|
||||
{
|
||||
return g_variant_new_int32 (0);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const GDBusInterfaceVTable inscription_vtable = {
|
||||
inscription_handle_method,
|
||||
inscription_get_property,
|
||||
NULL,
|
||||
};
|
||||
|
||||
/* }}} */
|
||||
/* {{{ GtkEditable */
|
||||
|
||||
@@ -1367,47 +1098,7 @@ text_view_handle_method (GDBusConnection *connection,
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetCharacterExtents") == 0)
|
||||
{
|
||||
int offset = 0;
|
||||
guint coords_type;
|
||||
|
||||
g_variant_get (parameters, "(iu)", &offset, &coords_type);
|
||||
|
||||
if (coords_type != ATSPI_COORD_TYPE_WINDOW)
|
||||
{
|
||||
g_dbus_method_invocation_return_error_literal (invocation,
|
||||
G_DBUS_ERROR,
|
||||
G_DBUS_ERROR_NOT_SUPPORTED,
|
||||
"Unsupported coordinate space");
|
||||
return;
|
||||
}
|
||||
|
||||
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
|
||||
|
||||
GtkTextIter iter;
|
||||
gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset);
|
||||
|
||||
GdkRectangle rect = { 0, };
|
||||
gtk_text_view_get_iter_location (GTK_TEXT_VIEW (widget), &iter, &rect);
|
||||
|
||||
int x, y;
|
||||
gtk_text_view_buffer_to_window_coords (GTK_TEXT_VIEW (widget),
|
||||
GTK_TEXT_WINDOW_WIDGET,
|
||||
rect.x, rect.y,
|
||||
&x, &y);
|
||||
|
||||
double dx, dy;
|
||||
gtk_widget_translate_coordinates (widget,
|
||||
GTK_WIDGET (gtk_widget_get_native (widget)),
|
||||
(double) x, (double) y, &dx, &dy);
|
||||
x = floor (dx);
|
||||
y = floor (dy);
|
||||
|
||||
g_dbus_method_invocation_return_value (invocation,
|
||||
g_variant_new ("(iiii)",
|
||||
x,
|
||||
y,
|
||||
rect.width,
|
||||
rect.height));
|
||||
g_dbus_method_invocation_return_error_literal (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "");
|
||||
}
|
||||
else if (g_strcmp0 (method_name, "GetRangeExtents") == 0)
|
||||
{
|
||||
@@ -1570,8 +1261,6 @@ gtk_atspi_get_text_vtable (GtkAccessible *accessible)
|
||||
{
|
||||
if (GTK_IS_LABEL (accessible))
|
||||
return &label_vtable;
|
||||
else if (GTK_IS_INSCRIPTION (accessible))
|
||||
return &inscription_vtable;
|
||||
else if (GTK_IS_EDITABLE (accessible) &&
|
||||
GTK_IS_TEXT (gtk_editable_get_delegate (GTK_EDITABLE (accessible))))
|
||||
return &editable_vtable;
|
||||
|
||||
@@ -155,7 +155,6 @@
|
||||
#include <gtk/gtkimcontextsimple.h>
|
||||
#include <gtk/gtkimmulticontext.h>
|
||||
#include <gtk/gtkinfobar.h>
|
||||
#include <gtk/gtkinscription.h>
|
||||
#include <gtk/gtklabel.h>
|
||||
#include <gtk/gtklayoutmanager.h>
|
||||
#include <gtk/gtklayoutchild.h>
|
||||
|
||||
@@ -47,13 +47,6 @@
|
||||
* the full width of the box, even if the children at either side take
|
||||
* up different amounts of space.
|
||||
*
|
||||
* # GtkActionBar as GtkBuildable
|
||||
*
|
||||
* The `GtkActionBar` implementation of the `GtkBuildable` interface supports
|
||||
* adding children at the start or end sides by specifying “start” or “end” as
|
||||
* the “type” attribute of a `<child>` element, or setting the center widget
|
||||
* by specifying “center” value.
|
||||
*
|
||||
* # CSS nodes
|
||||
*
|
||||
* ```
|
||||
|
||||
+19
-78
@@ -158,30 +158,6 @@ struct _GtkAssistantClass
|
||||
void (* cancel) (GtkAssistant *assistant);
|
||||
};
|
||||
|
||||
#define GTK_TYPE_ASSISTANT_PAGES (gtk_assistant_pages_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (GtkAssistantPages, gtk_assistant_pages, GTK, ASSISTANT_PAGES, GObject)
|
||||
|
||||
struct _GtkAssistantPages
|
||||
{
|
||||
GObject parent_instance;
|
||||
GtkAssistant *assistant;
|
||||
};
|
||||
|
||||
struct _GtkAssistantPagesClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
enum {
|
||||
PAGES_PROP_0,
|
||||
PAGES_PROP_ITEM_TYPE,
|
||||
PAGES_PROP_N_ITEMS,
|
||||
|
||||
PAGES_N_PROPS
|
||||
};
|
||||
|
||||
static GParamSpec *pages_properties[PAGES_N_PROPS] = { NULL, };
|
||||
|
||||
static void gtk_assistant_dispose (GObject *object);
|
||||
static void gtk_assistant_map (GtkWidget *widget);
|
||||
static void gtk_assistant_unmap (GtkWidget *widget);
|
||||
@@ -1313,11 +1289,8 @@ gtk_assistant_dispose (GObject *object)
|
||||
{
|
||||
GtkAssistant *assistant = GTK_ASSISTANT (object);
|
||||
|
||||
if (assistant->model && g_list_length (assistant->pages))
|
||||
{
|
||||
g_list_model_items_changed (G_LIST_MODEL (assistant->model), 0, g_list_length (assistant->pages), 0);
|
||||
g_object_notify_by_pspec (G_OBJECT (assistant->model), pages_properties[PAGES_PROP_N_ITEMS]);
|
||||
}
|
||||
if (assistant->model)
|
||||
g_list_model_items_changed (G_LIST_MODEL (assistant->model), 0, g_list_length (assistant->pages), 0);
|
||||
|
||||
/* We set current to NULL so that the remove code doesn't try
|
||||
* to do anything funny
|
||||
@@ -1760,10 +1733,7 @@ gtk_assistant_add_page (GtkAssistant *assistant,
|
||||
}
|
||||
|
||||
if (assistant->model)
|
||||
{
|
||||
g_list_model_items_changed (assistant->model, position, 0, 1);
|
||||
g_object_notify_by_pspec (G_OBJECT (assistant->model), pages_properties[PAGES_PROP_N_ITEMS]);
|
||||
}
|
||||
g_list_model_items_changed (assistant->model, position, 0, 1);
|
||||
|
||||
return position;
|
||||
}
|
||||
@@ -1789,10 +1759,7 @@ gtk_assistant_remove_page (GtkAssistant *assistant,
|
||||
assistant_remove_page (assistant, page);
|
||||
|
||||
if (assistant->model)
|
||||
{
|
||||
g_list_model_items_changed (assistant->model, page_num, 1, 0);
|
||||
g_object_notify_by_pspec (G_OBJECT (assistant->model), pages_properties[PAGES_PROP_N_ITEMS]);
|
||||
}
|
||||
g_list_model_items_changed (assistant->model, page_num, 1, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2217,6 +2184,20 @@ gtk_assistant_page_get_child (GtkAssistantPage *page)
|
||||
return page->page;
|
||||
}
|
||||
|
||||
#define GTK_TYPE_ASSISTANT_PAGES (gtk_assistant_pages_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (GtkAssistantPages, gtk_assistant_pages, GTK, ASSISTANT_PAGES, GObject)
|
||||
|
||||
struct _GtkAssistantPages
|
||||
{
|
||||
GObject parent_instance;
|
||||
GtkAssistant *assistant;
|
||||
};
|
||||
|
||||
struct _GtkAssistantPagesClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
static GType
|
||||
gtk_assistant_pages_get_item_type (GListModel *model)
|
||||
{
|
||||
@@ -2250,57 +2231,17 @@ gtk_assistant_pages_list_model_init (GListModelInterface *iface)
|
||||
iface->get_n_items = gtk_assistant_pages_get_n_items;
|
||||
iface->get_item = gtk_assistant_pages_get_item;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkAssistantPages, gtk_assistant_pages, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_assistant_pages_list_model_init))
|
||||
|
||||
static void
|
||||
gtk_assistant_pages_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkAssistantPages *self = GTK_ASSISTANT_PAGES (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PAGES_PROP_ITEM_TYPE:
|
||||
g_value_set_gtype (value, GTK_TYPE_ASSISTANT_PAGE);
|
||||
break;
|
||||
|
||||
case PAGES_PROP_N_ITEMS:
|
||||
g_value_set_uint (value, gtk_assistant_pages_get_n_items (G_LIST_MODEL (self)));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_assistant_pages_init (GtkAssistantPages *pages)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_assistant_pages_class_init (GtkAssistantPagesClass *klass)
|
||||
gtk_assistant_pages_class_init (GtkAssistantPagesClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->get_property = gtk_assistant_pages_get_property;
|
||||
|
||||
pages_properties[PAGES_PROP_ITEM_TYPE] =
|
||||
g_param_spec_gtype ("item-type", NULL, NULL,
|
||||
GTK_TYPE_ASSISTANT_PAGE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
pages_properties[PAGES_PROP_N_ITEMS] =
|
||||
g_param_spec_uint ("n-items", NULL, NULL,
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, PAGES_N_PROPS, pages_properties);
|
||||
}
|
||||
|
||||
static GtkAssistantPages *
|
||||
|
||||
+6
-43
@@ -43,10 +43,7 @@ enum {
|
||||
PROP_FILENAME,
|
||||
PROP_ATTRIBUTES,
|
||||
PROP_IO_PRIORITY,
|
||||
PROP_ITEM_TYPE,
|
||||
PROP_LOADING,
|
||||
PROP_N_ITEMS,
|
||||
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
@@ -152,10 +149,10 @@ gtk_bookmark_list_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_bookmark_list_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
gtk_bookmark_list_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkBookmarkList *self = GTK_BOOKMARK_LIST (object);
|
||||
|
||||
@@ -165,26 +162,18 @@ gtk_bookmark_list_get_property (GObject *object,
|
||||
g_value_set_string (value, self->attributes);
|
||||
break;
|
||||
|
||||
case PROP_FILENAME:
|
||||
g_value_set_string (value, self->filename);
|
||||
break;
|
||||
|
||||
case PROP_IO_PRIORITY:
|
||||
g_value_set_int (value, self->io_priority);
|
||||
break;
|
||||
|
||||
case PROP_ITEM_TYPE:
|
||||
g_value_set_gtype (value, G_TYPE_FILE_INFO);
|
||||
case PROP_FILENAME:
|
||||
g_value_set_string (value, self->filename);
|
||||
break;
|
||||
|
||||
case PROP_LOADING:
|
||||
g_value_set_boolean (value, gtk_bookmark_list_is_loading (self));
|
||||
break;
|
||||
|
||||
case PROP_N_ITEMS:
|
||||
g_value_set_uint (value, g_sequence_get_length (self->items));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -247,18 +236,6 @@ gtk_bookmark_list_class_init (GtkBookmarkListClass *class)
|
||||
-G_MAXINT, G_MAXINT, G_PRIORITY_DEFAULT,
|
||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkBookmarkList:item-type:
|
||||
*
|
||||
* The type of items. See [method@Gio.ListModel.get_item_type].
|
||||
*
|
||||
* Since: 4.8
|
||||
**/
|
||||
properties[PROP_ITEM_TYPE] =
|
||||
g_param_spec_gtype ("item-type", NULL, NULL,
|
||||
G_TYPE_FILE_INFO,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GtkBookmarkList:loading: (attributes org.gtk.Property.get=gtk_bookmark_list_is_loading)
|
||||
*
|
||||
@@ -269,18 +246,6 @@ gtk_bookmark_list_class_init (GtkBookmarkListClass *class)
|
||||
FALSE,
|
||||
GTK_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkBookmarkList:n-items:
|
||||
*
|
||||
* The number of items. See [method@Gio.ListModel.get_n_items].
|
||||
*
|
||||
* Since: 4.8
|
||||
**/
|
||||
properties[PROP_N_ITEMS] =
|
||||
g_param_spec_uint ("n-items", NULL, NULL,
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
|
||||
}
|
||||
|
||||
@@ -341,7 +306,6 @@ got_file_info (GObject *source,
|
||||
|
||||
g_sequence_append (self->items, info);
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), g_sequence_get_length (self->items) - 1, 0, 1);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
@@ -367,7 +331,6 @@ gtk_bookmark_list_clear_items (GtkBookmarkList *self)
|
||||
g_sequence_get_end_iter (self->items));
|
||||
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), 0, n_items, 0);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,24 +85,22 @@ static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
|
||||
static void
|
||||
gtk_builder_list_item_factory_setup (GtkListItemFactory *factory,
|
||||
GObject *item,
|
||||
gboolean bind,
|
||||
GFunc func,
|
||||
gpointer data)
|
||||
GtkListItemWidget *widget,
|
||||
GtkListItem *list_item)
|
||||
{
|
||||
GtkBuilderListItemFactory *self = GTK_BUILDER_LIST_ITEM_FACTORY (factory);
|
||||
GtkBuilder *builder;
|
||||
GError *error = NULL;
|
||||
|
||||
GTK_LIST_ITEM_FACTORY_CLASS (gtk_builder_list_item_factory_parent_class)->setup (factory, item, bind, func, data);
|
||||
GTK_LIST_ITEM_FACTORY_CLASS (gtk_builder_list_item_factory_parent_class)->setup (factory, widget, list_item);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
|
||||
gtk_builder_set_current_object (builder, item);
|
||||
gtk_builder_set_current_object (builder, G_OBJECT (list_item));
|
||||
if (self->scope)
|
||||
gtk_builder_set_scope (builder, self->scope);
|
||||
|
||||
if (!gtk_builder_extend_with_template (builder, G_OBJECT (item), G_OBJECT_TYPE (item),
|
||||
if (!gtk_builder_extend_with_template (builder, G_OBJECT (list_item), G_OBJECT_TYPE (list_item),
|
||||
(const char *)g_bytes_get_data (self->data, NULL),
|
||||
g_bytes_get_size (self->data),
|
||||
&error))
|
||||
|
||||
@@ -1409,13 +1409,13 @@ expression_info_construct (GtkBuilder *builder,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (g_type_fundamental (type) == G_TYPE_OBJECT)
|
||||
if (g_type_is_a (type, G_TYPE_OBJECT))
|
||||
{
|
||||
GObjectClass *class = g_type_class_ref (type);
|
||||
pspec = g_object_class_find_property (class, info->property.property_name);
|
||||
g_type_class_unref (class);
|
||||
}
|
||||
else if (g_type_fundamental (type) == G_TYPE_INTERFACE)
|
||||
else if (g_type_is_a (type, G_TYPE_INTERFACE))
|
||||
{
|
||||
GTypeInterface *iface = g_type_default_interface_ref (type);
|
||||
pspec = g_object_interface_find_property (iface, info->property.property_name);
|
||||
@@ -1495,7 +1495,7 @@ parse_signal (ParserData *data,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!g_signal_parse_name (name, object_info->type, &id, &detail, TRUE))
|
||||
if (!g_signal_parse_name (name, object_info->type, &id, &detail, FALSE))
|
||||
{
|
||||
g_set_error (error,
|
||||
GTK_BUILDER_ERROR,
|
||||
|
||||
@@ -428,19 +428,6 @@ gtk_builder_cscope_new (void)
|
||||
return g_object_new (GTK_TYPE_BUILDER_CSCOPE, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_builder_cscope_add_callback:
|
||||
* @self: a `GtkBuilderCScope`
|
||||
* @callback_symbols: (scope async): The callback pointer
|
||||
*
|
||||
* Adds the @callback_symbol to the scope of @builder under its
|
||||
* own name.
|
||||
*
|
||||
* This is a convenience wrapper of [method@Gtk.BuilderCScope.add_callback_symbol].
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
|
||||
/**
|
||||
* gtk_builder_cscope_add_callback_symbol:
|
||||
* @self: a `GtkBuilderCScope`
|
||||
|
||||
@@ -114,14 +114,10 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gtk_builder_cscope_add_callback_symbols (GtkBuilderCScope *self,
|
||||
const char *first_callback_name,
|
||||
GCallback first_callback_symbol,
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
#define gtk_builder_cscope_add_callback(scope, callback) \
|
||||
gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope), #callback, G_CALLBACK (callback))
|
||||
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GCallback gtk_builder_cscope_lookup_callback_symbol(GtkBuilderCScope *self,
|
||||
const char *callback_name);
|
||||
const char *callback_name);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -959,7 +959,7 @@ gtk_check_button_set_label (GtkCheckButton *self,
|
||||
gtk_label_set_use_underline (GTK_LABEL (child), priv->use_underline);
|
||||
gtk_check_button_real_set_child (self, GTK_WIDGET (child), LABEL_CHILD);
|
||||
}
|
||||
|
||||
|
||||
gtk_widget_add_css_class (GTK_WIDGET (self), "text-button");
|
||||
gtk_label_set_label (GTK_LABEL (priv->child), label);
|
||||
}
|
||||
@@ -1099,7 +1099,7 @@ gtk_check_button_set_use_underline (GtkCheckButton *self,
|
||||
return;
|
||||
|
||||
priv->use_underline = setting;
|
||||
if (priv->child_type == LABEL_CHILD && priv->child != NULL)
|
||||
if (priv->child_type == LABEL_CHILD)
|
||||
gtk_label_set_use_underline (GTK_LABEL (priv->child), priv->use_underline);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_USE_UNDERLINE]);
|
||||
|
||||
@@ -41,15 +41,15 @@ struct _GtkColumnListItemFactoryClass
|
||||
|
||||
G_DEFINE_TYPE (GtkColumnListItemFactory, gtk_column_list_item_factory, GTK_TYPE_LIST_ITEM_FACTORY)
|
||||
|
||||
#define ancestor_class(T_N) ((T_N##Class *)gtk_column_list_item_factory_parent_class)
|
||||
#define parent_class ancestor_class(GtkListItemFactory)
|
||||
|
||||
static void
|
||||
gtk_column_list_item_factory_setup (GtkListItemFactory *factory,
|
||||
GObject *item,
|
||||
gboolean bind,
|
||||
GFunc func,
|
||||
gpointer data)
|
||||
GtkListItemWidget *widget,
|
||||
GtkListItem *list_item)
|
||||
{
|
||||
GtkColumnListItemFactory *self = GTK_COLUMN_LIST_ITEM_FACTORY (factory);
|
||||
GtkListItemWidget *widget = data;
|
||||
GListModel *columns;
|
||||
guint i;
|
||||
|
||||
@@ -57,7 +57,7 @@ gtk_column_list_item_factory_setup (GtkListItemFactory *factory,
|
||||
gtk_widget_set_layout_manager (GTK_WIDGET (widget),
|
||||
gtk_column_view_layout_new (self->view));
|
||||
|
||||
GTK_LIST_ITEM_FACTORY_CLASS (gtk_column_list_item_factory_parent_class)->setup (factory, item, bind, func, data);
|
||||
parent_class->setup (factory, widget, list_item);
|
||||
|
||||
columns = gtk_column_view_get_columns (self->view);
|
||||
|
||||
@@ -66,7 +66,7 @@ gtk_column_list_item_factory_setup (GtkListItemFactory *factory,
|
||||
GtkColumnViewColumn *column = g_list_model_get_item (columns, i);
|
||||
|
||||
gtk_column_list_item_factory_add_column (self,
|
||||
widget,
|
||||
list_item->owner,
|
||||
column,
|
||||
FALSE);
|
||||
|
||||
@@ -76,43 +76,38 @@ gtk_column_list_item_factory_setup (GtkListItemFactory *factory,
|
||||
|
||||
static void
|
||||
gtk_column_list_item_factory_teardown (GtkListItemFactory *factory,
|
||||
GObject *item,
|
||||
gboolean unbind,
|
||||
GFunc func,
|
||||
gpointer data)
|
||||
GtkListItemWidget *widget,
|
||||
GtkListItem *list_item)
|
||||
{
|
||||
GtkListItemWidget *widget = data;
|
||||
GtkWidget *w = GTK_WIDGET (widget);
|
||||
GtkWidget *child;
|
||||
|
||||
GTK_LIST_ITEM_FACTORY_CLASS (gtk_column_list_item_factory_parent_class)->teardown (factory, item, unbind, func, data);
|
||||
parent_class->teardown (factory, widget, list_item);
|
||||
|
||||
while ((child = gtk_widget_get_first_child (GTK_WIDGET (widget))))
|
||||
while ((child = gtk_widget_get_first_child (w)))
|
||||
{
|
||||
gtk_list_item_widget_remove_child (GTK_LIST_ITEM_WIDGET (widget), child);
|
||||
gtk_list_item_widget_remove_child (widget, child);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_column_list_item_factory_update (GtkListItemFactory *factory,
|
||||
GObject *item,
|
||||
gboolean unbind,
|
||||
gboolean bind,
|
||||
GFunc func,
|
||||
gpointer data)
|
||||
GtkListItemWidget *widget,
|
||||
GtkListItem *list_item,
|
||||
guint position,
|
||||
gpointer item,
|
||||
gboolean selected)
|
||||
{
|
||||
GtkListItem *list_item = GTK_LIST_ITEM (item);
|
||||
GtkWidget *w = GTK_WIDGET (widget);
|
||||
GtkWidget *child;
|
||||
|
||||
GTK_LIST_ITEM_FACTORY_CLASS (gtk_column_list_item_factory_parent_class)->update (factory, item, unbind, bind, func, data);
|
||||
parent_class->update (factory, widget, list_item, position, item, selected);
|
||||
|
||||
for (child = gtk_widget_get_first_child (GTK_WIDGET (list_item->owner));
|
||||
for (child = gtk_widget_get_first_child (w);
|
||||
child;
|
||||
child = gtk_widget_get_next_sibling (child))
|
||||
{
|
||||
gtk_list_item_widget_update (GTK_LIST_ITEM_WIDGET (child),
|
||||
gtk_list_item_get_position (list_item),
|
||||
gtk_list_item_get_item (list_item),
|
||||
gtk_list_item_get_selected (list_item));
|
||||
gtk_list_item_widget_update (GTK_LIST_ITEM_WIDGET (child), position, item, selected);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +147,7 @@ gtk_column_list_item_factory_add_column (GtkColumnListItemFactory *factory,
|
||||
GtkWidget *cell;
|
||||
|
||||
cell = gtk_column_view_cell_new (column);
|
||||
gtk_list_item_widget_add_child (GTK_LIST_ITEM_WIDGET (list_item), GTK_WIDGET (cell));
|
||||
gtk_list_item_widget_add_child (list_item, cell);
|
||||
gtk_list_item_widget_update (GTK_LIST_ITEM_WIDGET (cell),
|
||||
gtk_list_item_widget_get_position (list_item),
|
||||
gtk_list_item_widget_get_item (list_item),
|
||||
|
||||
+1
-1
@@ -596,7 +596,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
|
||||
GtkTextDecorationStyle decoration_style;
|
||||
const GdkRGBA *color;
|
||||
const GdkRGBA *decoration_color;
|
||||
double letter_spacing;
|
||||
int letter_spacing;
|
||||
|
||||
/* text-decoration */
|
||||
decoration_line = _gtk_css_text_decoration_line_value_get (style->font_variant->text_decoration_line);
|
||||
|
||||
@@ -82,7 +82,6 @@ typedef enum {
|
||||
GTK_DEBUG_BUILDER_OBJECTS = 1 << 16,
|
||||
GTK_DEBUG_A11Y = 1 << 17,
|
||||
GTK_DEBUG_ICONFALLBACK = 1 << 18,
|
||||
GTK_DEBUG_INVERT_TEXT_DIR = 1 << 19,
|
||||
} GtkDebugFlags;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
+1
-42
@@ -60,11 +60,8 @@ enum {
|
||||
PROP_ERROR,
|
||||
PROP_FILE,
|
||||
PROP_IO_PRIORITY,
|
||||
PROP_ITEM_TYPE,
|
||||
PROP_LOADING,
|
||||
PROP_MONITORED,
|
||||
PROP_N_ITEMS,
|
||||
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
@@ -207,10 +204,6 @@ gtk_directory_list_get_property (GObject *object,
|
||||
g_value_set_int (value, self->io_priority);
|
||||
break;
|
||||
|
||||
case PROP_ITEM_TYPE:
|
||||
g_value_set_gtype (value, G_TYPE_FILE_INFO);
|
||||
break;
|
||||
|
||||
case PROP_LOADING:
|
||||
g_value_set_boolean (value, gtk_directory_list_is_loading (self));
|
||||
break;
|
||||
@@ -219,10 +212,6 @@ gtk_directory_list_get_property (GObject *object,
|
||||
g_value_set_boolean (value, gtk_directory_list_get_monitored (self));
|
||||
break;
|
||||
|
||||
case PROP_N_ITEMS:
|
||||
g_value_set_uint (value, g_sequence_get_length (self->items));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -323,18 +312,6 @@ gtk_directory_list_class_init (GtkDirectoryListClass *class)
|
||||
-G_MAXINT, G_MAXINT, G_PRIORITY_DEFAULT,
|
||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkDirectoryList:item-type:
|
||||
*
|
||||
* The type of items. See [method@Gio.ListModel.get_item_type].
|
||||
*
|
||||
* Since: 4.8
|
||||
**/
|
||||
properties[PROP_ITEM_TYPE] =
|
||||
g_param_spec_gtype ("item-type", NULL, NULL,
|
||||
G_TYPE_FILE_INFO,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GtkDirectoryList:loading: (attributes org.gtk.Property.get=gtk_directory_list_is_loading)
|
||||
*
|
||||
@@ -355,18 +332,6 @@ gtk_directory_list_class_init (GtkDirectoryListClass *class)
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkDirectoryList:n-items:
|
||||
*
|
||||
* The number of items. See [method@Gio.ListModel.get_n_items].
|
||||
*
|
||||
* Since: 4.8
|
||||
**/
|
||||
properties[PROP_N_ITEMS] =
|
||||
g_param_spec_uint ("n-items", NULL, NULL,
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
|
||||
}
|
||||
|
||||
@@ -415,7 +380,6 @@ gtk_directory_list_clear_items (GtkDirectoryList *self)
|
||||
g_sequence_get_end_iter (self->items));
|
||||
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), 0, n_items, 0);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
}
|
||||
|
||||
if (self->error)
|
||||
@@ -498,10 +462,7 @@ gtk_directory_list_got_files_cb (GObject *source,
|
||||
self);
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), g_sequence_get_length (self->items) - n, 0, n);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
}
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), g_sequence_get_length (self->items) - n, 0, n);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -619,7 +580,6 @@ handle_event (QueuedEvent *event)
|
||||
position = g_sequence_get_length (self->items);
|
||||
g_sequence_append (self->items, g_object_ref (info));
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), position, 0, 1);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -631,7 +591,6 @@ handle_event (QueuedEvent *event)
|
||||
position = g_sequence_iter_get_position (iter);
|
||||
g_sequence_remove (iter);
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), position, 1, 0);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
+2
-11
@@ -249,14 +249,6 @@ gtk_emoji_chooser_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (gtk_emoji_chooser_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_emoji_chooser_dispose (GObject *object)
|
||||
{
|
||||
gtk_widget_dispose_template (GTK_WIDGET (object), GTK_TYPE_EMOJI_CHOOSER);
|
||||
|
||||
G_OBJECT_CLASS (gtk_emoji_chooser_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
scroll_to_section (EmojiSection *section)
|
||||
{
|
||||
@@ -874,7 +866,7 @@ filter_func (GtkFlowBoxChild *child,
|
||||
goto out;
|
||||
|
||||
term_tokens = g_str_tokenize_and_fold (text, "en", NULL);
|
||||
|
||||
|
||||
g_variant_get_child (emoji_data, 1, "&s", &name);
|
||||
name_tokens = g_str_tokenize_and_fold (name, "en", NULL);
|
||||
g_variant_get_child (emoji_data, 2, "^a&s", &keywords);
|
||||
@@ -1211,7 +1203,6 @@ gtk_emoji_chooser_class_init (GtkEmojiChooserClass *klass)
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->finalize = gtk_emoji_chooser_finalize;
|
||||
object_class->dispose = gtk_emoji_chooser_dispose;
|
||||
widget_class->show = gtk_emoji_chooser_show;
|
||||
widget_class->map = gtk_emoji_chooser_map;
|
||||
|
||||
@@ -1287,7 +1278,7 @@ gtk_emoji_chooser_class_init (GtkEmojiChooserClass *klass)
|
||||
* @direction: 1 to scroll forward, -1 to scroll back
|
||||
*
|
||||
* Scrolls to the next or previous section.
|
||||
*/
|
||||
*/
|
||||
gtk_widget_class_install_action (widget_class, "scroll.section", "i",
|
||||
gtk_emoji_chooser_scroll_section);
|
||||
|
||||
|
||||
@@ -380,7 +380,9 @@ gtk_file_chooser_dialog_activate_response (GtkWidget *widget,
|
||||
static void
|
||||
gtk_file_chooser_dialog_dispose (GObject *object)
|
||||
{
|
||||
gtk_widget_dispose_template (GTK_WIDGET (object), GTK_TYPE_FILE_CHOOSER_DIALOG);
|
||||
GtkFileChooserDialogPrivate *priv = gtk_file_chooser_dialog_get_instance_private (GTK_FILE_CHOOSER_DIALOG (object));
|
||||
|
||||
g_clear_pointer ((GtkWidget **)&priv->widget, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (gtk_file_chooser_dialog_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ static GSList *get_selected_infos (GtkFileChooserWidget *impl);
|
||||
static void search_setup_widgets (GtkFileChooserWidget *impl);
|
||||
static void search_stop_searching (GtkFileChooserWidget *impl,
|
||||
gboolean remove_query);
|
||||
static void search_clear_model (GtkFileChooserWidget *impl,
|
||||
static void search_clear_model (GtkFileChooserWidget *impl,
|
||||
gboolean remove_from_treeview);
|
||||
static void search_entry_activate_cb (GtkFileChooserWidget *impl);
|
||||
static void search_entry_stop_cb (GtkFileChooserWidget *impl);
|
||||
@@ -720,8 +720,8 @@ error_creating_folder_dialog (GtkFileChooserWidget *impl,
|
||||
GFile *file,
|
||||
GError *error)
|
||||
{
|
||||
error_dialog (impl,
|
||||
_("The folder could not be created"),
|
||||
error_dialog (impl,
|
||||
_("The folder could not be created"),
|
||||
error);
|
||||
}
|
||||
|
||||
@@ -3122,11 +3122,10 @@ gtk_file_chooser_widget_dispose (GObject *object)
|
||||
GtkFileChooserWidget *impl = (GtkFileChooserWidget *) object;
|
||||
|
||||
cancel_all_operations (impl);
|
||||
|
||||
/* browse_files_popover is not a template child */
|
||||
g_clear_pointer (&impl->rename_file_popover, gtk_widget_unparent);
|
||||
g_clear_pointer (&impl->browse_files_popover, gtk_widget_unparent);
|
||||
g_clear_pointer (&impl->bookmarks_manager, _gtk_bookmarks_manager_free);
|
||||
g_clear_object (&impl->extra_widget);
|
||||
g_clear_pointer (&impl->bookmarks_manager, _gtk_bookmarks_manager_free);
|
||||
|
||||
if (impl->external_entry && impl->location_entry == impl->external_entry)
|
||||
{
|
||||
@@ -3134,10 +3133,9 @@ gtk_file_chooser_widget_dispose (GObject *object)
|
||||
location_entry_disconnect (impl);
|
||||
impl->external_entry = NULL;
|
||||
}
|
||||
|
||||
remove_settings_signal (impl);
|
||||
|
||||
gtk_widget_dispose_template (GTK_WIDGET (impl), GTK_TYPE_FILE_CHOOSER_WIDGET);
|
||||
g_clear_pointer (&impl->box, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (gtk_file_chooser_widget_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -6260,7 +6258,7 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserWidget *impl)
|
||||
case SAVE_ENTRY:
|
||||
goto save_entry;
|
||||
|
||||
case NOT_REACHED:
|
||||
case NOT_REACHED:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
@@ -43,9 +43,7 @@ enum {
|
||||
PROP_0,
|
||||
PROP_FILTER,
|
||||
PROP_INCREMENTAL,
|
||||
PROP_ITEM_TYPE,
|
||||
PROP_MODEL,
|
||||
PROP_N_ITEMS,
|
||||
PROP_PENDING,
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
@@ -208,18 +206,14 @@ gtk_filter_list_model_emit_items_changed_for_changes (GtkFilterListModel *self,
|
||||
gtk_bitset_difference (changes, old);
|
||||
if (!gtk_bitset_is_empty (changes))
|
||||
{
|
||||
guint min, max, removed, added;
|
||||
guint min, max;
|
||||
|
||||
min = gtk_bitset_get_minimum (changes);
|
||||
max = gtk_bitset_get_maximum (changes);
|
||||
removed = gtk_bitset_get_size_in_range (old, min, max);
|
||||
added = gtk_bitset_get_size_in_range (self->matches, min, max);
|
||||
g_list_model_items_changed (G_LIST_MODEL (self),
|
||||
min > 0 ? gtk_bitset_get_size_in_range (self->matches, 0, min - 1) : 0,
|
||||
removed,
|
||||
added);
|
||||
if (removed != added)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
gtk_bitset_get_size_in_range (old, min, max),
|
||||
gtk_bitset_get_size_in_range (self->matches, min, max));
|
||||
}
|
||||
gtk_bitset_unref (changes);
|
||||
gtk_bitset_unref (old);
|
||||
@@ -292,8 +286,6 @@ gtk_filter_list_model_items_changed_cb (GListModel *model,
|
||||
|
||||
case GTK_FILTER_MATCH_ALL:
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), position, removed, added);
|
||||
if (removed != added)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
return;
|
||||
|
||||
case GTK_FILTER_MATCH_SOME:
|
||||
@@ -324,8 +316,6 @@ gtk_filter_list_model_items_changed_cb (GListModel *model,
|
||||
g_list_model_items_changed (G_LIST_MODEL (self),
|
||||
position > 0 ? gtk_bitset_get_size_in_range (self->matches, 0, position - 1) : 0,
|
||||
filter_removed, filter_added);
|
||||
if (filter_removed != filter_added)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -374,18 +364,10 @@ gtk_filter_list_model_get_property (GObject *object,
|
||||
g_value_set_boolean (value, self->incremental);
|
||||
break;
|
||||
|
||||
case PROP_ITEM_TYPE:
|
||||
g_value_set_gtype (value, gtk_filter_list_model_get_item_type (G_LIST_MODEL (self)));
|
||||
break;
|
||||
|
||||
case PROP_MODEL:
|
||||
g_value_set_object (value, self->model);
|
||||
break;
|
||||
|
||||
case PROP_N_ITEMS:
|
||||
g_value_set_uint (value, gtk_filter_list_model_get_n_items (G_LIST_MODEL (self)));
|
||||
break;
|
||||
|
||||
case PROP_PENDING:
|
||||
g_value_set_uint (value, gtk_filter_list_model_get_pending (self));
|
||||
break;
|
||||
@@ -433,10 +415,7 @@ gtk_filter_list_model_refilter (GtkFilterListModel *self,
|
||||
self->strictness = new_strictness;
|
||||
gtk_filter_list_model_stop_filtering (self);
|
||||
if (n_before > 0)
|
||||
{
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), 0, n_before, 0);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
}
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), 0, n_before, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -444,17 +423,8 @@ gtk_filter_list_model_refilter (GtkFilterListModel *self,
|
||||
switch (self->strictness)
|
||||
{
|
||||
case GTK_FILTER_MATCH_NONE:
|
||||
{
|
||||
guint n_items;
|
||||
|
||||
self->strictness = new_strictness;
|
||||
n_items = g_list_model_get_n_items (self->model);
|
||||
if (n_items > 0)
|
||||
{
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), 0, 0, n_items);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
}
|
||||
}
|
||||
self->strictness = new_strictness;
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), 0, 0, g_list_model_get_n_items (self->model));
|
||||
break;
|
||||
case GTK_FILTER_MATCH_ALL:
|
||||
self->strictness = new_strictness;
|
||||
@@ -490,7 +460,6 @@ gtk_filter_list_model_refilter (GtkFilterListModel *self,
|
||||
|
||||
g_clear_pointer (&self->matches, gtk_bitset_unref);
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), start, n_before - end - start, n_after - end - start);
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -602,18 +571,6 @@ gtk_filter_list_model_class_init (GtkFilterListModelClass *class)
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkFilterListModel:item-type:
|
||||
*
|
||||
* The type of items. See [method@Gio.ListModel.get_item_type].
|
||||
*
|
||||
* Since: 4.8
|
||||
**/
|
||||
properties[PROP_ITEM_TYPE] =
|
||||
g_param_spec_gtype ("item-type", NULL, NULL,
|
||||
G_TYPE_OBJECT,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GtkFilterListModel:model: (attributes org.gtk.Property.get=gtk_filter_list_model_get_model org.gtk.Property.set=gtk_filter_list_model_set_model)
|
||||
*
|
||||
@@ -624,18 +581,6 @@ gtk_filter_list_model_class_init (GtkFilterListModelClass *class)
|
||||
G_TYPE_LIST_MODEL,
|
||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkFilterListModel:n-items:
|
||||
*
|
||||
* The number of items. See [method@Gio.ListModel.get_n_items].
|
||||
*
|
||||
* Since: 4.8
|
||||
**/
|
||||
properties[PROP_N_ITEMS] =
|
||||
g_param_spec_uint ("n-items", NULL, NULL,
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GtkFilterListModel:pending: (attributes org.gtk.Property.get=gtk_filter_list_model_get_pending)
|
||||
*
|
||||
@@ -792,8 +737,6 @@ gtk_filter_list_model_set_model (GtkFilterListModel *self,
|
||||
|
||||
if (removed > 0 || added > 0)
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), 0, removed, added);
|
||||
if (removed != added)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MODEL]);
|
||||
}
|
||||
|
||||
@@ -36,10 +36,7 @@
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ITEM_TYPE,
|
||||
PROP_MODEL,
|
||||
PROP_N_ITEMS,
|
||||
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
@@ -242,8 +239,6 @@ gtk_flatten_list_model_items_changed_cb (GListModel *model,
|
||||
}
|
||||
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), real_position, removed, added);
|
||||
if (removed != added)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -337,18 +332,10 @@ gtk_flatten_list_model_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ITEM_TYPE:
|
||||
g_value_set_gtype (value, gtk_flatten_list_model_get_item_type (G_LIST_MODEL (self)));
|
||||
break;
|
||||
|
||||
case PROP_MODEL:
|
||||
g_value_set_object (value, self->model);
|
||||
break;
|
||||
|
||||
case PROP_N_ITEMS:
|
||||
g_value_set_uint (value, gtk_flatten_list_model_get_n_items (G_LIST_MODEL (self)));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -380,8 +367,6 @@ gtk_flatten_list_model_model_items_changed_cb (GListModel *model,
|
||||
|
||||
if (real_removed > 0 || real_added > 0)
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), real_position, real_removed, real_added);
|
||||
if (real_removed != real_added)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -414,18 +399,6 @@ gtk_flatten_list_model_class_init (GtkFlattenListModelClass *class)
|
||||
gobject_class->get_property = gtk_flatten_list_model_get_property;
|
||||
gobject_class->dispose = gtk_flatten_list_model_dispose;
|
||||
|
||||
/**
|
||||
* GtkFlattenListModel:item-type:
|
||||
*
|
||||
* The type of items. See [method@Gio.ListModel.get_item_type].
|
||||
*
|
||||
* Since: 4.8
|
||||
**/
|
||||
properties[PROP_ITEM_TYPE] =
|
||||
g_param_spec_gtype ("item-type", NULL, NULL,
|
||||
G_TYPE_OBJECT,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GtkFlattenListModel:model: (attributes org.gtk.Property.get=gtk_flatten_list_model_get_model org.gtk.Property.set=gtk_flatten_list_model_set_model)
|
||||
*
|
||||
@@ -436,18 +409,6 @@ gtk_flatten_list_model_class_init (GtkFlattenListModelClass *class)
|
||||
G_TYPE_LIST_MODEL,
|
||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkFlattenListModel:n-items:
|
||||
*
|
||||
* The number of items. See [method@Gio.ListModel.get_n_items].
|
||||
*
|
||||
* Since: 4.8
|
||||
**/
|
||||
properties[PROP_N_ITEMS] =
|
||||
g_param_spec_uint ("n-items", NULL, NULL,
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, properties);
|
||||
}
|
||||
|
||||
@@ -520,8 +481,6 @@ gtk_flatten_list_model_set_model (GtkFlattenListModel *self,
|
||||
|
||||
if (removed > 0 || added > 0)
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), 0, removed, added);
|
||||
if (removed != added)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MODEL]);
|
||||
}
|
||||
|
||||
+37
-3
@@ -1206,8 +1206,43 @@ pango_font_description_to_css (PangoFontDescription *desc,
|
||||
}
|
||||
}
|
||||
if (set & PANGO_FONT_MASK_WEIGHT)
|
||||
g_string_append_printf (s, "font-weight: %d; ", pango_font_description_get_weight (desc));
|
||||
|
||||
{
|
||||
switch (pango_font_description_get_weight (desc))
|
||||
{
|
||||
case PANGO_WEIGHT_THIN:
|
||||
g_string_append (s, "font-weight: 100; ");
|
||||
break;
|
||||
case PANGO_WEIGHT_ULTRALIGHT:
|
||||
g_string_append (s, "font-weight: 200; ");
|
||||
break;
|
||||
case PANGO_WEIGHT_LIGHT:
|
||||
case PANGO_WEIGHT_SEMILIGHT:
|
||||
g_string_append (s, "font-weight: 300; ");
|
||||
break;
|
||||
case PANGO_WEIGHT_BOOK:
|
||||
case PANGO_WEIGHT_NORMAL:
|
||||
g_string_append (s, "font-weight: 400; ");
|
||||
break;
|
||||
case PANGO_WEIGHT_MEDIUM:
|
||||
g_string_append (s, "font-weight: 500; ");
|
||||
break;
|
||||
case PANGO_WEIGHT_SEMIBOLD:
|
||||
g_string_append (s, "font-weight: 600; ");
|
||||
break;
|
||||
case PANGO_WEIGHT_BOLD:
|
||||
g_string_append (s, "font-weight: 700; ");
|
||||
break;
|
||||
case PANGO_WEIGHT_ULTRABOLD:
|
||||
g_string_append (s, "font-weight: 800; ");
|
||||
break;
|
||||
case PANGO_WEIGHT_HEAVY:
|
||||
case PANGO_WEIGHT_ULTRAHEAVY:
|
||||
g_string_append (s, "font-weight: 900; ");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (set & PANGO_FONT_MASK_STRETCH)
|
||||
{
|
||||
switch (pango_font_description_get_stretch (desc))
|
||||
@@ -1234,7 +1269,6 @@ pango_font_description_to_css (PangoFontDescription *desc,
|
||||
g_string_append (s, "font-stretch: expanded; ");
|
||||
break;
|
||||
case PANGO_STRETCH_EXTRA_EXPANDED:
|
||||
g_string_append (s, "font-stretch: extra-expanded; ");
|
||||
break;
|
||||
case PANGO_STRETCH_ULTRA_EXPANDED:
|
||||
g_string_append (s, "font-stretch: ultra-expanded; ");
|
||||
|
||||
@@ -229,10 +229,10 @@ gtk_font_chooser_dialog_dispose (GObject *object)
|
||||
dialog);
|
||||
}
|
||||
|
||||
/* tweak_button is not a template child */
|
||||
g_clear_pointer (&dialog->select_button, gtk_widget_unparent);
|
||||
g_clear_pointer (&dialog->cancel_button, gtk_widget_unparent);
|
||||
g_clear_pointer (&dialog->tweak_button, gtk_widget_unparent);
|
||||
|
||||
gtk_widget_dispose_template (GTK_WIDGET (dialog), GTK_TYPE_FONT_CHOOSER_DIALOG);
|
||||
g_clear_pointer (&dialog->fontchooser, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (gtk_font_chooser_dialog_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
+19
-106
@@ -116,8 +116,6 @@ struct _GtkFontChooserWidget
|
||||
GtkWidget *size_label;
|
||||
GtkWidget *size_spin;
|
||||
GtkWidget *size_slider;
|
||||
GtkWidget *size_label2;
|
||||
GtkWidget *size_spin2;
|
||||
GtkWidget *size_slider2;
|
||||
|
||||
GtkWidget *axis_grid;
|
||||
@@ -915,8 +913,6 @@ gtk_font_chooser_widget_class_init (GtkFontChooserWidgetClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, size_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, size_spin);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, size_slider);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, size_label2);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, size_spin2);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, size_slider2);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, stack);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkFontChooserWidget, grid);
|
||||
@@ -1784,30 +1780,15 @@ typedef struct {
|
||||
GtkWidget *example;
|
||||
} FeatureItem;
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
get_feature_display_name (hb_tag_t tag)
|
||||
{
|
||||
int i;
|
||||
char buf[5] = { 0, };
|
||||
|
||||
hb_tag_to_string (tag, buf);
|
||||
|
||||
if (buf[0] == 's' && buf[1] == 's' && g_ascii_isdigit (buf[2]) && g_ascii_isdigit (buf[3]))
|
||||
{
|
||||
int num = (buf[2] - '0') * 10 + (buf[3] - '0');
|
||||
return g_strdup_printf (g_dpgettext2 (NULL, "OpenType layout", "Stylistic Set %d"), num);
|
||||
}
|
||||
|
||||
if (buf[0] == 'c' && buf[1] == 'v' && g_ascii_isdigit (buf[2]) && g_ascii_isdigit (buf[3]))
|
||||
{
|
||||
int num = (buf[2] - '0') * 10 + (buf[3] - '0');
|
||||
return g_strdup_printf (g_dpgettext2 (NULL, "OpenType layout", "Character Variant %d"), num);
|
||||
}
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (open_type_layout_features); i++)
|
||||
{
|
||||
if (tag == open_type_layout_features[i].tag)
|
||||
return g_strdup (g_dpgettext2 (NULL, "OpenType layout", open_type_layout_features[i].name));
|
||||
return g_dpgettext2 (NULL, "OpenType layout", open_type_layout_features[i].name);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1873,12 +1854,7 @@ find_affected_text (GtkFontChooserWidget *fontchooser,
|
||||
hb_ot_layout_script_find_language (hb_face, HB_OT_TAG_GSUB, script_index, lang_tag, &lang_index);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
if (hb_ot_layout_language_find_feature (hb_face,
|
||||
HB_OT_TAG_GSUB,
|
||||
script_index,
|
||||
lang_index,
|
||||
feature_tag,
|
||||
&feature_index))
|
||||
if (hb_ot_layout_language_find_feature (hb_face, HB_OT_TAG_GSUB, script_index, lang_index, feature_tag, &feature_index))
|
||||
{
|
||||
unsigned int lookup_indexes[32];
|
||||
unsigned int lookup_count = 32;
|
||||
@@ -1893,27 +1869,22 @@ find_affected_text (GtkFontChooserWidget *fontchooser,
|
||||
lookup_indexes);
|
||||
if (count > 0)
|
||||
{
|
||||
hb_set_t *glyphs_before = NULL;
|
||||
hb_set_t *glyphs_after = NULL;
|
||||
hb_set_t *glyphs_output = NULL;
|
||||
hb_set_t *glyphs_input;
|
||||
hb_set_t* glyphs_before = NULL;
|
||||
hb_set_t* glyphs_input = NULL;
|
||||
hb_set_t* glyphs_after = NULL;
|
||||
hb_set_t* glyphs_output = NULL;
|
||||
hb_codepoint_t gid;
|
||||
char buf[5] = { 0, };
|
||||
|
||||
hb_tag_to_string (feature_tag, buf);
|
||||
glyphs_input = hb_set_create ();
|
||||
|
||||
glyphs_input = hb_set_create ();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
hb_ot_layout_lookup_collect_glyphs (hb_face,
|
||||
HB_OT_TAG_GSUB,
|
||||
lookup_indexes[i],
|
||||
glyphs_before,
|
||||
glyphs_input,
|
||||
glyphs_after,
|
||||
glyphs_output);
|
||||
}
|
||||
// XXX For now, just look at first index
|
||||
hb_ot_layout_lookup_collect_glyphs (hb_face,
|
||||
HB_OT_TAG_GSUB,
|
||||
lookup_indexes[0],
|
||||
glyphs_before,
|
||||
glyphs_input,
|
||||
glyphs_after,
|
||||
glyphs_output);
|
||||
|
||||
if (!fontchooser->glyphmap)
|
||||
{
|
||||
@@ -1927,7 +1898,6 @@ find_affected_text (GtkFontChooserWidget *fontchooser,
|
||||
}
|
||||
}
|
||||
|
||||
gid = HB_SET_VALUE_INVALID;
|
||||
while (hb_set_next (glyphs_input, &gid))
|
||||
{
|
||||
hb_codepoint_t ch;
|
||||
@@ -1952,53 +1922,6 @@ find_affected_text (GtkFontChooserWidget *fontchooser,
|
||||
return g_string_free (chars, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
update_feature_label (GtkFontChooserWidget *fontchooser,
|
||||
FeatureItem *item,
|
||||
hb_font_t *hb_font,
|
||||
hb_tag_t script_tag,
|
||||
hb_tag_t lang_tag)
|
||||
{
|
||||
hb_face_t *hb_face;
|
||||
unsigned int script_index, lang_index, feature_index;
|
||||
hb_ot_name_id_t id;
|
||||
unsigned int len;
|
||||
char *label;
|
||||
|
||||
hb_face = hb_font_get_face (hb_font);
|
||||
|
||||
if (!(g_str_has_prefix (item->name, "ss") || g_str_has_prefix (item->name, "cv")) ||
|
||||
!g_ascii_isdigit (item->name[2]) || !g_ascii_isdigit (item->name[3]))
|
||||
return;
|
||||
|
||||
hb_ot_layout_table_find_script (hb_face, HB_OT_TAG_GSUB, script_tag, &script_index);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
hb_ot_layout_script_find_language (hb_face, HB_OT_TAG_GSUB, script_index, lang_tag, &lang_index);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
if (hb_ot_layout_language_find_feature (hb_face, HB_OT_TAG_GSUB, script_index, lang_index, item->tag, &feature_index) &&
|
||||
hb_ot_layout_feature_get_name_ids (hb_face, HB_OT_TAG_GSUB, feature_index, &id, NULL, NULL, NULL, NULL))
|
||||
{
|
||||
len = hb_ot_name_get_utf8 (hb_face, id, HB_LANGUAGE_INVALID, NULL, NULL);
|
||||
len++;
|
||||
label = g_new (char, len);
|
||||
hb_ot_name_get_utf8 (hb_face, id, HB_LANGUAGE_INVALID, &len, label);
|
||||
|
||||
char *s = g_strdup_printf ("%s (%s)", label, item->name);
|
||||
gtk_check_button_set_label (GTK_CHECK_BUTTON (item->feat), s);
|
||||
g_free (s);
|
||||
|
||||
g_free (label);
|
||||
}
|
||||
else
|
||||
{
|
||||
label = get_feature_display_name (item->tag);
|
||||
gtk_check_button_set_label (GTK_CHECK_BUTTON (item->feat), label);
|
||||
g_free (label);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_feature_example (GtkFontChooserWidget *fontchooser,
|
||||
FeatureItem *item,
|
||||
@@ -2139,13 +2062,10 @@ add_check_group (GtkFontChooserWidget *fontchooser,
|
||||
GtkGesture *gesture;
|
||||
GtkWidget *box;
|
||||
GtkWidget *example;
|
||||
char *name;
|
||||
|
||||
tag = hb_tag_from_string (tags[i], -1);
|
||||
|
||||
name = get_feature_display_name (tag);
|
||||
feat = gtk_check_button_new_with_label (name);
|
||||
g_free (name);
|
||||
feat = gtk_check_button_new_with_label (get_feature_display_name (tag));
|
||||
set_inconsistent (GTK_CHECK_BUTTON (feat), TRUE);
|
||||
g_signal_connect (feat, "toggled", G_CALLBACK (font_feature_toggled_cb), fontchooser);
|
||||
g_signal_connect_swapped (feat, "notify::inconsistent", G_CALLBACK (update_font_features), fontchooser);
|
||||
@@ -2207,14 +2127,14 @@ add_radio_group (GtkFontChooserWidget *fontchooser,
|
||||
hb_tag_t tag;
|
||||
GtkWidget *feat;
|
||||
FeatureItem *item;
|
||||
char *name;
|
||||
const char *name;
|
||||
GtkWidget *box;
|
||||
GtkWidget *example;
|
||||
|
||||
tag = hb_tag_from_string (tags[i], -1);
|
||||
name = get_feature_display_name (tag);
|
||||
|
||||
feat = gtk_check_button_new_with_label (name ? name : _("Default"));
|
||||
g_free (name);
|
||||
if (group_button == NULL)
|
||||
group_button = feat;
|
||||
else
|
||||
@@ -2341,7 +2261,6 @@ gtk_font_chooser_widget_update_font_features (GtkFontChooserWidget *fontchooser)
|
||||
gtk_widget_show (item->top);
|
||||
gtk_widget_show (gtk_widget_get_parent (item->top));
|
||||
|
||||
update_feature_label (fontchooser, item, hb_font, script_tag, lang_tag);
|
||||
update_feature_example (fontchooser, item, hb_font, script_tag, lang_tag, fontchooser->font_desc);
|
||||
|
||||
if (GTK_IS_CHECK_BUTTON (item->feat))
|
||||
@@ -2641,18 +2560,12 @@ gtk_font_chooser_widget_set_level (GtkFontChooserWidget *fontchooser,
|
||||
gtk_widget_show (fontchooser->size_label);
|
||||
gtk_widget_show (fontchooser->size_slider);
|
||||
gtk_widget_show (fontchooser->size_spin);
|
||||
gtk_widget_show (fontchooser->size_label2);
|
||||
gtk_widget_show (fontchooser->size_slider2);
|
||||
gtk_widget_show (fontchooser->size_spin2);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_hide (fontchooser->size_label);
|
||||
gtk_widget_hide (fontchooser->size_slider);
|
||||
gtk_widget_hide (fontchooser->size_spin);
|
||||
gtk_widget_hide (fontchooser->size_label2);
|
||||
gtk_widget_hide (fontchooser->size_slider2);
|
||||
gtk_widget_hide (fontchooser->size_spin2);
|
||||
}
|
||||
|
||||
update_fontlist (fontchooser);
|
||||
|
||||
@@ -411,7 +411,7 @@ gtk_gesture_click_class_init (GtkGestureClickClass *klass)
|
||||
* @x: X coordinate of the event
|
||||
* @y: Y coordinate of the event
|
||||
* @button: Button being released
|
||||
* @sequence: (nullable): Sequence being released
|
||||
* @sequence: Sequence being released
|
||||
*
|
||||
* Emitted whenever the gesture receives a release
|
||||
* event that had no previous corresponding press.
|
||||
|
||||
@@ -230,7 +230,7 @@ gtk_gesture_drag_new (void)
|
||||
*
|
||||
* If the @gesture is active, this function returns %TRUE
|
||||
* and fills in @x and @y with the drag start coordinates,
|
||||
* in widget-relative coordinates.
|
||||
* in surface-relative coordinates.
|
||||
*
|
||||
* Returns: %TRUE if the gesture is active
|
||||
*/
|
||||
|
||||
+1
-4
@@ -758,10 +758,7 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
|
||||
/* step 0: exit early if list is empty */
|
||||
if (gtk_list_item_manager_get_root (self->item_manager) == NULL)
|
||||
{
|
||||
gtk_list_base_update_adjustments (GTK_LIST_BASE (self), 0, 0, 0, 0, &x, &y);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
/* step 1: determine width of the list */
|
||||
gtk_grid_view_measure_column_size (self, &col_min, &col_nat);
|
||||
|
||||
+2
-12
@@ -1709,7 +1709,7 @@ static const char builtin_hicolor_index[] =
|
||||
"[Icon Theme]\n"
|
||||
"Name=Hicolor\n"
|
||||
"Hidden=True\n"
|
||||
"Directories=16x16/actions,16x16/status,22x22/actions,24x24/actions,24x24/status,32x32/actions,32x32/status,48x48/status,64x64/actions,scalable/status,scalable/actions\n"
|
||||
"Directories=16x16/actions,16x16/status,22x22/actions,24x24/actions,24x24/status,32x32/actions,32x32/status,48x48/status,64x64/actions\n"
|
||||
"[16x16/actions]\n"
|
||||
"Size=16\n"
|
||||
"Type=Threshold\n"
|
||||
@@ -1736,17 +1736,7 @@ static const char builtin_hicolor_index[] =
|
||||
"Type=Threshold\n"
|
||||
"[64x64/actions]\n"
|
||||
"Size=64\n"
|
||||
"Type=Threshold\n"
|
||||
"[scalable/status]\n"
|
||||
"MinSize=1\n"
|
||||
"Size=128\n"
|
||||
"MaxSize=256\n"
|
||||
"Type=Scalable\n"
|
||||
"[scalable/actions]\n"
|
||||
"MinSize=1\n"
|
||||
"Size=128\n"
|
||||
"MaxSize=256\n"
|
||||
"Type=Scalable\n";
|
||||
"Type=Threshold\n";
|
||||
|
||||
static void
|
||||
insert_theme (GtkIconTheme *self,
|
||||
|
||||
@@ -813,7 +813,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
|
||||
gboolean compose_match;
|
||||
guint keyval, state;
|
||||
|
||||
while (n_compose < priv->compose_buffer_len && priv->compose_buffer[n_compose] != 0)
|
||||
while (priv->compose_buffer[n_compose] != 0 && n_compose < priv->compose_buffer_len)
|
||||
n_compose++;
|
||||
|
||||
keyval = gdk_key_event_get_keyval (event);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2022 Benjamin Otte
|
||||
*
|
||||
* 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.1 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/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __GTK_INSCRIPTION_H__
|
||||
#define __GTK_INSCRIPTION_H__
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_INSCRIPTION (gtk_inscription_get_type ())
|
||||
|
||||
/**
|
||||
* GtkInscriptionOverflow:
|
||||
* @GTK_INSCRIPTION_OVERFLOW_CLIP: Clip the remaining text
|
||||
* @GTK_INSCRIPTION_OVERFLOW_ELLIPSIZE_START: Omit characters at the start of the text
|
||||
* @GTK_INSCRIPTION_OVERFLOW_ELLIPSIZE_MIDDLE: Omit characters at the middle of the text
|
||||
* @GTK_INSCRIPTION_OVERFLOW_ELLIPSIZE_END: Omit characters at the end of the text
|
||||
*
|
||||
* The different methods to handle text in #GtkInscription when it doesn't
|
||||
* fit the available space.
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
typedef enum {
|
||||
GTK_INSCRIPTION_OVERFLOW_CLIP,
|
||||
GTK_INSCRIPTION_OVERFLOW_ELLIPSIZE_START,
|
||||
GTK_INSCRIPTION_OVERFLOW_ELLIPSIZE_MIDDLE,
|
||||
GTK_INSCRIPTION_OVERFLOW_ELLIPSIZE_END
|
||||
} GtkInscriptionOverflow;
|
||||
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
G_DECLARE_FINAL_TYPE (GtkInscription, gtk_inscription, GTK, INSCRIPTION, GtkWidget)
|
||||
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
GtkWidget * gtk_inscription_new (const char *text);
|
||||
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
const char * gtk_inscription_get_text (GtkInscription *self);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_inscription_set_text (GtkInscription *self,
|
||||
const char *text);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
PangoAttrList * gtk_inscription_get_attributes (GtkInscription *self);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_inscription_set_attributes (GtkInscription *self,
|
||||
PangoAttrList *attrs);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_inscription_set_markup (GtkInscription *self,
|
||||
const char *markup);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
GtkInscriptionOverflow gtk_inscription_get_text_overflow (GtkInscription *self);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_inscription_set_text_overflow (GtkInscription *self,
|
||||
GtkInscriptionOverflow overflow);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
PangoWrapMode gtk_inscription_get_wrap_mode (GtkInscription *self);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_inscription_set_wrap_mode (GtkInscription *self,
|
||||
PangoWrapMode wrap_mode);
|
||||
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
guint gtk_inscription_get_min_chars (GtkInscription *self);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_inscription_set_min_chars (GtkInscription *self,
|
||||
guint min_chars);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
guint gtk_inscription_get_nat_chars (GtkInscription *self);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_inscription_set_nat_chars (GtkInscription *self,
|
||||
guint nat_chars);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
guint gtk_inscription_get_min_lines (GtkInscription *self);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_inscription_set_min_lines (GtkInscription *self,
|
||||
guint min_lines);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
guint gtk_inscription_get_nat_lines (GtkInscription *self);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_inscription_set_nat_lines (GtkInscription *self,
|
||||
guint nat_lines);
|
||||
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
float gtk_inscription_get_xalign (GtkInscription *self);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_inscription_set_xalign (GtkInscription *self,
|
||||
float xalign);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
float gtk_inscription_get_yalign (GtkInscription *self);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_inscription_set_yalign (GtkInscription *self,
|
||||
float yalign);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_INSCRIPTION_H__ */
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2022 Benjamin Otte
|
||||
*
|
||||
* 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.1 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/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __GTK_INSCRIPTION_PRIVATE_H__
|
||||
#define __GTK_INSCRIPTION_PRIVATE_H__
|
||||
|
||||
|
||||
#include <gtk/gtkinscription.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
PangoLayout * gtk_inscription_get_layout (GtkInscription *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_INSCRIPTION_PRIVATE_H__ */
|
||||
@@ -2020,12 +2020,6 @@ gtk_label_mnemonic_activate (GtkWidget *widget,
|
||||
if (self->mnemonic_widget)
|
||||
return gtk_widget_mnemonic_activate (self->mnemonic_widget, group_cycling);
|
||||
|
||||
/* Not a label for something else, but is selectable, so set focus into
|
||||
* the label itself.
|
||||
*/
|
||||
if (gtk_label_get_selectable (self) && gtk_widget_get_focusable (widget))
|
||||
return gtk_label_grab_focus (widget);
|
||||
|
||||
/* Try to find the widget to activate by traversing the
|
||||
* widget's ancestry.
|
||||
*/
|
||||
|
||||
+14
-37
@@ -37,13 +37,6 @@
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
/* Allow shadows to overdraw without immediately culling the widget at the viewport
|
||||
* boundary.
|
||||
* Choose this so that roughly 1 extra widget gets drawn on each side of the viewport,
|
||||
* but not more. Icons are 16px, text height is somewhere there, too.
|
||||
*/
|
||||
#define GTK_LIST_BASE_CHILD_MAX_OVERDRAW 10
|
||||
|
||||
typedef struct _RubberbandData RubberbandData;
|
||||
|
||||
struct _RubberbandData
|
||||
@@ -1358,10 +1351,6 @@ gtk_list_base_size_allocate_child (GtkListBase *self,
|
||||
int height)
|
||||
{
|
||||
GtkAllocation child_allocation;
|
||||
int self_width, self_height;
|
||||
|
||||
self_width = gtk_widget_get_width (GTK_WIDGET (self));
|
||||
self_height = gtk_widget_get_height (GTK_WIDGET (self));
|
||||
|
||||
if (gtk_list_base_get_orientation (GTK_LIST_BASE (self)) == GTK_ORIENTATION_VERTICAL)
|
||||
{
|
||||
@@ -1369,14 +1358,18 @@ gtk_list_base_size_allocate_child (GtkListBase *self,
|
||||
{
|
||||
child_allocation.x = x;
|
||||
child_allocation.y = y;
|
||||
child_allocation.width = width;
|
||||
child_allocation.height = height;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_allocation.x = self_width - x - width;
|
||||
int mirror_point = gtk_widget_get_width (GTK_WIDGET (self));
|
||||
|
||||
child_allocation.x = mirror_point - x - width;
|
||||
child_allocation.y = y;
|
||||
child_allocation.width = width;
|
||||
child_allocation.height = height;
|
||||
}
|
||||
child_allocation.width = width;
|
||||
child_allocation.height = height;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1384,32 +1377,20 @@ gtk_list_base_size_allocate_child (GtkListBase *self,
|
||||
{
|
||||
child_allocation.x = y;
|
||||
child_allocation.y = x;
|
||||
child_allocation.width = height;
|
||||
child_allocation.height = width;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_allocation.x = self_width - y - height;
|
||||
int mirror_point = gtk_widget_get_width (GTK_WIDGET (self));
|
||||
|
||||
child_allocation.x = mirror_point - y - height;
|
||||
child_allocation.y = x;
|
||||
child_allocation.width = height;
|
||||
child_allocation.height = width;
|
||||
}
|
||||
child_allocation.width = height;
|
||||
child_allocation.height = width;
|
||||
}
|
||||
|
||||
if (!gdk_rectangle_intersect (&child_allocation,
|
||||
&(GdkRectangle) {
|
||||
- GTK_LIST_BASE_CHILD_MAX_OVERDRAW,
|
||||
- GTK_LIST_BASE_CHILD_MAX_OVERDRAW,
|
||||
self_width + GTK_LIST_BASE_CHILD_MAX_OVERDRAW,
|
||||
self_height + GTK_LIST_BASE_CHILD_MAX_OVERDRAW
|
||||
},
|
||||
NULL))
|
||||
{
|
||||
/* child is fully outside the viewport, hide it and don't allocate it */
|
||||
gtk_widget_set_child_visible (child, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_widget_set_child_visible (child, TRUE);
|
||||
|
||||
gtk_widget_size_allocate (child, &child_allocation, -1);
|
||||
}
|
||||
|
||||
@@ -1740,12 +1721,8 @@ gtk_list_base_drag_end (GtkGestureDrag *gesture,
|
||||
double offset_y,
|
||||
GtkListBase *self)
|
||||
{
|
||||
GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self);
|
||||
gboolean modify, extend;
|
||||
|
||||
if (!priv->rubberband)
|
||||
return;
|
||||
|
||||
gtk_list_base_drag_update (gesture, offset_x, offset_y, self);
|
||||
get_selection_modifiers (GTK_GESTURE (gesture), &modify, &extend);
|
||||
gtk_list_base_stop_rubberband (self, modify, extend);
|
||||
|
||||
+3
-1
@@ -62,6 +62,8 @@ enum
|
||||
|
||||
G_DEFINE_TYPE (GtkListItem, gtk_list_item, G_TYPE_OBJECT)
|
||||
|
||||
#define parent_class ((GObjectClass *)gtk_list_item_parent_class)
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
|
||||
static void
|
||||
@@ -72,7 +74,7 @@ gtk_list_item_dispose (GObject *object)
|
||||
g_assert (self->owner == NULL); /* would hold a reference */
|
||||
g_clear_object (&self->child);
|
||||
|
||||
G_OBJECT_CLASS (gtk_list_item_parent_class)->dispose (object);
|
||||
parent_class->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+40
-38
@@ -80,36 +80,31 @@ G_DEFINE_TYPE (GtkListItemFactory, gtk_list_item_factory, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
gtk_list_item_factory_default_setup (GtkListItemFactory *self,
|
||||
GObject *item,
|
||||
gboolean bind,
|
||||
GFunc func,
|
||||
gpointer data)
|
||||
GtkListItemWidget *widget,
|
||||
GtkListItem *list_item)
|
||||
{
|
||||
if (func)
|
||||
func (item, data);
|
||||
gtk_list_item_widget_default_setup (widget, list_item);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_item_factory_default_teardown (GtkListItemFactory *self,
|
||||
GObject *item,
|
||||
gboolean unbind,
|
||||
GFunc func,
|
||||
gpointer data)
|
||||
GtkListItemWidget *widget,
|
||||
GtkListItem *list_item)
|
||||
{
|
||||
if (func)
|
||||
func (item, data);
|
||||
gtk_list_item_widget_default_teardown (widget, list_item);
|
||||
|
||||
gtk_list_item_set_child (list_item, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gtk_list_item_factory_default_update (GtkListItemFactory *self,
|
||||
GObject *item,
|
||||
gboolean unbind,
|
||||
gboolean bind,
|
||||
GFunc func,
|
||||
gpointer data)
|
||||
GtkListItemWidget *widget,
|
||||
GtkListItem *list_item,
|
||||
guint position,
|
||||
gpointer item,
|
||||
gboolean selected)
|
||||
{
|
||||
if (func)
|
||||
func (item, data);
|
||||
gtk_list_item_widget_default_update (widget, list_item, position, item, selected);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -127,38 +122,45 @@ gtk_list_item_factory_init (GtkListItemFactory *self)
|
||||
|
||||
void
|
||||
gtk_list_item_factory_setup (GtkListItemFactory *self,
|
||||
GObject *item,
|
||||
gboolean bind,
|
||||
GFunc func,
|
||||
gpointer data)
|
||||
GtkListItemWidget *widget)
|
||||
{
|
||||
GtkListItem *list_item;
|
||||
|
||||
g_return_if_fail (GTK_IS_LIST_ITEM_FACTORY (self));
|
||||
|
||||
GTK_LIST_ITEM_FACTORY_GET_CLASS (self)->setup (self, item, bind, func, data);
|
||||
list_item = gtk_list_item_new ();
|
||||
|
||||
GTK_LIST_ITEM_FACTORY_GET_CLASS (self)->setup (self, widget, list_item);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_list_item_factory_teardown (GtkListItemFactory *self,
|
||||
GObject *item,
|
||||
gboolean unbind,
|
||||
GFunc func,
|
||||
gpointer data)
|
||||
GtkListItemWidget *widget)
|
||||
{
|
||||
GtkListItem *list_item;
|
||||
|
||||
g_return_if_fail (GTK_IS_LIST_ITEM_FACTORY (self));
|
||||
|
||||
GTK_LIST_ITEM_FACTORY_GET_CLASS (self)->teardown (self, item, unbind, func, data);
|
||||
list_item = gtk_list_item_widget_get_list_item (widget);
|
||||
|
||||
GTK_LIST_ITEM_FACTORY_GET_CLASS (self)->teardown (self, widget, list_item);
|
||||
|
||||
g_object_unref (list_item);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_list_item_factory_update (GtkListItemFactory *self,
|
||||
GObject *item,
|
||||
gboolean unbind,
|
||||
gboolean bind,
|
||||
GFunc func,
|
||||
gpointer data)
|
||||
GtkListItemWidget *widget,
|
||||
guint position,
|
||||
gpointer item,
|
||||
gboolean selected)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_LIST_ITEM_FACTORY (self));
|
||||
g_return_if_fail (G_IS_OBJECT (item));
|
||||
GtkListItem *list_item;
|
||||
|
||||
GTK_LIST_ITEM_FACTORY_GET_CLASS (self)->update (self, item, unbind, bind, func, data);
|
||||
g_return_if_fail (GTK_IS_LIST_ITEM_FACTORY (self));
|
||||
g_return_if_fail (GTK_IS_LIST_ITEM_WIDGET (widget));
|
||||
|
||||
list_item = gtk_list_item_widget_get_list_item (widget);
|
||||
|
||||
GTK_LIST_ITEM_FACTORY_GET_CLASS (self)->update (self, widget, list_item, position, item, selected);
|
||||
}
|
||||
|
||||
@@ -37,44 +37,33 @@ struct _GtkListItemFactoryClass
|
||||
|
||||
/* setup @list_item so it can be bound */
|
||||
void (* setup) (GtkListItemFactory *self,
|
||||
GObject *item,
|
||||
gboolean bind,
|
||||
GFunc func,
|
||||
gpointer data);
|
||||
GtkListItemWidget *widget,
|
||||
GtkListItem *list_item);
|
||||
/* undo the effects of GtkListItemFactoryClass::setup() */
|
||||
void (* teardown) (GtkListItemFactory *self,
|
||||
GObject *item,
|
||||
gboolean unbind,
|
||||
GFunc func,
|
||||
gpointer data);
|
||||
GtkListItemWidget *widget,
|
||||
GtkListItem *list_item);
|
||||
|
||||
/* Update properties on @list_item to the given @item, which is in @position and @selected state.
|
||||
* One or more of those properties might be unchanged. */
|
||||
void (* update) (GtkListItemFactory *self,
|
||||
GObject *item,
|
||||
gboolean unbind,
|
||||
gboolean bind,
|
||||
GFunc func,
|
||||
gpointer data);
|
||||
GtkListItemWidget *widget,
|
||||
GtkListItem *list_item,
|
||||
guint position,
|
||||
gpointer item,
|
||||
gboolean selected);
|
||||
};
|
||||
|
||||
void gtk_list_item_factory_setup (GtkListItemFactory *self,
|
||||
GObject *item,
|
||||
gboolean bind,
|
||||
GFunc func,
|
||||
gpointer data);
|
||||
GtkListItemWidget *widget);
|
||||
void gtk_list_item_factory_teardown (GtkListItemFactory *self,
|
||||
GObject *item,
|
||||
gboolean unbind,
|
||||
GFunc func,
|
||||
gpointer data);
|
||||
GtkListItemWidget *widget);
|
||||
|
||||
void gtk_list_item_factory_update (GtkListItemFactory *self,
|
||||
GObject *item,
|
||||
gboolean unbind,
|
||||
gboolean bind,
|
||||
GFunc func,
|
||||
gpointer data);
|
||||
GtkListItemWidget *widget,
|
||||
guint position,
|
||||
gpointer item,
|
||||
gboolean selected);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
+87
-138
@@ -62,6 +62,9 @@ enum
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkListItemWidget, gtk_list_item_widget, GTK_TYPE_WIDGET)
|
||||
|
||||
#define ancestor_class(T_N) ((T_N##Class *)gtk_list_item_widget_parent_class)
|
||||
#define parent_class ancestor_class(GtkWidget)
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
@@ -137,86 +140,7 @@ gtk_list_item_widget_grab_focus (GtkWidget *widget)
|
||||
!priv->list_item->selectable)
|
||||
return FALSE;
|
||||
|
||||
return GTK_WIDGET_CLASS (gtk_list_item_widget_parent_class)->grab_focus (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_item_widget_setup_func (gpointer object,
|
||||
gpointer data)
|
||||
{
|
||||
GtkListItemWidget *self = data;
|
||||
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
|
||||
GtkListItem *list_item = object;
|
||||
|
||||
priv->list_item = list_item;
|
||||
list_item->owner = self;
|
||||
|
||||
if (list_item->child)
|
||||
gtk_list_item_widget_add_child (self, list_item->child);
|
||||
|
||||
gtk_list_item_widget_set_activatable (self, list_item->activatable);
|
||||
|
||||
gtk_list_item_do_notify (list_item,
|
||||
priv->item != NULL,
|
||||
priv->position != GTK_INVALID_LIST_POSITION,
|
||||
priv->selected);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_item_widget_setup_factory (GtkListItemWidget *self)
|
||||
{
|
||||
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
|
||||
GtkListItem *list_item;
|
||||
|
||||
list_item = gtk_list_item_new ();
|
||||
|
||||
gtk_list_item_factory_setup (priv->factory,
|
||||
G_OBJECT (list_item),
|
||||
priv->item != NULL,
|
||||
gtk_list_item_widget_setup_func,
|
||||
self);
|
||||
|
||||
g_assert (priv->list_item == list_item);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_item_widget_teardown_func (gpointer object,
|
||||
gpointer data)
|
||||
{
|
||||
GtkListItemWidget *self = data;
|
||||
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
|
||||
GtkListItem *list_item = object;
|
||||
|
||||
g_assert (priv->list_item == list_item);
|
||||
|
||||
priv->list_item = NULL;
|
||||
list_item->owner = NULL;
|
||||
|
||||
if (list_item->child)
|
||||
gtk_list_item_widget_remove_child (self, list_item->child);
|
||||
|
||||
gtk_list_item_widget_set_activatable (self, FALSE);
|
||||
|
||||
gtk_list_item_do_notify (list_item,
|
||||
priv->item != NULL,
|
||||
priv->position != GTK_INVALID_LIST_POSITION,
|
||||
priv->selected);
|
||||
|
||||
gtk_list_item_set_child (list_item, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_item_widget_teardown_factory (GtkListItemWidget *self)
|
||||
{
|
||||
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
|
||||
|
||||
gtk_list_item_factory_teardown (priv->factory,
|
||||
G_OBJECT (priv->list_item),
|
||||
priv->item != NULL,
|
||||
gtk_list_item_widget_teardown_func,
|
||||
self);
|
||||
|
||||
g_assert (priv->list_item == NULL);
|
||||
return parent_class->grab_focus (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -225,10 +149,10 @@ gtk_list_item_widget_root (GtkWidget *widget)
|
||||
GtkListItemWidget *self = GTK_LIST_ITEM_WIDGET (widget);
|
||||
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_list_item_widget_parent_class)->root (widget);
|
||||
parent_class->root (widget);
|
||||
|
||||
if (priv->factory)
|
||||
gtk_list_item_widget_setup_factory (self);
|
||||
gtk_list_item_factory_setup (priv->factory, self);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -237,10 +161,10 @@ gtk_list_item_widget_unroot (GtkWidget *widget)
|
||||
GtkListItemWidget *self = GTK_LIST_ITEM_WIDGET (widget);
|
||||
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_list_item_widget_parent_class)->unroot (widget);
|
||||
parent_class->unroot (widget);
|
||||
|
||||
if (priv->list_item)
|
||||
gtk_list_item_widget_teardown_factory (self);
|
||||
gtk_list_item_factory_teardown (priv->factory, self);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -278,7 +202,7 @@ gtk_list_item_widget_dispose (GObject *object)
|
||||
g_clear_object (&priv->item);
|
||||
g_clear_object (&priv->factory);
|
||||
|
||||
G_OBJECT_CLASS (gtk_list_item_widget_parent_class)->dispose (object);
|
||||
ancestor_class(GObject)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -553,45 +477,6 @@ gtk_list_item_widget_new (GtkListItemFactory *factory,
|
||||
NULL);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GtkListItemWidget *widget;
|
||||
guint position;
|
||||
gpointer item;
|
||||
gboolean selected;
|
||||
} GtkListItemWidgetUpdate;
|
||||
|
||||
static void
|
||||
gtk_list_item_widget_update_func (gpointer object,
|
||||
gpointer data)
|
||||
{
|
||||
GtkListItemWidgetUpdate *update = data;
|
||||
GtkListItem *list_item = object;
|
||||
/* Track notify manually instead of freeze/thaw_notify for performance reasons. */
|
||||
gboolean notify_item = FALSE, notify_position = FALSE, notify_selected = FALSE;
|
||||
GtkListItemWidget *self = update->widget;
|
||||
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
|
||||
|
||||
/* FIXME: It's kinda evil to notify external objects from here... */
|
||||
|
||||
if (g_set_object (&priv->item, update->item))
|
||||
notify_item = TRUE;
|
||||
|
||||
if (priv->position != update->position)
|
||||
{
|
||||
priv->position = update->position;
|
||||
notify_position = TRUE;
|
||||
}
|
||||
|
||||
if (priv->selected != update->selected)
|
||||
{
|
||||
priv->selected = update->selected;
|
||||
notify_selected = TRUE;
|
||||
}
|
||||
|
||||
if (list_item)
|
||||
gtk_list_item_do_notify (list_item, notify_item, notify_position, notify_selected);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_list_item_widget_update (GtkListItemWidget *self,
|
||||
guint position,
|
||||
@@ -599,24 +484,14 @@ gtk_list_item_widget_update (GtkListItemWidget *self,
|
||||
gboolean selected)
|
||||
{
|
||||
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
|
||||
GtkListItemWidgetUpdate update = { self, position, item, selected };
|
||||
gboolean was_selected;
|
||||
|
||||
was_selected = priv->selected;
|
||||
|
||||
if (priv->list_item)
|
||||
{
|
||||
gtk_list_item_factory_update (priv->factory,
|
||||
G_OBJECT (priv->list_item),
|
||||
priv->item != NULL,
|
||||
item != NULL,
|
||||
gtk_list_item_widget_update_func,
|
||||
&update);
|
||||
}
|
||||
gtk_list_item_factory_update (priv->factory, self, position, item, selected);
|
||||
else
|
||||
{
|
||||
gtk_list_item_widget_update_func (NULL, &update);
|
||||
}
|
||||
gtk_list_item_widget_default_update (self, NULL, position, item, selected);
|
||||
|
||||
/* don't look at selected variable, it's not reentrancy safe */
|
||||
if (was_selected != priv->selected)
|
||||
@@ -632,6 +507,80 @@ gtk_list_item_widget_update (GtkListItemWidget *self,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_list_item_widget_default_setup (GtkListItemWidget *self,
|
||||
GtkListItem *list_item)
|
||||
{
|
||||
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
|
||||
|
||||
priv->list_item = list_item;
|
||||
list_item->owner = self;
|
||||
|
||||
if (list_item->child)
|
||||
gtk_list_item_widget_add_child (self, list_item->child);
|
||||
|
||||
gtk_list_item_widget_set_activatable (self, list_item->activatable);
|
||||
|
||||
gtk_list_item_do_notify (list_item,
|
||||
priv->item != NULL,
|
||||
priv->position != GTK_INVALID_LIST_POSITION,
|
||||
priv->selected);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_list_item_widget_default_teardown (GtkListItemWidget *self,
|
||||
GtkListItem *list_item)
|
||||
{
|
||||
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
|
||||
|
||||
g_assert (priv->list_item == list_item);
|
||||
|
||||
priv->list_item = NULL;
|
||||
list_item->owner = NULL;
|
||||
|
||||
if (list_item->child)
|
||||
gtk_list_item_widget_remove_child (self, list_item->child);
|
||||
|
||||
gtk_list_item_widget_set_activatable (self, FALSE);
|
||||
|
||||
gtk_list_item_do_notify (list_item,
|
||||
priv->item != NULL,
|
||||
priv->position != GTK_INVALID_LIST_POSITION,
|
||||
priv->selected);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_list_item_widget_default_update (GtkListItemWidget *self,
|
||||
GtkListItem *list_item,
|
||||
guint position,
|
||||
gpointer item,
|
||||
gboolean selected)
|
||||
{
|
||||
/* Track notify manually instead of freeze/thaw_notify for performance reasons. */
|
||||
gboolean notify_item = FALSE, notify_position = FALSE, notify_selected = FALSE;
|
||||
GtkListItemWidgetPrivate *priv = gtk_list_item_widget_get_instance_private (self);
|
||||
|
||||
/* FIXME: It's kinda evil to notify external objects from here... */
|
||||
|
||||
if (g_set_object (&priv->item, item))
|
||||
notify_item = TRUE;
|
||||
|
||||
if (priv->position != position)
|
||||
{
|
||||
priv->position = position;
|
||||
notify_position = TRUE;
|
||||
}
|
||||
|
||||
if (priv->selected != selected)
|
||||
{
|
||||
priv->selected = selected;
|
||||
notify_selected = TRUE;
|
||||
}
|
||||
|
||||
if (list_item)
|
||||
gtk_list_item_do_notify (list_item, notify_item, notify_position, notify_selected);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_list_item_widget_set_factory (GtkListItemWidget *self,
|
||||
GtkListItemFactory *factory)
|
||||
@@ -644,7 +593,7 @@ gtk_list_item_widget_set_factory (GtkListItemWidget *self,
|
||||
if (priv->factory)
|
||||
{
|
||||
if (priv->list_item)
|
||||
gtk_list_item_widget_teardown_factory (self);
|
||||
gtk_list_item_factory_teardown (factory, self);
|
||||
g_clear_object (&priv->factory);
|
||||
}
|
||||
|
||||
@@ -653,7 +602,7 @@ gtk_list_item_widget_set_factory (GtkListItemWidget *self,
|
||||
priv->factory = g_object_ref (factory);
|
||||
|
||||
if (gtk_widget_get_root (GTK_WIDGET (self)))
|
||||
gtk_list_item_widget_setup_factory (self);
|
||||
gtk_list_item_factory_setup (factory, self);
|
||||
}
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FACTORY]);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user