Compare commits

..

1 Commits

Author SHA1 Message Date
Matthias Clasen 593289e40b gtk-demo: Speed up characters scrolling
Use a simple label widget that does not queue a
resize when the text is changed.
2022-05-07 11:43:50 -04:00
489 changed files with 1021903 additions and 13234 deletions
+2 -3
View File
@@ -25,7 +25,7 @@ variables:
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v38"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v36"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
.only-default:
@@ -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
-3
View File
@@ -14,9 +14,6 @@ Each Docker image has a tag composed of two parts:
See the [container registry][registry] for the available images for each
branch, as well as their available versions.
Note that using `latest` as version number will overwrite the most
recently uploaded image in the registry.
### Checklist for Updating a CI image
- [ ] Update the `${image}.Dockerfile` file with the dependencies
+2 -1
View File
@@ -1,4 +1,4 @@
FROM fedora:36
FROM fedora:34
RUN dnf -y install \
adwaita-icon-theme \
@@ -87,6 +87,7 @@ RUN dnf -y install \
python3-wheel \
redhat-rpm-config \
sassc \
systemtap-sdt-devel \
vulkan-devel \
wayland-devel \
wayland-protocols-devel \
-4
View File
@@ -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)),
}
+1 -1
View File
@@ -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
-150
View File
@@ -1,153 +1,3 @@
Overview of Changes in 4.7.0, 07-05-2022
========================================
* GtkTextView:
- Reduce overdraws
* GtkViewport:
- Default scroll-to-focus to TRUE
* GtkText:
- Stop blinking when we lose focus
* GtkSearchEntry:
- Make search delay configurable
* GtkPopoverMenu:
- Fix RTL positioning of buttons
* GtkLabel:
- Fix focus keynav with links
* GtkFileChooser:
- Prevent undesirable completion popups
- Fix a corner case in save mode
- Keep the portal filechooser alive long enough
* GtkCheckButton:
- Allow setting a custom child
* GtkEditableLabel:
- Make the :editing property writable
* GtkColumnView:
- Various optimizations to improve scrolling performance
* GtkTreeStore:
- Allow populating tree stores from ui files
* GtkBoxLayout:
- Avoid infinite loops
* CSS:
- Optimize reordering within the same parent
* Emoji:
- Update to CLDR v40 / Unicode 14
- Add more locales
* Input:
- Add scroll unit handling
- Handle display changes in GtkIMMultiContext
- Always populate GDK_AXIS_X/Y in event history
- Don't crash for large compose tables
* Accessibility:
- Fix a crash at start when orca is running
* Theme:
- Refresh icons
- Fix selection in vertical spin buttons
- Fix selection in editable labels
* gdk:
- Optimize pixel format conversions
- Use EGL_KHR_swap_buffers_with_damage for NVidia
* gsk:
- Handle large viewports
- Prepare texture libraries for glyphy rendering
- Don't leak big glyphs in the glyph cache
- Align offscreen rendering with th pixel grid
- Check for half-float support before using it
* Wayland:
- Use xdg-activation protocol
- Fix text caret coordinates
- Fix on-screen keyboard activation
* MacOS:
- Fix sluggish and reversed scrolling
- Improve monitor detection
- Event handling fixes
- Fix keyboard input on popovers
- Support OpenGL-based video playback
- Suport fullscreen
- Improve native filechoooser size allocation
- Use CALayer and IOSurface for rendering
- Use a per-monitor CVDisplayLink
- Fix kinetic scrolling
- Improve window placement
- Improve multi-monitor handling
- Start applications in the foreground
- Fix cursor blink time
* Windows:
- Fix preedit window placement on HiDPI
* Tools:
- gtk4-builder-tool: Don't require a display for all commands
- gtk4-builder-tool: Add a screenshot command
- gtk4-node-editor: Install this utility
* Debugging:
- inspector: Show more application data
- inspector: Allow viewing PangoAttrList properties
* Documentation:
- Use the gtk-builder-tool to generate screenshots
* Build:
- Fix cross-compilation
- Fix build on aarch64
- Fix build with gcc 12
* Translation updates
Basque
Brazilian Portuguese
British English
Catalan
Chinese (China)
Chinese (Taiwan)
Croatian
Czech
Danish
Finnish
Galician
Georgian
German
Hebrew
Hungarian
Indonesian
Italian
Kazakh
Korean
Latvian
Lithuanian
Norwegian Bokmål
Persian
Polish
Portuguese
Russian
Serbian
Slovak
Slovenian
Spanish
Swedish
Turkish
Ukrainian
Overview of Changes in 4.6.1, 11-02-2022
========================================
+1 -2
View File
@@ -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);
+5 -3
View File
@@ -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);
+17 -14
View File
@@ -9,6 +9,7 @@
#include <gtk/gtk.h>
#include "script-names.h"
#include "unicode-names.h"
#include "simplelabel.h"
#define UCD_TYPE_ITEM (ucd_item_get_type ())
@@ -102,7 +103,9 @@ setup_centered_label (GtkSignalListItemFactory *factory,
GObject *listitem)
{
GtkWidget *label;
label = gtk_label_new ("");
label = simple_label_new ();
simple_label_set_min_chars (SIMPLE_LABEL (label), 3);
simple_label_set_nat_chars (SIMPLE_LABEL (label), 20);
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
}
@@ -111,8 +114,9 @@ setup_label (GtkSignalListItemFactory *factory,
GObject *listitem)
{
GtkWidget *label;
label = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (label), 0);
label = simple_label_new ();
simple_label_set_min_chars (SIMPLE_LABEL (label), 3);
simple_label_set_nat_chars (SIMPLE_LABEL (label), 20);
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
}
@@ -121,10 +125,9 @@ setup_ellipsizing_label (GtkSignalListItemFactory *factory,
GObject *listitem)
{
GtkWidget *label;
label = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
gtk_label_set_width_chars (GTK_LABEL (label), 20);
label = simple_label_new ();
simple_label_set_min_chars (SIMPLE_LABEL (label), 3);
simple_label_set_nat_chars (SIMPLE_LABEL (label), 20);
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
}
@@ -142,7 +145,7 @@ bind_codepoint (GtkSignalListItemFactory *factory,
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
g_snprintf (buffer, 10, "%#06x", codepoint);
gtk_label_set_label (GTK_LABEL (label), buffer);
simple_label_set_text (SIMPLE_LABEL (label), buffer);
}
static void
@@ -161,7 +164,7 @@ bind_char (GtkSignalListItemFactory *factory,
if (g_unichar_isprint (codepoint))
g_unichar_to_utf8 (codepoint, buffer);
gtk_label_set_label (GTK_LABEL (label), buffer);
simple_label_set_text (SIMPLE_LABEL (label), buffer);
}
static void
@@ -176,7 +179,7 @@ bind_name (GtkSignalListItemFactory *factory,
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
name = ucd_item_get_name (UCD_ITEM (item));
gtk_label_set_label (GTK_LABEL (label), name);
simple_label_set_text (SIMPLE_LABEL (label), name);
}
static void
@@ -191,7 +194,7 @@ bind_type (GtkSignalListItemFactory *factory,
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
gtk_label_set_label (GTK_LABEL (label), get_unicode_type_name (g_unichar_type (codepoint)));
simple_label_set_text (SIMPLE_LABEL (label), get_unicode_type_name (g_unichar_type (codepoint)));
}
static void
@@ -206,7 +209,7 @@ bind_break_type (GtkSignalListItemFactory *factory,
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
gtk_label_set_label (GTK_LABEL (label), get_break_type_name (g_unichar_break_type (codepoint)));
simple_label_set_text (SIMPLE_LABEL (label), get_break_type_name (g_unichar_break_type (codepoint)));
}
static void
@@ -221,7 +224,7 @@ bind_combining_class (GtkSignalListItemFactory *factory,
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
gtk_label_set_label (GTK_LABEL (label), get_combining_class_name (g_unichar_combining_class (codepoint)));
simple_label_set_text (SIMPLE_LABEL (label), get_combining_class_name (g_unichar_combining_class (codepoint)));
}
static void
@@ -238,7 +241,7 @@ bind_script (GtkSignalListItemFactory *factory,
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
script = g_unichar_get_script (codepoint);
gtk_label_set_label (GTK_LABEL (label), get_script_name (script));
simple_label_set_text (SIMPLE_LABEL (label), get_script_name (script));
}
static void
+1
View File
@@ -130,6 +130,7 @@ extra_demo_sources = files([
'unicode-names.c',
'suggestionentry.c',
'language-names.c',
'simplelabel.c',
])
if os_unix
+260
View File
@@ -0,0 +1,260 @@
#include "simplelabel.h"
struct _SimpleLabel
{
GtkWidget parent_instance;
PangoLayout *layout;
int min_chars;
int nat_chars;
int min_width;
int nat_width;
int height;
};
struct _SimpleLabelClass
{
GtkWidgetClass parent_class;
};
enum {
PROP_TEXT = 1,
PROP_MIN_CHARS,
PROP_NAT_CHARS,
NUM_PROPERTIES
};
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
G_DEFINE_TYPE (SimpleLabel, simple_label, GTK_TYPE_WIDGET)
static void
simple_label_init (SimpleLabel *self)
{
self->layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), "");
pango_layout_set_ellipsize (self->layout, PANGO_ELLIPSIZE_NONE);
pango_layout_set_wrap (self->layout, PANGO_WRAP_WORD);
pango_layout_set_width (self->layout, -1);
}
static void
simple_label_dispose (GObject *object)
{
SimpleLabel *self = SIMPLE_LABEL (object);
g_clear_object (&self->layout);
G_OBJECT_CLASS (simple_label_parent_class)->dispose (object);
}
static void
simple_label_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
SimpleLabel *self = SIMPLE_LABEL (object);
switch (prop_id)
{
case PROP_TEXT:
simple_label_set_text (self, g_value_get_string (value));
break;
case PROP_MIN_CHARS:
simple_label_set_min_chars (self, g_value_get_int (value));
break;
case PROP_NAT_CHARS:
simple_label_set_nat_chars (self, g_value_get_int (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
simple_label_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
SimpleLabel *self = SIMPLE_LABEL (object);
switch (prop_id)
{
case PROP_TEXT:
g_value_set_string (value, pango_layout_get_text (self->layout));
break;
case PROP_MIN_CHARS:
g_value_set_int (value, self->min_chars);
break;
case PROP_NAT_CHARS:
g_value_set_int (value, self->nat_chars);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
simple_label_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
SimpleLabel *self = SIMPLE_LABEL (widget);
if (orientation == GTK_ORIENTATION_VERTICAL)
{
*minimum = *natural = self->height;
}
else
{
*minimum = self->min_width;
*natural = self->nat_width;
}
}
static void
simple_label_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
SimpleLabel *self = SIMPLE_LABEL (widget);
pango_layout_set_width (self->layout, width * PANGO_SCALE);
}
static void
simple_label_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
SimpleLabel *self = SIMPLE_LABEL (widget);
GtkStyleContext *context;
context = gtk_widget_get_style_context (widget);
gtk_snapshot_render_layout (snapshot, context, 0, 0, self->layout);
}
static void
simple_label_class_init (SimpleLabelClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = simple_label_dispose;
object_class->set_property = simple_label_set_property;
object_class->get_property = simple_label_get_property;
widget_class->measure = simple_label_measure;
widget_class->size_allocate = simple_label_size_allocate;
widget_class->snapshot = simple_label_snapshot;
properties[PROP_TEXT] =
g_param_spec_string ("text", "Text", "Text",
NULL,
G_PARAM_READWRITE);
properties[PROP_MIN_CHARS] =
g_param_spec_int ("min-chars", "Minimum Characters", "Minimum Characters",
0, G_MAXINT, 0,
G_PARAM_READWRITE);
properties[PROP_NAT_CHARS] =
g_param_spec_int ("nat-chars", "Natural Characters", "Natural Characters",
0, G_MAXINT, 0,
G_PARAM_READWRITE);
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
}
GtkWidget *
simple_label_new (void)
{
return g_object_new (SIMPLE_TYPE_LABEL, NULL);
}
void
simple_label_set_text (SimpleLabel *self,
const char *text)
{
if (strcmp (text, pango_layout_get_text (self->layout)) == 0)
return;
pango_layout_set_text (self->layout, text, -1);
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TEXT]);
}
static void
recalculate (SimpleLabel *self)
{
PangoContext *context;
PangoFontMetrics *metrics;
int char_width;
int digit_width;
int width;
int ascent;
int descent;
context = gtk_widget_get_pango_context (GTK_WIDGET (self));
metrics = pango_context_get_metrics (context,
pango_context_get_font_description (context),
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
ascent = pango_font_metrics_get_ascent (metrics);
descent = pango_font_metrics_get_descent (metrics);
pango_font_metrics_unref (metrics);
width = MAX (char_width, digit_width);
self->min_width = (width * self->min_chars) / PANGO_SCALE;
self->nat_width = (width * self->nat_chars) / PANGO_SCALE;
self->height = (ascent + descent) / PANGO_SCALE;
}
void
simple_label_set_min_chars (SimpleLabel *self,
int min_chars)
{
if (self->min_chars == min_chars)
return;
self->min_chars = min_chars;
recalculate (self);
gtk_widget_queue_resize (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MIN_CHARS]);
}
void
simple_label_set_nat_chars (SimpleLabel *self,
int nat_chars)
{
if (self->nat_chars == nat_chars)
return;
self->nat_chars = nat_chars;
recalculate (self);
gtk_widget_queue_resize (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_NAT_CHARS]);
}
+15
View File
@@ -0,0 +1,15 @@
#pragma once
#include <gtk/gtk.h>
#define SIMPLE_TYPE_LABEL (simple_label_get_type ())
G_DECLARE_FINAL_TYPE (SimpleLabel, simple_label, SIMPLE, LABEL, GtkWidget)
GtkWidget * simple_label_new (void);
void simple_label_set_text (SimpleLabel *self,
const char *text);
void simple_label_set_min_chars (SimpleLabel *self,
int min_chars);
void simple_label_set_nat_chars (SimpleLabel *self,
int nat_chars);
-23
View File
@@ -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,
@@ -983,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);
@@ -1090,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 */
-17
View File
@@ -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>
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
-1
View File
@@ -354,7 +354,6 @@ typedef struct {
typedef union {
BroadwayReplyBase base;
BroadwayReplySync sync;
BroadwayReplyEvent event;
BroadwayReplyQueryMouse query_mouse;
BroadwayReplyNewSurface new_surface;
+18 -14
View File
@@ -219,7 +219,11 @@ static void
client_handle_request (BroadwayClient *client,
BroadwayRequest *request)
{
BroadwayReply reply;
BroadwayReplyNewSurface reply_new_surface;
BroadwayReplySync reply_sync;
BroadwayReplyQueryMouse reply_query_mouse;
BroadwayReplyGrabPointer reply_grab_pointer;
BroadwayReplyUngrabPointer reply_ungrab_pointer;
guint32 before_serial, now_serial;
guint32 global_id;
int fd;
@@ -229,7 +233,7 @@ client_handle_request (BroadwayClient *client,
switch (request->base.type)
{
case BROADWAY_REQUEST_NEW_SURFACE:
reply.new_surface.id =
reply_new_surface.id =
broadway_server_new_surface (server, client->id,
request->new_surface.x,
request->new_surface.y,
@@ -237,9 +241,9 @@ client_handle_request (BroadwayClient *client,
request->new_surface.height);
client->surfaces =
g_list_prepend (client->surfaces,
GUINT_TO_POINTER (reply.new_surface.id));
GUINT_TO_POINTER (reply_new_surface.id));
send_reply (client, request, &reply, sizeof (reply.new_surface),
send_reply (client, request, (BroadwayReply *)&reply_new_surface, sizeof (reply_new_surface),
BROADWAY_REPLY_NEW_SURFACE);
break;
case BROADWAY_REQUEST_FLUSH:
@@ -247,7 +251,7 @@ client_handle_request (BroadwayClient *client,
break;
case BROADWAY_REQUEST_SYNC:
broadway_server_flush (server);
send_reply (client, request, &reply, sizeof (reply.sync),
send_reply (client, request, (BroadwayReply *)&reply_sync, sizeof (reply_sync),
BROADWAY_REPLY_SYNC);
break;
case BROADWAY_REQUEST_ROUNDTRIP:
@@ -257,11 +261,11 @@ client_handle_request (BroadwayClient *client,
break;
case BROADWAY_REQUEST_QUERY_MOUSE:
broadway_server_query_mouse (server,
&reply.query_mouse.surface,
&reply.query_mouse.root_x,
&reply.query_mouse.root_y,
&reply.query_mouse.mask);
send_reply (client, request, &reply, sizeof (reply.query_mouse),
&reply_query_mouse.surface,
&reply_query_mouse.root_x,
&reply_query_mouse.root_y,
&reply_query_mouse.mask);
send_reply (client, request, (BroadwayReply *)&reply_query_mouse, sizeof (reply_query_mouse),
BROADWAY_REPLY_QUERY_MOUSE);
break;
case BROADWAY_REQUEST_DESTROY_SURFACE:
@@ -357,21 +361,21 @@ client_handle_request (BroadwayClient *client,
request->move_resize.height);
break;
case BROADWAY_REQUEST_GRAB_POINTER:
reply.grab_pointer.status =
reply_grab_pointer.status =
broadway_server_grab_pointer (server,
client->id,
request->grab_pointer.id,
request->grab_pointer.owner_events,
request->grab_pointer.event_mask,
request->grab_pointer.time_);
send_reply (client, request, &reply, sizeof (reply.grab_pointer),
send_reply (client, request, (BroadwayReply *)&reply_grab_pointer, sizeof (reply_grab_pointer),
BROADWAY_REPLY_GRAB_POINTER);
break;
case BROADWAY_REQUEST_UNGRAB_POINTER:
reply.ungrab_pointer.status =
reply_ungrab_pointer.status =
broadway_server_ungrab_pointer (server,
request->ungrab_pointer.time_);
send_reply (client, request, &reply, sizeof (reply.ungrab_pointer),
send_reply (client, request, (BroadwayReply *)&reply_ungrab_pointer, sizeof (reply_ungrab_pointer),
BROADWAY_REPLY_UNGRAB_POINTER);
break;
case BROADWAY_REQUEST_FOCUS_SURFACE:
+2 -1
View File
@@ -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);
+1 -1
View File
@@ -125,7 +125,7 @@ gdk_app_launch_context_class_init (GdkAppLaunchContextClass *klass)
* The display that the `GdkAppLaunchContext` is on.
*/
g_object_class_install_property (gobject_class, PROP_DISPLAY,
g_param_spec_object ("display", NULL, NULL,
g_param_spec_object ("display", P_("Display"), P_("Display"),
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
}
+12 -4
View File
@@ -357,7 +357,9 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
* The `GdkDisplay` that the clipboard belongs to.
*/
properties[PROP_DISPLAY] =
g_param_spec_object ("display", NULL, NULL,
g_param_spec_object ("display",
"Display",
"Display owning this clipboard",
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -370,7 +372,9 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
* The possible formats that the clipboard can provide its data in.
*/
properties[PROP_FORMATS] =
g_param_spec_boxed ("formats", NULL, NULL,
g_param_spec_boxed ("formats",
"Formats",
"The possible formats for data",
GDK_TYPE_CONTENT_FORMATS,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
@@ -382,7 +386,9 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
* %TRUE if the contents of the clipboard are owned by this process.
*/
properties[PROP_LOCAL] =
g_param_spec_boolean ("local", NULL, NULL,
g_param_spec_boolean ("local",
"Local",
"If the contents are owned by this process",
TRUE,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
@@ -395,7 +401,9 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
* provided otherwise.
*/
properties[PROP_CONTENT] =
g_param_spec_object ("content", NULL, NULL,
g_param_spec_object ("content",
"Content",
"Provider of the clipboard's content",
GDK_TYPE_CONTENT_PROVIDER,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
+6 -2
View File
@@ -173,7 +173,9 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
* The possible formats that the provider can provide its data in.
*/
properties[PROP_FORMATS] =
g_param_spec_boxed ("formats", NULL, NULL,
g_param_spec_boxed ("formats",
"Formats",
"The possible formats for data",
GDK_TYPE_CONTENT_FORMATS,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
@@ -185,7 +187,9 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
* The subset of formats that clipboard managers should store this provider's data in.
*/
properties[PROP_STORABLE_FORMATS] =
g_param_spec_boxed ("storable-formats", NULL, NULL,
g_param_spec_boxed ("storable-formats",
"Storable formats",
"The formats that data should be stored in",
GDK_TYPE_CONTENT_FORMATS,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
+15 -5
View File
@@ -174,7 +174,9 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
*/
g_object_class_install_property (object_class,
PROP_FALLBACK,
g_param_spec_object ("fallback", NULL, NULL,
g_param_spec_object ("fallback",
P_("Fallback"),
P_("Cursor image to fall back to if this cursor cannot be displayed"),
GDK_TYPE_CURSOR,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -186,7 +188,9 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
*/
g_object_class_install_property (object_class,
PROP_HOTSPOT_X,
g_param_spec_int ("hotspot-x", NULL, NULL,
g_param_spec_int ("hotspot-x",
P_("Hotspot X"),
P_("Horizontal offset of the cursor hotspot"),
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -198,7 +202,9 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
*/
g_object_class_install_property (object_class,
PROP_HOTSPOT_Y,
g_param_spec_int ("hotspot-y", NULL, NULL,
g_param_spec_int ("hotspot-y",
P_("Hotspot Y"),
P_("Vertical offset of the cursor hotspot"),
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -212,7 +218,9 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
*/
g_object_class_install_property (object_class,
PROP_NAME,
g_param_spec_string ("name", NULL, NULL,
g_param_spec_string ("name",
P_("Name"),
P_("Name of this cursor"),
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -226,7 +234,9 @@ gdk_cursor_class_init (GdkCursorClass *cursor_class)
*/
g_object_class_install_property (object_class,
PROP_TEXTURE,
g_param_spec_object ("texture", NULL, NULL,
g_param_spec_object ("texture",
P_("Texture"),
P_("The texture displayed by this cursor"),
GDK_TYPE_TEXTURE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+48 -16
View File
@@ -109,7 +109,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* The `GdkDisplay` the `GdkDevice` pertains to.
*/
device_props[PROP_DISPLAY] =
g_param_spec_object ("display", NULL, NULL,
g_param_spec_object ("display",
P_("Device Display"),
P_("Display which the device belongs to"),
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
@@ -119,7 +121,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* The device name.
*/
device_props[PROP_NAME] =
g_param_spec_string ("name", NULL, NULL,
g_param_spec_string ("name",
P_("Device name"),
P_("Device name"),
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
@@ -130,7 +134,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* Source type for the device.
*/
device_props[PROP_SOURCE] =
g_param_spec_enum ("source", NULL, NULL,
g_param_spec_enum ("source",
P_("Input source"),
P_("Source type for the device"),
GDK_TYPE_INPUT_SOURCE,
GDK_SOURCE_MOUSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
@@ -142,7 +148,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* Whether the device is represented by a cursor on the screen.
*/
device_props[PROP_HAS_CURSOR] =
g_param_spec_boolean ("has-cursor", NULL, NULL,
g_param_spec_boolean ("has-cursor",
P_("Whether the device has a cursor"),
P_("Whether there is a visible cursor following device motion"),
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
@@ -153,7 +161,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* Number of axes in the device.
*/
device_props[PROP_N_AXES] =
g_param_spec_uint ("n-axes", NULL, NULL,
g_param_spec_uint ("n-axes",
P_("Number of axes in the device"),
P_("Number of axes in the device"),
0, G_MAXUINT,
0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -166,7 +176,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* See [method@Gdk.Device.get_vendor_id].
*/
device_props[PROP_VENDOR_ID] =
g_param_spec_string ("vendor-id", NULL, NULL,
g_param_spec_string ("vendor-id",
P_("Vendor ID"),
P_("Vendor ID"),
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
@@ -179,7 +191,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* See [method@Gdk.Device.get_product_id].
*/
device_props[PROP_PRODUCT_ID] =
g_param_spec_string ("product-id", NULL, NULL,
g_param_spec_string ("product-id",
P_("Product ID"),
P_("Product ID"),
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
@@ -190,7 +204,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* `GdkSeat` of this device.
*/
device_props[PROP_SEAT] =
g_param_spec_object ("seat", NULL, NULL,
g_param_spec_object ("seat",
P_("Seat"),
P_("Seat"),
GDK_TYPE_SEAT,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
@@ -204,7 +220,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* of touches is unknown.
*/
device_props[PROP_NUM_TOUCHES] =
g_param_spec_uint ("num-touches", NULL, NULL,
g_param_spec_uint ("num-touches",
P_("Number of concurrent touches"),
P_("Number of concurrent touches"),
0, G_MAXUINT,
0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
@@ -216,7 +234,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* The `GdkDeviceTool` that is currently used with this device.
*/
device_props[PROP_TOOL] =
g_param_spec_object ("tool", NULL, NULL,
g_param_spec_object ("tool",
P_("Tool"),
P_("The tool that is currently used with this device"),
GDK_TYPE_DEVICE_TOOL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -228,7 +248,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* This is only relevant for keyboard devices.
*/
device_props[PROP_DIRECTION] =
g_param_spec_enum ("direction", NULL, NULL,
g_param_spec_enum ("direction",
P_("Direction"),
P_("The direction of the current layout of the keyboard"),
PANGO_TYPE_DIRECTION, PANGO_DIRECTION_NEUTRAL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -240,7 +262,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* This is only relevant for keyboard devices.
*/
device_props[PROP_HAS_BIDI_LAYOUTS] =
g_param_spec_boolean ("has-bidi-layouts", NULL, NULL,
g_param_spec_boolean ("has-bidi-layouts",
P_("Has bidi layouts"),
P_("Whether the keyboard has bidi layouts"),
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -252,7 +276,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* This is only relevant for keyboard devices.
*/
device_props[PROP_CAPS_LOCK_STATE] =
g_param_spec_boolean ("caps-lock-state", NULL, NULL,
g_param_spec_boolean ("caps-lock-state",
P_("Caps lock state"),
P_("Whether the keyboard caps lock is on"),
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -264,7 +290,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* This is only relevant for keyboard devices.
*/
device_props[PROP_NUM_LOCK_STATE] =
g_param_spec_boolean ("num-lock-state", NULL, NULL,
g_param_spec_boolean ("num-lock-state",
P_("Num lock state"),
P_("Whether the keyboard num lock is on"),
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -276,7 +304,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* This is only relevant for keyboard devices.
*/
device_props[PROP_SCROLL_LOCK_STATE] =
g_param_spec_boolean ("scroll-lock-state", NULL, NULL,
g_param_spec_boolean ("scroll-lock-state",
P_("Scroll lock state"),
P_("Whether the keyboard scroll lock is on"),
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -288,7 +318,9 @@ gdk_device_class_init (GdkDeviceClass *klass)
* This is only relevant for keyboard devices.
*/
device_props[PROP_MODIFIER_STATE] =
g_param_spec_flags ("modifier-state", NULL, NULL,
g_param_spec_flags ("modifier-state",
P_("Modifier state"),
P_("The modifier state of the keyboard"),
GDK_TYPE_MODIFIER_TYPE, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+2 -7
View File
@@ -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
{
+12 -4
View File
@@ -111,7 +111,9 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
*
* The serial number of the tool.
*/
tool_props[TOOL_PROP_SERIAL] = g_param_spec_uint64 ("serial", NULL, NULL,
tool_props[TOOL_PROP_SERIAL] = g_param_spec_uint64 ("serial",
"Serial",
"Serial number",
0, G_MAXUINT64, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -122,7 +124,9 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
*
* The type of the tool.
*/
tool_props[TOOL_PROP_TOOL_TYPE] = g_param_spec_enum ("tool-type", NULL, NULL,
tool_props[TOOL_PROP_TOOL_TYPE] = g_param_spec_enum ("tool-type",
"Tool type",
"Tool type",
GDK_TYPE_DEVICE_TOOL_TYPE,
GDK_DEVICE_TOOL_TYPE_UNKNOWN,
G_PARAM_READWRITE |
@@ -134,7 +138,9 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
*
* The axes of the tool.
*/
tool_props[TOOL_PROP_AXES] = g_param_spec_flags ("axes", NULL, NULL,
tool_props[TOOL_PROP_AXES] = g_param_spec_flags ("axes",
"Axes",
"Tool axes",
GDK_TYPE_AXIS_FLAGS, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
@@ -144,7 +150,9 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
*
* The hardware ID of the tool.
*/
tool_props[TOOL_PROP_HARDWARE_ID] = g_param_spec_uint64 ("hardware-id", NULL, NULL,
tool_props[TOOL_PROP_HARDWARE_ID] = g_param_spec_uint64 ("hardware-id",
"Hardware ID",
"Hardware ID",
0, G_MAXUINT64, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+12 -6
View File
@@ -213,7 +213,9 @@ gdk_display_class_init (GdkDisplayClass *class)
* %TRUE if the display properly composites the alpha channel.
*/
props[PROP_COMPOSITED] =
g_param_spec_boolean ("composited", NULL, NULL,
g_param_spec_boolean ("composited",
P_("Composited"),
P_("Composited"),
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -223,7 +225,9 @@ gdk_display_class_init (GdkDisplayClass *class)
* %TRUE if the display supports an alpha channel.
*/
props[PROP_RGBA] =
g_param_spec_boolean ("rgba", NULL, NULL,
g_param_spec_boolean ("rgba",
P_("RGBA"),
P_("RGBA"),
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -233,7 +237,9 @@ gdk_display_class_init (GdkDisplayClass *class)
* %TRUE if the display supports input shapes.
*/
props[PROP_INPUT_SHAPES] =
g_param_spec_boolean ("input-shapes", NULL, NULL,
g_param_spec_boolean ("input-shapes",
P_("Input shapes"),
P_("Input shapes"),
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -1622,10 +1628,10 @@ gdk_display_check_egl_extensions (EGLDisplay egl_display,
/* translators: Arguments are the number of missing extensions
* followed by a comma-separated list of their names */
g_dngettext (GETTEXT_PACKAGE,
"EGL implementation is missing extension %s",
"EGL implementation is missing %2$d extensions: %1$s",
"EGL implementation is missing extension %2$s",
"EGL implementation is missing %d extensions: %s",
n_missing),
missing->str, (int) n_missing);
(int) n_missing, missing->str);
g_string_free (missing, TRUE);
return FALSE;
+3 -1
View File
@@ -155,7 +155,9 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
*/
g_object_class_install_property (object_class,
PROP_DEFAULT_DISPLAY,
g_param_spec_object ("default-display", NULL, NULL,
g_param_spec_object ("default-display",
P_("Default Display"),
P_("The default display for GDK"),
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
}
+21 -7
View File
@@ -379,7 +379,9 @@ gdk_drag_class_init (GdkDragClass *klass)
* The `GdkContentProvider`.
*/
properties[PROP_CONTENT] =
g_param_spec_object ("content", NULL, NULL,
g_param_spec_object ("content",
"Content",
"The content being dragged",
GDK_TYPE_CONTENT_PROVIDER,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -392,7 +394,9 @@ gdk_drag_class_init (GdkDragClass *klass)
* The `GdkDevice` that is performing the drag.
*/
properties[PROP_DEVICE] =
g_param_spec_object ("device", NULL, NULL,
g_param_spec_object ("device",
"Device",
"The device performing the drag",
GDK_TYPE_DEVICE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -405,7 +409,9 @@ gdk_drag_class_init (GdkDragClass *klass)
* The `GdkDisplay` that the drag belongs to.
*/
properties[PROP_DISPLAY] =
g_param_spec_object ("display", NULL, NULL,
g_param_spec_object ("display",
"Display",
"Display this drag belongs to",
GDK_TYPE_DISPLAY,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
@@ -417,7 +423,9 @@ gdk_drag_class_init (GdkDragClass *klass)
* The possible formats that the drag can provide its data in.
*/
properties[PROP_FORMATS] =
g_param_spec_boxed ("formats", NULL, NULL,
g_param_spec_boxed ("formats",
"Formats",
"The possible formats for data",
GDK_TYPE_CONTENT_FORMATS,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -430,7 +438,9 @@ gdk_drag_class_init (GdkDragClass *klass)
* The currently selected action of the drag.
*/
properties[PROP_SELECTED_ACTION] =
g_param_spec_flags ("selected-action", NULL, NULL,
g_param_spec_flags ("selected-action",
"Selected action",
"The currently selected action",
GDK_TYPE_DRAG_ACTION,
0,
G_PARAM_READWRITE |
@@ -443,7 +453,9 @@ gdk_drag_class_init (GdkDragClass *klass)
* The possible actions of this drag.
*/
properties[PROP_ACTIONS] =
g_param_spec_flags ("actions", NULL, NULL,
g_param_spec_flags ("actions",
"Actions",
"The possible actions",
GDK_TYPE_DRAG_ACTION,
0,
G_PARAM_READWRITE |
@@ -456,7 +468,9 @@ gdk_drag_class_init (GdkDragClass *klass)
* The surface where the drag originates.
*/
properties[PROP_SURFACE] =
g_param_spec_object ("surface", NULL, NULL,
g_param_spec_object ("surface",
"Surface",
"The surface where the drag originates",
GDK_TYPE_SURFACE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+6 -2
View File
@@ -168,7 +168,9 @@ gdk_draw_context_class_init (GdkDrawContextClass *klass)
* The `GdkDisplay` used to create the `GdkDrawContext`.
*/
pspecs[PROP_DISPLAY] =
g_param_spec_object ("display", NULL, NULL,
g_param_spec_object ("display",
P_("Display"),
P_("The GDK display used to create the context"),
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -180,7 +182,9 @@ gdk_draw_context_class_init (GdkDrawContextClass *klass)
* The `GdkSurface` the context is bound to.
*/
pspecs[PROP_SURFACE] =
g_param_spec_object ("surface", NULL, NULL,
g_param_spec_object ("surface",
P_("Surface"),
P_("The GDK surface bound to the context"),
GDK_TYPE_SURFACE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+18 -6
View File
@@ -325,7 +325,9 @@ gdk_drop_class_init (GdkDropClass *klass)
* The possible actions for this drop
*/
properties[PROP_ACTIONS] =
g_param_spec_flags ("actions", NULL, NULL,
g_param_spec_flags ("actions",
"Actions",
"The possible actions for this drop",
GDK_TYPE_DRAG_ACTION,
GDK_ACTION_ALL,
G_PARAM_READWRITE |
@@ -339,7 +341,9 @@ gdk_drop_class_init (GdkDropClass *klass)
* The `GdkDevice` performing the drop
*/
properties[PROP_DEVICE] =
g_param_spec_object ("device", NULL, NULL,
g_param_spec_object ("device",
"Device",
"The device performing the drop",
GDK_TYPE_DEVICE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -352,7 +356,9 @@ gdk_drop_class_init (GdkDropClass *klass)
* The `GdkDisplay` that the drop belongs to.
*/
properties[PROP_DISPLAY] =
g_param_spec_object ("display", NULL, NULL,
g_param_spec_object ("display",
"Display",
"Display this drag belongs to",
GDK_TYPE_DISPLAY,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
@@ -364,7 +370,9 @@ gdk_drop_class_init (GdkDropClass *klass)
* The `GdkDrag` that initiated this drop
*/
properties[PROP_DRAG] =
g_param_spec_object ("drag", NULL, NULL,
g_param_spec_object ("drag",
"Drag",
"The drag that initiated this drop",
GDK_TYPE_DRAG,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -377,7 +385,9 @@ gdk_drop_class_init (GdkDropClass *klass)
* The possible formats that the drop can provide its data in.
*/
properties[PROP_FORMATS] =
g_param_spec_boxed ("formats", NULL, NULL,
g_param_spec_boxed ("formats",
"Formats",
"The possible formats for data",
GDK_TYPE_CONTENT_FORMATS,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -390,7 +400,9 @@ gdk_drop_class_init (GdkDropClass *klass)
* The `GdkSurface` the drop happens on
*/
properties[PROP_SURFACE] =
g_param_spec_object ("surface", NULL, NULL,
g_param_spec_object ("surface",
"Surface",
"The surface the drop is happening on",
GDK_TYPE_SURFACE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+11 -1
View File
@@ -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;
+5 -1
View File
@@ -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,
+247 -245
View File
@@ -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;
@@ -688,7 +690,9 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
* can be shared.
*/
properties[PROP_SHARED_CONTEXT] =
g_param_spec_object ("shared-context", NULL, NULL,
g_param_spec_object ("shared-context",
P_("Shared context"),
P_("The GL context this context shares data with"),
GDK_TYPE_GL_CONTEXT,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -703,7 +707,9 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
* Since: 4.6
*/
properties[PROP_ALLOWED_APIS] =
g_param_spec_flags ("allowed-apis", NULL, NULL,
g_param_spec_flags ("allowed-apis",
P_("Allowed APIs"),
P_("The list of allowed APIs for this context"),
GDK_TYPE_GL_API,
DEFAULT_ALLOWED_APIS,
G_PARAM_READWRITE |
@@ -718,7 +724,9 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
* Since: 4.6
*/
properties[PROP_API] =
g_param_spec_flags ("api", NULL, NULL,
g_param_spec_flags ("api",
P_("API"),
P_("The API currently in use"),
GDK_TYPE_GL_API,
0,
G_PARAM_READABLE |
@@ -952,48 +960,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 +970,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 +979,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 +1055,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 +1065,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 +1342,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 +1673,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 +1851,4 @@ gdk_gl_backend_use (GdkGLBackend backend_type)
g_assert (the_gl_backend_type == backend_type);
}
-26
View File
@@ -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,
+2
View File
@@ -27,4 +27,6 @@
#include <glib/gi18n-lib.h>
#define P_(String) dgettext (GETTEXT_PACKAGE "-properties", String)
#endif
+3 -1
View File
@@ -123,7 +123,9 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
klass->keys_changed = gdk_keymap_keys_changed;
props[PROP_DISPLAY] =
g_param_spec_object ("display", NULL, NULL,
g_param_spec_object ("display",
"Display",
"The display of the keymap",
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+7 -7
View File
@@ -178,19 +178,19 @@ gdk_memory_texture_new_subtexture (GdkMemoryTexture *source,
GBytes *bytes;
g_return_val_if_fail (GDK_IS_MEMORY_TEXTURE (source), NULL);
g_return_val_if_fail (x >= 0 || x < GDK_TEXTURE (source)->width, NULL);
g_return_val_if_fail (y >= 0 || y < GDK_TEXTURE (source)->height, NULL);
g_return_val_if_fail (width > 0 || x + width <= GDK_TEXTURE (source)->width, NULL);
g_return_val_if_fail (height > 0 || y + height <= GDK_TEXTURE (source)->height, NULL);
g_return_val_if_fail (x < 0 || x >= GDK_TEXTURE (source)->width, NULL);
g_return_val_if_fail (y < 0 || y >= GDK_TEXTURE (source)->height, NULL);
g_return_val_if_fail (width <= 0 || x + width > GDK_TEXTURE (source)->width, NULL);
g_return_val_if_fail (height <= 0 || y + height > GDK_TEXTURE (source)->height, NULL);
texture = GDK_TEXTURE (source);
bpp = gdk_memory_format_bytes_per_pixel (texture->format);
offset = y * source->stride + x * bpp;
size = source->stride * (height - 1) + width * bpp;
size = source->stride * (height - 1) + x * bpp;
bytes = g_bytes_new_from_bytes (source->bytes, offset, size);
result = gdk_memory_texture_new (width,
height,
result = gdk_memory_texture_new (texture->width,
texture->height,
texture->format,
bytes,
source->stride);
+33 -11
View File
@@ -176,7 +176,9 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The `GdkDisplay` of the monitor.
*/
props[PROP_DISPLAY] =
g_param_spec_object ("display", NULL, NULL,
g_param_spec_object ("display",
"Display",
"The display of the monitor",
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
@@ -186,7 +188,9 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The manufacturer name.
*/
props[PROP_MANUFACTURER] =
g_param_spec_string ("manufacturer", NULL, NULL,
g_param_spec_string ("manufacturer",
"Manufacturer",
"The manufacturer name",
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -196,7 +200,9 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The model name.
*/
props[PROP_MODEL] =
g_param_spec_string ("model", NULL, NULL,
g_param_spec_string ("model",
"Model",
"The model name",
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -206,7 +212,9 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The connector name.
*/
props[PROP_CONNECTOR] =
g_param_spec_string ("connector", NULL, NULL,
g_param_spec_string ("connector",
"Connector",
"The connector name",
NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -216,7 +224,9 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The scale factor.
*/
props[PROP_SCALE_FACTOR] =
g_param_spec_int ("scale-factor", NULL, NULL,
g_param_spec_int ("scale-factor",
"Scale factor",
"The scale factor",
0, G_MAXINT,
1,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -227,7 +237,9 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The geometry of the monitor.
*/
props[PROP_GEOMETRY] =
g_param_spec_boxed ("geometry", NULL, NULL,
g_param_spec_boxed ("geometry",
"Geometry",
"The geometry of the monitor",
GDK_TYPE_RECTANGLE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -237,7 +249,9 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The width of the monitor, in millimeters.
*/
props[PROP_WIDTH_MM] =
g_param_spec_int ("width-mm", NULL, NULL,
g_param_spec_int ("width-mm",
"Physical width",
"The width of the monitor, in millimeters",
0, G_MAXINT,
0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -248,7 +262,9 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The height of the monitor, in millimeters.
*/
props[PROP_HEIGHT_MM] =
g_param_spec_int ("height-mm", NULL, NULL,
g_param_spec_int ("height-mm",
"Physical height",
"The height of the monitor, in millimeters",
0, G_MAXINT,
0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -259,7 +275,9 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The refresh rate, in milli-Hertz.
*/
props[PROP_REFRESH_RATE] =
g_param_spec_int ("refresh-rate", NULL, NULL,
g_param_spec_int ("refresh-rate",
"Refresh rate",
"The refresh rate, in millihertz",
0, G_MAXINT,
0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -270,7 +288,9 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* The subpixel layout.
*/
props[PROP_SUBPIXEL_LAYOUT] =
g_param_spec_enum ("subpixel-layout", NULL, NULL,
g_param_spec_enum ("subpixel-layout",
"Subpixel layout",
"The subpixel layout",
GDK_TYPE_SUBPIXEL_LAYOUT,
GDK_SUBPIXEL_LAYOUT_UNKNOWN,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -281,7 +301,9 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* Whether the object is still valid.
*/
props[PROP_VALID] =
g_param_spec_boolean ("valid", NULL, NULL,
g_param_spec_boolean ("valid",
"Valid",
"Whether the monitor is still valid",
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+6 -2
View File
@@ -85,7 +85,9 @@ gdk_popup_default_init (GdkPopupInterface *iface)
* The parent surface.
*/
g_object_interface_install_property (iface,
g_param_spec_object ("parent", NULL, NULL,
g_param_spec_object ("parent",
P_("Parent"),
P_("The parent surface"),
GDK_TYPE_SURFACE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
@@ -95,7 +97,9 @@ gdk_popup_default_init (GdkPopupInterface *iface)
* Whether to hide on outside clicks.
*/
g_object_interface_install_property (iface,
g_param_spec_boolean ("autohide", NULL, NULL,
g_param_spec_boolean ("autohide",
P_("Autohide"),
P_("Whether to hide on outside clicks"),
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
}
+3 -1
View File
@@ -184,7 +184,9 @@ gdk_seat_class_init (GdkSeatClass *klass)
* `GdkDisplay` of this seat.
*/
props[PROP_DISPLAY] =
g_param_spec_object ("display", NULL, NULL,
g_param_spec_object ("display",
P_("Display"),
P_("Display"),
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+21 -7
View File
@@ -506,7 +506,9 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* The mouse pointer for the `GdkSurface`.
*/
properties[PROP_CURSOR] =
g_param_spec_object ("cursor", NULL, NULL,
g_param_spec_object ("cursor",
P_("Cursor"),
P_("Cursor"),
GDK_TYPE_CURSOR,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
@@ -516,7 +518,9 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* The `GdkDisplay` connection of the surface.
*/
properties[PROP_DISPLAY] =
g_param_spec_object ("display", NULL, NULL,
g_param_spec_object ("display",
P_("Display"),
P_("Display"),
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
@@ -526,7 +530,9 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* The `GdkFrameClock` of the surface.
*/
properties[PROP_FRAME_CLOCK] =
g_param_spec_object ("frame-clock", NULL, NULL,
g_param_spec_object ("frame-clock",
P_("Frame Clock"),
P_("Frame Clock"),
GDK_TYPE_FRAME_CLOCK,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
@@ -536,7 +542,9 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* Whether the surface is mapped.
*/
properties[PROP_MAPPED] =
g_param_spec_boolean ("mapped", NULL, NULL,
g_param_spec_boolean ("mapped",
P_("Mapped"),
P_("Mapped"),
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -546,7 +554,9 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* The width of the surface in pixels.
*/
properties[PROP_WIDTH] =
g_param_spec_int ("width", NULL, NULL,
g_param_spec_int ("width",
P_("Width"),
P_("Width"),
0, G_MAXINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -556,7 +566,9 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* The height of the surface, in pixels.
*/
properties[PROP_HEIGHT] =
g_param_spec_int ("height", NULL, NULL,
g_param_spec_int ("height",
P_("Height"),
P_("Height"),
0, G_MAXINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
@@ -566,7 +578,9 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* The scale factor of the surface.
*/
properties[PROP_SCALE_FACTOR] =
g_param_spec_int ("scale-factor", NULL, NULL,
g_param_spec_int ("scale-factor",
P_("Scale factor"),
P_("Scale factor"),
1, G_MAXINT, 1,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+6 -2
View File
@@ -304,7 +304,9 @@ gdk_texture_class_init (GdkTextureClass *klass)
* The width of the texture, in pixels.
*/
properties[PROP_WIDTH] =
g_param_spec_int ("width", NULL, NULL,
g_param_spec_int ("width",
"Width",
"The width of the texture",
1,
G_MAXINT,
1,
@@ -319,7 +321,9 @@ gdk_texture_class_init (GdkTextureClass *klass)
* The height of the texture, in pixels.
*/
properties[PROP_HEIGHT] =
g_param_spec_int ("height", NULL, NULL,
g_param_spec_int ("height",
"Height",
"The height of the texture",
1,
G_MAXINT,
1,
+30 -10
View File
@@ -131,7 +131,9 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* The state of the toplevel.
*/
g_object_interface_install_property (iface,
g_param_spec_flags ("state", NULL, NULL,
g_param_spec_flags ("state",
P_("State"),
P_("State"),
GDK_TYPE_TOPLEVEL_STATE, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
@@ -141,7 +143,9 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* The title of the surface.
*/
g_object_interface_install_property (iface,
g_param_spec_string ("title", NULL, NULL,
g_param_spec_string ("title",
"Title",
"The title of the surface",
NULL,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -154,7 +158,9 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* startup feedback.
*/
g_object_interface_install_property (iface,
g_param_spec_string ("startup-id", NULL, NULL,
g_param_spec_string ("startup-id",
"Startup ID",
"The startup ID of the surface",
NULL,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -164,7 +170,9 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* The transient parent of the surface.
*/
g_object_interface_install_property (iface,
g_param_spec_object ("transient-for", NULL, NULL,
g_param_spec_object ("transient-for",
"Transient For",
"The transient parent of the surface",
GDK_TYPE_SURFACE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -174,7 +182,9 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* Whether the surface is modal.
*/
g_object_interface_install_property (iface,
g_param_spec_boolean ("modal", NULL, NULL,
g_param_spec_boolean ("modal",
"Modal",
"Whether the surface is modal",
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -184,7 +194,9 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* A list of textures to use as icon.
*/
g_object_interface_install_property (iface,
g_param_spec_pointer ("icon-list", NULL, NULL,
g_param_spec_pointer ("icon-list",
"Icon List",
"The list of icon textures",
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
/**
@@ -193,7 +205,9 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* Whether the window manager should add decorations.
*/
g_object_interface_install_property (iface,
g_param_spec_boolean ("decorated", NULL, NULL,
g_param_spec_boolean ("decorated",
"Decorated",
"Decorated",
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -203,7 +217,9 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* Whether the window manager should allow to close the surface.
*/
g_object_interface_install_property (iface,
g_param_spec_boolean ("deletable", NULL, NULL,
g_param_spec_boolean ("deletable",
"Deletable",
"Deletable",
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -213,7 +229,9 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* The fullscreen mode of the surface.
*/
g_object_interface_install_property (iface,
g_param_spec_enum ("fullscreen-mode", NULL, NULL,
g_param_spec_enum ("fullscreen-mode",
"Fullscreen mode",
"Fullscreen mode",
GDK_TYPE_FULLSCREEN_MODE,
GDK_FULLSCREEN_ON_CURRENT_MONITOR,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -224,7 +242,9 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
* Whether the surface should inhibit keyboard shortcuts.
*/
g_object_interface_install_property (iface,
g_param_spec_boolean ("shortcuts-inhibited", NULL, NULL,
g_param_spec_boolean ("shortcuts-inhibited",
"Shortcuts inhibited",
"Whether keyboard shortcuts are inhibited",
FALSE,
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY));
+2 -1
View File
@@ -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)
+3 -1
View File
@@ -601,7 +601,9 @@ gdk_macos_drag_class_init (GdkMacosDragClass *klass)
drag_class->handle_event = gdk_macos_drag_handle_event;
properties [PROP_DRAG_SURFACE] =
g_param_spec_object ("drag-surface", NULL, NULL,
g_param_spec_object ("drag-surface",
P_("Drag Surface"),
P_("Drag Surface"),
GDK_TYPE_MACOS_DRAG_SURFACE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+1 -4
View File
@@ -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);
+3 -1
View File
@@ -602,7 +602,9 @@ gdk_macos_surface_class_init (GdkMacosSurfaceClass *klass)
* The "native" property contains the underlying NSWindow.
*/
properties [PROP_NATIVE] =
g_param_spec_pointer ("native", NULL, NULL,
g_param_spec_pointer ("native",
"Native",
"The native NSWindow",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, properties);
+28 -66
View File
@@ -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 &&
+4 -13
View File
@@ -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)
{
+5 -16
View File
@@ -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);
}
+13 -1
View File
@@ -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
-10
View File
@@ -113,7 +113,6 @@ struct _GdkWaylandSurface
PopupState popup_state;
unsigned int popup_thaw_upon_show : 1;
unsigned int initial_configure_received : 1;
unsigned int has_uncommitted_ack_configure : 1;
unsigned int mapped : 1;
@@ -2985,9 +2984,6 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
if (GDK_IS_POPUP (surface))
{
impl->popup_thaw_upon_show = TRUE;
gdk_surface_freeze_updates (surface);
switch (impl->popup_state)
{
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
@@ -3227,12 +3223,6 @@ show_popup (GdkSurface *surface,
if (!impl->display_server.wl_surface)
gdk_wayland_surface_create_surface (surface);
if (impl->popup_thaw_upon_show)
{
impl->popup_thaw_upon_show = FALSE;
gdk_surface_thaw_updates (surface);
}
gdk_wayland_surface_map_popup (surface, width, height, layout);
}
+9 -3
View File
@@ -231,16 +231,22 @@ gdk_win32_hcursor_class_init (GdkWin32HCursorClass *klass)
object_class->set_property = gdk_win32_hcursor_set_property;
hcursor_props[PROP_DISPLAY] =
g_param_spec_object ("display", NULL, NULL,
g_param_spec_object ("display",
P_("Display"),
P_("The display that will use this cursor"),
GDK_TYPE_DISPLAY,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
hcursor_props[PROP_HANDLE] =
g_param_spec_pointer ("handle", NULL, NULL,
g_param_spec_pointer ("handle",
P_("Handle"),
P_("The HCURSOR handle for this cursor"),
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
hcursor_props[PROP_DESTROYABLE] =
g_param_spec_boolean ("destroyable", NULL, NULL,
g_param_spec_boolean ("destroyable",
P_("Destroyable"),
P_("Whether calling DestroyCursor() is allowed on this cursor"),
TRUE,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
-10
View File
@@ -58,7 +58,6 @@
#include "gdkdeviceprivate.h"
#include "gdkdevice-virtual.h"
#include "gdkdevice-wintab.h"
#include "gdkinput-dmanipulation.h"
#include "gdkinput-winpointer.h"
#include "gdkwin32dnd.h"
#include "gdkwin32dnd-private.h"
@@ -2657,13 +2656,6 @@ gdk_event_translate (MSG *msg,
return_val = TRUE;
break;
case DM_POINTERHITTEST:
gdk_dmanipulation_maybe_add_contact (window, msg);
*ret_valp = 0;
return_val = TRUE;
break;
case WM_MOUSEWHEEL:
case WM_MOUSEHWHEEL:
{
@@ -3164,8 +3156,6 @@ gdk_event_translate (MSG *msg,
if (win32_display->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
gdk_winpointer_finalize_surface (window);
gdk_dmanipulation_finalize_surface (window);
return_val = FALSE;
break;
+11 -5
View File
@@ -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;
}
-592
View File
@@ -1,592 +0,0 @@
/* gdkinput-dmanipulation.c
*
* Copyright © 2022 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
/* {{{ */
#ifdef WINVER
#undef WINVER
#endif
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define WINVER 0x0603
#define _WIN32_WINNT 0x0603
#define COBJMACROS
#include "config.h"
#include <gdk/gdk.h>
#include "gdkwin32.h"
#include "gdkprivate-win32.h"
#include "gdkdevicemanager-win32.h"
#include "gdkdevice-virtual.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkeventsprivate.h"
#include "gdkseatdefaultprivate.h"
#include "gdkinput-dmanipulation.h"
#include "winpointer.h"
#include <windows.h>
#include <directmanipulation.h>
typedef BOOL
(WINAPI *getPointerType_t)(UINT32 pointerId, POINTER_INPUT_TYPE *pointerType);
static getPointerType_t getPointerType;
static IDirectManipulationManager *dmanipulation_manager;
typedef struct
{
IDirectManipulationViewportEventHandlerVtbl *vtable;
LONG reference_count;
enum {
GESTURE_PAN,
GESTURE_ZOOM,
} gesture;
GdkTouchpadGesturePhase phase;
gpointer sequence;
float scale;
float pan_x;
float pan_y;
GdkSurface *surface;
GdkDevice *device;
}
DManipEventHandler;
static void dmanip_event_handler_running_state_clear (DManipEventHandler *handler);
static void dmanip_event_handler_free (DManipEventHandler *handler);
static void reset_viewport (IDirectManipulationViewport *viewport);
static gpointer util_get_next_sequence (void);
static GdkModifierType util_get_modifier_state (void);
static gboolean util_handler_free (gpointer);
/* }}} */
/* {{{ ViewportEventHandler */
static STDMETHODIMP_ (ULONG)
DManipEventHandler_AddRef (IDirectManipulationViewportEventHandler *self_)
{
DManipEventHandler *self = (DManipEventHandler*) self_;
return (ULONG) InterlockedIncrement (&self->reference_count);
}
static STDMETHODIMP_ (ULONG)
DManipEventHandler_Release (IDirectManipulationViewportEventHandler *self_)
{
DManipEventHandler *self = (DManipEventHandler*) self_;
/* NOTE: This may run from a worker thread */
LONG new_reference_count = InterlockedDecrement (&self->reference_count);
if (new_reference_count <= 0)
{
/* For safety, schedule the cleanup to be executed
* on the main thread */
g_idle_add (util_handler_free, self);
return 0;
}
return (ULONG) new_reference_count;
}
static STDMETHODIMP
DManipEventHandler_QueryInterface (IDirectManipulationViewportEventHandler *self_,
REFIID riid,
void **ppvObject)
{
DManipEventHandler *self = (DManipEventHandler*) self_;
if G_UNLIKELY (!self || !ppvObject)
return E_POINTER;
*ppvObject = NULL;
if (IsEqualGUID (riid, &IID_IUnknown))
*ppvObject = self;
else if (IsEqualGUID (riid, &IID_IDirectManipulationViewportEventHandler))
*ppvObject = self;
if (*ppvObject == NULL)
return E_NOINTERFACE;
DManipEventHandler_AddRef (self_);
return S_OK;
}
/* NOTE:
*
* All DManipEventHandler callbacks are fired from the main thread */
static STDMETHODIMP
DManipEventHandler_OnViewportUpdated (IDirectManipulationViewportEventHandler *self_,
IDirectManipulationViewport *viewport)
{
return S_OK;
}
static STDMETHODIMP
DManipEventHandler_OnContentUpdated (IDirectManipulationViewportEventHandler *self_,
IDirectManipulationViewport *viewport,
IDirectManipulationContent *content)
{
DManipEventHandler *self = (DManipEventHandler*) self_;
float transform[6] = {1., 0., 0., 1., 0., 0.};
HRESULT hr;
hr = IDirectManipulationContent_GetContentTransform (content, transform,
G_N_ELEMENTS (transform));
HR_CHECK_RETURN_VAL (hr, E_FAIL);
switch (self->gesture)
{
case GESTURE_PAN:
{
GdkWin32Surface *surface_win32;
GdkModifierType state;
uint32_t time;
int scale;
float pan_x;
float pan_y;
GdkEvent *event;
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,
FALSE,
GDK_SCROLL_UNIT_SURFACE);
_gdk_win32_append_event (event);
self->pan_x = pan_x;
self->pan_y = pan_y;
}
break;
case GESTURE_ZOOM:
{
GdkModifierType state;
uint32_t time;
POINT cursor = {0, 0};
float scale;
GdkEvent *event;
scale = transform[0];
state = util_get_modifier_state ();
time = (uint32_t) GetMessageTime ();
_gdk_win32_get_cursor_pos (&cursor);
ScreenToClient (GDK_SURFACE_HWND (self->surface), &cursor);
if (!self->sequence)
self->sequence = util_get_next_sequence ();
event = gdk_touchpad_event_new_pinch (self->surface, self->sequence, self->device,
time, state, self->phase, cursor.x, cursor.y,
2, 0.0, 0.0, scale, 0.0);
_gdk_win32_append_event (event);
self->scale = scale;
self->phase = GDK_TOUCHPAD_GESTURE_PHASE_UPDATE;
}
break;
default:
g_assert_not_reached ();
break;
}
return S_OK;
}
static STDMETHODIMP
DManipEventHandler_OnViewportStatusChanged (IDirectManipulationViewportEventHandler *self_,
IDirectManipulationViewport *viewport,
DIRECTMANIPULATION_STATUS current,
DIRECTMANIPULATION_STATUS previous)
{
DManipEventHandler *self = (DManipEventHandler*) self_;
if (previous == DIRECTMANIPULATION_RUNNING)
{
switch (self->gesture)
{
case GESTURE_PAN:
{
GdkModifierType state;
uint32_t time;
GdkEvent *event;
state = util_get_modifier_state ();
time = (uint32_t) GetMessageTime ();
event = gdk_scroll_event_new (self->surface, self->device,
NULL, time, state,
0.0, 0.0, TRUE,
GDK_SCROLL_UNIT_SURFACE);
_gdk_win32_append_event (event);
}
break;
case GESTURE_ZOOM:
{
GdkModifierType state;
uint32_t time;
POINT cursor = {0, 0};
GdkEvent *event;
if (self->phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN)
break;
state = util_get_modifier_state ();
time = (uint32_t) GetMessageTime ();
_gdk_win32_get_cursor_pos (&cursor);
ScreenToClient (GDK_SURFACE_HWND (self->surface), &cursor);
event = gdk_touchpad_event_new_pinch (self->surface, self->sequence, self->device,
time, state, GDK_TOUCHPAD_GESTURE_PHASE_END,
cursor.x, cursor.y, 2, 0., 0., self->scale,
0.);
_gdk_win32_append_event (event);
}
break;
default:
g_assert_not_reached ();
break;
}
dmanip_event_handler_running_state_clear (self);
reset_viewport (viewport);
}
return S_OK;
}
static void
dmanip_event_handler_running_state_clear (DManipEventHandler *handler)
{
handler->scale = 1.0;
handler->pan_x = 0.0;
handler->pan_y = 0.0;
handler->phase = GDK_TOUCHPAD_GESTURE_PHASE_BEGIN;
handler->sequence = NULL;
}
static DManipEventHandler*
dmanip_event_handler_new (GdkSurface *surface,
int gesture)
{
static IDirectManipulationViewportEventHandlerVtbl vtable = {
DManipEventHandler_QueryInterface,
DManipEventHandler_AddRef,
DManipEventHandler_Release,
DManipEventHandler_OnViewportStatusChanged,
DManipEventHandler_OnViewportUpdated,
DManipEventHandler_OnContentUpdated,
};
DManipEventHandler *handler;
handler = g_new0 (DManipEventHandler, 1);
handler->vtable = &vtable;
handler->reference_count = 1;
handler->gesture = gesture;
handler->surface = surface;
handler->device = _gdk_device_manager->core_pointer;
dmanip_event_handler_running_state_clear (handler);
return handler;
}
static void
dmanip_event_handler_free (DManipEventHandler *handler)
{
g_free (handler);
}
/* }}} */
/* {{{ Viewport utils */
static void
reset_viewport (IDirectManipulationViewport *viewport)
{
IDirectManipulationContent *content = NULL;
REFIID iid = &IID_IDirectManipulationContent;
float identity[6] = {1., 0., 0., 1., 0., 0.};
HRESULT hr;
hr = IDirectManipulationViewport_GetPrimaryContent (viewport, iid, (void**)&content);
HR_CHECK (hr);
hr = IDirectManipulationContent_SyncContentTransform (content, identity,
G_N_ELEMENTS (identity));
HR_CHECK (hr);
IUnknown_Release (content);
}
static void
close_viewport (IDirectManipulationViewport **p_viewport)
{
IDirectManipulationViewport *viewport = *p_viewport;
if (viewport)
{
IDirectManipulationViewport_Abandon (viewport);
IUnknown_Release (viewport);
*p_viewport = NULL;
}
}
static void
create_viewport (GdkSurface *surface,
int gesture,
IDirectManipulationViewport **pViewport)
{
DIRECTMANIPULATION_CONFIGURATION configuration = 0;
HWND hwnd = GDK_SURFACE_HWND (surface);
IDirectManipulationViewportEventHandler *handler;
DWORD cookie = 0;
HRESULT hr;
hr = IDirectManipulationManager_CreateViewport (dmanipulation_manager, NULL, hwnd,
&IID_IDirectManipulationViewport,
(void**) pViewport);
HR_CHECK_GOTO (hr, failed);
switch (gesture)
{
case GESTURE_PAN:
configuration = DIRECTMANIPULATION_CONFIGURATION_INTERACTION |
DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_X |
DIRECTMANIPULATION_CONFIGURATION_TRANSLATION_Y;
break;
case GESTURE_ZOOM:
configuration = DIRECTMANIPULATION_CONFIGURATION_INTERACTION |
DIRECTMANIPULATION_CONFIGURATION_SCALING;
break;
default:
g_assert_not_reached ();
break;
}
handler = (IDirectManipulationViewportEventHandler*)
dmanip_event_handler_new (surface, gesture);
hr = IDirectManipulationViewport_AddEventHandler (*pViewport, hwnd, handler, &cookie);
HR_CHECK_GOTO (hr, failed);
hr = IDirectManipulationViewport_ActivateConfiguration (*pViewport, configuration);
HR_CHECK_GOTO (hr, failed);
hr = IDirectManipulationViewport_SetViewportOptions (*pViewport,
DIRECTMANIPULATION_VIEWPORT_OPTIONS_DISABLEPIXELSNAPPING);
hr = IDirectManipulationViewport_Enable (*pViewport);
HR_CHECK_GOTO (hr, failed);
// drop our initial reference
IUnknown_Release (handler);
return;
failed:
if (handler)
IUnknown_Release (handler);
close_viewport (pViewport);
}
/* }}} */
/* {{{ Public */
void gdk_dmanipulation_initialize (void)
{
if (!getPointerType)
{
HMODULE user32_mod;
user32_mod = LoadLibraryW (L"user32.dll");
if (!user32_mod)
{
WIN32_API_FAILED ("LoadLibraryW");
return;
}
getPointerType = (getPointerType_t)
GetProcAddress (user32_mod, "GetPointerType");
if (!getPointerType)
return;
}
if (!gdk_win32_ensure_com ())
return;
if (dmanipulation_manager == NULL)
{
HRESULT hr;
hr = CoCreateInstance (&CLSID_DirectManipulationManager,
NULL,
CLSCTX_INPROC_SERVER,
&IID_IDirectManipulationManager,
(LPVOID*)&dmanipulation_manager);
if (FAILED (hr))
{
if (hr == REGDB_E_CLASSNOTREG || hr == E_NOINTERFACE);
/* Not an error,
* DirectManipulation is not available */
else HR_LOG (hr);
}
}
}
void gdk_dmanipulation_initialize_surface (GdkSurface *surface)
{
GdkWin32Surface *surface_win32;
HRESULT hr;
if (!dmanipulation_manager)
return;
surface_win32 = GDK_WIN32_SURFACE (surface);
create_viewport (surface, GESTURE_PAN,
&surface_win32->dmanipulation_viewport_pan);
create_viewport (surface, GESTURE_ZOOM,
&surface_win32->dmanipulation_viewport_zoom);
hr = IDirectManipulationManager_Activate (dmanipulation_manager,
GDK_SURFACE_HWND (surface));
HR_CHECK (hr);
}
void gdk_dmanipulation_finalize_surface (GdkSurface *surface)
{
GdkWin32Surface *surface_win32 = GDK_WIN32_SURFACE (surface);
close_viewport (&surface_win32->dmanipulation_viewport_zoom);
close_viewport (&surface_win32->dmanipulation_viewport_pan);
}
void gdk_dmanipulation_maybe_add_contact (GdkSurface *surface,
MSG *msg)
{
POINTER_INPUT_TYPE type = PT_POINTER;
UINT32 pointer_id = GET_POINTERID_WPARAM (msg->wParam);
if (!dmanipulation_manager)
return;
if (!getPointerType)
return;
if G_UNLIKELY (!getPointerType (pointer_id, &type))
{
WIN32_API_FAILED_LOG_ONCE ("GetPointerType");
return;
}
if (type == PT_TOUCHPAD)
{
GdkWin32Surface *surface_win32 = GDK_WIN32_SURFACE (surface);
HRESULT hr;
hr = IDirectManipulationViewport_SetContact (surface_win32->dmanipulation_viewport_pan,
pointer_id);
HR_CHECK (hr);
hr = IDirectManipulationViewport_SetContact (surface_win32->dmanipulation_viewport_zoom,
pointer_id);
HR_CHECK (hr);
}
}
/* }}} */
/* {{{ Utils */
static gpointer
util_get_next_sequence (void)
{
//TODO: sequence of other input types?
static unsigned char *sequence_counter = 0;
if (++sequence_counter == 0)
sequence_counter++;
return sequence_counter;
}
static GdkModifierType
util_get_modifier_state (void)
{
GdkModifierType mask = 0;
BYTE kbd[256];
GetKeyboardState (kbd);
if (kbd[VK_SHIFT] & 0x80)
mask |= GDK_SHIFT_MASK;
if (kbd[VK_CAPITAL] & 0x80)
mask |= GDK_LOCK_MASK;
if (kbd[VK_CONTROL] & 0x80)
mask |= GDK_CONTROL_MASK;
if (kbd[VK_MENU] & 0x80)
mask |= GDK_ALT_MASK;
return mask;
}
static gboolean
util_handler_free (gpointer handler)
{
dmanip_event_handler_free ((DManipEventHandler*)handler);
return G_SOURCE_REMOVE;
}
/* }}} */
-32
View File
@@ -1,32 +0,0 @@
/* gdkinput-dmanipulation.h
*
* Copyright © 2022 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef __GDK_INPUT_DMANIPULATION_H__
#define __GDK_INPUT_DMANIPULATION_H__
void gdk_dmanipulation_initialize (void);
void gdk_dmanipulation_initialize_surface (GdkSurface *surface);
void gdk_dmanipulation_finalize_surface (GdkSurface *surface);
void gdk_dmanipulation_maybe_add_contact (GdkSurface *surface,
MSG *msg);
#endif /* __GDK_INPUT_DMANIPULATION_H__ */
-83
View File
@@ -36,7 +36,6 @@
#include "gdkkeysyms.h"
#include "gdkintl.h"
#include "gdkprivate-win32.h"
#include "gdkinput-dmanipulation.h"
#include "gdkwin32.h"
#include <objbase.h>
@@ -50,12 +49,6 @@
static gboolean gdk_synchronize = FALSE;
/* Whether GDK initialized COM */
static gboolean co_initialized = FALSE;
/* Whether GDK initialized OLE */
static gboolean ole_initialized = FALSE;
void
_gdk_win32_surfaceing_init (void)
{
@@ -74,82 +67,6 @@ _gdk_win32_surfaceing_init (void)
GDK_NOTE (EVENTS, g_print ("input_locale: %p\n", _gdk_input_locale));
_gdk_win32_clipdrop_init ();
gdk_dmanipulation_initialize ();
}
gboolean
gdk_win32_ensure_com (void)
{
if (!co_initialized)
{
/* UI thread should only use STA model. See
* -> https://devblogs.microsoft.com/oldnewthing/20080424-00/?p=22603
* -> https://devblogs.microsoft.com/oldnewthing/20071018-00/?p=24743
*/
const DWORD flags = COINIT_APARTMENTTHREADED |
COINIT_DISABLE_OLE1DDE;
HRESULT hr;
hr = CoInitializeEx (NULL, flags);
if (SUCCEEDED (hr))
co_initialized = TRUE;
else switch (hr)
{
case RPC_E_CHANGED_MODE:
g_warning ("COM runtime already initialized on the main "
"thread with an incompatible apartment model");
break;
default:
HR_LOG (hr);
break;
}
}
return co_initialized;
}
static void
gdk_win32_finalize_com (void)
{
if (co_initialized)
{
CoUninitialize ();
co_initialized = FALSE;
}
}
gboolean
gdk_win32_ensure_ole (void)
{
if (!ole_initialized)
{
HRESULT hr = OleInitialize (NULL);
if (SUCCEEDED (hr))
ole_initialized = TRUE;
else switch (hr)
{
case RPC_E_CHANGED_MODE:
g_warning ("Failed to initialize the OLE2 runtime because "
"the thread has an incompatible apartment model");
break;
default:
HR_LOG (hr);
break;
}
}
return ole_initialized;
}
static void
gdk_win32_finalize_ole (void)
{
if (ole_initialized)
{
OleUninitialize ();
ole_initialized = FALSE;
}
}
void
-10
View File
@@ -196,9 +196,6 @@ void _gdk_remove_modal_window (GdkSurface *window);
GdkSurface *_gdk_modal_current (void);
gboolean _gdk_modal_blocked (GdkSurface *window);
gboolean gdk_win32_ensure_com (void);
gboolean gdk_win32_ensure_ole (void);
#ifdef G_ENABLE_DEBUG
void _gdk_win32_print_paletteentries (const PALETTEENTRY *pep,
const int nentries);
@@ -255,13 +252,6 @@ void _gdk_other_api_failed (const char *where,
#define GDI_CALL(api, arglist) (api arglist ? 1 : (WIN32_GDI_FAILED (#api), 0))
#define API_CALL(api, arglist) (api arglist ? 1 : (WIN32_API_FAILED (#api), 0))
#define HR_LOG(hr)
#define HR_CHECK_RETURN(hr) { if G_UNLIKELY (FAILED (hr)) return; }
#define HR_CHECK_RETURN_VAL(hr, val) { if G_UNLIKELY (FAILED (hr)) return val; }
#define HR_CHECK(hr)
#define HR_CHECK_GOTO(hr, label) { if G_UNLIKELY (FAILED (hr)) goto label; }
extern LRESULT CALLBACK _gdk_win32_surface_procedure (HWND, UINT, WPARAM, LPARAM);
extern GdkDisplay *_gdk_display;
+2 -9
View File
@@ -44,7 +44,6 @@
#include "gdktoplevelprivate.h"
#include "gdkwin32surface.h"
#include "gdkwin32cursor.h"
#include "gdkinput-dmanipulation.h"
#include "gdkinput-winpointer.h"
#include "gdkglcontext-win32.h"
#include "gdkdisplay-win32.h"
@@ -640,14 +639,8 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
}
gdk_surface_set_egl_native_window (surface, (void *) impl->handle);
if (surface_type != GDK_SURFACE_TEMP)
{
if (display_win32->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
gdk_winpointer_initialize_surface (surface);
gdk_dmanipulation_initialize_surface (surface);
}
if (display_win32->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
gdk_winpointer_initialize_surface (surface);
_gdk_win32_surface_enable_transparency (surface);
_gdk_win32_surface_register_dnd (surface);
-4
View File
@@ -32,7 +32,6 @@
#include "gdk/gdkcursor.h"
#include <windows.h>
#include <directmanipulation.h>
#ifdef HAVE_EGL
# include <epoxy/egl.h>
@@ -340,9 +339,6 @@ struct _GdkWin32Surface
} next_layout;
gboolean force_recompute_size;
IDirectManipulationViewport *dmanipulation_viewport_pan;
IDirectManipulationViewport *dmanipulation_viewport_zoom;
#ifdef HAVE_EGL
guint egl_force_redraw_all : 1;
#endif
-1
View File
@@ -17,7 +17,6 @@ gdk_win32_sources = files([
'gdkglcontext-win32-wgl.c',
'gdkglobals-win32.c',
'gdkhdataoutputstream-win32.c',
'gdkinput-dmanipulation.c',
'gdkinput-winpointer.c',
'gdkkeys-win32.c',
'gdkkeys-win32-impl.c',
+3 -1
View File
@@ -116,7 +116,9 @@ gdk_x11_device_xi2_class_init (GdkX11DeviceXI2Class *klass)
g_object_class_install_property (object_class,
PROP_DEVICE_ID,
g_param_spec_int ("device-id", NULL, NULL,
g_param_spec_int ("device-id",
P_("Device ID"),
P_("Device identifier"),
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+16 -6
View File
@@ -145,25 +145,33 @@ gdk_x11_device_manager_xi2_class_init (GdkX11DeviceManagerXI2Class *klass)
g_object_class_install_property (object_class,
PROP_DISPLAY,
g_param_spec_object ("display", NULL, NULL,
g_param_spec_object ("display",
"Display",
"Display for the device manager",
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_OPCODE,
g_param_spec_int ("opcode", NULL, NULL,
g_param_spec_int ("opcode",
P_("Opcode"),
P_("Opcode for XInput2 requests"),
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_MAJOR,
g_param_spec_int ("major", NULL, NULL,
g_param_spec_int ("major",
P_("Major"),
P_("Major version number"),
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
PROP_MINOR,
g_param_spec_int ("minor", NULL, NULL,
g_param_spec_int ("minor",
P_("Minor"),
P_("Minor version number"),
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
@@ -1655,7 +1663,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 +1766,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
NULL,
xev->time,
state,
direction);
direction,
FALSE);
}
else
{
+168 -143
View File
@@ -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
+1 -1
View File
@@ -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,
+3 -1
View File
@@ -94,7 +94,9 @@ gsk_gl_profiler_class_init (GskGLProfilerClass *klass)
gobject_class->finalize = gsk_gl_profiler_finalize;
gsk_gl_profiler_properties[PROP_GL_CONTEXT] =
g_param_spec_object ("gl-context", NULL, NULL,
g_param_spec_object ("gl-context",
"GL Context",
"The GdkGLContext used by the GL profiler",
GDK_TYPE_GL_CONTEXT,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+3 -7
View File
@@ -158,10 +158,6 @@ failure:
gdk_profiler_end_mark (start_time, "realize GskGLRenderer", NULL);
/* Assert either all or no state was set */
g_assert ((ret && self->driver != NULL && self->context != NULL && self->command_queue != NULL) ||
(!ret && self->driver == NULL && self->context == NULL && self->command_queue == NULL));
return ret;
}
@@ -407,11 +403,11 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
static void
gsk_gl_renderer_dispose (GObject *object)
{
#ifdef G_ENABLE_DEBUG
GskGLRenderer *self = (GskGLRenderer *)object;
if (self->driver != NULL)
g_critical ("Attempt to dispose %s without calling gsk_renderer_unrealize()",
G_OBJECT_TYPE_NAME (self));
g_assert (self->driver == NULL);
#endif
G_OBJECT_CLASS (gsk_gl_renderer_parent_class)->dispose (object);
}
+3 -1
View File
@@ -127,7 +127,9 @@ gsk_gl_shadow_library_class_init (GskGLShadowLibraryClass *klass)
object_class->set_property = gsk_gl_shadow_library_set_property;
properties [PROP_DRIVER] =
g_param_spec_object ("driver", NULL, NULL,
g_param_spec_object ("driver",
"Driver",
"Driver",
GSK_TYPE_GL_DRIVER,
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+3 -1
View File
@@ -256,7 +256,9 @@ gsk_gl_texture_library_class_init (GskGLTextureLibraryClass *klass)
klass->allocate = gsk_gl_texture_library_real_allocate;
properties [PROP_DRIVER] =
g_param_spec_object ("driver", NULL, NULL,
g_param_spec_object ("driver",
"Driver",
"Driver",
GSK_TYPE_GL_DRIVER,
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+6 -2
View File
@@ -444,7 +444,9 @@ gsk_gl_shader_class_init (GskGLShaderClass *klass)
* The source code for the shader, as a `GBytes`.
*/
gsk_gl_shader_properties[GLSHADER_PROP_SOURCE] =
g_param_spec_boxed ("source", NULL, NULL,
g_param_spec_boxed ("source",
"Source",
"The sourcecode for the shader",
G_TYPE_BYTES,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -459,7 +461,9 @@ gsk_gl_shader_class_init (GskGLShaderClass *klass)
* will be %NULL.
*/
gsk_gl_shader_properties[GLSHADER_PROP_RESOURCE] =
g_param_spec_string ("resource", NULL, NULL,
g_param_spec_string ("resource",
"Resources",
"Resource path to the source code",
NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
+6 -2
View File
@@ -192,7 +192,9 @@ gsk_renderer_class_init (GskRendererClass *klass)
* Whether the renderer has been associated with a surface or draw context.
*/
gsk_renderer_properties[PROP_REALIZED] =
g_param_spec_boolean ("realized", NULL, NULL,
g_param_spec_boolean ("realized",
"Realized",
"The renderer has been associated with a surface or draw context",
FALSE,
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
@@ -202,7 +204,9 @@ gsk_renderer_class_init (GskRendererClass *klass)
* The surface associated with renderer.
*/
gsk_renderer_properties[PROP_SURFACE] =
g_param_spec_object ("surface", NULL, NULL,
g_param_spec_object ("surface",
"Surface",
"The surface associated to the renderer",
GDK_TYPE_SURFACE,
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
+11 -56
View File
@@ -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)
@@ -1119,7 +1102,7 @@ parse_conic_gradient_node (GtkCssParser *parser)
g_array_append_val (stops, to);
}
result = gsk_conic_gradient_node_new (&bounds, &center, rotation,
result = gsk_conic_gradient_node_new (&bounds, &center, rotation,
(GskColorStop *) stops->data, stops->len);
g_array_free (stops, TRUE);
@@ -1405,7 +1388,7 @@ parse_cairo_node (GtkCssParser *parser)
parse_declarations (parser, declarations, G_N_ELEMENTS(declarations));
node = gsk_cairo_node_new (&bounds);
if (surface != NULL)
{
cairo_t *cr = gsk_cairo_node_get_draw_context (node);
@@ -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);
@@ -2711,41 +2697,10 @@ render_node_print (Printer *p,
start_node (p, "texture");
append_rect_param (p, "bounds", &node->bounds);
bytes = gdk_texture_save_to_png_bytes (texture);
_indent (p);
switch (gdk_texture_get_format (texture))
{
case GDK_MEMORY_B8G8R8A8_PREMULTIPLIED:
case GDK_MEMORY_A8R8G8B8_PREMULTIPLIED:
case GDK_MEMORY_R8G8B8A8_PREMULTIPLIED:
case GDK_MEMORY_B8G8R8A8:
case GDK_MEMORY_A8R8G8B8:
case GDK_MEMORY_R8G8B8A8:
case GDK_MEMORY_A8B8G8R8:
case GDK_MEMORY_R8G8B8:
case GDK_MEMORY_B8G8R8:
case GDK_MEMORY_R16G16B16:
case GDK_MEMORY_R16G16B16A16_PREMULTIPLIED:
case GDK_MEMORY_R16G16B16A16:
bytes = gdk_texture_save_to_png_bytes (texture);
g_string_append (p->str, "texture: url(\"data:image/png;base64,");
break;
case GDK_MEMORY_R16G16B16_FLOAT:
case GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED:
case GDK_MEMORY_R16G16B16A16_FLOAT:
case GDK_MEMORY_R32G32B32_FLOAT:
case GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED:
case GDK_MEMORY_R32G32B32A32_FLOAT:
bytes = gdk_texture_save_to_tiff_bytes (texture);
g_string_append (p->str, "texture: url(\"data:image/tiff;base64,");
break;
case GDK_MEMORY_N_FORMATS:
default:
g_assert_not_reached ();
}
g_string_append (p->str, "texture: url(\"data:image/png;base64,");
b64 = base64_encode_with_linebreaks (g_bytes_get_data (bytes, NULL),
g_bytes_get_size (bytes));
append_escaping_newlines (p->str, b64);
+4 -5
View File
@@ -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);
}
+1 -1
View File
@@ -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
}
},
+1 -5
View File
@@ -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 -41
View File
@@ -1098,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)
{
+48 -16
View File
@@ -378,7 +378,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* `g_get_application_name()`.
*/
props[PROP_NAME] =
g_param_spec_string ("program-name", NULL, NULL,
g_param_spec_string ("program-name",
P_("Program name"),
P_("The name of the program. If this is not set, it defaults to g_get_application_name()"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -388,7 +390,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* The version of the program.
*/
props[PROP_VERSION] =
g_param_spec_string ("version", NULL, NULL,
g_param_spec_string ("version",
P_("Program version"),
P_("The version of the program"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -398,7 +402,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* Copyright information for the program.
*/
props[PROP_COPYRIGHT] =
g_param_spec_string ("copyright", NULL, NULL,
g_param_spec_string ("copyright",
P_("Copyright string"),
P_("Copyright information for the program"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -412,7 +418,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* not a detailed list of features.
*/
props[PROP_COMMENTS] =
g_param_spec_string ("comments", NULL, NULL,
g_param_spec_string ("comments",
P_("Comments string"),
P_("Comments about the program"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -435,7 +443,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* be converted into clickable links.
*/
props[PROP_LICENSE] =
g_param_spec_string ("license", NULL, NULL,
g_param_spec_string ("license",
P_("License"),
P_("The license of the program"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -453,7 +463,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* be converted into clickable links.
*/
props[PROP_SYSTEM_INFORMATION] =
g_param_spec_string ("system-information", NULL, NULL,
g_param_spec_string ("system-information",
P_("System Information"),
P_("Information about the system on which the program is running"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -477,7 +489,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* a side effect.
*/
props[PROP_LICENSE_TYPE] =
g_param_spec_enum ("license-type", NULL, NULL,
g_param_spec_enum ("license-type",
P_("License Type"),
P_("The license type of the program"),
GTK_TYPE_LICENSE,
GTK_LICENSE_UNKNOWN,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -490,7 +504,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* This should be a string starting with `http://` or `https://`.
*/
props[PROP_WEBSITE] =
g_param_spec_string ("website", NULL, NULL,
g_param_spec_string ("website",
P_("Website URL"),
P_("The URL for the link to the website of the program"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -500,7 +516,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* The label for the link to the website of the program.
*/
props[PROP_WEBSITE_LABEL] =
g_param_spec_string ("website-label", NULL, NULL,
g_param_spec_string ("website-label",
P_("Website label"),
P_("The label for the link to the website of the program"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -513,7 +531,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* as links, see the introduction for more details.
*/
props[PROP_AUTHORS] =
g_param_spec_boxed ("authors", NULL, NULL,
g_param_spec_boxed ("authors",
P_("Authors"),
P_("List of authors of the program"),
G_TYPE_STRV,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -526,7 +546,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* as links, see the introduction for more details.
*/
props[PROP_DOCUMENTERS] =
g_param_spec_boxed ("documenters", NULL, NULL,
g_param_spec_boxed ("documenters",
P_("Documenters"),
P_("List of people documenting the program"),
G_TYPE_STRV,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -540,7 +562,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* as links.
*/
props[PROP_ARTISTS] =
g_param_spec_boxed ("artists", NULL, NULL,
g_param_spec_boxed ("artists",
P_("Artists"),
P_("List of people who have contributed artwork to the program"),
G_TYPE_STRV,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -555,7 +579,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* as links, see the introduction for more details.
*/
props[PROP_TRANSLATOR_CREDITS] =
g_param_spec_string ("translator-credits", NULL, NULL,
g_param_spec_string ("translator-credits",
P_("Translator credits"),
P_("Credits to the translators. This string should be marked as translatable"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -568,7 +594,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* [id@gtk_window_set_default_icon_name] will be used.
*/
props[PROP_LOGO] =
g_param_spec_object ("logo", NULL, NULL,
g_param_spec_object ("logo",
P_("Logo"),
P_("A logo for the about box."),
GDK_TYPE_PAINTABLE,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -580,7 +608,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* This property overrides the [property@Gtk.AboutDialog:logo] property.
*/
props[PROP_LOGO_ICON_NAME] =
g_param_spec_string ("logo-icon-name", NULL, NULL,
g_param_spec_string ("logo-icon-name",
P_("Logo Icon Name"),
P_("A named icon to use as the logo for the about box."),
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -590,7 +620,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
* Whether to wrap the text in the license dialog.
*/
props[PROP_WRAP_LICENSE] =
g_param_spec_boolean ("wrap-license", NULL, NULL,
g_param_spec_boolean ("wrap-license",
P_("Wrap license"),
P_("Whether to wrap the license text."),
FALSE,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
+3 -1
View File
@@ -65,7 +65,9 @@ gtk_accessible_default_init (GtkAccessibleInterface *iface)
* The accessible role cannot be changed once set.
*/
GParamSpec *pspec =
g_param_spec_enum ("accessible-role", NULL, NULL,
g_param_spec_enum ("accessible-role",
"Accessible Role",
"The role of the accessible object",
GTK_TYPE_ACCESSIBLE_ROLE,
GTK_ACCESSIBLE_ROLE_NONE,
G_PARAM_READWRITE |
+4 -2
View File
@@ -58,11 +58,13 @@ static void
gtk_actionable_default_init (GtkActionableInterface *iface)
{
g_object_interface_install_property (iface,
g_param_spec_string ("action-name", NULL, NULL,
g_param_spec_string ("action-name", P_("Action name"),
P_("The name of the associated action, like “app.quit”"),
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_interface_install_property (iface,
g_param_spec_variant ("action-target", NULL, NULL,
g_param_spec_variant ("action-target", P_("Action target value"),
P_("The parameter for action invocations"),
G_VARIANT_TYPE_ANY, NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
+3 -1
View File
@@ -171,7 +171,9 @@ gtk_action_bar_class_init (GtkActionBarClass *klass)
* Controls whether the action bar shows its contents.
*/
props[PROP_REVEALED] =
g_param_spec_boolean ("revealed", NULL, NULL,
g_param_spec_boolean ("revealed",
P_("Reveal"),
P_("Controls whether the action bar shows its contents or not"),
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+3 -3
View File
@@ -346,11 +346,11 @@ gtk_action_helper_class_init (GtkActionHelperClass *class)
class->get_property = gtk_action_helper_get_property;
class->finalize = gtk_action_helper_finalize;
gtk_action_helper_pspecs[PROP_ENABLED] = g_param_spec_boolean ("enabled", NULL, NULL, FALSE,
gtk_action_helper_pspecs[PROP_ENABLED] = g_param_spec_boolean ("enabled", "enabled", "enabled", FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
gtk_action_helper_pspecs[PROP_ACTIVE] = g_param_spec_boolean ("active", NULL, NULL, FALSE,
gtk_action_helper_pspecs[PROP_ACTIVE] = g_param_spec_boolean ("active", "active", "active", FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
gtk_action_helper_pspecs[PROP_ROLE] = g_param_spec_enum ("role", NULL, NULL,
gtk_action_helper_pspecs[PROP_ROLE] = g_param_spec_enum ("role", "role", "role",
GTK_TYPE_BUTTON_ROLE,
GTK_BUTTON_ROLE_NORMAL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+9 -9
View File
@@ -991,15 +991,13 @@ gtk_action_muxer_unregister_observer (GtkActionObservable *observable,
GtkActionObserver *observer)
{
GtkActionMuxer *muxer = GTK_ACTION_MUXER (observable);
Action *action = find_observers (muxer, name);
Action *action;
action = find_observers (muxer, name);
if (action)
{
if (g_slist_find (action->watchers, observer) != NULL)
{
g_object_weak_unref (G_OBJECT (observer), gtk_action_muxer_weak_notify, action);
gtk_action_muxer_unregister_internal (action, observer);
}
g_object_weak_unref (G_OBJECT (observer), gtk_action_muxer_weak_notify, action);
gtk_action_muxer_unregister_internal (action, observer);
}
}
@@ -1220,12 +1218,14 @@ gtk_action_muxer_class_init (GObjectClass *class)
class->finalize = gtk_action_muxer_finalize;
class->dispose = gtk_action_muxer_dispose;
properties[PROP_PARENT] = g_param_spec_object ("parent", NULL, NULL,
properties[PROP_PARENT] = g_param_spec_object ("parent", "Parent",
"The parent muxer",
GTK_TYPE_ACTION_MUXER,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
properties[PROP_WIDGET] = g_param_spec_object ("widget", NULL, NULL,
properties[PROP_WIDGET] = g_param_spec_object ("widget", "Widget",
"The widget that owns the muxer",
GTK_TYPE_WIDGET,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -1269,7 +1269,7 @@ gtk_action_muxer_insert (GtkActionMuxer *muxer,
if (!muxer->groups)
muxer->groups = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, gtk_action_muxer_free_group);
group = g_slice_new0 (Group);
group = g_slice_new (Group);
group->muxer = muxer;
group->group = g_object_ref (action_group);
group->prefix = g_strdup (prefix);
+18 -6
View File
@@ -137,7 +137,9 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
* The value of the adjustment.
*/
adjustment_props[PROP_VALUE] =
g_param_spec_double ("value", NULL, NULL,
g_param_spec_double ("value",
P_("Value"),
P_("The value of the adjustment"),
-G_MAXDOUBLE, G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE);
@@ -148,7 +150,9 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
* The minimum value of the adjustment.
*/
adjustment_props[PROP_LOWER] =
g_param_spec_double ("lower", NULL, NULL,
g_param_spec_double ("lower",
P_("Minimum Value"),
P_("The minimum value of the adjustment"),
-G_MAXDOUBLE, G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE);
@@ -162,7 +166,9 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
* property is nonzero.
*/
adjustment_props[PROP_UPPER] =
g_param_spec_double ("upper", NULL, NULL,
g_param_spec_double ("upper",
P_("Maximum Value"),
P_("The maximum value of the adjustment"),
-G_MAXDOUBLE, G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE);
@@ -173,7 +179,9 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
* The step increment of the adjustment.
*/
adjustment_props[PROP_STEP_INCREMENT] =
g_param_spec_double ("step-increment", NULL, NULL,
g_param_spec_double ("step-increment",
P_("Step Increment"),
P_("The step increment of the adjustment"),
-G_MAXDOUBLE, G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE);
@@ -184,7 +192,9 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
* The page increment of the adjustment.
*/
adjustment_props[PROP_PAGE_INCREMENT] =
g_param_spec_double ("page-increment", NULL, NULL,
g_param_spec_double ("page-increment",
P_("Page Increment"),
P_("The page increment of the adjustment"),
-G_MAXDOUBLE, G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE);
@@ -199,7 +209,9 @@ gtk_adjustment_class_init (GtkAdjustmentClass *class)
* `GtkSpinButton`.
*/
adjustment_props[PROP_PAGE_SIZE] =
g_param_spec_double ("page-size", NULL, NULL,
g_param_spec_double ("page-size",
P_("Page Size"),
P_("The page size of the adjustment"),
-G_MAXDOUBLE, G_MAXDOUBLE,
0.0,
GTK_PARAM_READWRITE);
+3 -1
View File
@@ -67,7 +67,9 @@ gtk_app_chooser_default_init (GtkAppChooserIface *iface)
*
* See `GContentType` for more information about content types.
*/
pspec = g_param_spec_string ("content-type", NULL, NULL,
pspec = g_param_spec_string ("content-type",
P_("Content type"),
P_("The content type used by the open with object"),
NULL,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
+12 -4
View File
@@ -682,7 +682,9 @@ gtk_app_chooser_button_class_init (GtkAppChooserButtonClass *klass)
* a `GtkAppChooserDialog`.
*/
properties[PROP_SHOW_DIALOG_ITEM] =
g_param_spec_boolean ("show-dialog-item", NULL, NULL,
g_param_spec_boolean ("show-dialog-item",
P_("Include an “Other…” item"),
P_("Whether the combobox should include an item that triggers a GtkAppChooserDialog"),
FALSE,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_STATIC_STRINGS|G_PARAM_EXPLICIT_NOTIFY);
@@ -693,7 +695,9 @@ gtk_app_chooser_button_class_init (GtkAppChooserButtonClass *klass)
* on top for the provided content type.
*/
properties[PROP_SHOW_DEFAULT_ITEM] =
g_param_spec_boolean ("show-default-item", NULL, NULL,
g_param_spec_boolean ("show-default-item",
P_("Show default item"),
P_("Whether the combobox should show the default application on top"),
FALSE,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_STATIC_STRINGS|G_PARAM_EXPLICIT_NOTIFY);
@@ -706,7 +710,9 @@ gtk_app_chooser_button_class_init (GtkAppChooserButtonClass *klass)
* The string may contain Pango markup.
*/
properties[PROP_HEADING] =
g_param_spec_string ("heading", NULL, NULL,
g_param_spec_string ("heading",
P_("Heading"),
P_("The text to show at the top of the dialog"),
NULL,
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS|G_PARAM_EXPLICIT_NOTIFY);
@@ -716,7 +722,9 @@ gtk_app_chooser_button_class_init (GtkAppChooserButtonClass *klass)
* Whether the app chooser dialog should be modal.
*/
properties[PROP_MODAL] =
g_param_spec_boolean ("modal", NULL, NULL,
g_param_spec_boolean ("modal",
P_("Modal"),
P_("Whether the dialog should be modal"),
TRUE,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_STATIC_STRINGS|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
+6 -2
View File
@@ -598,7 +598,9 @@ gtk_app_chooser_dialog_class_init (GtkAppChooserDialogClass *klass)
* The dialog's `GtkAppChooserWidget` content type will
* be guessed from the file, if present.
*/
pspec = g_param_spec_object ("gfile", NULL, NULL,
pspec = g_param_spec_object ("gfile",
P_("GFile"),
P_("The GFile used by the app chooser dialog"),
G_TYPE_FILE,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
@@ -611,7 +613,9 @@ gtk_app_chooser_dialog_class_init (GtkAppChooserDialogClass *klass)
*
* The string may contain Pango markup.
*/
pspec = g_param_spec_string ("heading", NULL, NULL,
pspec = g_param_spec_string ("heading",
P_("Heading"),
P_("The text to show at the top of the dialog"),
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
+18 -6
View File
@@ -906,7 +906,9 @@ gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
* If %FALSE, the default handler is listed among the recommended
* applications.
*/
pspec = g_param_spec_boolean ("show-default", NULL, NULL,
pspec = g_param_spec_boolean ("show-default",
P_("Show default app"),
P_("Whether the widget should show the default application"),
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_property (gobject_class, PROP_SHOW_DEFAULT, pspec);
@@ -920,7 +922,9 @@ gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
* If %FALSE, the recommended applications are listed
* among the other applications.
*/
pspec = g_param_spec_boolean ("show-recommended", NULL, NULL,
pspec = g_param_spec_boolean ("show-recommended",
P_("Show recommended apps"),
P_("Whether the widget should show recommended applications"),
TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_property (gobject_class, PROP_SHOW_RECOMMENDED, pspec);
@@ -934,7 +938,9 @@ gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
* If %FALSE, the fallback applications are listed among the
* other applications.
*/
pspec = g_param_spec_boolean ("show-fallback", NULL, NULL,
pspec = g_param_spec_boolean ("show-fallback",
P_("Show fallback apps"),
P_("Whether the widget should show fallback applications"),
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_property (gobject_class, PROP_SHOW_FALLBACK, pspec);
@@ -945,7 +951,9 @@ gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
* Determines whether the app chooser should show a section
* for other applications.
*/
pspec = g_param_spec_boolean ("show-other", NULL, NULL,
pspec = g_param_spec_boolean ("show-other",
P_("Show other apps"),
P_("Whether the widget should show other applications"),
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_property (gobject_class, PROP_SHOW_OTHER, pspec);
@@ -957,7 +965,9 @@ gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
* in a single list, without subsections for default,
* recommended or related applications.
*/
pspec = g_param_spec_boolean ("show-all", NULL, NULL,
pspec = g_param_spec_boolean ("show-all",
P_("Show all apps"),
P_("Whether the widget should show all applications"),
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_property (gobject_class, PROP_SHOW_ALL, pspec);
@@ -968,7 +978,9 @@ gtk_app_chooser_widget_class_init (GtkAppChooserWidgetClass *klass)
* The text that appears in the widget when there are no applications
* for the given content type.
*/
pspec = g_param_spec_string ("default-text", NULL, NULL,
pspec = g_param_spec_string ("default-text",
P_("Widgets default text"),
P_("The default text appearing when there are no applications"),
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_property (gobject_class, PROP_DEFAULT_TEXT, pspec);
+12 -4
View File
@@ -598,7 +598,9 @@ gtk_application_class_init (GtkApplicationClass *class)
* [property@Gtk.Application:screensaver-active] property).
*/
gtk_application_props[PROP_REGISTER_SESSION] =
g_param_spec_boolean ("register-session", NULL, NULL,
g_param_spec_boolean ("register-session",
P_("Register session"),
P_("Register with the session manager"),
FALSE,
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS);
@@ -615,7 +617,9 @@ gtk_application_class_init (GtkApplicationClass *class)
* Linux.
*/
gtk_application_props[PROP_SCREENSAVER_ACTIVE] =
g_param_spec_boolean ("screensaver-active", NULL, NULL,
g_param_spec_boolean ("screensaver-active",
P_("Screensaver Active"),
P_("Whether the screensaver is active"),
FALSE,
G_PARAM_READABLE|G_PARAM_STATIC_STRINGS);
@@ -625,7 +629,9 @@ gtk_application_class_init (GtkApplicationClass *class)
* The `GMenuModel` to be used for the application's menu bar.
*/
gtk_application_props[PROP_MENUBAR] =
g_param_spec_object ("menubar", NULL, NULL,
g_param_spec_object ("menubar",
P_("Menubar"),
P_("The GMenuModel for the menubar"),
G_TYPE_MENU_MODEL,
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS);
@@ -635,7 +641,9 @@ gtk_application_class_init (GtkApplicationClass *class)
* The currently focused window of the application.
*/
gtk_application_props[PROP_ACTIVE_WINDOW] =
g_param_spec_object ("active-window", NULL, NULL,
g_param_spec_object ("active-window",
P_("Active window"),
P_("The window which most recently had focus"),
GTK_TYPE_WINDOW,
G_PARAM_READABLE|G_PARAM_STATIC_STRINGS);
+4 -1
View File
@@ -685,7 +685,10 @@ gtk_application_window_class_init (GtkApplicationWindowClass *class)
* of whether the desktop shell is showing it or not.
*/
gtk_application_window_properties[PROP_SHOW_MENUBAR] =
g_param_spec_boolean ("show-menubar", NULL, NULL,
g_param_spec_boolean ("show-menubar",
P_("Show a menubar"),
P_("TRUE if the window should show a "
"menubar at the top of the window"),
FALSE, G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, N_PROPS, gtk_application_window_properties);
}
+15 -5
View File
@@ -140,7 +140,9 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_XALIGN,
g_param_spec_float ("xalign", NULL, NULL,
g_param_spec_float ("xalign",
P_("Horizontal Alignment"),
P_("X alignment of the child"),
0.0, 1.0, 0.5,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
@@ -150,7 +152,9 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_YALIGN,
g_param_spec_float ("yalign", NULL, NULL,
g_param_spec_float ("yalign",
P_("Vertical Alignment"),
P_("Y alignment of the child"),
0.0, 1.0, 0.5,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
@@ -163,7 +167,9 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_RATIO,
g_param_spec_float ("ratio", NULL, NULL,
g_param_spec_float ("ratio",
P_("Ratio"),
P_("Aspect ratio if obey_child is FALSE"),
MIN_RATIO, MAX_RATIO, 1.0,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
@@ -173,7 +179,9 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_OBEY_CHILD,
g_param_spec_boolean ("obey-child", NULL, NULL,
g_param_spec_boolean ("obey-child",
P_("Obey child"),
P_("Force aspect ratio to match that of the frames child"),
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
@@ -183,7 +191,9 @@ gtk_aspect_frame_class_init (GtkAspectFrameClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_CHILD,
g_param_spec_object ("child", NULL, NULL,
g_param_spec_object ("child",
P_("Child"),
P_("The child widget"),
GTK_TYPE_WIDGET,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
+18 -6
View File
@@ -253,7 +253,9 @@ gtk_assistant_page_class_init (GtkAssistantPageClass *class)
*/
g_object_class_install_property (object_class,
CHILD_PROP_PAGE_TYPE,
g_param_spec_enum ("page-type", NULL, NULL,
g_param_spec_enum ("page-type",
P_("Page type"),
P_("The type of the assistant page"),
GTK_TYPE_ASSISTANT_PAGE_TYPE,
GTK_ASSISTANT_PAGE_CONTENT,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -265,7 +267,9 @@ gtk_assistant_page_class_init (GtkAssistantPageClass *class)
*/
g_object_class_install_property (object_class,
CHILD_PROP_PAGE_TITLE,
g_param_spec_string ("title", NULL, NULL,
g_param_spec_string ("title",
P_("Page title"),
P_("The title of the assistant page"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -279,7 +283,9 @@ gtk_assistant_page_class_init (GtkAssistantPageClass *class)
*/
g_object_class_install_property (object_class,
CHILD_PROP_PAGE_COMPLETE,
g_param_spec_boolean ("complete", NULL, NULL,
g_param_spec_boolean ("complete",
P_("Page complete"),
P_("Whether all required fields on the page have been filled out"),
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
@@ -290,7 +296,9 @@ gtk_assistant_page_class_init (GtkAssistantPageClass *class)
*/
g_object_class_install_property (object_class,
CHILD_PROP_CHILD,
g_param_spec_object ("child", NULL, NULL,
g_param_spec_object ("child",
P_("Child widget"),
P_("The content the assistant page"),
GTK_TYPE_WIDGET,
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
@@ -596,7 +604,9 @@ gtk_assistant_class_init (GtkAssistantClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_USE_HEADER_BAR,
g_param_spec_int ("use-header-bar", NULL, NULL,
g_param_spec_int ("use-header-bar",
P_("Use Header Bar"),
P_("Use Header Bar for actions."),
-1, 1, -1,
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
@@ -607,7 +617,9 @@ gtk_assistant_class_init (GtkAssistantClass *class)
*/
g_object_class_install_property (gobject_class,
PROP_PAGES,
g_param_spec_object ("pages", NULL, NULL,
g_param_spec_object ("pages",
P_("Pages"),
P_("The pages of the assistant."),
G_TYPE_LIST_MODEL,
GTK_PARAM_READABLE));
+9 -3
View File
@@ -209,7 +209,9 @@ gtk_at_context_class_init (GtkATContextClass *klass)
* set or retrieved.
*/
obj_props[PROP_ACCESSIBLE_ROLE] =
g_param_spec_enum ("accessible-role", NULL, NULL,
g_param_spec_enum ("accessible-role",
"Accessible Role",
"The accessible role of the AT context",
GTK_TYPE_ACCESSIBLE_ROLE,
GTK_ACCESSIBLE_ROLE_NONE,
G_PARAM_READWRITE |
@@ -222,7 +224,9 @@ gtk_at_context_class_init (GtkATContextClass *klass)
* The `GtkAccessible` that created the `GtkATContext` instance.
*/
obj_props[PROP_ACCESSIBLE] =
g_param_spec_object ("accessible", NULL, NULL,
g_param_spec_object ("accessible",
"Accessible",
"The accessible implementation",
GTK_TYPE_ACCESSIBLE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
@@ -234,7 +238,9 @@ gtk_at_context_class_init (GtkATContextClass *klass)
* The `GdkDisplay` for the `GtkATContext`.
*/
obj_props[PROP_DISPLAY] =
g_param_spec_object ("display", NULL, NULL,
g_param_spec_object ("display",
"Display",
"The display connection",
GDK_TYPE_DISPLAY,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
+12 -4
View File
@@ -213,7 +213,9 @@ gtk_bookmark_list_class_init (GtkBookmarkListClass *class)
* The bookmark file to load.
*/
properties[PROP_FILENAME] =
g_param_spec_string ("filename", NULL, NULL,
g_param_spec_string ("filename",
P_("Filename"),
P_("Bookmark file to load"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY);
/**
@@ -222,7 +224,9 @@ gtk_bookmark_list_class_init (GtkBookmarkListClass *class)
* The attributes to query.
*/
properties[PROP_ATTRIBUTES] =
g_param_spec_string ("attributes", NULL, NULL,
g_param_spec_string ("attributes",
P_("Attributes"),
P_("Attributes to query"),
NULL,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -232,7 +236,9 @@ gtk_bookmark_list_class_init (GtkBookmarkListClass *class)
* Priority used when loading.
*/
properties[PROP_IO_PRIORITY] =
g_param_spec_int ("io-priority", NULL, NULL,
g_param_spec_int ("io-priority",
P_("IO priority"),
P_("Priority used when loading"),
-G_MAXINT, G_MAXINT, G_PRIORITY_DEFAULT,
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -242,7 +248,9 @@ gtk_bookmark_list_class_init (GtkBookmarkListClass *class)
* %TRUE if files are being loaded.
*/
properties[PROP_LOADING] =
g_param_spec_boolean ("loading", NULL, NULL,
g_param_spec_boolean ("loading",
P_("loading"),
P_("TRUE if files are being loaded"),
FALSE,
GTK_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY);
+6 -2
View File
@@ -159,7 +159,9 @@ gtk_bool_filter_class_init (GtkBoolFilterClass *class)
* The boolean expression to evaluate on item.
*/
properties[PROP_EXPRESSION] =
gtk_param_spec_expression ("expression", NULL, NULL,
gtk_param_spec_expression ("expression",
P_("Expression"),
P_("Expression to evaluate"),
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
/**
@@ -168,7 +170,9 @@ gtk_bool_filter_class_init (GtkBoolFilterClass *class)
* If the expression result should be inverted.
*/
properties[PROP_INVERT] =
g_param_spec_boolean ("invert", NULL, NULL,
g_param_spec_boolean ("invert",
P_("Invert"),
P_("If the expression result should be inverted"),
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
+9 -3
View File
@@ -258,7 +258,9 @@ gtk_box_class_init (GtkBoxClass *class)
* The amount of space between children.
*/
props[PROP_SPACING] =
g_param_spec_int ("spacing", NULL, NULL,
g_param_spec_int ("spacing",
P_("Spacing"),
P_("The amount of space between children"),
0, G_MAXINT, 0,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
@@ -268,7 +270,9 @@ gtk_box_class_init (GtkBoxClass *class)
* Whether the children should all be the same size.
*/
props[PROP_HOMOGENEOUS] =
g_param_spec_boolean ("homogeneous", NULL, NULL,
g_param_spec_boolean ("homogeneous",
P_("Homogeneous"),
P_("Whether the children should all be the same size"),
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
@@ -278,7 +282,9 @@ gtk_box_class_init (GtkBoxClass *class)
* The position of the baseline aligned widgets if extra space is available.
*/
props[PROP_BASELINE_POSITION] =
g_param_spec_enum ("baseline-position", NULL, NULL,
g_param_spec_enum ("baseline-position",
P_("Baseline position"),
P_("The position of the baseline aligned widgets if extra space is available"),
GTK_TYPE_BASELINE_POSITION,
GTK_BASELINE_POSITION_CENTER,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+9 -3
View File
@@ -896,7 +896,9 @@ gtk_box_layout_class_init (GtkBoxLayoutClass *klass)
* equally among the children.
*/
box_layout_props[PROP_HOMOGENEOUS] =
g_param_spec_boolean ("homogeneous", NULL, NULL,
g_param_spec_boolean ("homogeneous",
P_("Homogeneous"),
P_("Distribute space homogeneously"),
FALSE,
GTK_PARAM_READWRITE |
G_PARAM_EXPLICIT_NOTIFY);
@@ -907,7 +909,9 @@ gtk_box_layout_class_init (GtkBoxLayoutClass *klass)
* The space to put between the children.
*/
box_layout_props[PROP_SPACING] =
g_param_spec_int ("spacing", NULL, NULL,
g_param_spec_int ("spacing",
P_("Spacing"),
P_("Spacing between widgets"),
0, G_MAXINT, 0,
GTK_PARAM_READWRITE |
G_PARAM_EXPLICIT_NOTIFY);
@@ -922,7 +926,9 @@ gtk_box_layout_class_init (GtkBoxLayoutClass *klass)
* at least one child with a baseline alignment.
*/
box_layout_props[PROP_BASELINE_POSITION] =
g_param_spec_enum ("baseline-position", NULL, NULL,
g_param_spec_enum ("baseline-position",
P_("Baseline position"),
P_("The position of the baseline aligned widgets if extra space is available"),
GTK_TYPE_BASELINE_POSITION,
GTK_BASELINE_POSITION_CENTER,
GTK_PARAM_READWRITE |
+9 -3
View File
@@ -305,7 +305,9 @@ gtk_builder_class_init (GtkBuilderClass *klass)
* otherwise g_dgettext().
*/
builder_props[PROP_TRANSLATION_DOMAIN] =
g_param_spec_string ("translation-domain", NULL, NULL,
g_param_spec_string ("translation-domain",
P_("Translation Domain"),
P_("The translation domain used by gettext"),
NULL,
GTK_PARAM_READWRITE);
@@ -315,7 +317,9 @@ gtk_builder_class_init (GtkBuilderClass *klass)
* The object the builder is evaluating for.
*/
builder_props[PROP_CURRENT_OBJECT] =
g_param_spec_object ("current-object", NULL, NULL,
g_param_spec_object ("current-object",
P_("Current object"),
P_("The object the builder is evaluating for"),
G_TYPE_OBJECT,
GTK_PARAM_READWRITE);
@@ -325,7 +329,9 @@ gtk_builder_class_init (GtkBuilderClass *klass)
* The scope the builder is operating in
*/
builder_props[PROP_SCOPE] =
g_param_spec_object ("scope", NULL, NULL,
g_param_spec_object ("scope",
P_("Scope"),
P_("The scope the builder is operating in"),
GTK_TYPE_BUILDER_SCOPE,
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT);
+9 -3
View File
@@ -264,7 +264,9 @@ gtk_builder_list_item_factory_class_init (GtkBuilderListItemFactoryClass *klass)
* `GBytes` containing the UI definition.
*/
properties[PROP_BYTES] =
g_param_spec_boxed ("bytes", NULL, NULL,
g_param_spec_boxed ("bytes",
P_("Bytes"),
P_("bytes containing the UI definition"),
G_TYPE_BYTES,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
@@ -274,7 +276,9 @@ gtk_builder_list_item_factory_class_init (GtkBuilderListItemFactoryClass *klass)
* Path of the resource containing the UI definition.
*/
properties[PROP_RESOURCE] =
g_param_spec_string ("resource", NULL, NULL,
g_param_spec_string ("resource",
P_("Resource"),
P_("resource containing the UI definition"),
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
@@ -284,7 +288,9 @@ gtk_builder_list_item_factory_class_init (GtkBuilderListItemFactoryClass *klass)
* `GtkBuilderScope` to use when instantiating listitems
*/
properties[PROP_SCOPE] =
g_param_spec_object ("scope", NULL, NULL,
g_param_spec_object ("scope",
P_("Scope"),
P_("scope to use when instantiating listitems"),
GTK_TYPE_BUILDER_SCOPE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);

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