Compare commits

..

6 Commits

Author SHA1 Message Date
Matthias Clasen 0b7f7028d9 sortlistmodel: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 16:25:12 -04:00
Matthias Clasen 5dba053ad1 filterlistmodel: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 15:55:44 -04:00
Matthias Clasen cd8a810d69 slicelistmodel: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 15:38:15 -04:00
Matthias Clasen 8f63a5ab63 listlistmodel: Drop item_type
We are using G_TYPE_OBJECT throughout, so there
is no need for GtkListListModel to do anything else.

Update all callers.
2020-07-26 14:37:55 -04:00
Matthias Clasen eb3381723f maplistmodel: Make constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 14:23:16 -04:00
Matthias Clasen 7e87ad1887 flattenlistmodel: Make the constructor transfer full
This is for consistency with other wrapping list constructors.
We want them all to be transfer full, allow-none.

Update all callers.
2020-07-26 14:21:28 -04:00
571 changed files with 46319 additions and 15729 deletions
-13
View File
@@ -68,7 +68,6 @@ style-check-diff:
fedora-x86_64:
extends: .build-fedora-default
stage: build
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
script:
@@ -83,7 +82,6 @@ fedora-x86_64:
release-build:
extends: .build-fedora-default
stage: build
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
@@ -111,7 +109,6 @@ release-build:
msys2-mingw64:
extends: .mingw-defaults
needs: []
variables:
MSYSTEM: "MINGW64"
CHERE_INVOKING: "yes"
@@ -142,44 +139,37 @@ msys2-mingw64:
flatpak-manual:demo:
extends: .flatpak-manual
needs: []
variables:
APPID: org.gtk.Demo4
flatpak-master:demo:
extends: .flatpak-master
needs: []
variables:
APPID: org.gtk.Demo4
flatpak-manual:widget-factory:
extends: .flatpak-manual
needs: []
variables:
APPID: org.gtk.WidgetFactory4
flatpak-master:widget-factory:
extends: .flatpak-master
needs: []
variables:
APPID: org.gtk.WidgetFactory4
flatpak-manual:icon-browser:
extends: .flatpak-manual
needs: []
variables:
APPID: org.gtk.IconBrowser4
flatpak-master:icon-browser:
extends: .flatpak-master
needs: []
variables:
APPID: org.gtk.IconBrowser4
static-scan:
image: $FEDORA_IMAGE
stage: analysis
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug"
script:
@@ -196,7 +186,6 @@ asan-build:
image: $FEDORA_IMAGE
tags: [ asan ]
stage: analysis
needs: []
variables:
script:
- CC=clang meson --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=false _build
@@ -210,7 +199,6 @@ asan-build:
reference:
image: $DOCS_IMAGE
stage: docs
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
@@ -226,7 +214,6 @@ reference:
pages:
stage: deploy
needs: ['reference']
script:
- mv _reference/ public/
artifacts:
+1
View File
@@ -75,6 +75,7 @@ RUN dnf -y install \
python3-wheel \
redhat-rpm-config \
sassc \
sysprof-devel \
systemtap-sdt-devel \
vulkan-devel \
wayland-devel \
+3
View File
@@ -18,6 +18,7 @@ case "${backend}" in
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=gtk:a11y \
--no-suite=gsk-compare-broadway
# Store the exit code for the CI run, but always
@@ -37,6 +38,7 @@ case "${backend}" in
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=gtk:a11y \
--no-suite=gsk-compare-broadway
exit_code=$?
@@ -55,6 +57,7 @@ case "${backend}" in
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=gtk:a11y \
--no-suite=gsk-compare-opengl
# don't let Broadway failures fail the run, for now
-15
View File
@@ -1,15 +1,6 @@
Overview of Changes in GTK 3.99.0
=================================
* Remove the old accessibility implementation and
add the foundations for a new one that is based
on ARIA. The relevant widget api is GtkAccessible,
the backend implementations will use GtkATContext.
Currently, there is just a nascent test backend.
* Update the GTK headers to use char *, int, float and
double instead of the corresponding GLib types.
* Add GtkEditableLabel, a label that can be edited
* Add GtkBookmarkList, a list model for bookmarks
@@ -44,7 +35,6 @@ Overview of Changes in GTK 3.99.0
* GtkFilterListModel:
- Add incremental filtering
- Add a boolean filter, GtkBoolFilter
* GtkSortListModel:
- Use timsort
@@ -61,18 +51,13 @@ Overview of Changes in GTK 3.99.0
* Inspector:
- Improve list model support
- Add direct navigation between objects
- Show accessibility information
* GDK:
- Compress scroll events
- Keep a scroll history
- Clean up GdkDevice api
- Drop the master/slave device split
- Move axes to GdkDeviceTool
- Change monitor workarea to be per-backend API
- Improve frame clock accuracy
- Add a new macOS backend
- Add an ANGLE-based GLES renderer for Windows
* GSK:
- Use GL_ARB_framebuffer_object
+2
View File
@@ -56,6 +56,7 @@ building for:
- [Pango](https://download.gnome.org/sources/pango)
- [Epoxy](https://github.com/anholt/libepoxy)
- [Graphene](https://github.com/ebassi/graphene)
- [ATK](https://download.gnome.org/sources/atk)
- [Xkb-common](https://github.com/xkbcommon/libxkbcommon)
If you are building the X11 backend, you will also need:
@@ -69,6 +70,7 @@ If you are building the X11 backend, you will also need:
- xcursor
- xdamage
- xcomposite
- [atk-bridge-2.0](https://download.gnome.org/sources/at-spi2-atk)
If you are building the Wayland backend, you will also need:
+16
View File
@@ -95,6 +95,9 @@
<property name="program-name" translatable="yes">Builder demo</property>
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
<property name="modal">True</property>
<accessibility>
<relation target="window1" type="subwindow-of"/>
</accessibility>
</object>
<object class="GtkWindow" id="window1">
<property name="default-height">250</property>
@@ -110,6 +113,11 @@
</child>
<child>
<object class="GtkBox" id="toolbar1">
<child internal-child="accessible">
<object class="AtkObject" id="a11y-toolbar">
<property name="AtkObject::accessible-name">The toolbar</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">New</property>
@@ -166,6 +174,14 @@
<object class="GtkTreeView" id="treeview1">
<property name="model">liststore1</property>
<property name="tooltip-column">3</property>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-treeview">
<property name="AtkObject::accessible-name">Name list</property>
<property name="AtkObject::accessible-description">
A list of person with name, surname and age columns
</property>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="column1">
<property name="title">Name</property>
+2
View File
@@ -23,6 +23,7 @@
#include "demotaggedentry.h"
#include <gtk/gtk.h>
#include <gtk/gtk-a11y.h>
struct _DemoTaggedEntry
{
@@ -118,6 +119,7 @@ demo_tagged_entry_class_init (DemoTaggedEntryClass *klass)
gtk_editable_install_properties (object_class, 1);
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ENTRY_ACCESSIBLE);
gtk_widget_class_set_css_name (widget_class, "entry");
}
+1 -1
View File
@@ -254,7 +254,7 @@ do_dropdown (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (box, 10);
gtk_window_set_child (GTK_WINDOW (window), box);
button = gtk_drop_down_new (NULL, NULL);
button = gtk_drop_down_new ();
model = G_LIST_MODEL (pango_cairo_font_map_get_default ());
gtk_drop_down_set_model (GTK_DROP_DOWN (button), model);
+18
View File
@@ -45,6 +45,9 @@
<attributes>
<attribute name="weight" value="bold"></attribute>
</attributes>
<accessibility>
<relation type="label-for" target="treeview1"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
@@ -80,6 +83,9 @@
</child>
</object>
</child>
<accessibility>
<relation type="labelled-by" target="label1"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
@@ -127,6 +133,9 @@
</child>
</object>
</child>
<accessibility>
<relation type="labelled-by" target="label2"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
@@ -140,6 +149,9 @@
<attributes>
<attribute name="weight" value="bold"></attribute>
</attributes>
<accessibility>
<relation type="label-for" target="treeview2"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
@@ -153,6 +165,9 @@
<attributes>
<attribute name="weight" value="bold"></attribute>
</attributes>
<accessibility>
<relation type="label-for" target="treeview3"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
@@ -182,6 +197,9 @@
</child>
</object>
</child>
<accessibility>
<relation type="labelled-by" target="label3"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
+2 -2
View File
@@ -1,7 +1,7 @@
precision highp float;
void main() {
float lerpVal = gl_FragCoord.y / 500.0;
float lerpVal = gl_FragCoord.y / 500.0f;
gl_FragColor = mix(vec4(1.0, 0.85, 0.35, 1.0), vec4(0.2, 0.2, 0.2, 1.0), lerpVal);
gl_FragColor = mix(vec4(1.0f, 0.85f, 0.35f, 1.0f), vec4(0.2f, 0.2f, 0.2f, 1.0f), lerpVal);
}
+19 -6
View File
@@ -84,6 +84,9 @@
<property name="yalign">0</property>
<property name="label" translatable="0">Message</property>
<property name="wrap">1</property>
<accessibility>
<role type="static"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
@@ -181,17 +184,27 @@
<property name="margin-bottom">2</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="n_reshares_label">
<property name="label" translatable="0">&lt;b&gt;2&lt;/b&gt;
<object class="GtkFrame" id="frame1">
<child>
<object class="GtkLabel" id="n_reshares_label">
<property name="label" translatable="0">&lt;b&gt;2&lt;/b&gt;
Reshares</property>
<property name="use-markup">1</property>
<property name="use-markup">1</property>
</object>
</child>
<child type="label_item"/>
</object>
</child>
<child>
<object class="GtkLabel" id="n_favorites_label">
<property name="label" translatable="0">&lt;b&gt;2&lt;/b&gt;
<object class="GtkFrame" id="frame2">
<child>
<object class="GtkLabel" id="n_favorites_label">
<property name="label" translatable="0">&lt;b&gt;2&lt;/b&gt;
FAVORITES</property>
<property name="use-markup">1</property>
<property name="use-markup">1</property>
</object>
</child>
<child type="label_item"/>
</object>
</child>
</object>
+10 -9
View File
@@ -166,6 +166,14 @@ do_listview_applauncher (GtkWidget *do_widget)
g_signal_connect (factory, "setup", G_CALLBACK (setup_listitem_cb), NULL);
g_signal_connect (factory, "bind", G_CALLBACK (bind_listitem_cb), NULL);
/* Create the list widget here.
*/
list = gtk_list_view_new_with_factory (factory);
/* We connect the activate signal here. It's the function we defined
* above for launching the selected application.
*/
g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL);
/* And of course we need to set the data model. Here we call the function
* we wrote above that gives us the list of applications. Then we set
* it on the list widget.
@@ -173,15 +181,8 @@ do_listview_applauncher (GtkWidget *do_widget)
* to create as many listitems as it needs to show itself to the user.
*/
model = create_application_list ();
/* Create the list widget here.
*/
list = gtk_list_view_new_with_factory (model, factory);
/* We connect the activate signal here. It's the function we defined
* above for launching the selected application.
*/
g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL);
gtk_list_view_set_model (GTK_LIST_VIEW (list), model);
g_object_unref (model);
/* List widgets should always be contained in a #GtkScrolledWindow,
* because otherwise they might get too large or they might not
+7 -2
View File
@@ -463,6 +463,7 @@ do_listview_clocks (GtkWidget *do_widget)
GtkWidget *gridview, *sw;
GtkListItemFactory *factory;
GListModel *model;
GtkNoSelection *selection;
/* This is the normal window setup code every demo does */
window = gtk_window_new ();
@@ -484,12 +485,16 @@ do_listview_clocks (GtkWidget *do_widget)
factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (setup_listitem_cb), NULL);
model = G_LIST_MODEL (gtk_no_selection_new (create_clocks_model ()));
gridview = gtk_grid_view_new_with_factory (model, factory);
gridview = gtk_grid_view_new_with_factory (factory);
gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
gtk_scrollable_set_vscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
model = create_clocks_model ();
selection = gtk_no_selection_new (model);
gtk_grid_view_set_model (GTK_GRID_VIEW (gridview), G_LIST_MODEL (selection));
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), gridview);
g_object_unref (selection);
g_object_unref (model);
}
if (!gtk_widget_get_visible (window))
+27 -14
View File
@@ -663,7 +663,7 @@ create_color_grid (void)
GtkWidget *gridview;
GtkListItemFactory *factory;
gridview = gtk_grid_view_new (NULL);
gridview = gtk_grid_view_new ();
gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
gtk_scrollable_set_vscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
@@ -884,7 +884,7 @@ do_listview_colors (GtkWidget *do_widget)
sort_model = gtk_sort_list_model_new (gtk_color_list_new (0), NULL);
gtk_sort_list_model_set_incremental (sort_model, TRUE);
selection = gtk_multi_selection_new (G_LIST_MODEL (sort_model));
selection = GTK_MULTI_SELECTION (gtk_multi_selection_new (G_LIST_MODEL (sort_model)));
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Colors");
@@ -950,7 +950,7 @@ do_listview_colors (GtkWidget *do_widget)
factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (setup_selection_listitem_cb), NULL);
selection_view = gtk_grid_view_new_with_factory (NULL, factory);
selection_view = gtk_grid_view_new_with_factory (factory);
gtk_widget_add_css_class (selection_view, "compact");
gtk_grid_view_set_max_columns (GTK_GRID_VIEW (selection_view), 200);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), selection_view);
@@ -970,6 +970,7 @@ do_listview_colors (GtkWidget *do_widget)
no_selection = G_LIST_MODEL (gtk_no_selection_new (selection_filter));
gtk_grid_view_set_model (GTK_GRID_VIEW (selection_view), no_selection);
g_object_unref (selection_filter);
g_object_unref (no_selection);
selection_info_toggle = gtk_toggle_button_new ();
@@ -1002,7 +1003,8 @@ do_listview_colors (GtkWidget *do_widget)
g_signal_connect (selection, "items-changed", G_CALLBACK (items_changed_cb), label);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), label);
dropdown = gtk_drop_down_new_from_strings ((const char * const[]) { "8", "64", "512", "4096", "32768", "262144", "2097152", "16777216", NULL });
dropdown = gtk_drop_down_new ();
gtk_drop_down_set_from_strings (GTK_DROP_DOWN (dropdown), (const char *[]) { "8", "64", "512", "4096", "32768", "262144", "2097152", "16777216", NULL });
g_signal_connect (dropdown, "notify::selected",
G_CALLBACK (limit_changed_cb),
gtk_sort_list_model_get_model (sort_model));
@@ -1080,17 +1082,22 @@ do_listview_colors (GtkWidget *do_widget)
g_list_store_append (sorters, multi_sorter);
g_object_unref (multi_sorter);
dropdown = gtk_drop_down_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_append (GTK_BOX (box), gtk_label_new ("Sort by:"));
gtk_box_append (GTK_BOX (box), dropdown);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), box);
expression = gtk_cclosure_expression_new (G_TYPE_STRING,
NULL,
0, NULL,
(GCallback)get_title,
NULL, NULL);
gtk_drop_down_set_expression (GTK_DROP_DOWN (dropdown), expression);
gtk_expression_unref (expression);
dropdown = gtk_drop_down_new (G_LIST_MODEL (sorters), expression);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_append (GTK_BOX (box), gtk_label_new ("Sort by:"));
gtk_box_append (GTK_BOX (box), dropdown);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), box);
gtk_drop_down_set_model (GTK_DROP_DOWN (dropdown), G_LIST_MODEL (sorters));
g_object_unref (sorters);
g_object_bind_property (dropdown, "selected-item", sort_model, "sorter", G_BINDING_SYNC_CREATE);
@@ -1106,16 +1113,22 @@ do_listview_colors (GtkWidget *do_widget)
set_title (factory, "Everything");
g_list_store_append (factories, factory);
dropdown = gtk_drop_down_new ();
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_append (GTK_BOX (box), gtk_label_new ("Show:"));
gtk_box_append (GTK_BOX (box), dropdown);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), box);
expression = gtk_cclosure_expression_new (G_TYPE_STRING,
NULL,
0, NULL,
(GCallback)get_title,
NULL, NULL);
dropdown = gtk_drop_down_new (G_LIST_MODEL (factories), expression);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_box_append (GTK_BOX (box), gtk_label_new ("Show:"));
gtk_box_append (GTK_BOX (box), dropdown);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), box);
gtk_drop_down_set_expression (GTK_DROP_DOWN (dropdown), expression);
gtk_expression_unref (expression);
gtk_drop_down_set_model (GTK_DROP_DOWN (dropdown), G_LIST_MODEL (factories));
g_object_unref (factories);
g_object_bind_property (dropdown, "selected-item", gridview, "factory", G_BINDING_SYNC_CREATE);
}
+9 -3
View File
@@ -214,6 +214,7 @@ transform_settings_to_keys (GBinding *binding,
GtkSortListModel *sort_model;
GtkFilterListModel *filter_model;
GtkFilter *filter;
GtkNoSelection *selection_model;
char **keys;
guint i;
@@ -247,7 +248,10 @@ transform_settings_to_keys (GBinding *binding,
g_set_object (&current_filter, filter);
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (sort_model), filter);
g_value_take_object (to_value, gtk_no_selection_new (G_LIST_MODEL (filter_model)));
selection_model = gtk_no_selection_new (G_LIST_MODEL (filter_model));
g_object_unref (filter_model);
g_value_take_object (to_value, selection_model);
return TRUE;
}
@@ -394,8 +398,8 @@ do_listview_settings (GtkWidget *do_widget)
g_object_unref (actions);
model = create_settings_model (NULL, NULL);
treemodel = gtk_tree_list_model_new (model,
FALSE,
treemodel = gtk_tree_list_model_new (FALSE,
model,
TRUE,
create_settings_model,
NULL,
@@ -409,6 +413,8 @@ do_listview_settings (GtkWidget *do_widget)
columnview, NULL);
gtk_list_view_set_model (GTK_LIST_VIEW (listview), G_LIST_MODEL (selection));
g_object_unref (selection);
g_object_unref (treemodel);
g_object_unref (model);
name_column = GTK_COLUMN_VIEW_COLUMN (gtk_builder_get_object (builder, "name_column"));
sorter = gtk_string_sorter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "name"));
+7 -3
View File
@@ -281,16 +281,20 @@ GtkWidget *
create_weather_view (void)
{
GtkWidget *listview;
GListModel *model;
GListModel *model, *selection;
GtkListItemFactory *factory;
factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (setup_widget), NULL);
g_signal_connect (factory, "bind", G_CALLBACK (bind_widget), NULL);
model = G_LIST_MODEL (gtk_no_selection_new (create_weather_model ()));
listview = gtk_list_view_new_with_factory (model, factory);
listview = gtk_list_view_new_with_factory (factory);
gtk_orientable_set_orientation (GTK_ORIENTABLE (listview), GTK_ORIENTATION_HORIZONTAL);
gtk_list_view_set_show_separators (GTK_LIST_VIEW (listview), TRUE);
model = create_weather_model ();
selection = G_LIST_MODEL (gtk_no_selection_new (model));
gtk_list_view_set_model (GTK_LIST_VIEW (listview), selection);
g_object_unref (selection);
g_object_unref (model);
return listview;
}
+5 -1
View File
@@ -157,6 +157,7 @@ do_listview_words (GtkWidget *do_widget)
{
GtkWidget *header, *listview, *sw, *vbox, *search_entry, *open_button, *overlay;
GtkFilterListModel *filter_model;
GtkNoSelection *selection;
GtkStringList *stringlist;
GtkFilter *filter;
GFile *file;
@@ -214,15 +215,18 @@ do_listview_words (GtkWidget *do_widget)
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
listview = gtk_list_view_new_with_factory (
G_LIST_MODEL (gtk_no_selection_new (G_LIST_MODEL (filter_model))),
gtk_builder_list_item_factory_new_from_bytes (NULL,
g_bytes_new_static (factory_text, strlen (factory_text))));
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), listview);
selection = gtk_no_selection_new (G_LIST_MODEL (filter_model));
gtk_list_view_set_model (GTK_LIST_VIEW (listview), G_LIST_MODEL (selection));
g_object_unref (selection);
g_signal_connect (filter_model, "items-changed", G_CALLBACK (update_title_cb), progress);
g_signal_connect (filter_model, "notify::pending", G_CALLBACK (update_title_cb), progress);
update_title_cb (filter_model);
g_object_unref (filter_model);
}
if (!gtk_widget_get_visible (window))
+2 -2
View File
@@ -1136,8 +1136,8 @@ activate (GApplication *app)
g_signal_connect (search_bar, "notify::search-mode-enabled", G_CALLBACK (clear_search), NULL);
listmodel = create_demo_model ();
treemodel = gtk_tree_list_model_new (G_LIST_MODEL (listmodel),
FALSE,
treemodel = gtk_tree_list_model_new (FALSE,
G_LIST_MODEL (listmodel),
TRUE,
get_child_model,
NULL,
-5
View File
@@ -31,11 +31,6 @@
<update_contact>matthias.clasen_at_gmail.com</update_contact>
<developer_name>Matthias Clasen and others</developer_name>
<releases>
<release version="3.99.0" date="2020-07-30">
<description>
<p>A new developers snapshot towards GTK 4.0.</p>
</description>
</release>
<release version="3.94.0" date="2018-06-25">
<description>
<p>A new developers snapshot towards GTK 4.0.</p>
+18
View File
@@ -33,6 +33,9 @@
<object class="GtkLabel" id="label_plain">
<property name="label">Plain</property>
<property name="xalign">0</property>
<accessibility>
<relation type="label-for" target="scale_plain"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
@@ -45,6 +48,9 @@
<property name="draw-value">0</property>
<property name="adjustment">adjustment1</property>
<property name="hexpand">1</property>
<accessibility>
<relation type="labelled-by" target="label_plain"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
@@ -55,6 +61,9 @@
<object class="GtkLabel" id="label_marks">
<property name="label">Marks</property>
<property name="xalign">0</property>
<accessibility>
<relation type="label-for" target="scale_marks"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
@@ -74,6 +83,9 @@
<mark value="3" position="bottom"></mark>
<mark value="4" position="bottom"></mark>
</marks>
<accessibility>
<relation type="labelled-by" target="label_marks"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
@@ -84,6 +96,9 @@
<object class="GtkLabel" id="label_discrete">
<property name="label">Discrete</property>
<property name="xalign">0</property>
<accessibility>
<relation type="label-for" target="scale_discrete"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
@@ -97,6 +112,9 @@
<property name="draw-value">0</property>
<property name="adjustment">adjustment3</property>
<property name="hexpand">1</property>
<accessibility>
<relation type="labelled-by" target="label_discrete"/>
</accessibility>
<marks>
<mark value="0" position="bottom"></mark>
<mark value="1" position="bottom"></mark>
-16
View File
@@ -18,19 +18,3 @@ executable('gtk4-icon-browser',
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size,
install_dir: icontheme_dir
)
endforeach
# desktop file
install_data('org.gtk.IconBrowser4.desktop', install_dir: gtk_applicationsdir)
# appdata
install_data('org.gtk.IconBrowser4.appdata.xml', install_dir: gtk_appdatadir)
@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.gtk.IconBrowser4.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-2.0+</project_license>
<name>GTK Icon Browser</name>
<summary>Program to browse themed icons</summary>
<description>
<p>
GTK Icon Browser is a simple application to show themed icons that
are available on the system.
</p>
</description>
<screenshots>
<screenshot>
<image>https://static.gnome.org/appdata/gtk4-icon-browser/gtk-icon-browser1.png</image>
<caption>Icon Browser</caption>
</screenshot>
<screenshot>
<image>https://static.gnome.org/appdata/gtk4-icon-browser/gtk-icon-browser2.png</image>
<caption>Search</caption>
</screenshot>
</screenshots>
<kudos>
<kudo>HiDpiIcon</kudo>
<kudo>ModernToolkit</kudo>
</kudos>
<url type="homepage">https://www.gtk.org</url>
<translation type="gettext">gtk-4.0</translation>
<update_contact>matthias.clasen_at_gmail.com</update_contact>
<developer_name>Matthias Clasen and others</developer_name>
<releases>
<release version="3.99.0" date="2020-07-30">
<description>
<p>A new developers snapshot towards GTK 4.0.</p>
</description>
</release>
<release version="3.94.0" date="2018-06-25">
<description>
<p>A new developers snapshot towards GTK 4.0.</p>
</description>
</release>
</releases>
</component>
+48
View File
@@ -245,6 +245,9 @@
<object class="GtkImage" id="image1">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label1"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
@@ -255,6 +258,9 @@
<object class="GtkImage" id="image2">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label2"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
@@ -265,6 +271,9 @@
<object class="GtkImage" id="image3">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label3"/>
</accessibility>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
@@ -275,6 +284,9 @@
<object class="GtkImage" id="image4">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label4"/>
</accessibility>
<layout>
<property name="left-attach">3</property>
<property name="top-attach">1</property>
@@ -285,6 +297,9 @@
<object class="GtkImage" id="image5">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label5"/>
</accessibility>
<layout>
<property name="left-attach">4</property>
<property name="top-attach">1</property>
@@ -295,6 +310,9 @@
<object class="GtkImage" id="image6">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label5"/>
</accessibility>
<layout>
<property name="left-attach">5</property>
<property name="top-attach">1</property>
@@ -305,6 +323,9 @@
<object class="GtkImage" id="image7">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label5"/>
</accessibility>
<layout>
<property name="left-attach">6</property>
<property name="top-attach">1</property>
@@ -315,6 +336,9 @@
<object class="GtkImage" id="image8">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label6"/>
</accessibility>
<layout>
<property name="left-attach">7</property>
<property name="top-attach">1</property>
@@ -329,6 +353,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image1"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
@@ -343,6 +370,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image2"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
@@ -357,6 +387,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image3"/>
</accessibility>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
@@ -371,6 +404,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image4"/>
</accessibility>
<layout>
<property name="left-attach">3</property>
<property name="top-attach">2</property>
@@ -385,6 +421,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image5"/>
</accessibility>
<layout>
<property name="left-attach">4</property>
<property name="top-attach">2</property>
@@ -399,6 +438,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image6"/>
</accessibility>
<layout>
<property name="left-attach">5</property>
<property name="top-attach">2</property>
@@ -413,6 +455,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image7"/>
</accessibility>
<layout>
<property name="left-attach">6</property>
<property name="top-attach">2</property>
@@ -427,6 +472,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image8"/>
</accessibility>
<layout>
<property name="left-attach">7</property>
<property name="top-attach">2</property>
@@ -25,7 +25,7 @@
<update_contact>matthias.clasen_at_gmail.com</update_contact>
<developer_name>Matthias Clasen and others</developer_name>
<releases>
<release version="3.99.0" date="2020-07-30">
<release version="3.99.0" date="2020">
<description>
<p>A new developers snapshot towards GTK 4.0.</p>
</description>
@@ -32,11 +32,6 @@
<update_contact>matthias.clasen_at_gmail.com</update_contact>
<developer_name>Matthias Clasen and others</developer_name>
<releases>
<release version="3.99.0" date="2020-07-30">
<description>
<p>A new developers snapshot towards GTK 4.0.</p>
</description>
</release>
<release version="3.94.0" date="2018-06-25">
<description>
<p>A new developers snapshot towards GTK 4.0.</p>
+1
View File
@@ -565,6 +565,7 @@ on_scale_button_value_changed (GtkScaleButton *button,
}
gtk_widget_set_tooltip_text (GTK_WIDGET (button), str);
atk_object_set_description (gtk_widget_get_accessible (GTK_WIDGET (button)), str);
g_free (str);
}
+89 -1
View File
@@ -35,7 +35,7 @@
<attribute name="target">highcontrast-inverse</attribute>
</item>
</section>
</submenu>
</submenu>
<item>
<attribute name="label" translatable="yes">Transition Pages</attribute>
<attribute name="action">win.transition</attribute>
@@ -789,6 +789,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator" id="separator1">
<property name="orientation">vertical</property>
</object>
</child>
<child>
<object class="GtkBox" id="box19">
<property name="orientation">vertical</property>
@@ -884,6 +889,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator" id="separator2">
<property name="orientation">vertical</property>
</object>
</child>
<child>
<object class="GtkBox" id="box20">
<property name="orientation">vertical</property>
@@ -1032,6 +1042,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator" id="separator3">
<property name="orientation">vertical</property>
</object>
</child>
<child>
<object class="GtkBox" id="box26">
<property name="orientation">vertical</property>
@@ -1130,6 +1145,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator" id="separator4">
<property name="orientation">vertical</property>
</object>
</child>
<child>
<object class="GtkBox" id="box4">
<property name="orientation">vertical</property>
@@ -1229,6 +1249,9 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator" id="separator5"/>
</child>
<child>
<object class="GtkBox" id="box5">
<property name="spacing">10</property>
@@ -1545,6 +1568,9 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkFrame" id="page2frame1">
<child>
@@ -1613,6 +1639,9 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="has-frame">1</property>
@@ -1869,6 +1898,11 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="orientation">vertical</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
@@ -1945,6 +1979,9 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="vexpand">1</property>
@@ -1969,6 +2006,9 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkBox">
<child>
@@ -2029,6 +2069,11 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="orientation">vertical</property>
</object>
</child>
<child>
<object class="GtkBox" id="filler2">
<property name="orientation">vertical</property>
@@ -2038,6 +2083,9 @@ microphone-sensitivity-medium-symbolic</property>
<property name="halign">center</property>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkExpander" id="expander1">
<property name="expanded">1</property>
@@ -2212,6 +2260,9 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
@@ -2227,6 +2278,11 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="orientation">vertical</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
@@ -2316,6 +2372,9 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkFrame">
<child>
@@ -2793,6 +2852,11 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="orientation">vertical</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
@@ -2819,6 +2883,9 @@ microphone-sensitivity-medium-symbolic</property>
</style>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkNotebook">
<property name="scrollable">1</property>
@@ -2962,6 +3029,9 @@ bad things might happen.</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="label" translatable="yes">To free the princess, you have to slay the dragon.</property>
<accessibility>
<role type="static"/>
</accessibility>
</object>
</child>
</object>
@@ -3161,6 +3231,9 @@ bad things might happen.</property>
<object class="GtkLabel" id="title_label">
<property name="label">Title:</property>
<property name="xalign">1</property>
<accessibility>
<relation type="label-for" target="open_popover_entry"/>
</accessibility>
</object>
</child>
<child>
@@ -3168,6 +3241,9 @@ bad things might happen.</property>
<property name="valign">start</property>
<property name="label">Description:</property>
<property name="xalign">1</property>
<accessibility>
<relation type="label-for" target="open_popover_textview"/>
</accessibility>
<layout>
<property name="top-attach">1</property>
</layout>
@@ -3183,6 +3259,9 @@ bad things might happen.</property>
<property name="max-content-width">100</property>
<child>
<object class="GtkTextView" id="open_popover_textview">
<accessibility>
<relation type="labelled-by" target="description_label"/>
</accessibility>
</object>
</child>
<layout>
@@ -3195,6 +3274,9 @@ bad things might happen.</property>
<child>
<object class="GtkEntry" id="open_popover_entry">
<property name="activates-default">1</property>
<accessibility>
<relation type="labelled-by" target="title_label"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="column-span">2</property>
@@ -3275,6 +3357,9 @@ bad things might happen.</property>
<child>
<object class="GtkLabel">
<property name="label">No updates at this time</property>
<accessibility>
<role type="static"/>
</accessibility>
</object>
</child>
</object>
@@ -3283,6 +3368,9 @@ bad things might happen.</property>
<child>
<object class="GtkLabel">
<property name="label">You&apos;re in too deep!</property>
<accessibility>
<role type="static"/>
</accessibility>
</object>
</child>
</object>
+15 -5
View File
@@ -81,6 +81,7 @@ gdk_display_close
gdk_display_is_closed
gdk_display_is_rgba
gdk_display_is_composited
gdk_display_get_default_group
gdk_display_supports_input_shapes
gdk_display_get_app_launch_context
gdk_display_notify_startup_complete
@@ -189,7 +190,9 @@ gdk_surface_create_vulkan_context
gdk_surface_create_cairo_context
<SUBSECTION>
gdk_surface_queue_render
gdk_surface_queue_expose
gdk_surface_freeze_updates
gdk_surface_thaw_updates
gdk_surface_get_frame_clock
<SUBSECTION>
@@ -352,8 +355,14 @@ gdk_device_get_name
gdk_device_get_vendor_id
gdk_device_get_product_id
gdk_device_get_source
gdk_device_get_axis_use
gdk_device_get_associated_device
gdk_device_list_physical_devices
gdk_device_get_device_type
gdk_device_get_display
gdk_device_get_has_cursor
gdk_device_get_n_axes
gdk_device_get_axes
gdk_device_get_seat
gdk_device_get_num_touches
gdk_device_get_device_tool
@@ -365,14 +374,15 @@ gdk_device_get_scroll_lock_state
gdk_device_has_bidi_layouts
<SUBSECTION>
gdk_device_get_state
gdk_device_get_surface_at_position
GdkTimeCoord
gdk_device_get_axis
<SUBSECTION>
gdk_device_tool_get_serial
gdk_device_tool_get_tool_type
gdk_device_tool_get_hardware_id
gdk_device_tool_get_axes
<SUBSECTION Standard>
GDK_TYPE_AXIS_USE
@@ -428,8 +438,7 @@ gdk_seat_get_display
gdk_seat_get_capabilities
gdk_seat_get_pointer
gdk_seat_get_keyboard
gdk_seat_get_devices
gdk_seat_get_tools
gdk_seat_get_physical_devices
<SUBSECTION Standard>
GDK_SEAT
@@ -469,6 +478,7 @@ gdk_event_unref
gdk_event_get_event_type
gdk_event_get_surface
gdk_event_get_device
gdk_event_get_source_device
gdk_event_get_device_tool
gdk_event_get_time
gdk_event_get_display
@@ -813,7 +823,6 @@ gdk_x11_display_get_xrootwindow
gdk_x11_display_get_xcursor
gdk_x11_display_grab
gdk_x11_display_ungrab
gdk_x11_display_get_default_group
gdk_x11_display_error_trap_push
gdk_x11_display_error_trap_pop
gdk_x11_display_error_trap_pop_ignored
@@ -1121,6 +1130,7 @@ GDK_TYPE_GL_PROFILE
GdkMonitor
gdk_monitor_get_display
gdk_monitor_get_geometry
gdk_monitor_get_workarea
gdk_monitor_get_width_mm
gdk_monitor_get_height_mm
gdk_monitor_get_manufacturer
+6 -2
View File
@@ -127,7 +127,7 @@ compilation flags needed for that library along with version number
information.)
Some of the libraries that GTK depends on are maintained by the
GTK team: GLib, GdkPixbuf, Pango, and GObject Introspection.
GTK team: GLib, GdkPixbuf, Pango, ATK and GObject Introspection.
Other libraries are maintained separately.
- The GLib library provides core non-graphical functionality
@@ -139,6 +139,10 @@ Other libraries are maintained separately.
file formats. It is available [here](ttps://download.gnome.org/sources/gdk-pixbuf/).
- [Pango](http://www.pango.org) is a library for internationalized
text handling. It is available [here](https://download.gnome.org/sources/pango/).
- ATK is the Accessibility Toolkit. It provides a set of generic
interfaces allowing accessibility technologies such as
screen readers to interact with a graphical user interface.
It is available [here](https://download.gnome.org/sources/atk/).
- [GObject Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection)
is a framework for making introspection data available to language
bindings. It is available [here](https://download.gnome.org/sources/gobject-introspection/).
@@ -188,7 +192,7 @@ you'll have all of these installed already, or they will be easily
accessible through your operating system package repositories.
Then build and install the GTK libraries in the order:
GLib, Cairo, Pango, then GTK. For each library, follow the
GLib, Cairo, Pango, ATK, then GTK. For each library, follow the
instructions they provide, and make sure to share common settings
between them and the GTK build; if you are using a separate prefix
for GTK, for instance, you will need to use the same prefix for
+2 -2
View File
@@ -9,9 +9,9 @@ is used (the actual output on your system may be different):
```
$ pkg-config --cflags gtk4
-pthread -I/usr/include/gtk-4.0 -I/usr/lib64/gtk-4.0/include -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12
-pthread -I/usr/include/gtk-4.0 -I/usr/lib64/gtk-4.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12
$ pkg-config --libs gtk4
-pthread -lgtk-4 -lgdk-4 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0
-pthread -lgtk-4 -lgdk-4 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0
```
The simplest way to compile a program is to use the "backticks"
feature of the shell. If you enclose a command in backticks
+1 -7
View File
@@ -12,13 +12,6 @@ import subprocess
# The following code is taken from gtk-doc
def ExpandAbbreviations(symbol, text):
# Hack!
# Strip xlink namespace from hrefs since pandoc insists on
# inserting them, and namespace setup doesn't transfer across
# xi:include.
# Yay for XML!
text = re.sub('xlink:href', 'href', text)
# Convert '@param()'
text = re.sub(r'(\A|[^\\])\@(\w+((\.|->)\w+)*)\s*\(\)', r'\1<parameter>\2()</parameter>', text)
@@ -184,6 +177,7 @@ def ConvertToDocbook(infile, outfile):
subprocess.check_call(["pandoc", infile, "-o", outfile,
"--from=" + input_format,
"--to=" + output_format,
"--standalone",
"--top-level-division=" + division])
def ExpandGtkDocAbbreviations(infile, outfile):
-8
View File
@@ -55,7 +55,6 @@
<xi:include href="xml/gtkfilter.xml" />
<xi:include href="xml/gtkcustomfilter.xml" />
<xi:include href="xml/gtkmultifilter.xml" />
<xi:include href="xml/gtkboolfilter.xml" />
<xi:include href="xml/gtkstringfilter.xml" />
<xi:include href="xml/gtkfilefilter.xml" />
</section>
@@ -338,13 +337,6 @@
<xi:include href="xml/gtkshortcutlabel.xml" />
</chapter>
<chapter id="Accessibility">
<title>Accessibility</title>
<xi:include href="section-accessibility.xml"/>
<xi:include href="xml/gtkaccessible.xml" />
<xi:include href="xml/gtkatcontext.xml" />
</chapter>
<chapter id="MiscObjects">
<title>Miscellaneous</title>
<xi:include href="xml/gtkadjustment.xml" />
+28 -68
View File
@@ -88,6 +88,25 @@ GtkAccelLabelPrivate
gtk_accel_label_get_type
</SECTION>
<SECTION>
<FILE>gtkaccessible</FILE>
<TITLE>GtkAccessible</TITLE>
GtkAccessible
gtk_accessible_get_widget
gtk_accessible_set_widget
<SUBSECTION Standard>
GTK_ACCESSIBLE
GTK_TYPE_ACCESSIBLE
GTK_ACCESSIBLE_CLASS
GTK_ACCESSIBLE_GET_CLASS
GTK_IS_ACCESSIBLE
GTK_IS_ACCESSIBLE_CLASS
<SUBSECTION Private>
GtkAccessiblePrivate
gtk_accessible_get_type
</SECTION>
<SECTION>
<FILE>gtkadjustment</FILE>
<TITLE>GtkAdjustment</TITLE>
@@ -862,6 +881,7 @@ gtk_combo_box_set_active_id
gtk_combo_box_get_model
gtk_combo_box_set_model
gtk_combo_box_popdown
gtk_combo_box_get_popup_accessible
gtk_combo_box_get_row_separator_func
gtk_combo_box_set_row_separator_func
GtkSensitivityType
@@ -1203,6 +1223,9 @@ gtk_entry_completion_compute_prefix
gtk_entry_completion_complete
gtk_entry_completion_get_completion_prefix
gtk_entry_completion_insert_prefix
gtk_entry_completion_insert_action_text
gtk_entry_completion_insert_action_markup
gtk_entry_completion_delete_action
gtk_entry_completion_set_text_column
gtk_entry_completion_get_text_column
gtk_entry_completion_set_inline_completion
@@ -2809,7 +2832,7 @@ gtk_sort_list_model_set_model
gtk_sort_list_model_get_model
gtk_sort_list_model_set_incremental
gtk_sort_list_model_get_incremental
gtk_sort_list_model_get_pending
gtk_sort_list_model_get_peanding
<SUBSECTION Standard>
GTK_SORT_LIST_MODEL
GTK_IS_SORT_LIST_MODEL
@@ -4051,6 +4074,7 @@ GtkCellRendererState
GtkCellRendererMode
GtkCellRenderer
GtkCellRendererClass
gtk_cell_renderer_class_set_accessible_type
gtk_cell_renderer_get_aligned_area
gtk_cell_renderer_snapshot
gtk_cell_renderer_activate
@@ -4463,7 +4487,9 @@ gtk_widget_get_cursor
gtk_widget_set_cursor
gtk_widget_set_cursor_from_name
gtk_widget_mnemonic_activate
gtk_widget_class_set_accessible_type
gtk_widget_class_set_accessible_role
gtk_widget_get_accessible
gtk_widget_child_focus
gtk_widget_get_child_visible
gtk_widget_get_parent
@@ -7545,19 +7571,6 @@ GTK_TYPE_EXPRESSION
gtk_expression_get_type
</SECTION>
<SECTION>
<FILE>gtkboolfilter</FILE>
GtkBoolFilter
gtk_bool_filter_new
gtk_bool_filter_get_expression
gtk_bool_filter_set_expression
gtk_bool_filter_get_invert
gtk_bool_filter_set_invert
<SUBSECTION Private>
gtk_bool_filter_get_type
</SECTION>
<SECTION>
<FILE>gtkstringfilter</FILE>
GtkStringFilter
@@ -7581,7 +7594,7 @@ gtk_string_filter_get_type
<TITLE>GtkDropDown</TITLE>
GtkDropDown
gtk_drop_down_new
gtk_drop_down_new_from_strings
gtk_drop_down_set_from_strings
gtk_drop_down_set_model
gtk_drop_down_get_model
gtk_drop_down_set_selected
@@ -7626,56 +7639,3 @@ gtk_selection_filter_model_new_for_type
gtk_selection_filter_model_set_model
gtk_selection_filter_model_get_model
</SECTION>
<SECTION>
<FILE>gtkaccessible</FILE>
GtkAccessible
GtkAccessibleRole
GtkAccessibleState
GtkAccessibleProperty
GtkAccessibleRelation
GtkAccessibleTristate
GtkAccessibleInvalidState
GtkAccessibleAutocomplete
GtkAccessibleSort
gtk_accessible_get_accessible_role
gtk_accessible_update_state
gtk_accessible_update_state_value
gtk_accessible_reset_state
gtk_accessible_update_property
gtk_accessible_update_property_value
gtk_accessible_reset_property
gtk_accessible_update_relation
gtk_accessible_update_relation_value
gtk_accessible_reset_relation
<SUBSECTION Standard>
GTK_TYPE_ACCESSIBLE
GTK_TYPE_ACCESSIBLE_PROPERTY
GTK_TYPE_ACCESSIBLE_ROLE
GTK_TYPE_ACCESSIBLE_STATE
GTK_ACCESSIBLE
GTK_ACCESSIBLE_GET_IFACE
GTK_IS_ACCESSIBLE
<SUBSECTION Private>
gtk_accessible_get_type
</SECTION>
<SECTION>
<FILE>gtkatcontext</FILE>
GtkATContext
gtk_at_context_get_accessible
gtk_at_context_get_accessible_role
<SUBSECTION>
gtk_at_context_create
<SUBSECTION Standard>
GTK_TYPE_AT_CONTEXT
GTK_AT_CONTEXT
GTK_AT_CONTEXT_CLASS
GTK_AT_CONTEXT_GET_CLASS
GTK_IS_AT_CONTEXT
GTK_IS_AT_CONTEXT_CLASS
<SUBSECTION Private>
GtkATContextClass
gtk_at_context_get_type
</SECTION>
-1
View File
@@ -17,7 +17,6 @@ gtk_application_window_get_type
gtk_aspect_frame_get_type
gtk_assistant_get_type
gtk_assistant_page_get_type
gtk_at_context_get_type
gtk_bin_layout_get_type
gtk_bitset_get_type
gtk_expression_get_type
+1 -10
View File
@@ -6,24 +6,17 @@ private_headers = [
'gdkpixbufutilsprivate.h',
'gtkaccelgroupprivate.h',
'gtkaccelmapprivate.h',
'gtkaccessibleattributesetprivate.h',
'gtkaccessibleattributevalueprivate.h',
'gtkaccessibleprivate.h',
'gtkaccessiblevalueprivate.h',
'gtkactionhelperprivate.h',
'gtkactionmuxerprivate.h',
'gtkactionobservableprivate.h',
'gtkactionobserverprivate.h',
'gtkadjustmentprivate.h',
'gtkallocatedbitmaskprivate.h',
'gtkappchooserprivate.h',
'gtkapplicationaccelsprivate.h',
'gtkapplicationprivate.h',
'gtkatcontextprivate.h',
'gtkarrayimplprivate.h',
'gtkbindingsprivate.h',
'gtkbitmaskprivate.h',
'gtkbuilderprivate.h',
'gtkbuilderscopeprivate.h',
'gtkbuttonprivate.h',
'gtkcellareaboxcontextprivate.h',
'gtkcheckbuttonprivate.h',
@@ -52,7 +45,6 @@ private_headers = [
'gtkcssarrayvalueprivate.h',
'gtkcssbgsizevalueprivate.h',
'gtkcssbordervalueprivate.h',
'gtkcssboxesimplprivate.h',
'gtkcssboxesprivate.h',
'gtkcsscalcvalueprivate.h',
'gtkcsscolorvalueprivate.h',
@@ -401,7 +393,6 @@ expand_content_md_files = [
'drawing-model.md',
'css-overview.md',
'css-properties.md',
'section-accessibility.md',
'section-text-widget.md',
'section-tree-widget.md',
'section-list-widget.md',
+4 -11
View File
@@ -309,9 +309,10 @@ use the #GtkWindow:modal property of the dialog.
### Adapt to coordinate API changes
A number of coordinate APIs in GTK 3 had _double variants:
gdk_device_get_surface_at_position(), gdk_surface_get_device_position().
These have been changed to use doubles, and the _double variants
have been removed. Update your code accordingly.
gdk_device_get_position(), gdk_device_get_surface_at_position(),
gdk_surface_get_device_position(). These have been changed to use
doubles, and the _double variants have been removed. Update your
code accordingly.
Any APIs that deal with global (or root) coordinates have been
removed in GTK 4, since not all backends support them. You should
@@ -774,14 +775,6 @@ Instead of a monitor number, #GdkMonitor is now used throughout.
gdk_display_get_monitors() returns the list of monitors that can be queried
or observed for monitors to pass to APIs like gtk_window_fullscreen_on_monitor().
### Adapt to monitor API changes
The gdk_monitor_get_workarea() API is gone. Individual backends can still
provide this information, for example with gdk_x11_monitor_get_workarea().
If you use this information, your code should check which backend is in
use and then call the appropriate backend API.
### Adapt to cursor API changes
Use the new gtk_widget_set_cursor() function to set cursors, instead of
+12
View File
@@ -61,6 +61,18 @@ other widgets that display text.
</para></listitem>
</varlistentry>
<varlistentry>
<term>ATK</term>
<listitem><para>
ATK is the Accessibility Toolkit. It provides a set of generic
interfaces allowing accessibility technologies to interact with a
graphical user interface. For example, a screen reader uses ATK to
discover the text in an interface and read it to blind users. GTK
widgets have built-in support for accessibility using the ATK
framework.
</para></listitem>
</varlistentry>
<varlistentry>
<term>GdkPixbuf</term>
<listitem><para>
-212
View File
@@ -1,212 +0,0 @@
# GTK Accessibility {#gtk-accessibility}
## The standard accessibility interface
The #GtkAccessible interface provides the accessibility information about
an application's user interface elements. Assistive technology (AT)
applications, like Orca, convey this information to users with disabilities,
or reduced abilities, to help them use the application.
Standard GTK controls implement the #GtkAccessible interface and are thus
accessible to ATs by default. This means that if you use GTK controls such
as #GtkButton, #GtkEntry, or #GtkListView, you only need to supply
application-specific details when the defaults values are incomplete. You
can do this by setting the appropriate properties in your #GtkBuilder
template and UI definition files, or by setting the properties defined by
the #GtkAccessible interface.
If you are implementing your own #GtkWidget derived type, you will need to
set the #GtkAccessible properties yourself, and provide an implementation
of the #GtkAccessible virtual functions.
## Accessible roles and attributes
The fundamental concepts of an accessible widget are *roles* and
*attributes*; each GTK control has a role, while its functionality is
described by a set of *attributes*.
### Roles
Roles define the taxonomy and semantics of a UI control to any assistive
technology application; for instance, a button will have a role of
`GTK_ACCESSIBLE_ROLE_BUTTON`; an entry will have a role of
`GTK_ACCESSIBLE_ROLE_TEXTBOX`; a toggle button will have a role of
`GTK_ACCESSIBLE_ROLE_CHECKBOX`; etc.
Each role is part of the widget's instance, and **cannot** be changed over
time or as the result of a user action. Roles allows assistive technology
applications to identify a UI control and decide how to present it to a
user; if a part of the application's UI changes role, the control needs to
be removed and replaced with another one with the appropriate role.
#### List of accessible roles
Each role name is part of the #GtkAccessibleRole enumeration.
| Role name | Description | Related GTK widget |
|-----------|-------------|--------------------|
| `BUTTON` | A control that performs an action when pressed | #GtkButton, #GtkLinkButton, #GtkExpander |
| `CHECKBOX` | A control that has three possible value: `true`, `false`, or `undefined` | #GtkCheckButton |
| `COMBOBOX` | A control that can be expanded to show a list of possible values to select | #GtkComboBox |
| `DIALOG` | A dialog that prompts the user to enter information or require a response | #GtkDialog and subclasses |
| `IMG` | An image | #GtkImage, #GtkPicture |
| `LABEL` | A visible name or caption for a user interface component | #GtkLabel |
| `METER` | Represents a value within a known range | #GtkLevelBar |
| `PROGRESS_BAR` | An element that display progress | #GtkProgressBar |
| `RADIO` | A checkable input in a group of radio roles | #GtkRadioButton |
| `SCROLLBAR` | A graphical object controlling the scolling of content | #GtkScrollbar |
| `SEARCH_BOX` | A text box for entering search criteria | #GtkSearchEntry |
| `SEPARATOR` | A divider that separates sections of content or groups of items | #GtkSeparator |
| `SPIN_BUTTON` | A range control that allows seelcting among discrete choices | #GtkSpinButton |
| `SWITCH` | A control that represents on/off values | #GtkSwitch |
| `TEXT_BOX` | A type of input that allows free-form text as its value. | #GtkEntry, #GtkPasswordEntry, #GtkTextView |
| `WINDOW` | An application window | #GtkWindow |
| `...` | … |
See the [WAI-ARIA](https://www.w3.org/WAI/PF/aria/appendices#quickref) list
of roles for additional information.
### Attributes
Attributes provide specific information about an accessible UI
control, and describe it for the assistive technology applications. GTK
divides the accessible attributes into three categories:
- *properties*, described by the values of the #GtkAccessibleProperty
enumeration
- *relations*, described by the values of the #GtkAccessibleRelation
enumeration
- *states*, described by the values of the #GtkAccessibleState enumeration
Each attribute accepts a value of a specific type.
Unlike roles, attributes may change over time, or in response to user action;
for instance:
- a toggle button will change its %GTK_ACCESSIBLE_STATE_CHECKED state every
time it is toggled, either by the user or programmatically
- setting the mnemonic widget on a #GtkLabel will update the
%GTK_ACCESSIBLE_RELATION_LABELLED_BY relation on the widget with a
reference to the label
- changing the #GtkAdjustment instance on a #GtkScrollbar will change the
%GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, %GTK_ACCESSIBLE_PROPERTY_VALUE_MIN,
and %GTK_ACCESSIBLE_PROPERTY_VALUE_NOW properties with the upper, lower,
and value properties of the #GtkAdjustment
See the [WAI-ARIA](https://www.w3.org/WAI/PF/aria/appendices#quickref) list
of attributes for additional information.
#### List of accessible properties
Each state name is part of the #GtkAccessibleProperty enumeration.
| State name | ARIA attribute | Value type | Notes |
|------------|----------------|------------|-------|
| %GTK_ACCESSIBLE_STATE_BUSY | “aria-busy” | boolean |
| %GTK_ACCESSIBLE_STATE_CHECKED | “aria-checked” | #GtkAccessibleTristate | Indicates the current state of a #GtkCheckButton |
| %GTK_ACCESSIBLE_STATE_DISABLED | “aria-disabled” | boolean | Corresponds to the #GtkWidget:sensitive property on #GtkWidget |
| %GTK_ACCESSIBLE_STATE_EXPANDED | “aria-expanded” | boolean or undefined | Corresponds to the #GtkExpander:expanded property on #GtkExpander |
| %GTK_ACCESSIBLE_STATE_HIDDEN | “aria-hidden” | boolean | Corresponds to the #GtkWidget:visible property on #GtkWidget |
| %GTK_ACCESSIBLE_STATE_INVALID | “aria-invalid” | #GtkAccessibleInvalidState | Set when a widget is showing an error |
| %GTK_ACCESSIBLE_STATE_PRESSED | “aria-pressed” | #GtkAccessibleTristate | Indicates the current state of a #GtkToggleButton |
| %GTK_ACCESSIBLE_STATE_SELECTED | “aria-selected” | boolean or undefined | Set when a widget is selected |
#### List of accessible relations
Each state name is part of the #GtkAccessibleRelation enumeration.
| State name | ARIA attribute | Value type |
|------------|----------------|------------|
| %GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE | “aria-autocomplete” | #GtkAccessibleAutocomplete |
| %GTK_ACCESSIBLE_PROPERTY_DESCRIPTION | “aria-description” | translatable string |
| %GTK_ACCESSIBLE_PROPERTY_HAS_POPUP | “aria-haspopup” | boolean |
| %GTK_ACCESSIBLE_PROPERTY_KEY_SHORTCUTS | “aria-keyshortcuts” | string |
| %GTK_ACCESSIBLE_PROPERTY_LABEL | “aria-label” | translatable string |
| %GTK_ACCESSIBLE_PROPERTY_LEVEL | “aria-level” | integer |
| %GTK_ACCESSIBLE_PROPERTY_MODAL | “aria-modal” | boolean |
| %GTK_ACCESSIBLE_PROPERTY_MULTI_LINE | “aria-multiline” | boolean |
| %GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE | “aria-multiselectable” | boolean |
| %GTK_ACCESSIBLE_PROPERTY_ORIENTATION | “aria-orientation” | #GtkOrientation |
| %GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER | “aria-placeholder” | translatable string |
| %GTK_ACCESSIBLE_PROPERTY_READ_ONLY | “aria-readonly” | boolean |
| %GTK_ACCESSIBLE_PROPERTY_REQUIRED | “aria-required” | boolean |
| %GTK_ACCESSIBLE_PROPERTY_ROLE_DESCRIPTION | “aria-roledescription” | translatable string |
| %GTK_ACCESSIBLE_PROPERTY_SORT | “aria-sort” | #GtkAccessibleSort |
| %GTK_ACCESSIBLE_PROPERTY_VALUE_MAX | “aria-valuemax” | double |
| %GTK_ACCESSIBLE_PROPERTY_VALUE_MIN | “aria-valuemin” | double |
| %GTK_ACCESSIBLE_PROPERTY_VALUE_NOW | “aria-valuenow” | double |
| %GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT | “aria-valuetext” | translatable string |
#### List of accessible states
Each state name is part of the #GtkAccessibleState enumeration.
| State name | ARIA attribute | Value type |
|------------|----------------|------------|
| %GTK_ACCESSIBLE_RELATION_ACTIVE_DESCENDANT | “aria-activedescendant” | #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_COL_COUNT | “aria-colcount” | integer |
| %GTK_ACCESSIBLE_RELATION_COL_INDEX | “aria-colindex” | integer |
| %GTK_ACCESSIBLE_RELATION_COL_INDEX_TEXT | “aria-colindextext” | translatable string |
| %GTK_ACCESSIBLE_RELATION_COL_SPAN | “aria-colspan” | integer |
| %GTK_ACCESSIBLE_RELATION_CONTROLS | “aria-controls” | a #GList of #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_DESCRIBED_BY | “aria-describedby” | a #GList of #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_DETAILS | “aria-details” | a #GList of #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE | “aria-errormessage” | #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_FLOW_TO | “aria-flowto” | a #GList of #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_LABELLED_BY | “aria-labelledby” | a #GList of #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_OWNS | “aria-owns” | a #GList of #GtkAccessible |
| %GTK_ACCESSIBLE_RELATION_POS_IN_SET | “aria-posinset” | integer |
| %GTK_ACCESSIBLE_RELATION_ROW_COUNT | “aria-rowcount” | integer |
| %GTK_ACCESSIBLE_RELATION_ROW_INDEX | “aria-rowindex” | integer |
| %GTK_ACCESSIBLE_RELATION_ROW_INDEX_TEXT | “aria-rowindextext” | translatable string |
| %GTK_ACCESSIBLE_RELATION_ROW_SPAN | “aria-rowspan” | integer |
| %GTK_ACCESSIBLE_RELATION_SET_SIZE | “aria-setsize” | integer |
## Application development rules
Even if standard UI controls provided by GTK have accessibility information
out of the box, there are some additional properties and considerations for
application developers. For instance, if your application presents the user
with a form to fill out, you should ensure that:
* the container of the form has a `GTK_ACCESSIBLE_ROLE_FORM` role
* each text entry widget in the form has the `GTK_ACCESSIBLE_RELATION_LABELLED_BY`
relation pointing to the label widget that describes it
Another example: if you create a tool bar containing buttons with only icons,
you should ensure that:
* the container has a `GTK_ACCESSIBLE_ROLE_TOOLBAR` role
* each button has a `GTK_ACCESSIBLE_PROPERTY_LABEL` property set with the user
readable and localised action performed when pressed; for instance "Copy",
"Paste", "Add layer", or "Remove"
GTK will try to fill in some information by using ancillary UI control
property, for instance the accessible label will be taken from the label or
placeholder text used by the UI control, or from its tooltip, if the
`GTK_ACCESSIBLE_PROPERTY_LABEL` property or the `GTK_ACCESSIBLE_RELATION_LABELLED_BY`
relation are unset. Nevertheless, it is good practice and project hygiene
to explicitly specify the accessible properties, just like it's good practice
to specify tooltips and style classes.
Application developers using GTK **should** ensure that their UI controls
are accessible as part of the development process. When using `GtkBuilder`
templates and UI definition files, GTK provides a validation tool that
verifies that each UI element has a valid role and properties; this tool can
be used as part of the application's test suite to avoid regressions.
## Implementations
Each UI control implements the #GtkAccessible interface to allow widget and
application developers to specify the roles, state, and relations between UI
controls. This API is purely descriptive.
Each `GtkAccessible` implementation must provide a #GtkATContext instance,
which acts as a proxy to the specific platform's accessibility API:
* AT-SPI on Linux/BSD
* NSAccessibility on macOS
* Active Accessibility on Windows
Additionally, an ad hoc accessibility backend is available for the GTK
testsuite, to ensure reproducibility of issues in the CI pipeline.
+23 -1
View File
@@ -23,6 +23,10 @@
#include "gdksurfaceprivate.h"
#include "gdkprivate-broadway.h"
static void gdk_broadway_device_get_state (GdkDevice *device,
GdkSurface *surface,
double *axes,
GdkModifierType *mask);
static void gdk_broadway_device_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,
GdkCursor *cursor);
@@ -54,6 +58,7 @@ gdk_broadway_device_class_init (GdkBroadwayDeviceClass *klass)
{
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
device_class->get_state = gdk_broadway_device_get_state;
device_class->set_surface_cursor = gdk_broadway_device_set_surface_cursor;
device_class->query_state = gdk_broadway_device_query_state;
device_class->grab = gdk_broadway_device_grab;
@@ -72,6 +77,23 @@ gdk_broadway_device_init (GdkBroadwayDevice *device_core)
_gdk_device_add_axis (device, GDK_AXIS_Y, 0, 0, 1);
}
static void
gdk_broadway_device_get_state (GdkDevice *device,
GdkSurface *surface,
double *axes,
GdkModifierType *mask)
{
double x, y;
gdk_surface_get_device_position (surface, device, &x, &y, mask);
if (axes)
{
axes[0] = x;
axes[1] = y;
}
}
static void
gdk_broadway_device_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,
@@ -135,7 +157,7 @@ _gdk_broadway_surface_grab_check_unmap (GdkSurface *surface,
seat = gdk_display_get_default_seat (display);
devices = gdk_seat_get_devices (seat, GDK_SEAT_CAPABILITY_ALL);
devices = gdk_seat_get_physical_devices (seat, GDK_SEAT_CAPABILITY_ALL);
devices = g_list_prepend (devices, gdk_seat_get_keyboard (seat));
devices = g_list_prepend (devices, gdk_seat_get_pointer (seat));
+14
View File
@@ -119,6 +119,7 @@ create_core_pointer (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Pointer",
"type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
@@ -130,6 +131,7 @@ create_core_keyboard (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Keyboard",
"type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", display,
@@ -141,6 +143,7 @@ create_pointer (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Pointer",
"type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
@@ -152,6 +155,7 @@ create_keyboard (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Keyboard",
"type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", display,
@@ -163,6 +167,7 @@ create_touchscreen (GdkDisplay *display)
{
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Touchscreen",
"type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_TOUCHSCREEN,
"has-cursor", FALSE,
"display", display,
@@ -260,6 +265,14 @@ gdk_broadway_display_has_pending (GdkDisplay *display)
return FALSE;
}
static GdkSurface *
gdk_broadway_display_get_default_group (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return NULL;
}
static void
gdk_broadway_display_dispose (GObject *object)
{
@@ -428,6 +441,7 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
display_class->flush = gdk_broadway_display_flush;
display_class->has_pending = gdk_broadway_display_has_pending;
display_class->queue_events = _gdk_broadway_display_queue_events;
display_class->get_default_group = gdk_broadway_display_get_default_group;
display_class->get_next_serial = gdk_broadway_display_get_next_serial;
display_class->notify_startup_complete = gdk_broadway_display_notify_startup_complete;
+10
View File
@@ -100,6 +100,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
event = gdk_crossing_event_new (GDK_ENTER_NOTIFY,
surface,
display_broadway->core_pointer,
display_broadway->pointer,
message->base.time,
message->pointer.state,
message->pointer.win_x,
@@ -118,6 +119,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY,
surface,
display_broadway->core_pointer,
display_broadway->pointer,
message->base.time,
message->pointer.state,
message->pointer.win_x,
@@ -138,6 +140,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
{
event = gdk_motion_event_new (surface,
display_broadway->core_pointer,
display_broadway->pointer,
NULL,
message->base.time,
message->pointer.state,
@@ -164,6 +167,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
: GDK_BUTTON_RELEASE,
surface,
display_broadway->core_pointer,
display_broadway->pointer,
NULL,
message->base.time,
message->pointer.state,
@@ -183,6 +187,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
{
event = gdk_scroll_event_new_discrete (surface,
display_broadway->core_pointer,
display_broadway->pointer,
NULL,
message->base.time,
0,
@@ -229,6 +234,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
GUINT_TO_POINTER (message->touch.sequence_id),
surface,
display_broadway->core_pointer,
display_broadway->touchscreen,
message->base.time,
state,
message->touch.win_x,
@@ -257,6 +263,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
: GDK_KEY_RELEASE,
surface,
display_broadway->core_keyboard,
display_broadway->keyboard,
message->base.time,
message->key.key,
message->key.state,
@@ -273,6 +280,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
case BROADWAY_EVENT_UNGRAB_NOTIFY:
_gdk_display_device_grab_update (display,
display_broadway->core_pointer,
display_broadway->pointer,
message->base.serial);
break;
@@ -313,6 +321,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
{
event = gdk_focus_event_new (surface,
display_broadway->core_keyboard,
display_broadway->keyboard,
FALSE);
node = _gdk_event_queue_append (display, event);
@@ -323,6 +332,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
{
event = gdk_focus_event_new (surface,
display_broadway->core_keyboard,
display_broadway->keyboard,
TRUE);
node = _gdk_event_queue_append (display, event);
+59 -12
View File
@@ -556,20 +556,12 @@ gdk_broadway_surface_layout_popup (GdkSurface *surface,
int height,
GdkPopupLayout *layout)
{
GdkMonitor *monitor;
GdkRectangle bounds;
GdkRectangle final_rect;
int x, y;
monitor = gdk_surface_get_layout_monitor (surface, layout,
gdk_monitor_get_geometry);
gdk_monitor_get_geometry (monitor, &bounds);
gdk_surface_layout_popup_helper (surface,
width,
height,
monitor,
&bounds,
layout,
&final_rect);
@@ -1137,10 +1129,65 @@ create_moveresize_surface (MoveResizeData *mv_resize,
static void
calculate_unmoving_origin (MoveResizeData *mv_resize)
{
gdk_surface_get_geometry (mv_resize->moveresize_surface,
&mv_resize->moveresize_orig_x,
&mv_resize->moveresize_orig_y,
NULL, NULL);
int x, y, width, height;
if (mv_resize->moveresize_geom_mask & GDK_HINT_WIN_GRAVITY &&
mv_resize->moveresize_geometry.win_gravity == GDK_GRAVITY_STATIC)
{
gdk_surface_get_origin (mv_resize->moveresize_surface,
&mv_resize->moveresize_orig_x,
&mv_resize->moveresize_orig_y);
}
else
{
gdk_surface_get_geometry (mv_resize->moveresize_surface,
&x, &y, &width, &height);
switch (mv_resize->moveresize_geometry.win_gravity)
{
case GDK_GRAVITY_NORTH_WEST:
mv_resize->moveresize_orig_x = x;
mv_resize->moveresize_orig_y = y;
break;
case GDK_GRAVITY_NORTH:
mv_resize->moveresize_orig_x = x + width / 2;
mv_resize->moveresize_orig_y = y;
break;
case GDK_GRAVITY_NORTH_EAST:
mv_resize->moveresize_orig_x = x = width;
mv_resize->moveresize_orig_y = y;
break;
case GDK_GRAVITY_WEST:
mv_resize->moveresize_orig_x = x;
mv_resize->moveresize_orig_y = y + height / 2;
break;
case GDK_GRAVITY_CENTER:
mv_resize->moveresize_orig_x = x + width / 2;
mv_resize->moveresize_orig_y = y + height / 2;
break;
case GDK_GRAVITY_EAST:
mv_resize->moveresize_orig_x = x + width;
mv_resize->moveresize_orig_y = y + height / 2;
break;
case GDK_GRAVITY_SOUTH_WEST:
mv_resize->moveresize_orig_x = x + width;
mv_resize->moveresize_orig_y = y + height;
break;
case GDK_GRAVITY_SOUTH:
mv_resize->moveresize_orig_x = x + width / 2;
mv_resize->moveresize_orig_y = y + height;
break;
case GDK_GRAVITY_SOUTH_EAST:
mv_resize->moveresize_orig_x = x;
mv_resize->moveresize_orig_y = y + height;
break;
case GDK_GRAVITY_STATIC:
default:
mv_resize->moveresize_orig_x = x;
mv_resize->moveresize_orig_y = y;
break;
}
}
}
static void
+187 -3
View File
@@ -86,6 +86,8 @@ enum {
PROP_0,
PROP_DISPLAY,
PROP_NAME,
PROP_ASSOCIATED_DEVICE,
PROP_TYPE,
PROP_SOURCE,
PROP_HAS_CURSOR,
PROP_N_AXES,
@@ -93,6 +95,7 @@ enum {
PROP_PRODUCT_ID,
PROP_SEAT,
PROP_NUM_TOUCHES,
PROP_AXES,
PROP_TOOL,
PROP_DIRECTION,
PROP_HAS_BIDI_LAYOUTS,
@@ -139,6 +142,33 @@ gdk_device_class_init (GdkDeviceClass *klass)
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
/**
* GdkDevice:type:
*
* Device role in the device manager.
*/
device_props[PROP_TYPE] =
g_param_spec_enum ("type",
P_("Device type"),
P_("Device role in the device manager"),
GDK_TYPE_DEVICE_TYPE,
GDK_DEVICE_TYPE_LOGICAL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
/**
* GdkDevice:associated-device:
*
* Associated pointer or keyboard with this device, if any. Devices of
* type #GDK_DEVICE_TYPE_LOGICAL always come in keyboard/pointer pairs.
* Other device types will have a %NULL associated device.
*/
device_props[PROP_ASSOCIATED_DEVICE] =
g_param_spec_object ("associated-device",
P_("Associated device"),
P_("Associated pointer or keyboard with this device"),
GDK_TYPE_DEVICE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* GdkDevice:source:
@@ -157,7 +187,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
/**
* GdkDevice:has-cursor:
*
* Whether the device is represented by a cursor on the screen.
* Whether the device is represented by a cursor on the screen. Devices of type
* %GDK_DEVICE_TYPE_LOGICAL will have %TRUE here.
*/
device_props[PROP_HAS_CURSOR] =
g_param_spec_boolean ("has-cursor",
@@ -234,6 +265,17 @@ gdk_device_class_init (GdkDeviceClass *klass)
0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
/**
* GdkDevice:axes:
*
* The axes currently available for this device.
*/
device_props[PROP_AXES] =
g_param_spec_flags ("axes",
P_("Axes"),
P_("Axes"),
GDK_TYPE_AXIS_FLAGS, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
device_props[PROP_TOOL] =
g_param_spec_object ("tool",
@@ -353,14 +395,15 @@ gdk_device_dispose (GObject *object)
GdkDevice *device = GDK_DEVICE (object);
GdkDevice *associated = device->associated;
if (associated)
if (associated && device->type == GDK_DEVICE_TYPE_PHYSICAL)
_gdk_device_remove_physical_device (associated, device);
if (associated)
{
device->associated = NULL;
if (associated->associated == device)
if (device->type == GDK_DEVICE_TYPE_LOGICAL &&
associated->associated == device)
_gdk_device_set_associated_device (associated, NULL);
g_object_unref (associated);
@@ -389,6 +432,9 @@ gdk_device_set_property (GObject *object,
device->name = g_value_dup_string (value);
break;
case PROP_TYPE:
device->type = g_value_get_enum (value);
break;
case PROP_SOURCE:
device->source = g_value_get_enum (value);
break;
@@ -426,9 +472,15 @@ gdk_device_get_property (GObject *object,
case PROP_DISPLAY:
g_value_set_object (value, device->display);
break;
case PROP_ASSOCIATED_DEVICE:
g_value_set_object (value, device->associated);
break;
case PROP_NAME:
g_value_set_string (value, device->name);
break;
case PROP_TYPE:
g_value_set_enum (value, device->type);
break;
case PROP_SOURCE:
g_value_set_enum (value, device->source);
break;
@@ -450,6 +502,9 @@ gdk_device_get_property (GObject *object,
case PROP_NUM_TOUCHES:
g_value_set_uint (value, device->num_touches);
break;
case PROP_AXES:
g_value_set_flags (value, device->axis_flags);
break;
case PROP_TOOL:
g_value_set_object (value, device->last_tool);
break;
@@ -477,6 +532,37 @@ gdk_device_get_property (GObject *object,
}
}
/**
* gdk_device_get_state: (skip)
* @device: a #GdkDevice.
* @surface: a #GdkSurface.
* @axes: (nullable) (array): an array of doubles to store the values of
* the axes of @device in, or %NULL.
* @mask: (optional) (out): location to store the modifiers, or %NULL.
*
* Gets the current state of a pointer device relative to @surface. As a
* physical devices coordinates are those of its logical pointer, this
* function may not be called on devices of type %GDK_DEVICE_TYPE_PHYSICAL,
* unless there is an ongoing grab on them.
*
* See also: gdk_seat_grab().
*/
void
gdk_device_get_state (GdkDevice *device,
GdkSurface *surface,
double *axes,
GdkModifierType *mask)
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD);
g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL ||
gdk_display_device_is_grabbed (gdk_device_get_display (device), device));
if (GDK_DEVICE_GET_CLASS (device)->get_state)
GDK_DEVICE_GET_CLASS (device)->get_state (device, surface, axes, mask);
}
/*
* gdk_device_get_position:
* @device: pointer device to query status about.
@@ -492,6 +578,8 @@ gdk_device_get_position (GdkDevice *device,
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD);
g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL ||
gdk_display_device_is_grabbed (gdk_device_get_display (device), device));
_gdk_device_query_state (device, NULL, NULL, x, y, NULL);
}
@@ -508,6 +596,10 @@ gdk_device_get_position (GdkDevice *device,
* double precision. Returns %NULL if the surface tree under @device is not known to GDK (for example,
* belongs to another application).
*
* As a physical device coordinates are those of its logical pointer, this
* function may not be called on devices of type %GDK_DEVICE_TYPE_PHYSICAL,
* unless there is an ongoing grab on them, see gdk_seat_grab().
*
* Returns: (nullable) (transfer none): the #GdkSurface under the
* device position, or %NULL.
**/
@@ -521,6 +613,8 @@ gdk_device_get_surface_at_position (GdkDevice *device,
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, NULL);
g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL ||
gdk_display_device_is_grabbed (gdk_device_get_display (device), device), NULL);
surface = _gdk_device_surface_at_position (device, &tmp_x, &tmp_y, NULL);
@@ -622,6 +716,42 @@ gdk_device_get_display (GdkDevice *device)
return device->display;
}
/**
* gdk_device_get_associated_device:
* @device: a #GdkDevice
*
* Returns the #GdkDevice associated to @device:
*
* - if @device is of type %GDK_DEVICE_TYPE_LOGICAL, it will return
* the paired pointer or keyboard.
* - if @device is of type %GDK_DEVICE_TYPE_PHYSICAL, it will return
* the logical device to which @device is attached to.
* - if @device is of type %GDK_DEVICE_TYPE_FLOATING, %NULL will be
* returned, as there is no associated device.
*
* Returns: (nullable) (transfer none): The associated device, or
* %NULL
**/
GdkDevice *
gdk_device_get_associated_device (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
return device->associated;
}
static void
_gdk_device_set_device_type (GdkDevice *device,
GdkDeviceType type)
{
if (device->type != type)
{
device->type = type;
g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_TYPE]);
}
}
void
_gdk_device_set_associated_device (GdkDevice *device,
GdkDevice *associated)
@@ -640,6 +770,14 @@ _gdk_device_set_associated_device (GdkDevice *device,
if (associated)
device->associated = g_object_ref (associated);
if (device->type != GDK_DEVICE_TYPE_LOGICAL)
{
if (device->associated)
_gdk_device_set_device_type (device, GDK_DEVICE_TYPE_PHYSICAL);
else
_gdk_device_set_device_type (device, GDK_DEVICE_TYPE_FLOATING);
}
}
/**
@@ -656,6 +794,7 @@ GList *
gdk_device_list_physical_devices (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL, NULL);
return g_list_copy (device->physical_devices);
}
@@ -664,6 +803,9 @@ void
_gdk_device_add_physical_device (GdkDevice *device,
GdkDevice *physical)
{
g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL);
g_return_if_fail (gdk_device_get_device_type (physical) != GDK_DEVICE_TYPE_LOGICAL);
if (!g_list_find (device->physical_devices, physical))
device->physical_devices = g_list_prepend (device->physical_devices, physical);
}
@@ -674,6 +816,9 @@ _gdk_device_remove_physical_device (GdkDevice *device,
{
GList *elem;
g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL);
g_return_if_fail (gdk_device_get_device_type (physical) != GDK_DEVICE_TYPE_LOGICAL);
elem = g_list_find (device->physical_devices, physical);
if (elem == NULL)
return;
@@ -681,6 +826,22 @@ _gdk_device_remove_physical_device (GdkDevice *device,
device->physical_devices = g_list_delete_link (device->physical_devices, elem);
}
/**
* gdk_device_get_device_type:
* @device: a #GdkDevice
*
* Returns the device type for @device.
*
* Returns: the #GdkDeviceType for @device.
**/
GdkDeviceType
gdk_device_get_device_type (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_DEVICE_TYPE_LOGICAL);
return device->type;
}
/**
* gdk_device_get_n_axes:
* @device: a pointer #GdkDevice
@@ -824,7 +985,10 @@ _gdk_device_reset_axes (GdkDevice *device)
for (i = device->axes->len - 1; i >= 0; i--)
g_array_remove_index (device->axes, i);
device->axis_flags = 0;
g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_N_AXES]);
g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_AXES]);
}
guint
@@ -863,7 +1027,10 @@ _gdk_device_add_axis (GdkDevice *device,
device->axes = g_array_append_val (device->axes, axis_info);
pos = device->axes->len - 1;
device->axis_flags |= (1 << use);
g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_N_AXES]);
g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_AXES]);
return pos;
}
@@ -1152,6 +1319,7 @@ const char *
gdk_device_get_vendor_id (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL, NULL);
return device->vendor_id;
}
@@ -1170,6 +1338,7 @@ const char *
gdk_device_get_product_id (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL, NULL);
return device->product_id;
}
@@ -1205,11 +1374,26 @@ gdk_device_get_seat (GdkDevice *device)
return device->seat;
}
/**
* gdk_device_get_axes:
* @device: a #GdkDevice
*
* Returns the axes currently available on the device.
**/
GdkAxisFlags
gdk_device_get_axes (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->axis_flags;
}
void
gdk_device_update_tool (GdkDevice *device,
GdkDeviceTool *tool)
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL);
if (g_set_object (&device->last_tool, tool))
{
+47
View File
@@ -40,6 +40,7 @@ typedef struct _GdkTimeCoord GdkTimeCoord;
* @GDK_SOURCE_MOUSE: the device is a mouse. (This will be reported for the core
* pointer, even if it is something else, such as a trackball.)
* @GDK_SOURCE_PEN: the device is a stylus of a graphics tablet or similar device.
* @GDK_SOURCE_CURSOR: the device is a graphics tablet puck or similar device.
* @GDK_SOURCE_KEYBOARD: the device is a keyboard.
* @GDK_SOURCE_TOUCHSCREEN: the device is a direct-input touch device, such
* as a touchscreen or tablet
@@ -55,6 +56,7 @@ typedef enum
{
GDK_SOURCE_MOUSE,
GDK_SOURCE_PEN,
GDK_SOURCE_CURSOR,
GDK_SOURCE_KEYBOARD,
GDK_SOURCE_TOUCHSCREEN,
GDK_SOURCE_TOUCHPAD,
@@ -62,6 +64,23 @@ typedef enum
GDK_SOURCE_TABLET_PAD
} GdkInputSource;
/**
* GdkDeviceType:
* @GDK_DEVICE_TYPE_LOGICAL: Device is a logical device. There will
* be an associated focus indicator on the screen.
* @GDK_DEVICE_TYPE_PHYSICAL: Device is a physical device.
* @GDK_DEVICE_TYPE_FLOATING: Device is a physical device, currently
* not attached to any seat.
*
* Indicates the device type.
*/
typedef enum {
GDK_DEVICE_TYPE_LOGICAL,
GDK_DEVICE_TYPE_PHYSICAL,
GDK_DEVICE_TYPE_FLOATING
} GdkDeviceType;
/**
* GdkTimeCoord:
* @time: The timestamp for this event.
@@ -89,14 +108,39 @@ gboolean gdk_device_get_has_cursor (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkInputSource gdk_device_get_source (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkAxisUse gdk_device_get_axis_use (GdkDevice *device,
guint index_);
GDK_AVAILABLE_IN_ALL
void gdk_device_get_state (GdkDevice *device,
GdkSurface *surface,
double *axes,
GdkModifierType *mask);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
double *win_x,
double *win_y);
GDK_AVAILABLE_IN_ALL
int gdk_device_get_n_axes (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_axis (GdkDevice *device,
double *axes,
GdkAxisUse use,
double *value);
GDK_AVAILABLE_IN_ALL
GdkDisplay * gdk_device_get_display (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkDevice * gdk_device_get_associated_device (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GList * gdk_device_list_physical_devices (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkDeviceType gdk_device_get_device_type (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
const char *gdk_device_get_vendor_id (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
@@ -105,6 +149,9 @@ const char *gdk_device_get_product_id (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkSeat *gdk_device_get_seat (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkAxisFlags gdk_device_get_axes (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
guint gdk_device_get_num_touches (GdkDevice *device);
+2 -2
View File
@@ -39,6 +39,8 @@ struct _GdkDevice
char *name;
GdkInputSource source;
gboolean has_cursor;
GdkAxisFlags axis_flags;
GdkDeviceType type;
GdkDisplay *display;
/* The paired logical device for logical devices,
* or the associated logical device for physical ones
@@ -130,8 +132,6 @@ gboolean _gdk_device_translate_axis (GdkDevice *device,
GdkTimeCoord ** _gdk_device_allocate_history (GdkDevice *device,
int n_events);
GList * gdk_device_list_physical_devices (GdkDevice *device);
void _gdk_device_add_physical_device (GdkDevice *device,
GdkDevice *physical);
void _gdk_device_remove_physical_device (GdkDevice *device,
-16
View File
@@ -209,19 +209,3 @@ gdk_device_tool_get_tool_type (GdkDeviceTool *tool)
return tool->type;
}
/**
* gdk_device_tool_get_axes:
* @tool: a #GdkDeviceTool
*
* Gets the axes of the tool.
*
* Returns: the axes of @tool
*/
GdkAxisFlags
gdk_device_tool_get_axes (GdkDeviceTool *tool)
{
g_return_val_if_fail (tool != NULL, 0);
return tool->tool_axes;
}
-3
View File
@@ -71,9 +71,6 @@ guint64 gdk_device_tool_get_hardware_id (GdkDeviceTool *tool);
GDK_AVAILABLE_IN_ALL
GdkDeviceToolType gdk_device_tool_get_tool_type (GdkDeviceTool *tool);
GDK_AVAILABLE_IN_ALL
GdkAxisFlags gdk_device_tool_get_axes (GdkDeviceTool *tool);
G_END_DECLS
#endif /* __GDK_DEVICE_TOOL_H__ */
+33 -14
View File
@@ -491,6 +491,7 @@ generate_grab_broken_event (GdkDisplay *display,
GdkEvent *event;
event = gdk_grab_broken_event_new (surface,
device,
device,
grab_surface,
implicit);
@@ -602,6 +603,7 @@ get_current_toplevel (GdkDisplay *display,
static void
switch_to_pointer_grab (GdkDisplay *display,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceGrabInfo *grab,
GdkDeviceGrabInfo *last_grab,
guint32 time,
@@ -639,7 +641,12 @@ switch_to_pointer_grab (GdkDisplay *display,
if (grab == NULL /* ungrab */ ||
(!last_grab->owner_events && grab->owner_events) /* switched to owner_events */ )
{
if (grab)
/* Ungrabbed physical devices don't have a position by
* itself, rather depend on its logical pointer, so
* it doesn't make sense to track any position for
* these after the grab
*/
if (grab || gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL)
new_toplevel = get_current_toplevel (display, device, &x, &y, &state);
if (new_toplevel)
@@ -673,6 +680,7 @@ _gdk_display_update_last_event (GdkDisplay *display,
void
_gdk_display_device_grab_update (GdkDisplay *display,
GdkDevice *device,
GdkDevice *source_device,
gulong current_serial)
{
GdkDeviceGrabInfo *current_grab, *next_grab;
@@ -697,7 +705,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
if (!current_grab->activated)
{
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
switch_to_pointer_grab (display, device, current_grab, NULL, time, current_serial);
switch_to_pointer_grab (display, device, source_device, current_grab, NULL, time, current_serial);
}
break;
@@ -725,7 +733,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
g_hash_table_insert (display->device_grabs, device, grabs);
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
switch_to_pointer_grab (display, device,
switch_to_pointer_grab (display, device, source_device,
next_grab, current_grab,
time, current_serial);
@@ -811,15 +819,9 @@ _gdk_display_get_pointer_info (GdkDisplay *display,
GdkDevice *device)
{
GdkPointerSurfaceInfo *info;
GdkSeat *seat;
if (device)
{
seat = gdk_device_get_seat (device);
if (device == gdk_seat_get_keyboard (seat))
device = gdk_seat_get_pointer (seat);
}
if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
device = gdk_device_get_associated_device (device);
if (G_UNLIKELY (!device))
return NULL;
@@ -995,6 +997,25 @@ gdk_display_flush (GdkDisplay *display)
GDK_DISPLAY_GET_CLASS (display)->flush (display);
}
/**
* gdk_display_get_default_group:
* @display: a #GdkDisplay
*
* Returns the default group leader surface for all toplevel surfaces
* on @display. This surface is implicitly created by GDK.
* See gdk_surface_set_group().
*
* Returns: (transfer none): The default group leader surface
* for @display
**/
GdkSurface *
gdk_display_get_default_group (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_DISPLAY_GET_CLASS (display)->get_default_group (display);
}
/**
* gdk_display_get_clipboard:
* @display: a #GdkDisplay
@@ -1039,11 +1060,9 @@ gdk_display_get_primary_clipboard (GdkDisplay *display)
* gdk_display_supports_input_shapes:
* @display: a #GdkDisplay
*
* Returns %TRUE if gdk_surface_set_input_region() can
* Returns %TRUE if gdk_surface_input_shape_combine_mask() can
* be used to modify the input shape of surfaces on @display.
*
* On modern displays, this value is always %TRUE.
*
* Returns: %TRUE if surfaces with modified input shape are supported
*/
gboolean
+3
View File
@@ -71,6 +71,9 @@ gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
GdkDisplay *gdk_display_get_default (void);
GDK_AVAILABLE_IN_ALL
GdkSurface *gdk_display_get_default_group (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
GdkClipboard * gdk_display_get_clipboard (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
+2
View File
@@ -123,6 +123,7 @@ struct _GdkDisplayClass
gboolean (*has_pending) (GdkDisplay *display);
void (*queue_events) (GdkDisplay *display);
void (*make_default) (GdkDisplay *display);
GdkSurface * (*get_default_group) (GdkDisplay *display);
GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
@@ -178,6 +179,7 @@ void _gdk_display_update_last_event (GdkDisplay *display,
GdkEvent *event);
void _gdk_display_device_grab_update (GdkDisplay *display,
GdkDevice *device,
GdkDevice *source_device,
gulong current_serial);
GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
GdkDevice *device);
+97 -36
View File
@@ -153,6 +153,7 @@ gdk_event_finalize (GdkEvent *self)
g_clear_object (&self->surface);
g_clear_object (&self->device);
g_clear_object (&self->source_device);
g_type_free_instance ((GTypeInstance *) self);
}
@@ -397,6 +398,7 @@ type_name ## _get_type (void) \
* @event_type: the #GdkEventType to allocate
* @surface: (nullable): the #GdkSurface of the event
* @device: (nullable): the #GdkDevice of the event
* @source_device: (nullable): the source #GdkDevice of the event
* @time_: the event serial
*
* Allocates a #GdkEvent for the given @event_type, and sets its
@@ -408,6 +410,7 @@ static gpointer
gdk_event_alloc (GdkEventType event_type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time_)
{
g_assert (event_type >= GDK_DELETE && event_type < GDK_EVENT_LAST);
@@ -425,6 +428,7 @@ gdk_event_alloc (GdkEventType event_type,
event->event_type = event_type;
event->surface = surface != NULL ? g_object_ref (surface) : NULL;
event->device = device != NULL ? g_object_ref (device) : NULL;
event->source_device = source_device != NULL ? g_object_ref (source_device) : NULL;
event->time = time_;
return event;
@@ -483,6 +487,15 @@ check_event_sanity (GdkEvent *event)
return FALSE;
}
if (event->source_device != NULL &&
gdk_surface_get_display (event->surface) != gdk_device_get_display (event->source_device))
{
char *type = g_enum_to_string (GDK_TYPE_EVENT_TYPE, event->event_type);
g_warning ("Event of type %s with mismatched source device display", type);
g_free (type);
return FALSE;
}
return TRUE;
}
#endif
@@ -691,6 +704,7 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
gdk_scroll_event_get_deltas (old_event, &dx, &dy);
event = gdk_scroll_event_new (surface,
device,
gdk_event_get_source_device (old_event),
gdk_event_get_device_tool (old_event),
gdk_event_get_time (old_event),
gdk_event_get_modifier_state (old_event),
@@ -718,24 +732,25 @@ gdk_motion_event_push_history (GdkEvent *event,
GdkEvent *history_event)
{
GdkMotionEvent *self = (GdkMotionEvent *) event;
GdkDeviceTool *tool;
GdkTimeCoord hist;
int i;
GdkDevice *device;
int i, n_axes;
g_assert (GDK_IS_EVENT_TYPE (event, GDK_MOTION_NOTIFY));
g_assert (GDK_IS_EVENT_TYPE (history_event, GDK_MOTION_NOTIFY));
if (!self->tool)
return;
tool = gdk_event_get_device_tool (history_event);
device = gdk_event_get_device (history_event);
n_axes = gdk_device_get_n_axes (device);
memset (&hist, 0, sizeof (GdkTimeCoord));
hist.time = gdk_event_get_time (history_event);
hist.flags = gdk_device_tool_get_axes (tool);
hist.flags = gdk_device_get_axes (device);
for (i = GDK_AXIS_X; i < GDK_AXIS_LAST; i++)
gdk_event_get_axis (history_event, i, &hist.axes[i]);
for (i = 0; i < n_axes; i++)
{
GdkAxisUse use = gdk_device_get_axis_use (device, i);
gdk_event_get_axis (history_event, use, &hist.axes[use]);
}
if (G_UNLIKELY (!self->history))
self->history = g_array_new (FALSE, TRUE, sizeof (GdkTimeCoord));
@@ -937,8 +952,10 @@ gdk_event_get_axis (GdkEvent *event,
if (!gdk_event_get_axes (event, &axes, &n_axes))
return FALSE;
*value = axes[axis_use];
return TRUE;
if (axis_use >= gdk_device_get_n_axes (event->device))
return FALSE;
return gdk_device_get_axis (event->device, axes, axis_use, value);
}
/**
@@ -1200,6 +1217,33 @@ gdk_event_get_device (GdkEvent *event)
return event->device;
}
/**
* gdk_event_get_source_device:
* @event: a #GdkEvent
*
* This function returns the physical #GdkDevice that has triggered
* the event, falling back to the logical device, as returned by
* gdk_event_get_device(), if the event wasnt caused by
* interaction with a hardware device. This may happen for example
* in synthesized crossing events after a #GdkSurface updates its
* geometry or a grab is acquired/released.
*
* If the event does not contain a device field, this function will
* return %NULL.
*
* Returns: (nullable) (transfer none): a #GdkDevice, or %NULL.
**/
GdkDevice *
gdk_event_get_source_device (GdkEvent *event)
{
g_return_val_if_fail (GDK_IS_EVENT (event), NULL);
if (event->source_device)
return event->source_device;
return event->device;
}
/**
* gdk_event_get_device_tool:
* @event: a #GdkEvent
@@ -1358,13 +1402,13 @@ gdk_button_event_get_axes (GdkEvent *event,
guint *n_axes)
{
GdkButtonEvent *self = (GdkButtonEvent *) event;
GdkDevice *source_device = gdk_event_get_device (event);
GdkDevice *source_device = gdk_event_get_source_device (event);
if (source_device == NULL)
return FALSE;
*axes = self->axes;
*n_axes = GDK_AXIS_LAST;
*n_axes = gdk_device_get_n_axes (source_device);
return TRUE;
}
@@ -1389,6 +1433,7 @@ GdkEvent *
gdk_button_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
@@ -1400,7 +1445,7 @@ gdk_button_event_new (GdkEventType type,
g_return_val_if_fail (type == GDK_BUTTON_PRESS ||
type == GDK_BUTTON_RELEASE, NULL);
GdkButtonEvent *self = gdk_event_alloc (type, surface, device, time);
GdkButtonEvent *self = gdk_event_alloc (type, surface, device, source_device, time);
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
self->axes = axes;
@@ -1465,6 +1510,7 @@ GDK_DEFINE_EVENT_TYPE (GdkKeyEvent, gdk_key_event,
* @type: the event type, either %GDK_KEY_PRESS or %GDK_KEY_RELEASE
* @surface: the #GdkSurface of the event
* @device: the #GdkDevice related to the event
* @source_device: the source #GdkDevice related to the event
* @time: the event's timestamp
* @keycode: the keycode of the event
* @state: the modifiers state
@@ -1480,6 +1526,7 @@ GdkEvent *
gdk_key_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint keycode,
GdkModifierType state,
@@ -1490,7 +1537,7 @@ gdk_key_event_new (GdkEventType type,
g_return_val_if_fail (type == GDK_KEY_PRESS ||
type == GDK_KEY_RELEASE, NULL);
GdkKeyEvent *self = gdk_event_alloc (type, surface, device, time);
GdkKeyEvent *self = gdk_event_alloc (type, surface, device, source_device, time);
GdkEvent *event = (GdkEvent *) self;
self->keycode = keycode;
@@ -1854,7 +1901,7 @@ gdk_configure_event_new (GdkSurface *surface,
g_return_val_if_fail (width >= 0 && height >= 0, NULL);
self = gdk_event_alloc (GDK_CONFIGURE, surface, NULL, GDK_CURRENT_TIME);
self = gdk_event_alloc (GDK_CONFIGURE, surface, NULL, NULL, GDK_CURRENT_TIME);
self->width = width;
self->height = height;
@@ -1932,13 +1979,13 @@ gdk_touch_event_get_axes (GdkEvent *event,
guint *n_axes)
{
GdkTouchEvent *self = (GdkTouchEvent *) event;
GdkDevice *source_device = gdk_event_get_device (event);
GdkDevice *source_device = gdk_event_get_source_device (event);
if (source_device == NULL)
return FALSE;
*axes = self->axes;
*n_axes = GDK_AXIS_LAST;
*n_axes = gdk_device_get_n_axes (source_device);
return TRUE;
}
@@ -1966,6 +2013,7 @@ gdk_touch_event_new (GdkEventType type,
GdkEventSequence *sequence,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
GdkModifierType state,
double x,
@@ -1980,7 +2028,7 @@ gdk_touch_event_new (GdkEventType type,
type == GDK_TOUCH_UPDATE ||
type == GDK_TOUCH_CANCEL, NULL);
self = gdk_event_alloc (type, surface, device, time);
self = gdk_event_alloc (type, surface, device, source_device, time);
self->sequence = sequence;
self->state = state;
self->x = x;
@@ -2069,6 +2117,7 @@ GdkEvent *
gdk_crossing_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
GdkModifierType state,
double x,
@@ -2081,7 +2130,7 @@ gdk_crossing_event_new (GdkEventType type,
g_return_val_if_fail (type == GDK_ENTER_NOTIFY ||
type == GDK_LEAVE_NOTIFY, NULL);
self = gdk_event_alloc (type, surface, device, time);
self = gdk_event_alloc (type, surface, device, source_device, time);
self->state = state;
self->x = x;
@@ -2174,7 +2223,7 @@ GDK_DEFINE_EVENT_TYPE (GdkDeleteEvent, gdk_delete_event,
GdkEvent *
gdk_delete_event_new (GdkSurface *surface)
{
return gdk_event_alloc (GDK_DELETE, surface, NULL, GDK_CURRENT_TIME);
return gdk_event_alloc (GDK_DELETE, surface, NULL, NULL, GDK_CURRENT_TIME);
}
/* }}} */
@@ -2199,9 +2248,10 @@ GDK_DEFINE_EVENT_TYPE (GdkFocusEvent, gdk_focus_event,
GdkEvent *
gdk_focus_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
gboolean focus_in)
{
GdkFocusEvent *self = gdk_event_alloc (GDK_FOCUS_CHANGE, surface, device, GDK_CURRENT_TIME);
GdkFocusEvent *self = gdk_event_alloc (GDK_FOCUS_CHANGE, surface, device, source_device, GDK_CURRENT_TIME);
self->focus_in = focus_in;
@@ -2278,6 +2328,7 @@ GDK_DEFINE_EVENT_TYPE (GdkScrollEvent, gdk_scroll_event,
GdkEvent *
gdk_scroll_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
@@ -2285,7 +2336,7 @@ gdk_scroll_event_new (GdkSurface *surface,
double delta_y,
gboolean is_stop)
{
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, source_device, time);
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
self->state = state;
@@ -2300,13 +2351,14 @@ gdk_scroll_event_new (GdkSurface *surface,
GdkEvent *
gdk_scroll_event_new_discrete (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
GdkScrollDirection direction,
gboolean emulated)
{
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, source_device, time);
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
self->state = state;
@@ -2429,6 +2481,7 @@ GDK_DEFINE_EVENT_TYPE (GdkTouchpadEvent, gdk_touchpad_event,
GdkEvent *
gdk_touchpad_event_new_swipe (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
GdkModifierType state,
GdkTouchpadGesturePhase phase,
@@ -2438,7 +2491,7 @@ gdk_touchpad_event_new_swipe (GdkSurface *surface,
double dx,
double dy)
{
GdkTouchpadEvent *self = gdk_event_alloc (GDK_TOUCHPAD_SWIPE, surface, device, time);
GdkTouchpadEvent *self = gdk_event_alloc (GDK_TOUCHPAD_SWIPE, surface, device, source_device, time);
self->state = state;
self->phase = phase;
@@ -2454,6 +2507,7 @@ gdk_touchpad_event_new_swipe (GdkSurface *surface,
GdkEvent *
gdk_touchpad_event_new_pinch (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
GdkModifierType state,
GdkTouchpadGesturePhase phase,
@@ -2465,7 +2519,7 @@ gdk_touchpad_event_new_pinch (GdkSurface *surface,
double scale,
double angle_delta)
{
GdkTouchpadEvent *self = gdk_event_alloc (GDK_TOUCHPAD_PINCH, surface, device, time);
GdkTouchpadEvent *self = gdk_event_alloc (GDK_TOUCHPAD_PINCH, surface, device, source_device, time);
self->state = state;
self->phase = phase;
@@ -2607,13 +2661,14 @@ GDK_DEFINE_EVENT_TYPE (GdkPadEvent, gdk_pad_event,
GdkEvent *
gdk_pad_event_new_ring (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint group,
guint index,
guint mode,
double value)
{
GdkPadEvent *self = gdk_event_alloc (GDK_PAD_RING, surface, device, time);
GdkPadEvent *self = gdk_event_alloc (GDK_PAD_RING, surface, device, source_device, time);
self->group = group;
self->index = index;
@@ -2626,13 +2681,14 @@ gdk_pad_event_new_ring (GdkSurface *surface,
GdkEvent *
gdk_pad_event_new_strip (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint group,
guint index,
guint mode,
double value)
{
GdkPadEvent *self = gdk_event_alloc (GDK_PAD_STRIP, surface, device, time);
GdkPadEvent *self = gdk_event_alloc (GDK_PAD_STRIP, surface, device, source_device, time);
self->group = group;
self->index = index;
@@ -2646,6 +2702,7 @@ GdkEvent *
gdk_pad_event_new_button (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint group,
guint button,
@@ -2656,7 +2713,7 @@ gdk_pad_event_new_button (GdkEventType type,
g_return_val_if_fail (type == GDK_PAD_BUTTON_PRESS ||
type == GDK_PAD_BUTTON_RELEASE, NULL);
self = gdk_event_alloc (type, surface, device, time);
self = gdk_event_alloc (type, surface, device, source_device, time);
self->group = group;
self->button = button;
@@ -2668,11 +2725,12 @@ gdk_pad_event_new_button (GdkEventType type,
GdkEvent *
gdk_pad_event_new_group_mode (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint group,
guint mode)
{
GdkPadEvent *self = gdk_event_alloc (GDK_PAD_GROUP_MODE, surface, device, time);
GdkPadEvent *self = gdk_event_alloc (GDK_PAD_GROUP_MODE, surface, device, source_device, time);
self->group = group;
self->mode = mode;
@@ -2801,13 +2859,13 @@ gdk_motion_event_get_axes (GdkEvent *event,
guint *n_axes)
{
GdkMotionEvent *self = (GdkMotionEvent *) event;
GdkDevice *source_device = gdk_event_get_device (event);
GdkDevice *source_device = gdk_event_get_source_device (event);
if (source_device == NULL)
return FALSE;
*axes = self->axes;
*n_axes = GDK_AXIS_LAST;
*n_axes = gdk_device_get_n_axes (source_device);
return TRUE;
}
@@ -2830,6 +2888,7 @@ GDK_DEFINE_EVENT_TYPE (GdkMotionEvent, gdk_motion_event,
GdkEvent *
gdk_motion_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
@@ -2837,7 +2896,7 @@ gdk_motion_event_new (GdkSurface *surface,
double y,
double *axes)
{
GdkMotionEvent *self = gdk_event_alloc (GDK_MOTION_NOTIFY, surface, device, time);
GdkMotionEvent *self = gdk_event_alloc (GDK_MOTION_NOTIFY, surface, device, source_device, time);
self->tool = tool ? g_object_ref (tool) : NULL;
self->state = state;
@@ -2945,6 +3004,7 @@ GdkEvent *
gdk_proximity_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
guint32 time)
{
@@ -2953,7 +3013,7 @@ gdk_proximity_event_new (GdkEventType type,
g_return_val_if_fail (type == GDK_PROXIMITY_IN ||
type == GDK_PROXIMITY_OUT, NULL);
self = gdk_event_alloc (type, surface, device, time);
self = gdk_event_alloc (type, surface, device, source_device, time);
self->tool = tool ? g_object_ref (tool) : NULL;
@@ -3029,7 +3089,7 @@ gdk_dnd_event_new (GdkEventType type,
type == GDK_DRAG_LEAVE ||
type == GDK_DROP_START, NULL);
self = gdk_event_alloc (type, surface, device, time);
self = gdk_event_alloc (type, surface, device, NULL, time);
self->drop = drop != NULL ? g_object_ref (drop) : NULL;
self->x = x;
@@ -3082,10 +3142,11 @@ GDK_DEFINE_EVENT_TYPE (GdkGrabBrokenEvent, gdk_grab_broken_event,
GdkEvent *
gdk_grab_broken_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkSurface *grab_surface,
gboolean implicit)
{
GdkGrabBrokenEvent *self = gdk_event_alloc (GDK_GRAB_BROKEN, surface, device, GDK_CURRENT_TIME);
GdkGrabBrokenEvent *self = gdk_event_alloc (GDK_GRAB_BROKEN, surface, device, source_device, GDK_CURRENT_TIME);
self->grab_surface = grab_surface;
self->implicit = implicit;
+3
View File
@@ -350,6 +350,9 @@ GdkSeat * gdk_event_get_seat (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkDevice * gdk_event_get_device (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkDevice * gdk_event_get_source_device (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkDeviceTool * gdk_event_get_device_tool (GdkEvent *event);
+18
View File
@@ -42,6 +42,7 @@ typedef struct _GdkEventClass GdkEventClass;
* @event_type: the specialized event type
* @surface: the surface of the event
* @device: the device of the event
* @source_device: the source device
* @time: a serial identifier of the event that can be used to order
* two events
* @flags: event flags
@@ -62,6 +63,7 @@ struct _GdkEvent
/* The devices associated to the event */
GdkDevice *device;
GdkDevice *source_device;
guint32 time;
guint16 flags;
@@ -448,6 +450,7 @@ void gdk_event_init_types (void);
GdkEvent * gdk_button_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
@@ -458,6 +461,7 @@ GdkEvent * gdk_button_event_new (GdkEventType type,
GdkEvent * gdk_motion_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
@@ -468,6 +472,7 @@ GdkEvent * gdk_motion_event_new (GdkSurface *surface,
GdkEvent * gdk_crossing_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
GdkModifierType state,
double x,
@@ -478,12 +483,14 @@ GdkEvent * gdk_crossing_event_new (GdkEventType type,
GdkEvent * gdk_proximity_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
guint32 time);
GdkEvent * gdk_key_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint keycode,
GdkModifierType modifiers,
@@ -493,6 +500,7 @@ GdkEvent * gdk_key_event_new (GdkEventType type,
GdkEvent * gdk_focus_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
gboolean focus_in);
GdkEvent * gdk_configure_event_new (GdkSurface *surface,
@@ -503,6 +511,7 @@ GdkEvent * gdk_delete_event_new (GdkSurface *surface);
GdkEvent * gdk_scroll_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
@@ -512,6 +521,7 @@ GdkEvent * gdk_scroll_event_new (GdkSurface *surface,
GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
guint32 time,
GdkModifierType state,
@@ -522,6 +532,7 @@ GdkEvent * gdk_touch_event_new (GdkEventType type,
GdkEventSequence *sequence,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
GdkModifierType state,
double x,
@@ -531,6 +542,7 @@ GdkEvent * gdk_touch_event_new (GdkEventType type,
GdkEvent * gdk_touchpad_event_new_swipe (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
GdkModifierType state,
GdkTouchpadGesturePhase phase,
@@ -542,6 +554,7 @@ GdkEvent * gdk_touchpad_event_new_swipe (GdkSurface *surface,
GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
GdkModifierType state,
GdkTouchpadGesturePhase phase,
@@ -555,6 +568,7 @@ GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
GdkEvent * gdk_pad_event_new_ring (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint group,
guint index,
@@ -563,6 +577,7 @@ GdkEvent * gdk_pad_event_new_ring (GdkSurface *surface,
GdkEvent * gdk_pad_event_new_strip (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint group,
guint index,
@@ -572,6 +587,7 @@ GdkEvent * gdk_pad_event_new_strip (GdkSurface *surface,
GdkEvent * gdk_pad_event_new_button (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint group,
guint button,
@@ -579,6 +595,7 @@ GdkEvent * gdk_pad_event_new_button (GdkEventType type,
GdkEvent * gdk_pad_event_new_group_mode (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint group,
guint mode);
@@ -593,6 +610,7 @@ GdkEvent * gdk_dnd_event_new (GdkEventType type,
GdkEvent * gdk_grab_broken_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkSurface *grab_surface,
gboolean implicit);
+1 -3
View File
@@ -334,7 +334,6 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
cairo_region_t *clip_region;
GdkGLContextPaintData *paint_data;
int major, minor, version;
gboolean es_use_bgra = FALSE;
paint_context = gdk_surface_get_paint_gl_context (surface, NULL);
if (paint_context == NULL)
@@ -344,7 +343,6 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
}
clip_region = gdk_cairo_region_from_clip (cr);
es_use_bgra = gdk_gl_context_use_es_bgra (paint_context);
gdk_gl_context_make_current (paint_context);
paint_data = gdk_gl_context_get_paint_data (paint_context);
@@ -415,7 +413,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
glReadPixels (x, y, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
cairo_image_surface_get_data (image));
else
glReadPixels (x, y, width, height, es_use_bgra ? GL_BGRA : GL_RGBA, GL_UNSIGNED_BYTE,
glReadPixels (x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE,
cairo_image_surface_get_data (image));
glPixelStorei (GL_PACK_ROW_LENGTH, 0);
+2 -33
View File
@@ -92,10 +92,6 @@
#include "gdkintl.h"
#include "gdk-private.h"
#ifdef GDK_WINDOWING_WIN32
# include "gdk/win32/gdkwin32.h"
#endif
#include <epoxy/gl.h>
typedef struct {
@@ -997,14 +993,11 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
has_npot = priv->gl_version >= 20;
has_texture_rectangle = FALSE;
/* This should check for GL_NV_framebuffer_blit as well - see extension at:
/* This should check for GL_NV_framebuffer_blit - see extension at:
*
* https://www.khronos.org/registry/gles/extensions/NV/NV_framebuffer_blit.txt
*
* for ANGLE, we can enable bit blitting if we have the
* GL_ANGLE_framebuffer_blit extension
*/
priv->has_gl_framebuffer_blit = epoxy_has_gl_extension ("GL_ANGLE_framebuffer_blit");
priv->has_gl_framebuffer_blit = FALSE;
/* No OES version */
priv->has_frame_terminator = FALSE;
@@ -1222,27 +1215,3 @@ gdk_gl_context_get_current (void)
return current;
}
gboolean
gdk_gl_context_has_debug (GdkGLContext *self)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
return priv->debug_enabled || priv->use_khr_debug;
}
/* This is currently private! */
/* When using GL/ES, don't flip the 'R' and 'B' bits on Windows/ANGLE for glReadPixels() */
gboolean
gdk_gl_context_use_es_bgra (GdkGLContext *context)
{
if (!gdk_gl_context_get_use_es (context))
return FALSE;
#ifdef GDK_WINDOWING_WIN32
if (GDK_WIN32_IS_GL_CONTEXT (context))
return TRUE;
#endif
return FALSE;
}
+1 -6
View File
@@ -1,7 +1,7 @@
/* GDK - The GIMP Drawing Kit
*
* gdkglcontextprivate.h: GL context abstraction
*
*
* Copyright © 2014 Emmanuele Bassi
*
* This library is free software; you can redistribute it and/or
@@ -105,11 +105,6 @@ void gdk_gl_context_label_object_printf (GdkGLContext
guint name,
const char *format,
...) G_GNUC_PRINTF (4, 5);
gboolean gdk_gl_context_has_debug (GdkGLContext *self) G_GNUC_PURE;
gboolean gdk_gl_context_use_es_bgra (GdkGLContext *context);
G_END_DECLS
#endif /* __GDK_GL_CONTEXT_PRIVATE_H__ */
+15 -11
View File
@@ -268,13 +268,7 @@ void gdk_device_ungrab (GdkDevice *device,
void gdk_device_get_position (GdkDevice *device,
double *x,
double *y);
int gdk_device_get_n_axes (GdkDevice *device);
gboolean gdk_device_get_axis (GdkDevice *device,
double *axes,
GdkAxisUse use,
double *value);
GdkAxisUse gdk_device_get_axis_use (GdkDevice *device,
guint index_);
void gdk_surface_get_root_coords (GdkSurface *surface,
int x,
@@ -296,8 +290,15 @@ GdkGLContext *gdk_surface_get_shared_data_gl_context (GdkSurface *surface);
typedef enum
{
GDK_HINT_POS = 1 << 0,
GDK_HINT_MIN_SIZE = 1 << 1,
GDK_HINT_MAX_SIZE = 1 << 2,
GDK_HINT_BASE_SIZE = 1 << 3,
GDK_HINT_ASPECT = 1 << 4,
GDK_HINT_RESIZE_INC = 1 << 5,
GDK_HINT_WIN_GRAVITY = 1 << 6,
GDK_HINT_USER_POS = 1 << 7,
GDK_HINT_USER_SIZE = 1 << 8
} GdkSurfaceHints;
typedef enum
@@ -326,6 +327,13 @@ struct _GdkGeometry
int min_height;
int max_width;
int max_height;
int base_width;
int base_height;
int width_inc;
int height_inc;
double min_aspect;
double max_aspect;
GdkGravity win_gravity;
};
GDK_AVAILABLE_IN_ALL
@@ -380,10 +388,6 @@ void gdk_surface_begin_move_drag (GdkSurface *surface,
int y,
guint32 timestamp);
void gdk_surface_freeze_updates (GdkSurface *surface);
void gdk_surface_thaw_updates (GdkSurface *surface);
G_END_DECLS
#endif /* __GDK_INTERNALS_H__ */
+47
View File
@@ -51,6 +51,7 @@ enum {
PROP_CONNECTOR,
PROP_SCALE_FACTOR,
PROP_GEOMETRY,
PROP_WORKAREA,
PROP_WIDTH_MM,
PROP_HEIGHT_MM,
PROP_REFRESH_RATE,
@@ -111,6 +112,14 @@ gdk_monitor_get_property (GObject *object,
g_value_set_boxed (value, &monitor->geometry);
break;
case PROP_WORKAREA:
{
GdkRectangle workarea;
gdk_monitor_get_workarea (monitor, &workarea);
g_value_set_boxed (value, &workarea);
}
break;
case PROP_WIDTH_MM:
g_value_set_int (value, monitor->width_mm);
break;
@@ -213,6 +222,12 @@ gdk_monitor_class_init (GdkMonitorClass *class)
"The geometry of the monitor",
GDK_TYPE_RECTANGLE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
props[PROP_WORKAREA] =
g_param_spec_boxed ("workarea",
"Workarea",
"The workarea of the monitor",
GDK_TYPE_RECTANGLE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
props[PROP_WIDTH_MM] =
g_param_spec_int ("width-mm",
"Physical width",
@@ -301,6 +316,38 @@ gdk_monitor_get_geometry (GdkMonitor *monitor,
*geometry = monitor->geometry;
}
/**
* gdk_monitor_get_workarea:
* @monitor: a #GdkMonitor
* @workarea: (out): a #GdkRectangle to be filled with
* the monitor workarea
*
* Retrieves the size and position of the work area on a monitor
* within the display coordinate space. The returned geometry is in
* application pixels, not in device pixels (see
* gdk_monitor_get_scale_factor()).
*
* The work area should be considered when positioning menus and
* similar popups, to avoid placing them below panels, docks or other
* desktop components.
*
* Note that not all backends may have a concept of workarea. This
* function will return the monitor geometry if a workarea is not
* available, or does not apply.
*/
void
gdk_monitor_get_workarea (GdkMonitor *monitor,
GdkRectangle *workarea)
{
g_return_if_fail (GDK_IS_MONITOR (monitor));
g_return_if_fail (workarea != NULL);
if (GDK_MONITOR_GET_CLASS (monitor)->get_workarea)
GDK_MONITOR_GET_CLASS (monitor)->get_workarea (monitor, workarea);
else
*workarea = monitor->geometry;
}
/**
* gdk_monitor_get_width_mm:
* @monitor: a #GdkMonitor
+3
View File
@@ -69,6 +69,9 @@ GDK_AVAILABLE_IN_ALL
void gdk_monitor_get_geometry (GdkMonitor *monitor,
GdkRectangle *geometry);
GDK_AVAILABLE_IN_ALL
void gdk_monitor_get_workarea (GdkMonitor *monitor,
GdkRectangle *workarea);
GDK_AVAILABLE_IN_ALL
int gdk_monitor_get_width_mm (GdkMonitor *monitor);
GDK_AVAILABLE_IN_ALL
int gdk_monitor_get_height_mm (GdkMonitor *monitor);
+3
View File
@@ -48,6 +48,9 @@ struct _GdkMonitor {
struct _GdkMonitorClass {
GObjectClass parent_class;
void (* get_workarea) (GdkMonitor *monitor,
GdkRectangle *geometry);
};
GdkMonitor * gdk_monitor_new (GdkDisplay *display);
+6 -41
View File
@@ -22,7 +22,6 @@
#include <glib-object.h>
#include "gdkdisplay.h"
#include "gdkdevice.h"
#include "gdkdevicetoolprivate.h"
#include "gdkseatprivate.h"
#include "gdkdeviceprivate.h"
#include "gdkintl.h"
@@ -324,26 +323,26 @@ gdk_seat_ungrab (GdkSeat *seat)
}
/**
* gdk_seat_get_devices:
* gdk_seat_get_physical_devices:
* @seat: a #GdkSeat
* @capabilities: capabilities to get devices for
*
* Returns the devices that match the given capabilities.
* Returns the physical devices that match the given capabilities.
*
* Returns: (transfer container) (element-type GdkDevice): A list of #GdkDevices.
* The list must be freed with g_list_free(), the elements are owned
* by GDK and must not be freed.
**/
GList *
gdk_seat_get_devices (GdkSeat *seat,
GdkSeatCapabilities capabilities)
gdk_seat_get_physical_devices (GdkSeat *seat,
GdkSeatCapabilities capabilities)
{
GdkSeatClass *seat_class;
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
seat_class = GDK_SEAT_GET_CLASS (seat);
return seat_class->get_devices (seat, capabilities);
return seat_class->get_physical_devices (seat, capabilities);
}
/**
@@ -439,45 +438,11 @@ GdkDeviceTool *
gdk_seat_get_tool (GdkSeat *seat,
guint64 serial,
guint64 hw_id)
{
GdkDeviceTool *match = NULL;
GList *tools, *l;
tools = gdk_seat_get_tools (seat);
for (l = tools; l; l = l->next)
{
GdkDeviceTool *tool = l->data;
if (tool->serial == serial && tool->hw_id == hw_id)
{
match = tool;
break;
}
}
g_list_free (tools);
return match;
}
/**
* gdk_seat_get_tools:
* @seat: A #GdkSeat
*
* Returns all #GdkDeviceTools that are known to the
* application.
*
* Returns: (transfer container) (element-type Gdk.DeviceTool): A list of tools. Free with
* g_list_free().
**/
GList *
gdk_seat_get_tools (GdkSeat *seat)
{
GdkSeatClass *seat_class;
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
seat_class = GDK_SEAT_GET_CLASS (seat);
return seat_class->get_tools (seat);
return seat_class->get_tool (seat, serial, hw_id);
}
+1 -3
View File
@@ -75,11 +75,9 @@ GdkSeatCapabilities
gdk_seat_get_capabilities (GdkSeat *seat);
GDK_AVAILABLE_IN_ALL
GList * gdk_seat_get_devices (GdkSeat *seat,
GList * gdk_seat_get_physical_devices (GdkSeat *seat,
GdkSeatCapabilities capabilities);
GList * gdk_seat_get_tools (GdkSeat *seat);
GDK_AVAILABLE_IN_ALL
GdkDevice * gdk_seat_get_pointer (GdkSeat *seat);
GDK_AVAILABLE_IN_ALL
+14 -9
View File
@@ -228,6 +228,7 @@ device_get_capability (GdkDevice *device)
case GDK_SOURCE_TOUCHSCREEN:
return GDK_SEAT_CAPABILITY_TOUCH;
case GDK_SOURCE_PEN:
case GDK_SOURCE_CURSOR:
return GDK_SEAT_CAPABILITY_TABLET_STYLUS;
case GDK_SOURCE_TABLET_PAD:
return GDK_SEAT_CAPABILITY_TABLET_PAD;
@@ -262,8 +263,8 @@ append_filtered (GList *list,
}
static GList *
gdk_seat_default_get_devices (GdkSeat *seat,
GdkSeatCapabilities capabilities)
gdk_seat_default_get_physical_devices (GdkSeat *seat,
GdkSeatCapabilities capabilities)
{
GdkSeatDefaultPrivate *priv;
GList *devices = NULL;
@@ -279,12 +280,13 @@ gdk_seat_default_get_devices (GdkSeat *seat,
return devices;
}
static GList *
gdk_seat_default_get_tools (GdkSeat *seat)
static GdkDeviceTool *
gdk_seat_default_get_tool (GdkSeat *seat,
guint64 serial,
guint64 hw_id)
{
GdkSeatDefaultPrivate *priv;
GdkDeviceTool *tool;
GList *tools = NULL;
guint i;
priv = gdk_seat_default_get_instance_private (GDK_SEAT_DEFAULT (seat));
@@ -295,10 +297,12 @@ gdk_seat_default_get_tools (GdkSeat *seat)
for (i = 0; i < priv->tools->len; i++)
{
tool = g_ptr_array_index (priv->tools, i);
tools = g_list_prepend (tools, tool);
if (tool->serial == serial && tool->hw_id == hw_id)
return tool;
}
return tools;
return NULL;
}
static void
@@ -315,8 +319,9 @@ gdk_seat_default_class_init (GdkSeatDefaultClass *klass)
seat_class->ungrab = gdk_seat_default_ungrab;
seat_class->get_logical_device = gdk_seat_default_get_logical_device;
seat_class->get_devices = gdk_seat_default_get_devices;
seat_class->get_tools = gdk_seat_default_get_tools;
seat_class->get_physical_devices = gdk_seat_default_get_physical_devices;
seat_class->get_tool = gdk_seat_default_get_tool;
}
static void
+5 -3
View File
@@ -54,10 +54,12 @@ struct _GdkSeatClass
GdkDevice * (* get_logical_device) (GdkSeat *seat,
GdkSeatCapabilities capability);
GList * (* get_devices) (GdkSeat *seat,
GdkSeatCapabilities capabilities);
GList * (* get_physical_devices) (GdkSeat *seat,
GdkSeatCapabilities capabilities);
GList * (* get_tools) (GdkSeat *seat);
GdkDeviceTool * (* get_tool) (GdkSeat *seat,
guint64 serial,
guint64 tool_id);
};
void gdk_seat_device_added (GdkSeat *seat,
+164 -79
View File
@@ -137,10 +137,8 @@ get_display_for_surface (GdkSurface *primary,
}
static GdkMonitor *
get_monitor_for_rect (GdkDisplay *display,
const GdkRectangle *rect,
void (*get_bounds) (GdkMonitor *monitor,
GdkRectangle *bounds))
get_monitor_for_rect (GdkDisplay *display,
const GdkRectangle *rect)
{
int biggest_area = G_MININT;
GdkMonitor *best_monitor = NULL;
@@ -154,7 +152,7 @@ get_monitor_for_rect (GdkDisplay *display,
for (i = 0; i < g_list_model_get_n_items (monitors); i++)
{
monitor = g_list_model_get_item (monitors, i);
get_bounds (monitor, &workarea);
gdk_monitor_get_workarea (monitor, &workarea);
if (gdk_rectangle_intersect (&workarea, rect, &intersection))
{
@@ -249,35 +247,16 @@ maybe_flip_position (int bounds_pos,
return primary;
}
GdkMonitor *
gdk_surface_get_layout_monitor (GdkSurface *surface,
GdkPopupLayout *layout,
void (*get_bounds) (GdkMonitor *monitor,
GdkRectangle *bounds))
{
GdkDisplay *display;
GdkRectangle root_rect;
root_rect = *gdk_popup_layout_get_anchor_rect (layout);
gdk_surface_get_root_coords (surface->parent,
root_rect.x,
root_rect.y,
&root_rect.x,
&root_rect.y);
display = get_display_for_surface (surface, surface->transient_for);
return get_monitor_for_rect (display, &root_rect, get_bounds);
}
void
gdk_surface_layout_popup_helper (GdkSurface *surface,
int width,
int height,
GdkMonitor *monitor,
GdkRectangle *bounds,
GdkPopupLayout *layout,
GdkRectangle *out_final_rect)
{
GdkDisplay *display;
GdkMonitor *monitor;
GdkRectangle bounds;
GdkRectangle root_rect;
GdkGravity rect_anchor;
GdkGravity surface_anchor;
@@ -298,6 +277,10 @@ gdk_surface_layout_popup_helper (GdkSurface *surface,
&root_rect.x,
&root_rect.y);
display = get_display_for_surface (surface, surface->transient_for);
monitor = get_monitor_for_rect (display, &root_rect);
gdk_monitor_get_workarea (monitor, &bounds);
rect_anchor = gdk_popup_layout_get_rect_anchor (layout);
surface_anchor = gdk_popup_layout_get_surface_anchor (layout);
gdk_popup_layout_get_offset (layout, &rect_anchor_dx, &rect_anchor_dy);
@@ -305,8 +288,8 @@ gdk_surface_layout_popup_helper (GdkSurface *surface,
final_rect.width = width - surface->shadow_left - surface->shadow_right;
final_rect.height = height - surface->shadow_top - surface->shadow_bottom;
final_rect.x = maybe_flip_position (bounds->x,
bounds->width,
final_rect.x = maybe_flip_position (bounds.x,
bounds.width,
root_rect.x,
root_rect.width,
final_rect.width,
@@ -315,8 +298,8 @@ gdk_surface_layout_popup_helper (GdkSurface *surface,
rect_anchor_dx,
anchor_hints & GDK_ANCHOR_FLIP_X,
&flipped_x);
final_rect.y = maybe_flip_position (bounds->y,
bounds->height,
final_rect.y = maybe_flip_position (bounds.y,
bounds.height,
root_rect.y,
root_rect.height,
final_rect.height,
@@ -328,44 +311,44 @@ gdk_surface_layout_popup_helper (GdkSurface *surface,
if (anchor_hints & GDK_ANCHOR_SLIDE_X)
{
if (final_rect.x + final_rect.width > bounds->x + bounds->width)
final_rect.x = bounds->x + bounds->width - final_rect.width;
if (final_rect.x + final_rect.width > bounds.x + bounds.width)
final_rect.x = bounds.x + bounds.width - final_rect.width;
if (final_rect.x < bounds->x)
final_rect.x = bounds->x;
if (final_rect.x < bounds.x)
final_rect.x = bounds.x;
}
if (anchor_hints & GDK_ANCHOR_SLIDE_Y)
{
if (final_rect.y + final_rect.height > bounds->y + bounds->height)
final_rect.y = bounds->y + bounds->height - final_rect.height;
if (final_rect.y + final_rect.height > bounds.y + bounds.height)
final_rect.y = bounds.y + bounds.height - final_rect.height;
if (final_rect.y < bounds->y)
final_rect.y = bounds->y;
if (final_rect.y < bounds.y)
final_rect.y = bounds.y;
}
if (anchor_hints & GDK_ANCHOR_RESIZE_X)
{
if (final_rect.x < bounds->x)
if (final_rect.x < bounds.x)
{
final_rect.width -= bounds->x - final_rect.x;
final_rect.x = bounds->x;
final_rect.width -= bounds.x - final_rect.x;
final_rect.x = bounds.x;
}
if (final_rect.x + final_rect.width > bounds->x + bounds->width)
final_rect.width = bounds->x + bounds->width - final_rect.x;
if (final_rect.x + final_rect.width > bounds.x + bounds.width)
final_rect.width = bounds.x + bounds.width - final_rect.x;
}
if (anchor_hints & GDK_ANCHOR_RESIZE_Y)
{
if (final_rect.y < bounds->y)
if (final_rect.y < bounds.y)
{
final_rect.height -= bounds->y - final_rect.y;
final_rect.y = bounds->y;
final_rect.height -= bounds.y - final_rect.y;
final_rect.y = bounds.y;
}
if (final_rect.y + final_rect.height > bounds->y + bounds->height)
final_rect.height = bounds->y + bounds->height - final_rect.y;
if (final_rect.y + final_rect.height > bounds.y + bounds.height)
final_rect.height = bounds.y + bounds.height - final_rect.y;
}
final_rect.x -= surface->shadow_left;
@@ -1355,15 +1338,15 @@ gdk_surface_paint_on_clock (GdkFrameClock *clock,
g_object_unref (surface);
}
/*
/**
* gdk_surface_invalidate_rect:
* @surface: a #GdkSurface
* @rect: (allow-none): rectangle to invalidate or %NULL to invalidate the whole
* surface
*
* A convenience wrapper around gdk_surface_invalidate_region()
* which invalidates a rectangular region.
* See gdk_surface_invalidate_region() for details.
* A convenience wrapper around gdk_surface_invalidate_region() which
* invalidates a rectangular region. See
* gdk_surface_invalidate_region() for details.
**/
void
gdk_surface_invalidate_rect (GdkSurface *surface,
@@ -1406,17 +1389,19 @@ impl_surface_add_update_area (GdkSurface *impl_surface,
}
/**
* gdk_surface_queue_render:
* gdk_surface_queue_expose:
* @surface: a #GdkSurface
*
* Forces a #GdkSurface::render signal emission for @surface
* to be scheduled.
* Forces an expose event for @surface to be scheduled.
*
* If the invalid area of @surface is empty, an expose event will
* still be emitted. Its invalid region will be empty.
*
* This function is useful for implementations that track invalid
* regions on their own.
**/
void
gdk_surface_queue_render (GdkSurface *surface)
gdk_surface_queue_expose (GdkSurface *surface)
{
cairo_region_t *region;
@@ -1427,17 +1412,17 @@ gdk_surface_queue_render (GdkSurface *surface)
cairo_region_destroy (region);
}
/*
/**
* gdk_surface_invalidate_region:
* @surface: a #GdkSurface
* @region: a #cairo_region_t
*
* Adds @region to the update area for @surface. The update area is
* the region that needs to be redrawn, or dirty region.
* Adds @region to the update area for @surface. The update area is the
* region that needs to be redrawn, or dirty region.
*
* GDK will process all updates whenever the frame clock schedules a
* redraw, so theres no need to do forces redraws manually, you just
* need to invalidate regions that you know should be redrawn.
* GDK will process all updates whenever the frame clock schedules a redraw,
* so theres no need to do forces redraws manually, you just need to
* invalidate regions that you know should be redrawn.
**/
void
gdk_surface_invalidate_region (GdkSurface *surface,
@@ -1467,12 +1452,12 @@ gdk_surface_invalidate_region (GdkSurface *surface,
cairo_region_destroy (visible_region);
}
/*
/**
* _gdk_surface_clear_update_area:
* @surface: a #GdkSurface.
*
* Internal function to clear the update area for a surface.
* This is called when the surface is hidden or destroyed.
* Internal function to clear the update area for a surface. This
* is called when the surface is hidden or destroyed.
**/
void
_gdk_surface_clear_update_area (GdkSurface *surface)
@@ -1488,15 +1473,15 @@ _gdk_surface_clear_update_area (GdkSurface *surface)
}
}
/*
/**
* gdk_surface_freeze_updates:
* @surface: a #GdkSurface
*
* Temporarily freezes a surface such that it wont receive expose
* events. The surface will begin receiving expose events again when
* gdk_surface_thaw_updates() is called. If gdk_surface_freeze_updates()
* has been called more than once, gdk_surface_thaw_updates() must be
* called an equal number of times to begin processing exposes.
* has been called more than once, gdk_surface_thaw_updates() must be called
* an equal number of times to begin processing exposes.
**/
void
gdk_surface_freeze_updates (GdkSurface *surface)
@@ -1508,7 +1493,7 @@ gdk_surface_freeze_updates (GdkSurface *surface)
_gdk_frame_clock_uninhibit_freeze (surface->frame_clock);
}
/*
/**
* gdk_surface_thaw_updates:
* @surface: a #GdkSurface
*
@@ -1586,11 +1571,33 @@ gdk_surface_constrain_size (GdkGeometry *geometry,
*/
int min_width = 0;
int min_height = 0;
int base_width = 0;
int base_height = 0;
int xinc = 1;
int yinc = 1;
int max_width = G_MAXINT;
int max_height = G_MAXINT;
if (flags & GDK_HINT_MIN_SIZE)
#define FLOOR(value, base) ( ((int) ((value) / (base))) * (base) )
if ((flags & GDK_HINT_BASE_SIZE) && (flags & GDK_HINT_MIN_SIZE))
{
base_width = geometry->base_width;
base_height = geometry->base_height;
min_width = geometry->min_width;
min_height = geometry->min_height;
}
else if (flags & GDK_HINT_BASE_SIZE)
{
base_width = geometry->base_width;
base_height = geometry->base_height;
min_width = geometry->base_width;
min_height = geometry->base_height;
}
else if (flags & GDK_HINT_MIN_SIZE)
{
base_width = geometry->min_width;
base_height = geometry->min_height;
min_width = geometry->min_width;
min_height = geometry->min_height;
}
@@ -1601,11 +1608,80 @@ gdk_surface_constrain_size (GdkGeometry *geometry,
max_height = geometry->max_height;
}
if (flags & GDK_HINT_RESIZE_INC)
{
xinc = MAX (xinc, geometry->width_inc);
yinc = MAX (yinc, geometry->height_inc);
}
/* clamp width and height to min and max values
*/
width = CLAMP (width, min_width, max_width);
height = CLAMP (height, min_height, max_height);
/* shrink to base + N * inc
*/
width = base_width + FLOOR (width - base_width, xinc);
height = base_height + FLOOR (height - base_height, yinc);
/* constrain aspect ratio, according to:
*
* width
* min_aspect <= -------- <= max_aspect
* height
*/
if (flags & GDK_HINT_ASPECT &&
geometry->min_aspect > 0 &&
geometry->max_aspect > 0)
{
int delta;
if (flags & GDK_HINT_BASE_SIZE)
{
width -= base_width;
height -= base_height;
min_width -= base_width;
min_height -= base_height;
max_width -= base_width;
max_height -= base_height;
}
if (geometry->min_aspect * height > width)
{
delta = FLOOR (height - width / geometry->min_aspect, yinc);
if (height - delta >= min_height)
height -= delta;
else
{
delta = FLOOR (height * geometry->min_aspect - width, xinc);
if (width + delta <= max_width)
width += delta;
}
}
if (geometry->max_aspect * height < width)
{
delta = FLOOR (width - height * geometry->max_aspect, xinc);
if (width - delta >= min_width)
width -= delta;
else
{
delta = FLOOR (width / geometry->max_aspect - height, yinc);
if (height + delta <= max_height)
height += delta;
}
}
if (flags & GDK_HINT_BASE_SIZE)
{
width += base_width;
height += base_height;
}
}
#undef FLOOR
*new_width = width;
*new_height = height;
}
@@ -1686,7 +1762,7 @@ gdk_surface_hide (GdkSurface *surface)
seat = gdk_display_get_default_seat (display);
if (seat)
{
devices = gdk_seat_get_devices (seat, GDK_SEAT_CAPABILITY_ALL);
devices = gdk_seat_get_physical_devices (seat, GDK_SEAT_CAPABILITY_ALL);
devices = g_list_prepend (devices, gdk_seat_get_keyboard (seat));
devices = g_list_prepend (devices, gdk_seat_get_pointer (seat));
}
@@ -1804,10 +1880,10 @@ gdk_surface_set_cursor (GdkSurface *surface,
device = gdk_seat_get_pointer (s->data);
gdk_surface_set_cursor_internal (surface, device, surface->cursor);
devices = gdk_seat_get_devices (s->data, GDK_SEAT_CAPABILITY_TABLET_STYLUS);
devices = gdk_seat_get_physical_devices (s->data, GDK_SEAT_CAPABILITY_TABLET_STYLUS);
for (d = devices; d; d = d->next)
{
device = d->data;
device = gdk_device_get_associated_device (d->data);
gdk_surface_set_cursor_internal (surface, device, surface->cursor);
}
g_list_free (devices);
@@ -1840,6 +1916,7 @@ gdk_surface_get_device_cursor (GdkSurface *surface,
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
g_return_val_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL, NULL);
return g_hash_table_lookup (surface->device_cursor, device);
}
@@ -1865,6 +1942,7 @@ gdk_surface_set_device_cursor (GdkSurface *surface,
g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL);
if (!cursor)
g_hash_table_remove (surface->device_cursor, device);
@@ -2144,12 +2222,13 @@ _gdk_windowing_got_event (GdkDisplay *display,
gboolean unlink_event = FALSE;
GdkDeviceGrabInfo *button_release_grab;
GdkPointerSurfaceInfo *pointer_info = NULL;
GdkDevice *device;
GdkDevice *device, *source_device;
GdkEventType type;
_gdk_display_update_last_event (display, event);
device = gdk_event_get_device (event);
source_device = gdk_event_get_source_device (event);
if (device)
{
@@ -2157,10 +2236,15 @@ _gdk_windowing_got_event (GdkDisplay *display,
gdk_device_get_source (device) != GDK_SOURCE_TABLET_PAD)
{
pointer_info = _gdk_display_get_pointer_info (display, device);
pointer_info->last_physical_device = device;
if (source_device != pointer_info->last_physical_device &&
gdk_device_get_device_type (source_device) == GDK_DEVICE_TYPE_PHYSICAL)
pointer_info->last_physical_device = source_device;
else if (pointer_info->last_physical_device)
source_device = pointer_info->last_physical_device;
}
_gdk_display_device_grab_update (display, device, serial);
_gdk_display_device_grab_update (display, device, source_device, serial);
}
event_surface = gdk_event_get_surface (event);
@@ -2188,7 +2272,8 @@ _gdk_windowing_got_event (GdkDisplay *display,
serial,
gdk_event_get_time (event),
TRUE);
_gdk_display_device_grab_update (display, device, serial);
_gdk_display_device_grab_update (display, device,
source_device, serial);
}
}
else if (type == GDK_BUTTON_RELEASE ||
@@ -2207,7 +2292,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
{
button_release_grab->serial_end = serial;
button_release_grab->implicit_ungrab = FALSE;
_gdk_display_device_grab_update (display, device, serial);
_gdk_display_device_grab_update (display, device, source_device, serial);
}
}
}
+6 -1
View File
@@ -206,7 +206,12 @@ GDK_AVAILABLE_IN_ALL
void gdk_surface_beep (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_queue_render (GdkSurface *surface);
void gdk_surface_queue_expose (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_freeze_updates (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_thaw_updates (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GdkFrameClock* gdk_surface_get_frame_clock (GdkSurface *surface);
-7
View File
@@ -174,16 +174,9 @@ struct _GdkSurfaceClass
void gdk_surface_set_state (GdkSurface *surface,
GdkSurfaceState new_state);
GdkMonitor * gdk_surface_get_layout_monitor (GdkSurface *surface,
GdkPopupLayout *layout,
void (*get_bounds) (GdkMonitor *monitor,
GdkRectangle *bounds));
void gdk_surface_layout_popup_helper (GdkSurface *surface,
int width,
int height,
GdkMonitor *monitor,
GdkRectangle *bounds,
GdkPopupLayout *layout,
GdkRectangle *out_final_rect);
+3 -3
View File
@@ -352,8 +352,8 @@
monitor = _gdk_macos_display_get_monitor_at_display_coords ([self gdkDisplay],
currentLocation.x,
currentLocation.y);
gdk_macos_monitor_get_geometry (monitor, &geometry);
gdk_macos_monitor_get_workarea (monitor, &workarea);
gdk_monitor_get_geometry (monitor, &geometry);
gdk_monitor_get_workarea (monitor, &workarea);
_edge_snapping_set_monitor (&self->snapping, &geometry, &workarea);
/* Convert origins to GDK coordinates */
@@ -424,7 +424,7 @@
monitor = _gdk_macos_surface_get_best_monitor ([self gdkSurface]);
gdk_monitor_get_geometry (monitor, &geometry);
gdk_macos_monitor_get_workarea (monitor, &workarea);
gdk_monitor_get_workarea (monitor, &workarea);
initialMoveLocation = [NSEvent mouseLocation];
+43 -31
View File
@@ -28,7 +28,7 @@
#include "gdkmacoseventsource-private.h"
static gint64 host_to_frame_clock_time (gint64 val);
static gint64 host_to_frame_clock_time (gint64 host_time);
static gboolean
gdk_display_link_source_prepare (GSource *source,
@@ -203,40 +203,52 @@ gdk_display_link_source_new (void)
}
static gint64
host_to_frame_clock_time (gint64 val)
host_to_frame_clock_time (gint64 host_time)
{
/* NOTE: Code adapted from GLib's g_get_monotonic_time(). */
static mach_timebase_info_data_t timebase_info;
mach_timebase_info_data_t timebase_info;
/* we get nanoseconds from mach_absolute_time() using timebase_info */
mach_timebase_info (&timebase_info);
if (timebase_info.numer != timebase_info.denom)
/*
* NOTE:
*
* This code is taken from GLib to match g_get_monotonic_time().
*/
if (G_UNLIKELY (timebase_info.denom == 0))
{
#ifdef HAVE_UINT128_T
val = ((__uint128_t) val * (__uint128_t) timebase_info.numer) / timebase_info.denom / 1000;
#else
guint64 t_high, t_low;
guint64 result_high, result_low;
/* This is a fraction that we must use to scale
* mach_absolute_time() by in order to reach nanoseconds.
*
* We've only ever observed this to be 1/1, but maybe it could be
* 1000/1 if mach time is microseconds already, or 1/1000 if
* picoseconds. Try to deal nicely with that.
*/
mach_timebase_info (&timebase_info);
/* 64 bit x 32 bit / 32 bit with 96-bit intermediate
* algorithm lifted from qemu */
t_low = (val & 0xffffffffLL) * (guint64) timebase_info.numer;
t_high = (val >> 32) * (guint64) timebase_info.numer;
t_high += (t_low >> 32);
result_high = t_high / (guint64) timebase_info.denom;
result_low = (((t_high % (guint64) timebase_info.denom) << 32) +
(t_low & 0xffffffff)) /
(guint64) timebase_info.denom;
val = ((result_high << 32) | result_low) / 1000;
#endif
}
else
{
/* nanoseconds to microseconds */
val = val / 1000;
/* We actually want microseconds... */
if (timebase_info.numer % 1000 == 0)
timebase_info.numer /= 1000;
else
timebase_info.denom *= 1000;
/* We want to make the numer 1 to avoid having to multiply... */
if (timebase_info.denom % timebase_info.numer == 0)
{
timebase_info.denom /= timebase_info.numer;
timebase_info.numer = 1;
}
else
{
/* We could just multiply by timebase_info.numer below, but why
* bother for a case that may never actually exist...
*
* Plus -- performing the multiplication would risk integer
* overflow. If we ever actually end up in this situation, we
* should more carefully evaluate the correct course of action.
*/
mach_timebase_info (&timebase_info); /* Get a fresh copy for a better message */
g_error ("Got weird mach timebase info of %d/%d. Please file a bug against GLib.",
timebase_info.numer, timebase_info.denom);
}
}
return val;
return host_time / timebase_info.denom;
}
+22 -1
View File
@@ -123,7 +123,27 @@ gdk_macos_device_ungrab (GdkDevice *device,
if (grab != NULL)
grab->serial_end = 0;
_gdk_display_device_grab_update (display, device, 0);
_gdk_display_device_grab_update (display, device, device, 0);
}
static void
gdk_macos_device_get_state (GdkDevice *device,
GdkSurface *surface,
double *axes,
GdkModifierType *mask)
{
double x_pos, y_pos;
g_assert (GDK_IS_MACOS_DEVICE (device));
g_assert (GDK_IS_MACOS_SURFACE (surface));
gdk_surface_get_device_position (surface, device, &x_pos, &y_pos, mask);
if (axes != NULL)
{
axes[0] = x_pos;
axes[1] = y_pos;
}
}
static void
@@ -172,6 +192,7 @@ gdk_macos_device_class_init (GdkMacosDeviceClass *klass)
{
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
device_class->get_state = gdk_macos_device_get_state;
device_class->grab = gdk_macos_device_grab;
device_class->query_state = gdk_macos_device_query_state;
device_class->set_surface_cursor = gdk_macos_device_set_surface_cursor;
+1 -3
View File
@@ -414,13 +414,11 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
GdkMacosDrag *self = GDK_MACOS_DRAG (drag);
GdkModifierType state;
GdkDevice *pointer;
GdkSeat *seat;
int dx, dy;
dx = dy = 0;
state = gdk_event_get_modifier_state (event);
seat = gdk_event_get_seat (event);
pointer = gdk_seat_get_pointer (seat);
pointer = gdk_device_get_associated_device (gdk_event_get_device (event));
if (event->event_type == GDK_KEY_PRESS)
{
+4 -12
View File
@@ -41,18 +41,7 @@ struct _GdkMacosMonitorClass
G_DEFINE_TYPE (GdkMacosMonitor, gdk_macos_monitor, GDK_TYPE_MONITOR)
/**
* gdk_macos_monitor_get_workarea:
* @monitor: a #GdkMonitor
* @workarea: (out): a #GdkRectangle to be filled with
* the monitor workarea
*
* Retrieves the size and position of the work area on a monitor
* within the display coordinate space. The returned geometry is in
* application pixels, not in device pixels (see
* gdk_monitor_get_scale_factor()).
*/
void
static void
gdk_macos_monitor_get_workarea (GdkMonitor *monitor,
GdkRectangle *geometry)
{
@@ -82,6 +71,9 @@ gdk_macos_monitor_get_workarea (GdkMonitor *monitor,
static void
gdk_macos_monitor_class_init (GdkMacosMonitorClass *klass)
{
GdkMonitorClass *monitor_class = GDK_MONITOR_CLASS (klass);
monitor_class->get_workarea = gdk_macos_monitor_get_workarea;
}
static void
-3
View File
@@ -38,9 +38,6 @@ typedef struct _GdkMacosMonitorClass GdkMacosMonitorClass;
GDK_AVAILABLE_IN_ALL
GType gdk_macos_monitor_get_type (void);
void gdk_macos_monitor_get_workarea (GdkMonitor *monitor,
GdkRectangle *geometry);
G_END_DECLS
#endif /* __GDK_MACOS_MONITOR_H__ */
-8
View File
@@ -45,8 +45,6 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
int height,
GdkPopupLayout *layout)
{
GdkMonitor *monitor;
GdkRectangle bounds;
GdkRectangle final_rect;
int x, y;
@@ -60,15 +58,9 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
self->layout = gdk_popup_layout_ref (layout);
}
monitor = gdk_surface_get_layout_monitor (surface, layout,
gdk_macos_monitor_get_workarea);
gdk_macos_monitor_get_workarea (monitor, &bounds);
gdk_surface_layout_popup_helper (GDK_SURFACE (self),
width,
height,
monitor,
&bounds,
layout,
&final_rect);
+2
View File
@@ -38,12 +38,14 @@ _gdk_macos_seat_new (GdkMacosDisplay *display)
core_pointer = g_object_new (GDK_TYPE_MACOS_DEVICE,
"name", "Core Pointer",
"type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
NULL);
core_keyboard = g_object_new (GDK_TYPE_MACOS_DEVICE,
"name", "Core Keyboard",
"type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", display,
+27
View File
@@ -623,6 +623,10 @@ _gdk_macos_surface_set_geometry_hints (GdkMacosSurface *self,
g_return_if_fail (geometry != NULL);
g_return_if_fail (self->window != NULL);
if (geom_mask & GDK_HINT_POS) { /* TODO */ }
if (geom_mask & GDK_HINT_USER_POS) { /* TODO */ }
if (geom_mask & GDK_HINT_USER_SIZE) { /* TODO */ }
if (geom_mask & GDK_HINT_MAX_SIZE)
max_size = NSMakeSize (geometry->max_width, geometry->max_height);
else
@@ -634,6 +638,29 @@ _gdk_macos_surface_set_geometry_hints (GdkMacosSurface *self,
else
min_size = NSMakeSize (1, 1);
[self->window setContentMinSize:min_size];
if (geom_mask & GDK_HINT_BASE_SIZE) { /* TODO */ }
if (geom_mask & GDK_HINT_RESIZE_INC)
{
NSSize size = NSMakeSize (geometry->width_inc, geometry->height_inc);
[self->window setContentResizeIncrements:size];
}
if (geom_mask & GDK_HINT_ASPECT)
{
NSSize size;
if (geometry->min_aspect != geometry->max_aspect)
g_warning ("Only equal minimum and maximum aspect ratios are supported on Mac OS. Using minimum aspect ratio...");
size.width = geometry->min_aspect;
size.height = 1.0;
[self->window setContentAspectRatio:size];
}
if (geom_mask & GDK_HINT_WIN_GRAVITY) { /* TODO */ }
}
void
+1 -1
View File
@@ -173,7 +173,7 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
{
GdkRectangle visible;
gdk_macos_monitor_get_workarea (monitor, &visible);
gdk_monitor_get_workarea (monitor, &visible);
if (x < visible.x)
x = visible.x;
+88 -34
View File
@@ -186,7 +186,7 @@ struct _GdkWaylandTabletData
GdkWaylandTabletToolData *current_tool;
int axis_indices[GDK_AXIS_LAST];
double axes[GDK_AXIS_LAST];
double *axes;
};
struct _GdkWaylandSeat
@@ -307,6 +307,23 @@ static void deliver_key_event (GdkWaylandSeat *seat,
uint32_t state,
gboolean from_key_repeat);
static void
gdk_wayland_device_get_state (GdkDevice *device,
GdkSurface *surface,
double *axes,
GdkModifierType *mask)
{
double x, y;
gdk_surface_get_device_position (surface, device, &x, &y, mask);
if (axes)
{
axes[0] = x;
axes[1] = y;
}
}
static void
gdk_wayland_pointer_stop_cursor_animation (GdkWaylandPointerData *pointer)
{
@@ -561,6 +578,7 @@ emulate_crossing (GdkSurface *surface,
event = gdk_crossing_event_new (type,
surface,
device,
device,
time_,
state,
x, y,
@@ -585,6 +603,7 @@ emulate_touch_crossing (GdkSurface *surface,
event = gdk_crossing_event_new (type,
surface,
device,
source,
time_,
0,
touch->x, touch->y,
@@ -600,7 +619,7 @@ emulate_focus (GdkSurface *surface,
gboolean focus_in,
guint32 time_)
{
GdkEvent *event = gdk_focus_event_new (surface, device, focus_in);
GdkEvent *event = gdk_focus_event_new (surface, device, device, focus_in);
_gdk_wayland_display_deliver_event (gdk_surface_get_display (surface), event);
}
@@ -795,6 +814,7 @@ gdk_wayland_device_class_init (GdkWaylandDeviceClass *klass)
{
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
device_class->get_state = gdk_wayland_device_get_state;
device_class->set_surface_cursor = gdk_wayland_device_set_surface_cursor;
device_class->query_state = gdk_wayland_device_query_state;
device_class->grab = gdk_wayland_device_grab;
@@ -1324,6 +1344,7 @@ flush_discrete_scroll_event (GdkWaylandSeat *seat,
source = get_scroll_device (seat, seat->pointer_info.frame.source);
event = gdk_scroll_event_new_discrete (seat->pointer_info.focus,
seat->logical_pointer,
source,
NULL,
seat->pointer_info.time,
@@ -1345,6 +1366,7 @@ flush_smooth_scroll_event (GdkWaylandSeat *seat,
source = get_scroll_device (seat, seat->pointer_info.frame.source);
event = gdk_scroll_event_new (seat->pointer_info.focus,
seat->logical_pointer,
source,
NULL,
seat->pointer_info.time,
@@ -1462,6 +1484,7 @@ pointer_handle_enter (void *data,
event = gdk_crossing_event_new (GDK_ENTER_NOTIFY,
seat->pointer_info.focus,
seat->logical_pointer,
seat->pointer,
0,
0,
seat->pointer_info.surface_x,
@@ -1510,12 +1533,14 @@ pointer_handle_leave (void *data,
display_serial, NULL, TRUE);
_gdk_display_device_grab_update (seat->display,
seat->logical_pointer,
seat->pointer,
display_serial);
}
event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY,
seat->pointer_info.focus,
seat->logical_pointer,
seat->pointer,
0,
0,
seat->pointer_info.surface_x,
@@ -1559,6 +1584,7 @@ pointer_handle_motion (void *data,
event = gdk_motion_event_new (seat->pointer_info.focus,
seat->logical_pointer,
seat->pointer,
NULL,
time,
device_get_modifiers (seat->logical_pointer),
@@ -1622,6 +1648,7 @@ pointer_handle_button (void *data,
event = gdk_button_event_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE,
seat->pointer_info.focus,
seat->logical_pointer,
seat->pointer,
NULL,
time,
device_get_modifiers (seat->logical_pointer),
@@ -1885,6 +1912,7 @@ keyboard_handle_enter (void *data,
event = gdk_focus_event_new (seat->keyboard_focus,
seat->logical_keyboard,
seat->keyboard,
TRUE);
GDK_SEAT_NOTE (seat, EVENTS,
@@ -1919,6 +1947,7 @@ keyboard_handle_leave (void *data,
event = gdk_focus_event_new (seat->keyboard_focus,
seat->logical_keyboard,
seat->keyboard,
FALSE);
g_object_unref (seat->keyboard_focus);
@@ -2045,6 +2074,7 @@ deliver_key_event (GdkWaylandSeat *seat,
event = gdk_key_event_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
seat->keyboard_focus,
seat->logical_keyboard,
seat->keyboard,
time_,
key,
device_get_modifiers (seat->logical_pointer),
@@ -2361,6 +2391,7 @@ touch_handle_down (void *data,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->logical_touch,
seat->touch,
time,
device_get_modifiers (seat->logical_touch),
touch->x, touch->y,
@@ -2403,6 +2434,7 @@ touch_handle_up (void *data,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->logical_touch,
seat->touch,
time,
device_get_modifiers (seat->logical_touch),
touch->x, touch->y,
@@ -2447,6 +2479,7 @@ touch_handle_motion (void *data,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->logical_touch,
seat->touch,
time,
device_get_modifiers (seat->logical_touch),
touch->x, touch->y,
@@ -2492,6 +2525,7 @@ touch_handle_cancel (void *data,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->logical_touch,
seat->touch,
GDK_CURRENT_TIME,
device_get_modifiers (seat->logical_touch),
touch->x, touch->y,
@@ -2520,6 +2554,7 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
seat->pointer_info.time = _time;
event = gdk_touchpad_event_new_swipe (seat->pointer_info.focus,
seat->logical_pointer,
seat->pointer,
_time,
device_get_modifiers (seat->logical_pointer),
@@ -2616,6 +2651,7 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
seat->pointer_info.time = _time;
event = gdk_touchpad_event_new_pinch (seat->pointer_info.focus,
seat->logical_pointer,
seat->pointer,
_time,
device_get_modifiers (seat->logical_pointer),
@@ -2737,6 +2773,9 @@ _gdk_wayland_seat_remove_tablet (GdkWaylandSeat *seat,
if (tablet->pointer_info.focus)
g_object_unref (tablet->pointer_info.focus);
if (tablet->axes)
g_free (tablet->axes);
wl_surface_destroy (tablet->pointer_info.pointer_surface);
g_object_unref (tablet->logical_device);
g_object_unref (tablet->stylus_device);
@@ -2823,6 +2862,7 @@ tablet_handle_done (void *data,
logical_name = g_strdup_printf ("Logical pointer for %s", tablet->name);
logical_device = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", logical_name,
"type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
@@ -2832,6 +2872,7 @@ tablet_handle_done (void *data,
stylus_device = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", tablet->name,
"type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_PEN,
"has-cursor", FALSE,
"display", display,
@@ -2936,6 +2977,7 @@ seat_handle_capabilities (void *data,
seat->pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Pointer",
"type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
@@ -3005,6 +3047,7 @@ seat_handle_capabilities (void *data,
seat->keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Keyboard",
"type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", seat->display,
@@ -3032,7 +3075,8 @@ seat_handle_capabilities (void *data,
seat->logical_touch = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Touch Logical Pointer",
"source", GDK_SOURCE_TOUCHSCREEN,
"type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
@@ -3043,6 +3087,7 @@ seat_handle_capabilities (void *data,
seat->touch = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Touch",
"type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_TOUCHSCREEN,
"has-cursor", FALSE,
"display", seat->display,
@@ -3079,12 +3124,14 @@ get_scroll_device (GdkWaylandSeat *seat,
{
seat->wheel_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Wheel Scrolling",
"type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
NULL);
gdk_seat_device_added (GDK_SEAT (seat), seat->wheel_scrolling);
_gdk_device_set_associated_device (seat->wheel_scrolling, seat->logical_pointer);
gdk_seat_device_added (GDK_SEAT (seat), seat->wheel_scrolling);
}
return seat->wheel_scrolling;
@@ -3093,12 +3140,14 @@ get_scroll_device (GdkWaylandSeat *seat,
{
seat->finger_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Finger Scrolling",
"type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_TOUCHPAD,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
NULL);
gdk_seat_device_added (GDK_SEAT (seat), seat->finger_scrolling);
_gdk_device_set_associated_device (seat->finger_scrolling, seat->logical_pointer);
gdk_seat_device_added (GDK_SEAT (seat), seat->finger_scrolling);
}
return seat->finger_scrolling;
@@ -3107,12 +3156,14 @@ get_scroll_device (GdkWaylandSeat *seat,
{
seat->continuous_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Continuous Scrolling",
"type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_TRACKPOINT,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
NULL);
gdk_seat_device_added (GDK_SEAT (seat), seat->continuous_scrolling);
_gdk_device_set_associated_device (seat->continuous_scrolling, seat->logical_pointer);
gdk_seat_device_added (GDK_SEAT (seat), seat->continuous_scrolling);
}
return seat->continuous_scrolling;
@@ -3338,6 +3389,12 @@ gdk_wayland_device_tablet_clone_tool_axes (GdkWaylandTabletData *tablet,
tablet->axis_indices[GDK_AXIS_SLIDER] = axis_pos;
}
if (tablet->axes)
g_free (tablet->axes);
tablet->axes =
g_new0 (double, gdk_device_get_n_axes (tablet->stylus_device));
g_object_thaw_notify (G_OBJECT (tablet->stylus_device));
}
@@ -3399,6 +3456,7 @@ tablet_tool_handle_proximity_in (void *data,
event = gdk_proximity_event_new (GDK_PROXIMITY_IN,
tablet->pointer_info.focus,
tablet->logical_device,
tablet->stylus_device,
tool->tool,
tablet->pointer_info.time);
gdk_wayland_tablet_set_frame_event (tablet, event);
@@ -3429,6 +3487,7 @@ tablet_tool_handle_proximity_out (void *data,
event = gdk_proximity_event_new (GDK_PROXIMITY_OUT,
tablet->pointer_info.focus,
tablet->logical_device,
tablet->stylus_device,
tool->tool,
tablet->pointer_info.time);
gdk_wayland_tablet_set_frame_event (tablet, event);
@@ -3451,7 +3510,7 @@ static double *
tablet_copy_axes (GdkWaylandTabletData *tablet)
{
return g_memdup (tablet->axes,
sizeof (double) * GDK_AXIS_LAST);
sizeof (double) * gdk_device_get_n_axes (tablet->stylus_device));
}
static void
@@ -3465,6 +3524,7 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet,
event = gdk_button_event_new (evtype,
tablet->pointer_info.focus,
tablet->logical_device,
tablet->stylus_device,
tablet->current_tool->tool,
tablet->pointer_info.time,
device_get_modifiers (seat->logical_pointer),
@@ -3529,6 +3589,7 @@ tablet_tool_handle_motion (void *data,
event = gdk_motion_event_new (tablet->pointer_info.focus,
tablet->logical_device,
tablet->stylus_device,
tool->tool,
tablet->pointer_info.time,
device_get_modifiers (tablet->logical_device),
@@ -3549,7 +3610,7 @@ tablet_tool_handle_pressure (void *data,
int axis_index = tablet->axis_indices[GDK_AXIS_PRESSURE];
_gdk_device_translate_axis (tablet->stylus_device, axis_index,
pressure, &tablet->axes[GDK_AXIS_PRESSURE]);
pressure, &tablet->axes[axis_index]);
GDK_SEAT_NOTE (tool->seat, EVENTS,
g_message ("tablet tool %d pressure %d",
@@ -3566,7 +3627,7 @@ tablet_tool_handle_distance (void *data,
int axis_index = tablet->axis_indices[GDK_AXIS_DISTANCE];
_gdk_device_translate_axis (tablet->stylus_device, axis_index,
distance, &tablet->axes[GDK_AXIS_DISTANCE]);
distance, &tablet->axes[axis_index]);
GDK_SEAT_NOTE (tool->seat, EVENTS,
g_message ("tablet tool %d distance %d",
@@ -3586,10 +3647,10 @@ tablet_tool_handle_tilt (void *data,
_gdk_device_translate_axis (tablet->stylus_device, xtilt_axis_index,
wl_fixed_to_double (xtilt),
&tablet->axes[GDK_AXIS_XTILT]);
&tablet->axes[xtilt_axis_index]);
_gdk_device_translate_axis (tablet->stylus_device, ytilt_axis_index,
wl_fixed_to_double (ytilt),
&tablet->axes[GDK_AXIS_YTILT]);
&tablet->axes[ytilt_axis_index]);
GDK_SEAT_NOTE (tool->seat, EVENTS,
g_message ("tablet tool %d tilt %f/%f",
@@ -3644,7 +3705,7 @@ tablet_tool_handle_rotation (void *data,
_gdk_device_translate_axis (tablet->stylus_device, axis_index,
wl_fixed_to_double (degrees),
&tablet->axes[GDK_AXIS_ROTATION]);
&tablet->axes[axis_index]);
GDK_SEAT_NOTE (tool->seat, EVENTS,
g_message ("tablet tool %d rotation %f",
@@ -3662,7 +3723,7 @@ tablet_tool_handle_slider (void *data,
int axis_index = tablet->axis_indices[GDK_AXIS_SLIDER];
_gdk_device_translate_axis (tablet->stylus_device, axis_index,
position, &tablet->axes[GDK_AXIS_SLIDER]);
position, &tablet->axes[axis_index]);
GDK_SEAT_NOTE (tool->seat, EVENTS,
g_message ("tablet tool %d slider %d",
@@ -3690,6 +3751,7 @@ tablet_tool_handle_wheel (void *data,
/* Send smooth event */
event = gdk_scroll_event_new (tablet->pointer_info.focus,
tablet->logical_device,
tablet->stylus_device,
tablet->current_tool->tool,
tablet->pointer_info.time,
device_get_modifiers (tablet->logical_device),
@@ -3700,6 +3762,7 @@ tablet_tool_handle_wheel (void *data,
/* Send discrete event */
event = gdk_scroll_event_new_discrete (tablet->pointer_info.focus,
tablet->logical_device,
tablet->stylus_device,
tablet->current_tool->tool,
tablet->pointer_info.time,
@@ -3810,6 +3873,7 @@ tablet_pad_ring_handle_frame (void *data,
g_message ("tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring));
event = gdk_pad_event_new_ring (seat->keyboard_focus,
pad->device,
pad->device,
time,
g_list_index (pad->mode_groups, group),
@@ -3884,6 +3948,7 @@ tablet_pad_strip_handle_frame (void *data,
wp_tablet_pad_strip));
event = gdk_pad_event_new_strip (seat->keyboard_focus,
pad->device,
pad->device,
time,
g_list_index (pad->mode_groups, group),
@@ -4009,6 +4074,7 @@ tablet_pad_group_handle_mode (void *data,
n_group = g_list_index (pad->mode_groups, group);
event = gdk_pad_event_new_group_mode (seat->keyboard_focus,
pad->device,
pad->device,
time,
n_group,
@@ -4089,6 +4155,7 @@ tablet_pad_handle_done (void *data,
pad->device =
g_object_new (GDK_TYPE_WAYLAND_DEVICE_PAD,
"name", "Pad device",
"type", GDK_DEVICE_TYPE_PHYSICAL,
"source", GDK_SOURCE_TABLET_PAD,
"display", gdk_seat_get_display (pad->seat),
"seat", pad->seat,
@@ -4123,6 +4190,7 @@ tablet_pad_handle_button (void *data,
: GDK_PAD_BUTTON_RELEASE,
GDK_WAYLAND_SEAT (pad->seat)->keyboard_focus,
pad->device,
pad->device,
time,
n_group,
button,
@@ -4266,6 +4334,7 @@ init_devices (GdkWaylandSeat *seat)
/* pointer */
seat->logical_pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Core Pointer",
"type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
@@ -4277,6 +4346,7 @@ init_devices (GdkWaylandSeat *seat)
/* keyboard */
seat->logical_keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Core Keyboard",
"type", GDK_DEVICE_TYPE_LOGICAL,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", seat->display,
@@ -4652,8 +4722,8 @@ gdk_wayland_seat_get_logical_device (GdkSeat *seat,
}
static GList *
gdk_wayland_seat_get_devices (GdkSeat *seat,
GdkSeatCapabilities capabilities)
gdk_wayland_seat_get_physical_devices (GdkSeat *seat,
GdkSeatCapabilities capabilities)
{
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
GList *physical_devices = NULL;
@@ -4697,22 +4767,6 @@ gdk_wayland_seat_get_devices (GdkSeat *seat,
return physical_devices;
}
static GList *
gdk_wayland_seat_get_tools (GdkSeat *seat)
{
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
GList *tools = NULL, *l;
for (l = wayland_seat->tablet_tools; l; l = l->next)
{
GdkWaylandTabletToolData *tool = l->data;
tools = g_list_prepend (tools, tool->tool);
}
return tools;
}
static void
gdk_wayland_seat_class_init (GdkWaylandSeatClass *klass)
{
@@ -4725,8 +4779,7 @@ gdk_wayland_seat_class_init (GdkWaylandSeatClass *klass)
seat_class->grab = gdk_wayland_seat_grab;
seat_class->ungrab = gdk_wayland_seat_ungrab;
seat_class->get_logical_device = gdk_wayland_seat_get_logical_device;
seat_class->get_devices = gdk_wayland_seat_get_devices;
seat_class->get_tools = gdk_wayland_seat_get_tools;
seat_class->get_physical_devices = gdk_wayland_seat_get_physical_devices;
}
static void
@@ -4851,7 +4904,7 @@ _gdk_wayland_seat_get_implicit_grab_serial (GdkSeat *seat,
if (event)
{
GdkDevice *source = gdk_event_get_device (event);
GdkDevice *source = gdk_event_get_source_device (event);
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
GList *l;
@@ -4934,6 +4987,7 @@ gdk_wayland_device_unset_touch_grab (GdkDevice *gdk_device,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->logical_touch,
seat->touch,
GDK_CURRENT_TIME,
device_get_modifiers (seat->logical_touch),
touch->x, touch->y,
+9
View File
@@ -846,6 +846,14 @@ gdk_wayland_display_has_pending (GdkDisplay *display)
return FALSE;
}
static GdkSurface *
gdk_wayland_display_get_default_group (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return NULL;
}
static gulong
gdk_wayland_display_get_next_serial (GdkDisplay *display)
{
@@ -1004,6 +1012,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
display_class->make_default = gdk_wayland_display_make_default;
display_class->has_pending = gdk_wayland_display_has_pending;
display_class->queue_events = _gdk_wayland_display_queue_events;
display_class->get_default_group = gdk_wayland_display_get_default_group;
display_class->get_app_launch_context = _gdk_wayland_display_get_app_launch_context;
display_class->get_next_serial = gdk_wayland_display_get_next_serial;
display_class->get_startup_notification_id = gdk_wayland_display_get_startup_notification_id;
+3
View File
@@ -1306,6 +1306,9 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
{
GdkSurfaceHints geometry_mask = impl->geometry_mask;
/* Ignore size increments for maximized/fullscreen surfaces */
if (fixed_size)
geometry_mask &= ~GDK_HINT_RESIZE_INC;
if (!saved_size)
{
/* Do not reapply constrains if we are restoring original size */
+15 -1
View File
@@ -59,6 +59,19 @@ _gdk_device_virtual_set_active (GdkDevice *device,
g_signal_emit_by_name (G_OBJECT (device), "changed");
}
static void
gdk_device_virtual_get_state (GdkDevice *device,
GdkSurface *window,
double *axes,
GdkModifierType *mask)
{
GdkDeviceVirtual *virtual = GDK_DEVICE_VIRTUAL (device);
GdkDevice *active = virtual->active_device;
GDK_DEVICE_GET_CLASS (active)->get_state (active,
window, axes, mask);
}
static void
gdk_device_virtual_set_surface_cursor (GdkDevice *device,
GdkSurface *window,
@@ -151,7 +164,7 @@ gdk_device_virtual_ungrab (GdkDevice *device,
ReleaseCapture ();
}
_gdk_display_device_grab_update (display, device, 0);
_gdk_display_device_grab_update (display, device, device, 0);
}
static void
@@ -159,6 +172,7 @@ gdk_device_virtual_class_init (GdkDeviceVirtualClass *klass)
{
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
device_class->get_state = gdk_device_virtual_get_state;
device_class->set_surface_cursor = gdk_device_virtual_set_surface_cursor;
device_class->query_state = gdk_device_virtual_query_state;
device_class->grab = gdk_device_virtual_grab;
+18
View File
@@ -29,6 +29,23 @@
G_DEFINE_TYPE (GdkDeviceWin32, gdk_device_win32, GDK_TYPE_DEVICE)
static void
gdk_device_win32_get_state (GdkDevice *device,
GdkSurface *window,
double *axes,
GdkModifierType *mask)
{
double x, y;
gdk_surface_get_device_position (window, device, &x, &y, mask);
if (axes)
{
axes[0] = round (x);
axes[1] = round (y);
}
}
static void
gdk_device_win32_set_surface_cursor (GdkDevice *device,
GdkSurface *window,
@@ -207,6 +224,7 @@ gdk_device_win32_class_init (GdkDeviceWin32Class *klass)
{
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
device_class->get_state = gdk_device_win32_get_state;
device_class->set_surface_cursor = gdk_device_win32_set_surface_cursor;
device_class->query_state = gdk_device_win32_query_state;
device_class->grab = gdk_device_win32_grab;
+32 -4
View File
@@ -54,6 +54,33 @@ get_current_mask (void)
return mask;
}
static void
gdk_device_wintab_get_state (GdkDevice *device,
GdkSurface *window,
double *axes,
GdkModifierType *mask)
{
GdkDeviceWintab *device_wintab;
device_wintab = GDK_DEVICE_WINTAB (device);
/* For now just use the last known button and axis state of the device.
* Since graphical tablets send an insane amount of motion events each
* second, the info should be fairly up to date */
if (mask)
{
*mask = get_current_mask ();
*mask &= 0xFF; /* Mask away core pointer buttons */
*mask |= ((device_wintab->button_state << 8)
& (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK));
}
if (axes && device_wintab->last_axis_data)
_gdk_device_wintab_translate_axes (device_wintab, window, axes, NULL, NULL);
}
static void
gdk_device_wintab_set_surface_cursor (GdkDevice *device,
GdkSurface *window,
@@ -201,18 +228,18 @@ _gdk_device_wintab_translate_axes (GdkDeviceWintab *device_wintab,
minfo.rcWork.bottom - minfo.rcWork.top,
i,
device_wintab->last_axis_data[i],
&axes[use]);
&axes[i]);
}
if (use == GDK_AXIS_X)
temp_x = axes[use];
temp_x = axes[i];
else if (use == GDK_AXIS_Y)
temp_y = axes[use];
temp_y = axes[i];
break;
default:
_gdk_device_translate_axis (device, i,
device_wintab->last_axis_data[i],
&axes[use]);
&axes[i]);
break;
}
}
@@ -229,6 +256,7 @@ gdk_device_wintab_class_init (GdkDeviceWintabClass *klass)
{
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
device_class->get_state = gdk_device_wintab_get_state;
device_class->set_surface_cursor = gdk_device_wintab_set_surface_cursor;
device_class->query_state = gdk_device_wintab_query_state;
device_class->grab = gdk_device_wintab_grab;
+17 -9
View File
@@ -74,12 +74,13 @@ static GdkDevice *
create_pointer (GdkDeviceManagerWin32 *device_manager,
GType g_type,
const char *name,
gboolean has_cursor)
GdkDeviceType type)
{
return g_object_new (g_type,
"name", name,
"type", type,
"source", GDK_SOURCE_MOUSE,
"has-cursor", has_cursor,
"has-cursor", type == GDK_DEVICE_TYPE_LOGICAL,
"display", _gdk_display,
NULL);
}
@@ -87,10 +88,12 @@ create_pointer (GdkDeviceManagerWin32 *device_manager,
static GdkDevice *
create_keyboard (GdkDeviceManagerWin32 *device_manager,
GType g_type,
const char *name)
const char *name,
GdkDeviceType type)
{
return g_object_new (g_type,
"name", name,
"type", type,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", _gdk_display,
@@ -552,6 +555,7 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
device = g_object_new (GDK_TYPE_DEVICE_WINTAB,
"name", device_name,
"type", GDK_DEVICE_TYPE_FLOATING,
"source", GDK_SOURCE_PEN,
"has-cursor", lc.lcOptions & CXO_SYSTEM,
"display", display,
@@ -689,12 +693,12 @@ gdk_device_manager_win32_constructed (GObject *object)
create_pointer (device_manager,
GDK_TYPE_DEVICE_VIRTUAL,
"Virtual Core Pointer",
TRUE);
GDK_DEVICE_TYPE_LOGICAL);
device_manager->system_pointer =
create_pointer (device_manager,
GDK_TYPE_DEVICE_WIN32,
"System Aggregated Pointer",
FALSE);
GDK_DEVICE_TYPE_PHYSICAL);
_gdk_device_virtual_set_active (device_manager->core_pointer,
device_manager->system_pointer);
_gdk_device_set_associated_device (device_manager->system_pointer, device_manager->core_pointer);
@@ -703,11 +707,13 @@ gdk_device_manager_win32_constructed (GObject *object)
device_manager->core_keyboard =
create_keyboard (device_manager,
GDK_TYPE_DEVICE_VIRTUAL,
"Virtual Core Keyboard");
"Virtual Core Keyboard",
GDK_DEVICE_TYPE_LOGICAL);
device_manager->system_keyboard =
create_keyboard (device_manager,
GDK_TYPE_DEVICE_WIN32,
"System Aggregated Keyboard");
"System Aggregated Keyboard",
GDK_DEVICE_TYPE_PHYSICAL);
_gdk_device_virtual_set_active (device_manager->core_keyboard,
device_manager->system_keyboard);
_gdk_device_set_associated_device (device_manager->system_keyboard, device_manager->core_keyboard);
@@ -1038,7 +1044,7 @@ gdk_input_other_event (GdkDisplay *display,
if (event_type == GDK_BUTTON_PRESS ||
event_type == GDK_BUTTON_RELEASE)
{
axes = g_new (double, GDK_AXIS_LAST);
axes = g_new (double, num_axes);
_gdk_device_wintab_translate_axes (source_device,
window,
@@ -1055,6 +1061,7 @@ gdk_input_other_event (GdkDisplay *display,
event = gdk_button_event_new (event_type,
window,
device_manager->core_pointer,
GDK_DEVICE (source_device),
NULL,
_gdk_win32_get_next_tick (msg->time),
event_state,
@@ -1073,7 +1080,7 @@ gdk_input_other_event (GdkDisplay *display,
}
else
{
axes = g_new (double, GDK_AXIS_LAST);
axes = g_new (double, num_axes);
_gdk_device_wintab_translate_axes (source_device,
window,
axes,
@@ -1088,6 +1095,7 @@ gdk_input_other_event (GdkDisplay *display,
event = gdk_motion_event_new (window,
device_manager->core_pointer,
GDK_DEVICE (source_device),
NULL,
_gdk_win32_get_next_tick (msg->time),
event_state,
+13 -52
View File
@@ -39,13 +39,6 @@
#include <dwmapi.h>
#include "gdkwin32langnotification.h"
#ifdef GDK_WIN32_ENABLE_EGL
# include <epoxy/egl.h>
#endif
#ifndef IMAGE_FILE_MACHINE_ARM64
# define IMAGE_FILE_MACHINE_ARM64 0xAA64
#endif
static int debug_indent = 0;
@@ -234,8 +227,8 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
primary_to_move = w32_ex_monitor;
gdk_monitor_get_geometry (m, &geometry);
gdk_win32_monitor_get_workarea (m, &workarea);
gdk_win32_monitor_get_workarea (ex_monitor, &ex_workarea);
gdk_monitor_get_workarea (m, &workarea);
gdk_monitor_get_workarea (ex_monitor, &ex_workarea);
if (memcmp (&workarea, &ex_workarea, sizeof (GdkRectangle)) != 0)
{
@@ -619,6 +612,16 @@ gdk_win32_display_get_name (GdkDisplay *display)
return display_name_cache;
}
static GdkSurface *
gdk_win32_display_get_default_group (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_warning ("gdk_display_get_default_group not yet implemented");
return NULL;
}
static void
gdk_win32_display_beep (GdkDisplay *display)
{
@@ -648,14 +651,6 @@ gdk_win32_display_dispose (GObject *object)
{
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (object);
#ifdef GDK_WIN32_ENABLE_EGL
if (display_win32->egl_disp != EGL_NO_DISPLAY)
{
eglTerminate (display_win32->egl_disp);
display_win32->egl_disp = EGL_NO_DISPLAY;
}
#endif
if (display_win32->hwnd != NULL)
{
DestroyWindow (display_win32->hwnd);
@@ -884,40 +879,6 @@ _gdk_win32_enable_hidpi (GdkWin32Display *display)
}
}
static void
_gdk_win32_check_on_arm64 (GdkWin32Display *display)
{
static gsize checked = 0;
if (g_once_init_enter (&checked))
{
HMODULE kernel32 = LoadLibraryW (L"kernel32.dll");
if (kernel32 != NULL)
{
display->cpu_funcs.isWow64Process2 =
(funcIsWow64Process2) GetProcAddress (kernel32, "IsWow64Process2");
if (display->cpu_funcs.isWow64Process2 != NULL)
{
USHORT proc_cpu = 0;
USHORT native_cpu = 0;
display->cpu_funcs.isWow64Process2 (GetCurrentProcess (),
&proc_cpu,
&native_cpu);
if (native_cpu == IMAGE_FILE_MACHINE_ARM64)
display->running_on_arm64 = TRUE;
}
FreeLibrary (kernel32);
}
g_once_init_leave (&checked, 1);
}
}
static void
gdk_win32_display_init (GdkWin32Display *display)
{
@@ -926,7 +887,6 @@ gdk_win32_display_init (GdkWin32Display *display)
display->monitors = G_LIST_MODEL (g_list_store_new (GDK_TYPE_MONITOR));
_gdk_win32_enable_hidpi (display);
_gdk_win32_check_on_arm64 (display);
/* if we have DPI awareness, set up fixed scale if set */
if (display->dpi_aware_type != PROCESS_DPI_UNAWARE &&
@@ -1101,6 +1061,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
display_class->flush = gdk_win32_display_flush;
display_class->has_pending = _gdk_win32_display_has_pending;
display_class->queue_events = _gdk_win32_display_queue_events;
display_class->get_default_group = gdk_win32_display_get_default_group;
//? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context;
-29
View File
@@ -24,10 +24,6 @@
#include "gdkwin32screen.h"
#include "gdkwin32cursor.h"
#ifdef GDK_WIN32_ENABLE_EGL
# include <epoxy/egl.h>
#endif
/* Define values used to set DPI-awareness */
typedef enum _GdkWin32ProcessDpiAwareness {
@@ -69,13 +65,6 @@ typedef struct _GdkWin32User32DPIFuncs
funcIsProcessDPIAware isDpiAwareFunc;
} GdkWin32User32DPIFuncs;
/* Detect running architecture */
typedef BOOL (WINAPI *funcIsWow64Process2) (HANDLE, USHORT *, USHORT *);
typedef struct _GdkWin32KernelCPUFuncs
{
funcIsWow64Process2 isWow64Process2;
} GdkWin32KernelCPUFuncs;
struct _GdkWin32Display
{
GdkDisplay display;
@@ -93,14 +82,6 @@ struct _GdkWin32Display
guint gl_version;
HWND gl_hwnd;
#ifdef GDK_WIN32_ENABLE_EGL
/* EGL (Angle) Items */
guint have_egl : 1;
guint egl_version;
EGLDisplay egl_disp;
HDC hdc_egl_temp;
#endif
GListModel *monitors;
guint hasWglARBCreateContext : 1;
@@ -109,12 +90,6 @@ struct _GdkWin32Display
guint hasWglARBPixelFormat : 1;
guint hasWglARBmultisample : 1;
#ifdef GDK_WIN32_ENABLE_EGL
guint hasEglKHRCreateContext : 1;
guint hasEglSurfacelessContext : 1;
EGLint egl_min_swap_interval;
#endif
/* HiDPI Items */
guint have_at_least_win81 : 1;
GdkWin32ProcessDpiAwareness dpi_aware_type;
@@ -138,10 +113,6 @@ struct _GdkWin32Display
/* Message filters */
GList *filters;
/* Running CPU items */
guint running_on_arm64 : 1;
GdkWin32KernelCPUFuncs cpu_funcs;
};
struct _GdkWin32DisplayClass
+1 -3
View File
@@ -2381,7 +2381,6 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkModifierType state;
GdkDevice *pointer;
GdkSeat *seat;
int dx, dy;
GDK_NOTE (DND, g_print ("gdk_dnd_handle_key_event: 0x%p\n", drag));
@@ -2389,8 +2388,7 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
state = gdk_event_get_modifier_state (event);
dx = dy = 0;
seat = gdk_event_get_seat (event);
pointer = gdk_seat_get_pointer (seat);
pointer = gdk_device_get_associated_device (gdk_event_get_device (event));
if (gdk_event_get_event_type (event) == GDK_KEY_PRESS)
{
+232 -11
View File
@@ -51,7 +51,6 @@
#include "gdkmonitorprivate.h"
#include "gdkwin32.h"
#include "gdkkeysyms.h"
#include "gdkglcontext-win32.h"
#include "gdkdevicemanager-win32.h"
#include "gdkdisplay-win32.h"
#include "gdkdeviceprivate.h"
@@ -202,11 +201,13 @@ generate_focus_event (GdkDeviceManagerWin32 *device_manager,
gboolean in)
{
GdkDevice *device;
GdkDevice *source_device;
GdkEvent *event;
device = GDK_DEVICE_MANAGER_WIN32 (device_manager)->core_keyboard;
source_device = GDK_DEVICE_MANAGER_WIN32 (device_manager)->system_keyboard;
event = gdk_focus_event_new (window, device, in);
event = gdk_focus_event_new (window, device, source_device, in);
_gdk_win32_append_event (event);
}
@@ -219,14 +220,22 @@ generate_grab_broken_event (GdkDeviceManagerWin32 *device_manager,
{
GdkEvent *event;
GdkDevice *device;
GdkDevice *source_device;
if (keyboard)
device = device_manager->core_keyboard;
{
device = device_manager->core_keyboard;
source_device = device_manager->system_keyboard;
}
else
device = device_manager->core_pointer;
{
device = device_manager->core_pointer;
source_device = device_manager->system_pointer;
}
event = gdk_grab_broken_event_new (window,
device,
source_device,
grab_window,
FALSE);
@@ -1070,6 +1079,7 @@ send_crossing_event (GdkDisplay *display,
event = gdk_crossing_event_new (type,
window,
device_manager->core_pointer,
device_manager->system_pointer,
_gdk_win32_get_next_tick (time_),
mask,
pt.x / impl->surface_scale,
@@ -1351,6 +1361,17 @@ _gdk_win32_hrgn_to_region (HRGN hrgn,
return result;
}
static void
adjust_drag (LONG *drag,
LONG curr,
int inc)
{
if (*drag > curr)
*drag = curr + ((*drag + inc/2 - curr) / inc) * inc;
else
*drag = curr - ((curr - *drag + inc/2) / inc) * inc;
}
static void
handle_wm_paint (MSG *msg,
GdkSurface *window)
@@ -1567,6 +1588,7 @@ generate_button_event (GdkEventType type,
event = gdk_button_event_new (type,
window,
device_manager->core_pointer,
device_manager->system_pointer,
NULL,
_gdk_win32_get_next_tick (msg->time),
build_pointer_event_state (msg),
@@ -1987,7 +2009,7 @@ static gboolean
gdk_event_translate (MSG *msg,
int *ret_valp)
{
RECT rect;
RECT rect, *drag, orig_drag;
POINT point;
MINMAXINFO *mmi;
HWND hwnd;
@@ -2110,6 +2132,7 @@ gdk_event_translate (MSG *msg,
event = gdk_key_event_new (GDK_KEY_PRESS,
window,
device_manager_win32->core_keyboard,
device_manager_win32->system_keyboard,
_gdk_win32_get_next_tick (msg->time),
0,
0,
@@ -2314,6 +2337,7 @@ gdk_event_translate (MSG *msg,
: GDK_KEY_RELEASE,
window,
device_manager_win32->core_keyboard,
device_manager_win32->system_keyboard,
_gdk_win32_get_next_tick (msg->time),
state,
keycode,
@@ -2388,6 +2412,7 @@ gdk_event_translate (MSG *msg,
event = gdk_key_event_new (GDK_KEY_PRESS,
window,
device_manager_win32->core_keyboard,
device_manager_win32->system_keyboard,
_gdk_win32_get_next_tick (msg->time),
build_key_event_state (key_state),
0,
@@ -2401,6 +2426,7 @@ gdk_event_translate (MSG *msg,
event = gdk_key_event_new (GDK_KEY_RELEASE,
window,
device_manager_win32->core_keyboard,
device_manager_win32->system_keyboard,
_gdk_win32_get_next_tick (msg->time),
build_key_event_state (key_state),
0,
@@ -2613,6 +2639,7 @@ gdk_event_translate (MSG *msg,
event = gdk_motion_event_new (window,
device_manager_win32->core_pointer,
device_manager_win32->system_pointer,
NULL,
_gdk_win32_get_next_tick (msg->time),
build_pointer_event_state (msg),
@@ -2738,6 +2765,7 @@ gdk_event_translate (MSG *msg,
event = gdk_scroll_event_new (window,
device_manager_win32->core_pointer,
device_manager_win32->system_pointer,
NULL,
_gdk_win32_get_next_tick (msg->time),
build_pointer_event_state (msg),
@@ -2760,6 +2788,7 @@ gdk_event_translate (MSG *msg,
event = gdk_scroll_event_new_discrete (window,
device_manager_win32->core_pointer,
device_manager_win32->system_pointer,
NULL,
_gdk_win32_get_next_tick (msg->time),
build_pointer_event_state (msg),
@@ -2935,11 +2964,7 @@ gdk_event_translate (MSG *msg,
{
case SC_MINIMIZE:
case SC_RESTORE:
do_show_window (window, msg->wParam == SC_MINIMIZE ? TRUE : FALSE);
if (msg->wParam == SC_RESTORE)
_gdk_win32_surface_invalidate_egl_framebuffer (window);
do_show_window (window, msg->wParam == SC_MINIMIZE ? TRUE : FALSE);
break;
case SC_MAXIMIZE:
impl = GDK_WIN32_SURFACE (window);
@@ -3152,6 +3177,7 @@ gdk_event_translate (MSG *msg,
case WM_SIZING:
GetWindowRect (GDK_SURFACE_HWND (window), &rect);
drag = (RECT *) msg->lParam;
GDK_NOTE (EVENTS, g_print (" %s curr:%s drag:%s",
(msg->wParam == WMSZ_BOTTOM ? "BOTTOM" :
(msg->wParam == WMSZ_BOTTOMLEFT ? "BOTTOMLEFT" :
@@ -3164,10 +3190,205 @@ gdk_event_translate (MSG *msg,
(msg->wParam == WMSZ_BOTTOMRIGHT ? "BOTTOMRIGHT" :
"???")))))))),
_gdk_win32_rect_to_string (&rect),
_gdk_win32_rect_to_string ((RECT *) msg->lParam)));
_gdk_win32_rect_to_string (drag)));
impl = GDK_WIN32_SURFACE (window);
orig_drag = *drag;
if (impl->hint_flags & GDK_HINT_RESIZE_INC)
{
GDK_NOTE (EVENTS, g_print (" (RESIZE_INC)"));
if (impl->hint_flags & GDK_HINT_BASE_SIZE)
{
/* Resize in increments relative to the base size */
rect.left = rect.top = 0;
rect.right = impl->hints.base_width * impl->surface_scale;
rect.bottom = impl->hints.base_height * impl->surface_scale;
_gdk_win32_adjust_client_rect (window, &rect);
point.x = rect.left;
point.y = rect.top;
ClientToScreen (GDK_SURFACE_HWND (window), &point);
rect.left = point.x;
rect.top = point.y;
point.x = rect.right;
point.y = rect.bottom;
ClientToScreen (GDK_SURFACE_HWND (window), &point);
rect.right = point.x;
rect.bottom = point.y;
GDK_NOTE (EVENTS, g_print (" (also BASE_SIZE, using %s)",
_gdk_win32_rect_to_string (&rect)));
}
switch (msg->wParam)
{
case WMSZ_BOTTOM:
if (drag->bottom == rect.bottom)
break;
adjust_drag (&drag->bottom, rect.bottom, impl->hints.height_inc * impl->surface_scale);
break;
case WMSZ_BOTTOMLEFT:
if (drag->bottom == rect.bottom && drag->left == rect.left)
break;
adjust_drag (&drag->bottom, rect.bottom, impl->hints.height_inc * impl->surface_scale);
adjust_drag (&drag->left, rect.left, impl->hints.width_inc * impl->surface_scale);
break;
case WMSZ_LEFT:
if (drag->left == rect.left)
break;
adjust_drag (&drag->left, rect.left, impl->hints.width_inc * impl->surface_scale);
break;
case WMSZ_TOPLEFT:
if (drag->top == rect.top && drag->left == rect.left)
break;
adjust_drag (&drag->top, rect.top, impl->hints.height_inc * impl->surface_scale);
adjust_drag (&drag->left, rect.left, impl->hints.width_inc * impl->surface_scale);
break;
case WMSZ_TOP:
if (drag->top == rect.top)
break;
adjust_drag (&drag->top, rect.top, impl->hints.height_inc * impl->surface_scale);
break;
case WMSZ_TOPRIGHT:
if (drag->top == rect.top && drag->right == rect.right)
break;
adjust_drag (&drag->top, rect.top, impl->hints.height_inc * impl->surface_scale);
adjust_drag (&drag->right, rect.right, impl->hints.width_inc * impl->surface_scale);
break;
case WMSZ_RIGHT:
if (drag->right == rect.right)
break;
adjust_drag (&drag->right, rect.right, impl->hints.width_inc * impl->surface_scale);
break;
case WMSZ_BOTTOMRIGHT:
if (drag->bottom == rect.bottom && drag->right == rect.right)
break;
adjust_drag (&drag->bottom, rect.bottom, impl->hints.height_inc * impl->surface_scale);
adjust_drag (&drag->right, rect.right, impl->hints.width_inc * impl->surface_scale);
break;
}
if (drag->bottom != orig_drag.bottom || drag->left != orig_drag.left ||
drag->top != orig_drag.top || drag->right != orig_drag.right)
{
*ret_valp = TRUE;
return_val = TRUE;
GDK_NOTE (EVENTS, g_print (" (handled RESIZE_INC: %s)",
_gdk_win32_rect_to_string (drag)));
}
}
/* WM_GETMINMAXINFO handles min_size and max_size hints? */
if (impl->hint_flags & GDK_HINT_ASPECT)
{
RECT decorated_rect;
RECT undecorated_drag;
int decoration_width, decoration_height;
double drag_aspect;
int drag_width, drag_height, new_width, new_height;
GetClientRect (GDK_SURFACE_HWND (window), &rect);
decorated_rect = rect;
_gdk_win32_adjust_client_rect (window, &decorated_rect);
/* Set undecorated_drag to the client area being dragged
* out, in screen coordinates.
*/
undecorated_drag = *drag;
undecorated_drag.left -= decorated_rect.left - rect.left;
undecorated_drag.right -= decorated_rect.right - rect.right;
undecorated_drag.top -= decorated_rect.top - rect.top;
undecorated_drag.bottom -= decorated_rect.bottom - rect.bottom;
decoration_width = (decorated_rect.right - decorated_rect.left) - (rect.right - rect.left);
decoration_height = (decorated_rect.bottom - decorated_rect.top) - (rect.bottom - rect.top);
drag_width = undecorated_drag.right - undecorated_drag.left;
drag_height = undecorated_drag.bottom - undecorated_drag.top;
drag_aspect = (double) drag_width / drag_height;
GDK_NOTE (EVENTS, g_print (" (ASPECT:%g--%g curr: %g)",
impl->hints.min_aspect, impl->hints.max_aspect, drag_aspect));
if (drag_aspect < impl->hints.min_aspect)
{
/* Aspect is getting too narrow */
switch (msg->wParam)
{
case WMSZ_BOTTOM:
case WMSZ_TOP:
/* User drags top or bottom edge outward. Keep height, increase width. */
new_width = impl->hints.min_aspect * drag_height;
drag->left -= (new_width - drag_width) / 2;
drag->right = drag->left + new_width + decoration_width;
break;
case WMSZ_BOTTOMLEFT:
case WMSZ_BOTTOMRIGHT:
/* User drags bottom-left or bottom-right corner down. Adjust height. */
new_height = drag_width / impl->hints.min_aspect;
drag->bottom = drag->top + new_height + decoration_height;
break;
case WMSZ_LEFT:
case WMSZ_RIGHT:
/* User drags left or right edge inward. Decrease height */
new_height = drag_width / impl->hints.min_aspect;
drag->top += (drag_height - new_height) / 2;
drag->bottom = drag->top + new_height + decoration_height;
break;
case WMSZ_TOPLEFT:
case WMSZ_TOPRIGHT:
/* User drags top-left or top-right corner up. Adjust height. */
new_height = drag_width / impl->hints.min_aspect;
drag->top = drag->bottom - new_height - decoration_height;
}
}
else if (drag_aspect > impl->hints.max_aspect)
{
/* Aspect is getting too wide */
switch (msg->wParam)
{
case WMSZ_BOTTOM:
case WMSZ_TOP:
/* User drags top or bottom edge inward. Decrease width. */
new_width = impl->hints.max_aspect * drag_height;
drag->left += (drag_width - new_width) / 2;
drag->right = drag->left + new_width + decoration_width;
break;
case WMSZ_BOTTOMLEFT:
case WMSZ_TOPLEFT:
/* User drags bottom-left or top-left corner left. Adjust width. */
new_width = impl->hints.max_aspect * drag_height;
drag->left = drag->right - new_width - decoration_width;
break;
case WMSZ_BOTTOMRIGHT:
case WMSZ_TOPRIGHT:
/* User drags bottom-right or top-right corner right. Adjust width. */
new_width = impl->hints.max_aspect * drag_height;
drag->right = drag->left + new_width + decoration_width;
break;
case WMSZ_LEFT:
case WMSZ_RIGHT:
/* User drags left or right edge outward. Increase height. */
new_height = drag_width / impl->hints.max_aspect;
drag->top -= (new_height - drag_height) / 2;
drag->bottom = drag->top + new_height + decoration_height;
break;
}
}
*ret_valp = TRUE;
return_val = TRUE;
GDK_NOTE (EVENTS, g_print (" (handled ASPECT: %s)",
_gdk_win32_rect_to_string (drag)));
}
break;
case WM_GETMINMAXINFO:
+144 -574
View File
@@ -41,10 +41,6 @@
#include <cairo.h>
#include <epoxy/wgl.h>
#ifdef GDK_WIN32_ENABLE_EGL
# include <epoxy/egl.h>
#endif
G_DEFINE_TYPE (GdkWin32GLContext, gdk_win32_gl_context, GDK_TYPE_GL_CONTEXT)
static void
@@ -55,37 +51,17 @@ _gdk_win32_gl_context_dispose (GObject *gobject)
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (gdk_gl_context_get_display (context));
GdkSurface *surface = gdk_gl_context_get_surface (context);
if (display_win32 != NULL)
if (context_win32->hglrc != NULL)
{
if (display_win32->have_wgl)
{
if (wglGetCurrentContext () == context_win32->hglrc)
wglMakeCurrent (NULL, NULL);
if (wglGetCurrentContext () == context_win32->hglrc)
wglMakeCurrent (NULL, NULL);
GDK_NOTE (OPENGL, g_print ("Destroying WGL context\n"));
GDK_NOTE (OPENGL, g_print ("Destroying WGL context\n"));
wglDeleteContext (context_win32->hglrc);
context_win32->hglrc = NULL;
wglDeleteContext (context_win32->hglrc);
context_win32->hglrc = NULL;
ReleaseDC (display_win32->gl_hwnd, context_win32->gl_hdc);
}
#ifdef GDK_WIN32_ENABLE_EGL
else if (display_win32->have_egl)
{
if (eglGetCurrentContext () == context_win32->egl_context)
eglMakeCurrent(display_win32->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);
GDK_NOTE (OPENGL, g_message ("Destroying EGL (ANGLE) context"));
eglDestroyContext (display_win32->egl_disp,
context_win32->egl_context);
context_win32->egl_context = EGL_NO_CONTEXT;
ReleaseDC (display_win32->gl_hwnd, context_win32->gl_hdc);
}
#endif
ReleaseDC (display_win32->gl_hwnd, context_win32->gl_hdc);
}
if (surface != NULL)
@@ -101,6 +77,7 @@ _gdk_win32_gl_context_dispose (GObject *gobject)
if (impl->suppress_layered == 0)
_gdk_win32_surface_update_style_bits (surface);
}
G_OBJECT_CLASS (gdk_win32_gl_context_parent_class)->dispose (gobject);
}
@@ -123,33 +100,6 @@ gdk_gl_blit_region (GdkSurface *surface, cairo_region_t *region)
}
}
#ifdef GDK_WIN32_ENABLE_EGL
static gboolean
_get_is_egl_force_redraw (GdkSurface *surface)
{
/* We only need to call gdk_window_invalidate_rect () if necessary */
if (surface->gl_paint_context != NULL && gdk_gl_context_get_use_es (surface->gl_paint_context))
{
GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
return impl->egl_force_redraw_all;
}
return FALSE;
}
static void
_reset_egl_force_redraw (GdkSurface *surface)
{
if (surface->gl_paint_context != NULL && gdk_gl_context_get_use_es (surface->gl_paint_context))
{
GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
if (impl->egl_force_redraw_all)
impl->egl_force_redraw_all = FALSE;
}
}
#endif
static void
gdk_win32_gl_context_end_frame (GdkDrawContext *draw_context,
cairo_region_t *painted)
@@ -158,6 +108,7 @@ gdk_win32_gl_context_end_frame (GdkDrawContext *draw_context,
GdkWin32GLContext *context_win32 = GDK_WIN32_GL_CONTEXT (context);
GdkSurface *surface = gdk_gl_context_get_surface (context);
GdkWin32Display *display = (GDK_WIN32_DISPLAY (gdk_gl_context_get_display (context)));
gboolean can_wait = display->hasWglOMLSyncControl;
cairo_rectangle_int_t whole_window;
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_parent_class)->end_frame (draw_context, painted);
@@ -165,12 +116,9 @@ gdk_win32_gl_context_end_frame (GdkDrawContext *draw_context,
return;
gdk_gl_context_make_current (context);
whole_window = (GdkRectangle) { 0, 0, gdk_surface_get_width (surface), gdk_surface_get_height (surface) };
if (!gdk_gl_context_get_use_es (context))
if (context_win32->do_frame_sync)
{
gboolean can_wait = display->hasWglOMLSyncControl;
if (context_win32->do_frame_sync)
{
glFinish ();
@@ -187,54 +135,29 @@ gdk_win32_gl_context_end_frame (GdkDrawContext *draw_context,
&ust, &msc, &sbc);
}
}
if (cairo_region_contains_rectangle (painted, &whole_window) == CAIRO_REGION_OVERLAP_IN)
SwapBuffers (context_win32->gl_hdc);
else if (gdk_gl_context_has_framebuffer_blit (context))
{
glDrawBuffer(GL_FRONT);
glReadBuffer(GL_BACK);
gdk_gl_blit_region (surface, painted);
glDrawBuffer(GL_BACK);
glFlush();
if (gdk_gl_context_has_frame_terminator (context))
glFrameTerminatorGREMEDY ();
}
else
{
g_warning ("Need to swap whole buffer even thouigh not everything was redrawn. Expect artifacts.");
SwapBuffers (context_win32->gl_hdc);
}
}
#ifdef GDK_WIN32_ENABLE_EGL
whole_window = (GdkRectangle) { 0, 0, gdk_surface_get_width (surface), gdk_surface_get_height (surface) };
if (cairo_region_contains_rectangle (painted, &whole_window) == CAIRO_REGION_OVERLAP_IN)
{
SwapBuffers (context_win32->gl_hdc);
}
else if (gdk_gl_context_has_framebuffer_blit (context))
{
glDrawBuffer(GL_FRONT);
glReadBuffer(GL_BACK);
gdk_gl_blit_region (surface, painted);
glDrawBuffer(GL_BACK);
glFlush();
if (gdk_gl_context_has_frame_terminator (context))
glFrameTerminatorGREMEDY ();
}
else
{
EGLSurface egl_surface = _gdk_win32_surface_get_egl_surface (surface, context_win32->egl_config, FALSE);
gboolean force_egl_redraw_all = _get_is_egl_force_redraw (surface);
if (force_egl_redraw_all)
{
GdkRectangle rect = {0, 0, gdk_surface_get_width (surface), gdk_surface_get_height (surface)};
/* We need to do gdk_window_invalidate_rect() so that we don't get glitches after maximizing or
* restoring or using aerosnap
*/
gdk_surface_invalidate_rect (surface, &rect);
_reset_egl_force_redraw (surface);
}
if (cairo_region_contains_rectangle (painted, &whole_window) == CAIRO_REGION_OVERLAP_IN || force_egl_redraw_all)
eglSwapBuffers (display->egl_disp, egl_surface);
else if (gdk_gl_context_has_framebuffer_blit (context))
gdk_gl_blit_region (surface, painted);
else
{
g_warning ("Need to swap whole buffer even thouigh not everything was redrawn. Expect artifacts.");
eglSwapBuffers (display->egl_disp, egl_surface);
}
g_warning ("Need to swap whole buffer even thouigh not everything was redrawn. Expect artifacts.");
SwapBuffers (context_win32->gl_hdc);
}
#endif
}
static void
@@ -492,151 +415,61 @@ _gdk_init_dummy_context (GdkWGLDummy *dummy)
return best_idx;
}
#ifdef GDK_WIN32_ENABLE_EGL
#ifndef EGL_PLATFORM_ANGLE_ANGLE
#define EGL_PLATFORM_ANGLE_ANGLE 0x3202
#endif
#ifndef EGL_PLATFORM_ANGLE_TYPE_ANGLE
#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203
#endif
#ifndef EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
#endif
static EGLDisplay
_gdk_win32_get_egl_display (GdkWin32Display *display)
{
EGLDisplay disp;
gboolean success = FALSE;
if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
{
PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay = (void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
if (getPlatformDisplay)
{
EGLint disp_attr[] = {EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, EGL_NONE};
disp = getPlatformDisplay (EGL_PLATFORM_ANGLE_ANGLE, display->hdc_egl_temp, disp_attr);
if (disp != EGL_NO_DISPLAY)
return disp;
}
}
return eglGetDisplay (display->hdc_egl_temp);
}
#endif
static gboolean
_gdk_win32_display_init_gl (GdkDisplay *display)
{
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (display);
int best_idx = 0;
GdkWGLDummy dummy;
gboolean disable_wgl = FALSE;
#ifdef GDK_WIN32_ENABLE_EGL
EGLDisplay egl_disp;
disable_wgl = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES) ||
display_win32->running_on_arm64;
#endif
if (display_win32->have_wgl
#ifdef GDK_WIN32_ENABLE_EGL
|| display_win32->have_egl
#endif
)
if (display_win32->have_wgl)
return TRUE;
if (!disable_wgl)
{
GdkWGLDummy dummy;
memset (&dummy, 0, sizeof (GdkWGLDummy));
memset (&dummy, 0, sizeof (GdkWGLDummy));
/* acquire and cache dummy Window (HWND & HDC) and
* dummy GL Context, it is used to query functions
* and used for other stuff as well
*/
best_idx = _gdk_init_dummy_context (&dummy);
/* acquire and cache dummy Window (HWND & HDC) and
* dummy GL Context, it is used to query functions
* and used for other stuff as well
*/
best_idx = _gdk_init_dummy_context (&dummy);
if (best_idx == 0 || !wglMakeCurrent (dummy.hdc, dummy.hglrc))
return FALSE;
if (best_idx == 0 || !wglMakeCurrent (dummy.hdc, dummy.hglrc))
return FALSE;
display_win32->have_wgl = TRUE;
display_win32->gl_version = epoxy_gl_version ();
display_win32->have_wgl = TRUE;
display_win32->gl_version = epoxy_gl_version ();
display_win32->hasWglARBCreateContext =
epoxy_has_wgl_extension (dummy.hdc, "WGL_ARB_create_context");
display_win32->hasWglEXTSwapControl =
epoxy_has_wgl_extension (dummy.hdc, "WGL_EXT_swap_control");
display_win32->hasWglOMLSyncControl =
epoxy_has_wgl_extension (dummy.hdc, "WGL_OML_sync_control");
display_win32->hasWglARBPixelFormat =
epoxy_has_wgl_extension (dummy.hdc, "WGL_ARB_pixel_format");
display_win32->hasWglARBmultisample =
epoxy_has_wgl_extension (dummy.hdc, "WGL_ARB_multisample");
display_win32->hasWglARBCreateContext =
epoxy_has_wgl_extension (dummy.hdc, "WGL_ARB_create_context");
display_win32->hasWglEXTSwapControl =
epoxy_has_wgl_extension (dummy.hdc, "WGL_EXT_swap_control");
display_win32->hasWglOMLSyncControl =
epoxy_has_wgl_extension (dummy.hdc, "WGL_OML_sync_control");
display_win32->hasWglARBPixelFormat =
epoxy_has_wgl_extension (dummy.hdc, "WGL_ARB_pixel_format");
display_win32->hasWglARBmultisample =
epoxy_has_wgl_extension (dummy.hdc, "WGL_ARB_multisample");
GDK_NOTE (OPENGL,
g_print ("WGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Checked extensions:\n"
"\t* WGL_ARB_pixel_format: %s\n"
"\t* WGL_ARB_create_context: %s\n"
"\t* WGL_EXT_swap_control: %s\n"
"\t* WGL_OML_sync_control: %s\n"
"\t* WGL_ARB_multisample: %s\n",
display_win32->gl_version / 10,
display_win32->gl_version % 10,
glGetString (GL_VENDOR),
display_win32->hasWglARBPixelFormat ? "yes" : "no",
display_win32->hasWglARBCreateContext ? "yes" : "no",
display_win32->hasWglEXTSwapControl ? "yes" : "no",
display_win32->hasWglOMLSyncControl ? "yes" : "no",
display_win32->hasWglARBmultisample ? "yes" : "no"));
wglMakeCurrent (NULL, NULL);
_destroy_dummy_gl_context (dummy);
}
#ifdef GDK_WIN32_ENABLE_EGL
else
{
egl_disp = _gdk_win32_get_egl_display (display_win32);
if (egl_disp == EGL_NO_DISPLAY || !eglInitialize (egl_disp, NULL, NULL))
{
if (egl_disp != EGL_NO_DISPLAY)
{
eglTerminate (egl_disp);
egl_disp = EGL_NO_DISPLAY;
}
return FALSE;
}
display_win32->egl_disp = egl_disp;
display_win32->have_egl = TRUE;
display_win32->egl_version = epoxy_egl_version (egl_disp);
eglBindAPI(EGL_OPENGL_ES_API);
display_win32->hasEglSurfacelessContext =
epoxy_has_egl_extension (egl_disp, "EGL_KHR_surfaceless_context");
GDK_NOTE (OPENGL,
g_print ("EGL API version %d.%d found\n"
GDK_NOTE (OPENGL,
g_print ("WGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Checked extensions:\n"
"\t* EGL_KHR_surfaceless_context: %s\n",
display_win32->egl_version / 10,
display_win32->egl_version % 10,
eglQueryString (display_win32->egl_disp, EGL_VENDOR),
display_win32->hasEglSurfacelessContext ? "yes" : "no"));
}
#endif
"\t* WGL_ARB_pixel_format: %s\n"
"\t* WGL_ARB_create_context: %s\n"
"\t* WGL_EXT_swap_control: %s\n"
"\t* WGL_OML_sync_control: %s\n"
"\t* WGL_ARB_multisample: %s\n",
display_win32->gl_version / 10,
display_win32->gl_version % 10,
glGetString (GL_VENDOR),
display_win32->hasWglARBPixelFormat ? "yes" : "no",
display_win32->hasWglARBCreateContext ? "yes" : "no",
display_win32->hasWglEXTSwapControl ? "yes" : "no",
display_win32->hasWglOMLSyncControl ? "yes" : "no",
display_win32->hasWglARBmultisample ? "yes" : "no"));
wglMakeCurrent (NULL, NULL);
_destroy_dummy_gl_context (dummy);
return TRUE;
}
@@ -816,122 +649,6 @@ _set_pixformat_for_hdc (HDC hdc,
return TRUE;
}
#ifdef GDK_WIN32_ENABLE_EGL
#define MAX_EGL_ATTRS 30
static gboolean
find_eglconfig_for_window (GdkWin32Display *display,
EGLConfig *egl_config_out,
EGLint *min_swap_interval_out,
GError **error)
{
EGLint attrs[MAX_EGL_ATTRS];
EGLint count;
EGLConfig *configs, chosen_config;
int i = 0;
EGLDisplay egl_disp = display->egl_disp;
attrs[i++] = EGL_CONFORMANT;
attrs[i++] = EGL_OPENGL_ES2_BIT;
attrs[i++] = EGL_SURFACE_TYPE;
attrs[i++] = EGL_WINDOW_BIT;
attrs[i++] = EGL_COLOR_BUFFER_TYPE;
attrs[i++] = EGL_RGB_BUFFER;
attrs[i++] = EGL_RED_SIZE;
attrs[i++] = 1;
attrs[i++] = EGL_GREEN_SIZE;
attrs[i++] = 1;
attrs[i++] = EGL_BLUE_SIZE;
attrs[i++] = 1;
attrs[i++] = EGL_ALPHA_SIZE;
attrs[i++] = 1;
attrs[i++] = EGL_NONE;
g_assert (i < MAX_EGL_ATTRS);
if (!eglChooseConfig (display->egl_disp, attrs, NULL, 0, &count) || count < 1)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
_("No available configurations for the given pixel format"));
return FALSE;
}
configs = g_new (EGLConfig, count);
if (!eglChooseConfig (display->egl_disp, attrs, configs, count, &count) || count < 1)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
_("No available configurations for the given pixel format"));
return FALSE;
}
/* Pick first valid configuration i guess? */
chosen_config = configs[0];
if (!eglGetConfigAttrib (display->egl_disp, chosen_config,
EGL_MIN_SWAP_INTERVAL, min_swap_interval_out))
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
"Could not retrieve the minimum swap interval");
g_free (configs);
return FALSE;
}
if (egl_config_out != NULL)
*egl_config_out = chosen_config;
g_free (configs);
return TRUE;
}
#define N_EGL_ATTRS 16
static EGLContext
_create_egl_context (EGLDisplay display,
EGLConfig config,
GdkGLContext *share,
int flags,
int major,
int minor,
gboolean *is_legacy)
{
EGLContext ctx;
EGLint context_attribs[N_EGL_ATTRS];
int i = 0;
/* ANGLE does not support the GL_OES_vertex_array_object extension, so we need to use ES3 directly */
context_attribs[i++] = EGL_CONTEXT_CLIENT_VERSION;
context_attribs[i++] = 3;
/* 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);
ctx = eglCreateContext (display,
config,
share != NULL ? GDK_WIN32_GL_CONTEXT (share)->egl_context
: EGL_NO_CONTEXT,
context_attribs);
if (ctx != EGL_NO_CONTEXT)
GDK_NOTE (OPENGL, g_message ("Created EGL context[%p]", ctx));
return ctx;
}
#endif /* GDK_WIN32_ENABLE_EGL */
static gboolean
gdk_win32_gl_context_realize (GdkGLContext *context,
GError **error)
@@ -939,23 +656,39 @@ gdk_win32_gl_context_realize (GdkGLContext *context,
GdkGLContext *share = gdk_gl_context_get_shared_context (context);
GdkWin32GLContext *context_win32 = GDK_WIN32_GL_CONTEXT (context);
/* These are the real WGL context items that we will want to use later */
HGLRC hglrc;
int pixel_format;
gboolean debug_bit, compat_bit, legacy_bit;
gboolean use_es = FALSE;
/* request flags and specific versions for core (3.2+) WGL context */
int flags = 0;
int major = 0;
int minor = 0;
int glver_major = 0;
int glver_minor = 0;
GdkSurface *surface = gdk_gl_context_get_surface (context);
GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (gdk_surface_get_display (surface));
gdk_gl_context_get_required_version (context, &major, &minor);
if (!_set_pixformat_for_hdc (context_win32->gl_hdc,
&pixel_format,
win32_display))
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
_("No available configurations for the given pixel format"));
return FALSE;
}
gdk_gl_context_get_required_version (context, &glver_major, &glver_minor);
debug_bit = gdk_gl_context_get_debug_enabled (context);
compat_bit = gdk_gl_context_get_forward_compatible (context);
/* if there isn't wglCreateContextAttribsARB(), or if GDK_GL_LEGACY is set, we default to a legacy context */
legacy_bit = !win32_display->hasWglARBCreateContext ||
g_getenv ("GDK_GL_LEGACY") != NULL;
/*
* A legacy context cannot be shared with core profile ones, so this means we
* must stick to a legacy context if the shared context is a legacy context
@@ -963,114 +696,42 @@ gdk_win32_gl_context_realize (GdkGLContext *context,
if (share != NULL && gdk_gl_context_is_legacy (share))
legacy_bit = TRUE;
/* if GDK_GL_LEGACY is set, we default to a legacy context */
legacy_bit = g_getenv ("GDK_GL_LEGACY") != NULL;
if (debug_bit)
flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
if (compat_bit)
flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
use_es = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES) ||
(share != NULL && gdk_gl_context_get_use_es (share));
GDK_NOTE (OPENGL,
g_print ("Creating %s WGL context (version:%d.%d, debug:%s, forward:%s, legacy: %s)\n",
compat_bit ? "core" : "compat",
glver_major,
glver_minor,
debug_bit ? "yes" : "no",
compat_bit ? "yes" : "no",
legacy_bit ? "yes" : "no"));
if (win32_display->have_wgl || !use_es)
hglrc = _create_gl_context (context_win32->gl_hdc,
share,
flags,
glver_major,
glver_minor,
&legacy_bit,
win32_display->hasWglARBCreateContext);
if (hglrc == NULL)
{
/* These are the real WGL context items that we will want to use later */
HGLRC hglrc;
int pixel_format;
if (!_set_pixformat_for_hdc (context_win32->gl_hdc,
&pixel_format,
win32_display))
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
_("No available configurations for the given pixel format"));
return FALSE;
}
/* if there isn't wglCreateContextAttribsARB() on WGL, use a legacy context */
if (!legacy_bit)
legacy_bit = !win32_display->hasWglARBCreateContext;
if (debug_bit)
flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
if (compat_bit)
flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
GDK_NOTE (OPENGL,
g_print ("Creating %s WGL context (version:%d.%d, debug:%s, forward:%s, legacy: %s)\n",
compat_bit ? "core" : "compat",
major,
minor,
debug_bit ? "yes" : "no",
compat_bit ? "yes" : "no",
legacy_bit ? "yes" : "no"));
hglrc = _create_gl_context (context_win32->gl_hdc,
share,
flags,
major,
minor,
&legacy_bit,
win32_display->hasWglARBCreateContext);
if (hglrc == NULL)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Unable to create a GL context"));
return FALSE;
}
GDK_NOTE (OPENGL,
g_print ("Created WGL context[%p], pixel_format=%d\n",
hglrc,
pixel_format));
context_win32->hglrc = hglrc;
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Unable to create a GL context"));
return FALSE;
}
#ifdef GDK_WIN32_ENABLE_EGL
else
{
EGLContext egl_context;
EGLContext ctx;
GDK_NOTE (OPENGL,
g_print ("Created WGL context[%p], pixel_format=%d\n",
hglrc,
pixel_format));
if (debug_bit)
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
if (compat_bit)
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
GDK_NOTE (OPENGL, g_message ("Creating EGL context version %d.%d (debug:%s, forward:%s, legacy:%s)",
major, minor,
debug_bit ? "yes" : "no",
compat_bit ? "yes" : "no",
legacy_bit ? "yes" : "no"));
ctx = _create_egl_context (win32_display->egl_disp,
context_win32->egl_config,
share,
flags,
major,
minor,
&legacy_bit);
if (ctx == EGL_NO_CONTEXT)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Unable to create a GL context"));
return FALSE;
}
GDK_NOTE (OPENGL,
g_print ("Created EGL context[%p]\n",
ctx));
context_win32->egl_context = ctx;
use_es = TRUE;
}
#endif
/* set whether we are using GLES */
gdk_gl_context_set_use_es (context, use_es);
context_win32->hglrc = hglrc;
/* OpenGL does not work with WS_EX_LAYERED enabled, so we need to
* disable WS_EX_LAYERED when we acquire a valid HGLRC
@@ -1120,22 +781,9 @@ _gdk_win32_surface_create_gl_context (GdkSurface *surface,
GdkWin32GLContext *context = NULL;
/* Acquire and store up the Windows-specific HWND and HDC */
/* HWND hwnd;*/
HWND hwnd;
HDC hdc;
#ifdef GDK_WIN32_ENABLE_EGL
EGLContext egl_context;
EGLConfig config;
#endif
display_win32->gl_hwnd = GDK_SURFACE_HWND (surface);
hdc = GetDC (display_win32->gl_hwnd);
#ifdef GDK_WIN32_ENABLE_EGL
/* display_win32->hdc_egl_temp should *not* be destroyed here! It is destroyed at dispose()! */
display_win32->hdc_egl_temp = hdc;
#endif
if (!_gdk_win32_display_init_gl (display))
{
g_set_error_literal (error, GDK_GL_ERROR,
@@ -1144,21 +792,10 @@ _gdk_win32_surface_create_gl_context (GdkSurface *surface,
return NULL;
}
#if 0
if (display_win32->have_wgl)
{
hwnd = GDK_SURFACE_HWND (surface);
hdc = GetDC (hwnd);
hwnd = GDK_SURFACE_HWND (surface);
hdc = GetDC (hwnd);
display_win32->gl_hwnd = hwnd;
}
#endif
#ifdef GDK_WIN32_ENABLE_EGL
if (display_win32->have_egl && !find_eglconfig_for_window (display_win32, &config,
&display_win32->egl_min_swap_interval, error))
return NULL;
#endif
display_win32->gl_hwnd = hwnd;
context = g_object_new (GDK_TYPE_WIN32_GL_CONTEXT,
"surface", surface,
@@ -1168,11 +805,6 @@ _gdk_win32_surface_create_gl_context (GdkSurface *surface,
context->gl_hdc = hdc;
context->is_attached = attached;
#ifdef GDK_WIN32_ENABLE_EGL
if (display_win32->have_egl)
context->egl_config = config;
#endif
return GDK_GL_CONTEXT (context);
}
@@ -1188,85 +820,40 @@ _gdk_win32_display_make_gl_context_current (GdkDisplay *display,
if (context == NULL)
{
#ifdef GDK_WIN32_ENABLE_EGL
if (display_win32->egl_disp != EGL_NO_DISPLAY)
eglMakeCurrent(display_win32->egl_disp,
EGL_NO_SURFACE,
EGL_NO_SURFACE,
EGL_NO_CONTEXT);
else
#endif
wglMakeCurrent(NULL, NULL);
wglMakeCurrent(NULL, NULL);
return TRUE;
}
context_win32 = GDK_WIN32_GL_CONTEXT (context);
if (!gdk_gl_context_get_use_es (context))
if (!wglMakeCurrent (context_win32->gl_hdc, context_win32->hglrc))
{
if (!wglMakeCurrent (context_win32->gl_hdc, context_win32->hglrc))
{
GDK_NOTE (OPENGL,
g_print ("Making WGL context current failed\n"));
return FALSE;
}
if (context_win32->is_attached && display_win32->hasWglEXTSwapControl)
{
surface = gdk_gl_context_get_surface (context);
/* If there is compositing there is no particular need to delay
* the swap when drawing on the offscreen, rendering to the screen
* happens later anyway, and its up to the compositor to sync that
* to the vblank. */
display = gdk_surface_get_display (surface);
do_frame_sync = ! gdk_display_is_composited (display);
if (do_frame_sync != context_win32->do_frame_sync)
{
context_win32->do_frame_sync = do_frame_sync;
if (do_frame_sync)
wglSwapIntervalEXT (1);
else
wglSwapIntervalEXT (0);
}
}
GDK_NOTE (OPENGL,
g_print ("Making WGL context current failed\n"));
return FALSE;
}
#ifdef GDK_WIN32_ENABLE_EGL
else
if (context_win32->is_attached && display_win32->hasWglEXTSwapControl)
{
EGLSurface egl_surface;
surface = gdk_gl_context_get_surface (context);
if (context_win32->is_attached)
egl_surface = _gdk_win32_surface_get_egl_surface (surface, context_win32->egl_config, FALSE);
else
/* If there is compositing there is no particular need to delay
* the swap when drawing on the offscreen, rendering to the screen
* happens later anyway, and its up to the compositor to sync that
* to the vblank. */
display = gdk_surface_get_display (surface);
do_frame_sync = ! gdk_display_is_composited (display);
if (do_frame_sync != context_win32->do_frame_sync)
{
if (display_win32->hasEglSurfacelessContext)
egl_surface = EGL_NO_SURFACE;
context_win32->do_frame_sync = do_frame_sync;
if (do_frame_sync)
wglSwapIntervalEXT (1);
else
egl_surface = _gdk_win32_surface_get_egl_surface (surface, context_win32->egl_config, TRUE);
wglSwapIntervalEXT (0);
}
if (!eglMakeCurrent (display_win32->egl_disp,
egl_surface,
egl_surface,
context_win32->egl_context))
{
g_warning ("eglMakeCurrent failed");
return FALSE;
}
if (display_win32->egl_min_swap_interval == 0)
eglSwapInterval (display_win32->egl_disp, 0);
else
g_debug ("Can't disable GL swap interval");
}
#endif
return TRUE;
}
@@ -1301,20 +888,3 @@ gdk_win32_display_get_wgl_version (GdkDisplay *display,
return TRUE;
}
void
_gdk_win32_surface_invalidate_egl_framebuffer (GdkSurface *surface)
{
/* If we are using ANGLE, we need to force redraw of the whole Window and its child windows
* as we need to re-acquire the EGL surfaces that we rendered to upload to Cairo explicitly,
* using gdk_window_invalidate_rect (), when we maximize or restore or use aerosnap
*/
#ifdef GDK_WIN32_ENABLE_EGL
if (surface->gl_paint_context != NULL && gdk_gl_context_get_use_es (surface->gl_paint_context))
{
GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
impl->egl_force_redraw_all = TRUE;
}
#endif
}
-12
View File
@@ -24,10 +24,6 @@
#include <epoxy/gl.h>
#include <epoxy/wgl.h>
#ifdef GDK_WIN32_ENABLE_EGL
# include <epoxy/egl.h>
#endif
#include "gdkglcontextprivate.h"
#include "gdkdisplayprivate.h"
#include "gdksurface.h"
@@ -47,12 +43,6 @@ struct _GdkWin32GLContext
/* other items */
guint is_attached : 1;
guint do_frame_sync : 1;
#ifdef GDK_WIN32_ENABLE_EGL
/* EGL (Angle) Context Items */
EGLContext egl_context;
EGLConfig egl_config;
#endif
};
struct _GdkWin32GLContextClass
@@ -69,8 +59,6 @@ _gdk_win32_surface_create_gl_context (GdkSurface *window,
gboolean
_gdk_win32_display_make_gl_context_current (GdkDisplay *display,
GdkGLContext *context);
void
_gdk_win32_surface_invalidate_egl_framebuffer (GdkSurface *surface);
G_END_DECLS
+3 -12
View File
@@ -851,18 +851,7 @@ _gdk_win32_monitor_compare (GdkWin32Monitor *a,
return a == b ? 0 : a < b ? -1 : 1;
}
/**
* gdk_win32_monitor_get_workarea:
* @monitor: a #GdkMonitor
* @workarea: (out): a #GdkRectangle to be filled with
* the monitor workarea
*
* Retrieves the size and position of the work area on a monitor
* within the display coordinate space. The returned geometry is in
* application pixels, not in device pixels (see
* gdk_monitor_get_scale_factor()).
*/
void
static void
gdk_win32_monitor_get_workarea (GdkMonitor *monitor,
GdkRectangle *dest)
{
@@ -880,4 +869,6 @@ static void
gdk_win32_monitor_class_init (GdkWin32MonitorClass *class)
{
G_OBJECT_CLASS (class)->finalize = gdk_win32_monitor_finalize;
GDK_MONITOR_CLASS (class)->get_workarea = gdk_win32_monitor_get_workarea;
}
+116 -75
View File
@@ -711,22 +711,6 @@ gdk_win32_surface_destroy (GdkSurface *window,
gdk_win32_surface_set_transient_for (child, NULL);
}
#ifdef GDK_WIN32_ENABLE_EGL
GdkWin32Display *display = GDK_WIN32_DISPLAY (gdk_surface_get_display (window));
/* Get rid of any EGLSurfaces that we might have created */
if (surface->egl_surface != EGL_NO_SURFACE)
{
eglDestroySurface (display->egl_disp, surface->egl_surface);
surface->egl_surface = EGL_NO_SURFACE;
}
if (surface->egl_dummy_surface != EGL_NO_SURFACE)
{
eglDestroySurface (display->egl_disp, surface->egl_dummy_surface);
surface->egl_dummy_surface = EGL_NO_SURFACE;
}
#endif
/* Remove ourself from our transient owner */
if (surface->transient_owner != NULL)
{
@@ -779,6 +763,75 @@ get_outer_rect (GdkSurface *window,
_gdk_win32_adjust_client_rect (window, rect);
}
static void
adjust_for_gravity_hints (GdkSurface *window,
RECT *outer_rect,
int *x,
int *y)
{
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
if (impl->hint_flags & GDK_HINT_WIN_GRAVITY)
{
#ifdef G_ENABLE_DEBUG
int orig_x = *x, orig_y = *y;
#endif
switch (impl->hints.win_gravity)
{
case GDK_GRAVITY_NORTH:
case GDK_GRAVITY_CENTER:
case GDK_GRAVITY_SOUTH:
*x -= (outer_rect->right - outer_rect->left / 2) / impl->surface_scale;
*x += window->width / 2;
break;
case GDK_GRAVITY_SOUTH_EAST:
case GDK_GRAVITY_EAST:
case GDK_GRAVITY_NORTH_EAST:
*x -= (outer_rect->right - outer_rect->left) / impl->surface_scale;
*x += window->width;
break;
case GDK_GRAVITY_STATIC:
*x += outer_rect->left / impl->surface_scale;
break;
default:
break;
}
switch (impl->hints.win_gravity)
{
case GDK_GRAVITY_WEST:
case GDK_GRAVITY_CENTER:
case GDK_GRAVITY_EAST:
*y -= ((outer_rect->bottom - outer_rect->top) / 2) / impl->surface_scale;
*y += window->height / 2;
break;
case GDK_GRAVITY_SOUTH_WEST:
case GDK_GRAVITY_SOUTH:
case GDK_GRAVITY_SOUTH_EAST:
*y -= (outer_rect->bottom - outer_rect->top) / impl->surface_scale;
*y += window->height;
break;
case GDK_GRAVITY_STATIC:
*y += outer_rect->top * impl->surface_scale;
break;
default:
break;
}
GDK_NOTE (MISC,
(orig_x != *x || orig_y != *y) ?
g_print ("adjust_for_gravity_hints: x: %d->%d, y: %d->%d\n",
orig_x, *x, orig_y, *y)
: (void) 0);
}
}
static void
gdk_win32_surface_fullscreen (GdkSurface *window);
@@ -848,6 +901,8 @@ show_window_internal (GdkSurface *window,
/* For initial map of "normal" windows we want to emulate WM window
* positioning behaviour, which means:
* + Use user specified position if GDK_HINT_POS or GDK_HINT_USER_POS
* otherwise:
* + default to the initial CW_USEDEFAULT placement,
* no matter if the user moved the window before showing it.
* + Certain window types and hints have more elaborate positioning
@@ -855,7 +910,8 @@ show_window_internal (GdkSurface *window,
*/
surface = GDK_WIN32_SURFACE (window);
if (!already_mapped &&
GDK_IS_TOPLEVEL (window))
GDK_IS_TOPLEVEL (window) &&
(surface->hint_flags & (GDK_HINT_POS | GDK_HINT_USER_POS)) == 0)
{
gboolean center = FALSE;
RECT window_rect, center_on_rect;
@@ -1069,6 +1125,8 @@ gdk_win32_surface_do_move (GdkSurface *window,
impl = GDK_WIN32_SURFACE (window);
get_outer_rect (window, window->width, window->height, &outer_rect);
adjust_for_gravity_hints (window, &outer_rect, &x, &y);
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,0,0,"
"NOACTIVATE|NOSIZE|NOZORDER)\n",
GDK_SURFACE_HWND (window),
@@ -1153,6 +1211,8 @@ gdk_win32_surface_do_move_resize (GdkSurface *window,
get_outer_rect (window, width, height, &outer_rect);
adjust_for_gravity_hints (window, &outer_rect, &x, &y);
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%ld,%ld,"
"NOACTIVATE|NOZORDER)\n",
GDK_SURFACE_HWND (window),
@@ -1193,16 +1253,14 @@ gdk_win32_surface_move_resize_internal (GdkSurface *window,
}
else
{
_gdk_win32_surface_invalidate_egl_framebuffer (window);
if (with_move)
{
{
gdk_win32_surface_do_move_resize (window, x, y, width, height);
}
}
else
{
gdk_win32_surface_resize (window, width, height);
}
{
gdk_win32_surface_resize (window, width, height);
}
}
out:
@@ -1235,20 +1293,12 @@ gdk_win32_surface_layout_popup (GdkSurface *surface,
int height,
GdkPopupLayout *layout)
{
GdkMonitor *monitor;
GdkRectangle bounds;
GdkRectangle final_rect;
int x, y;
monitor = gdk_surface_get_layout_monitor (surface, layout,
gdk_win32_monitor_get_workarea);
gdk_win32_monitor_get_workarea (monitor, &bounds);
gdk_surface_layout_popup_helper (surface,
width,
height,
monitor,
&bounds,
layout,
&final_rect);
@@ -1434,6 +1484,11 @@ gdk_win32_surface_set_geometry_hints (GdkSurface *window,
impl->hint_flags = geom_mask;
impl->hints = *geometry;
if (geom_mask & GDK_HINT_POS)
{
/* even the X11 mplementation doesn't care */
}
if (geom_mask & GDK_HINT_MIN_SIZE)
{
GDK_NOTE (MISC, g_print ("... MIN_SIZE: %dx%d\n",
@@ -1446,6 +1501,29 @@ gdk_win32_surface_set_geometry_hints (GdkSurface *window,
geometry->max_width, geometry->max_height));
}
if (geom_mask & GDK_HINT_BASE_SIZE)
{
GDK_NOTE (MISC, g_print ("... BASE_SIZE: %dx%d\n",
geometry->base_width, geometry->base_height));
}
if (geom_mask & GDK_HINT_RESIZE_INC)
{
GDK_NOTE (MISC, g_print ("... RESIZE_INC: (%d,%d)\n",
geometry->width_inc, geometry->height_inc));
}
if (geom_mask & GDK_HINT_ASPECT)
{
GDK_NOTE (MISC, g_print ("... ASPECT: %g--%g\n",
geometry->min_aspect, geometry->max_aspect));
}
if (geom_mask & GDK_HINT_WIN_GRAVITY)
{
GDK_NOTE (MISC, g_print ("... GRAVITY: %d\n", geometry->win_gravity));
}
_gdk_win32_surface_update_style_bits (window);
}
@@ -2000,7 +2078,7 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context)
monitor = g_list_model_get_item (monitors, monitor_idx);
g_object_unref (monitors);
gdk_win32_monitor_get_workarea (monitor, &wa);
gdk_monitor_get_workarea (monitor, &wa);
gdk_monitor_get_geometry (monitor, &geometry);
for (other_monitor_idx = 0;
@@ -2017,7 +2095,7 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context)
other_monitor = g_list_model_get_item (monitors, other_monitor_idx);
g_object_unref (other_monitor);
gdk_win32_monitor_get_workarea (other_monitor, &other_wa);
gdk_monitor_get_workarea (other_monitor, &other_wa);
/* An edge triggers AeroSnap only if there are no
* monitors beyond that edge.
@@ -2161,7 +2239,7 @@ unsnap (GdkSurface *window,
if (impl->snap_stash == NULL)
return;
gdk_win32_monitor_get_workarea (monitor, &rect);
gdk_monitor_get_workarea (monitor, &rect);
GDK_NOTE (MISC, g_print ("Monitor work area %d x %d @ %d : %d\n", rect.width, rect.height, rect.x, rect.y));
@@ -2338,7 +2416,7 @@ snap_left (GdkSurface *window,
impl->snap_state = GDK_WIN32_AEROSNAP_STATE_HALFLEFT;
gdk_win32_monitor_get_workarea (snap_monitor, &rect);
gdk_monitor_get_workarea (snap_monitor, &rect);
stash_window (window, impl);
@@ -2366,7 +2444,7 @@ snap_right (GdkSurface *window,
impl->snap_state = GDK_WIN32_AEROSNAP_STATE_HALFRIGHT;
gdk_win32_monitor_get_workarea (snap_monitor, &rect);
gdk_monitor_get_workarea (snap_monitor, &rect);
stash_window (window, impl);
@@ -3129,7 +3207,7 @@ start_indicator (GdkSurface *window,
display = gdk_surface_get_display (window);
monitor = get_monitor_at_point (display, x, y);
gdk_win32_monitor_get_workarea (monitor, &workarea);
gdk_monitor_get_workarea (monitor, &workarea);
maxysize = GetSystemMetrics (SM_CYVIRTUALSCREEN) / impl->surface_scale;
start_size.x = start_size.y = 0;
@@ -3723,9 +3801,6 @@ gdk_win32_surface_end_move_resize_drag (GdkSurface *window)
{
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
GdkW32DragMoveResizeContext *context = &impl->drag_move_resize_context;
if (context->op == GDK_WIN32_DRAGOP_RESIZE)
_gdk_win32_surface_invalidate_egl_framebuffer (window);
context->op = GDK_WIN32_DRAGOP_NONE;
@@ -4203,8 +4278,6 @@ gdk_win32_surface_unmaximize (GdkSurface *window)
GDK_SURFACE_HWND (window),
_gdk_win32_surface_state_to_string (window->state)));
_gdk_win32_surface_invalidate_egl_framebuffer (window);
if (GDK_SURFACE_IS_MAPPED (window))
GtkShowWindow (window, SW_RESTORE);
else
@@ -4281,7 +4354,6 @@ gdk_win32_surface_unfullscreen (GdkSurface *window)
impl->hint_flags = fi->hint_flags;
SetWindowLong (GDK_SURFACE_HWND (window), GWL_STYLE, fi->style);
_gdk_win32_surface_invalidate_egl_framebuffer (window);
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window), HWND_NOTOPMOST,
fi->r.left, fi->r.top,
fi->r.right - fi->r.left, fi->r.bottom - fi->r.top,
@@ -5060,34 +5132,3 @@ gdk_win32_drag_surface_iface_init (GdkDragSurfaceInterface *iface)
{
iface->present = gdk_win32_drag_surface_present;
}
#ifdef GDK_WIN32_ENABLE_EGL
EGLSurface
_gdk_win32_surface_get_egl_surface (GdkSurface *surface,
EGLConfig config,
gboolean is_dummy)
{
GdkWin32Display *display = GDK_WIN32_DISPLAY (gdk_surface_get_display (surface));
GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
if (is_dummy)
{
if (impl->egl_dummy_surface == EGL_NO_SURFACE)
{
EGLint attribs[] = {EGL_WIDTH, 1, EGL_WIDTH, 1, EGL_NONE};
impl->egl_dummy_surface = eglCreatePbufferSurface (display->egl_disp,
config,
attribs);
}
return impl->egl_dummy_surface;
}
else
{
if (impl->egl_surface == EGL_NO_SURFACE)
impl->egl_surface = eglCreateWindowSurface (display->egl_disp, config, display->gl_hwnd, NULL);
return impl->egl_surface;
}
}
#endif
-16
View File
@@ -34,10 +34,6 @@
#include <windows.h>
#ifdef GDK_WIN32_ENABLE_EGL
# include <epoxy/egl.h>
#endif
G_BEGIN_DECLS
typedef enum
@@ -355,12 +351,6 @@ struct _GdkWin32Surface
int surface_scale;
int unscaled_width;
int unscaled_height;
#ifdef GDK_WIN32_ENABLE_EGL
EGLSurface egl_surface;
EGLSurface egl_dummy_surface;
guint egl_force_redraw_all : 1;
#endif
};
struct _GdkWin32SurfaceClass
@@ -402,12 +392,6 @@ void
gdk_win32_surface_apply_queued_move_resize (GdkSurface *surface,
RECT window_rect);
#ifdef GDK_WIN32_ENABLE_EGL
EGLSurface _gdk_win32_surface_get_egl_surface (GdkSurface *surface,
EGLConfig config,
gboolean is_dummy);
#endif
G_END_DECLS
#endif /* __GDK_SURFACE_WIN32_H__ */
-3
View File
@@ -45,9 +45,6 @@ typedef struct _GdkWin32MonitorClass GdkWin32MonitorClass;
GDK_AVAILABLE_IN_ALL
GType gdk_win32_monitor_get_type (void) G_GNUC_CONST;
void gdk_win32_monitor_get_workarea (GdkMonitor *monitor,
GdkRectangle *workarea);
G_END_DECLS
#endif /* __GDK_WIN32_MONITOR_H__ */
+1 -7
View File
@@ -43,12 +43,6 @@ gdk_win32_public_headers = files([
install_headers(gdk_win32_public_headers, 'gdkwin32.h', subdir: 'gtk-4.0/gdk/win32/')
GDK_WIN32_EGL_CFLAGS = []
if win32_has_egl
GDK_WIN32_EGL_CFLAGS = ['-DGDK_WIN32_ENABLE_EGL']
endif
gdk_win32_deps = [ # FIXME
pangowin32_dep
]
@@ -56,5 +50,5 @@ gdk_win32_deps = [ # FIXME
libgdk_win32 = static_library('gdk-win32',
gdk_win32_sources, gdkconfig, gdkenum_h,
include_directories: [confinc, gdkinc],
c_args: ['-DGTK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"', '-DINSIDE_GDK_WIN32'] + GDK_WIN32_EGL_CFLAGS,
c_args: ['-DGTK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"', '-DINSIDE_GDK_WIN32'],
dependencies: [gdk_deps, gdk_win32_deps])
+88 -15
View File
@@ -50,7 +50,6 @@ struct _GdkX11DeviceXI2
int device_id;
GArray *scroll_valuators;
double *last_axes;
GdkX11DeviceType device_type;
};
struct _GdkX11DeviceXI2Class
@@ -71,6 +70,10 @@ static void gdk_x11_device_xi2_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec);
static void gdk_x11_device_xi2_get_state (GdkDevice *device,
GdkSurface *surface,
double *axes,
GdkModifierType *mask);
static void gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,
GdkCursor *cursor);
@@ -112,6 +115,7 @@ gdk_x11_device_xi2_class_init (GdkX11DeviceXI2Class *klass)
object_class->get_property = gdk_x11_device_xi2_get_property;
object_class->set_property = gdk_x11_device_xi2_set_property;
device_class->get_state = gdk_x11_device_xi2_get_state;
device_class->set_surface_cursor = gdk_x11_device_xi2_set_surface_cursor;
device_class->query_state = gdk_x11_device_xi2_query_state;
device_class->grab = gdk_x11_device_xi2_grab;
@@ -183,6 +187,78 @@ gdk_x11_device_xi2_set_property (GObject *object,
}
}
static void
gdk_x11_device_xi2_get_state (GdkDevice *device,
GdkSurface *surface,
double *axes,
GdkModifierType *mask)
{
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
if (axes)
{
GdkDisplay *display;
XIDeviceInfo *info;
int i, j, ndevices;
Screen *xscreen;
display = gdk_device_get_display (device);
xscreen = GDK_X11_SCREEN (GDK_X11_DISPLAY (display)->screen)->xscreen;
gdk_x11_display_error_trap_push (display);
info = XIQueryDevice (GDK_DISPLAY_XDISPLAY (display),
device_xi2->device_id, &ndevices);
gdk_x11_display_error_trap_pop_ignored (display);
for (i = 0, j = 0; info && i < info->num_classes; i++)
{
XIAnyClassInfo *class_info = info->classes[i];
GdkAxisUse use;
double value;
if (class_info->type != XIValuatorClass)
continue;
value = ((XIValuatorClassInfo *) class_info)->value;
use = gdk_device_get_axis_use (device, j);
switch ((guint) use)
{
case GDK_AXIS_X:
case GDK_AXIS_Y:
case GDK_AXIS_IGNORE:
{
int root_x, root_y;
/* FIXME: Maybe root coords caching should happen here */
gdk_surface_get_origin (surface, &root_x, &root_y);
_gdk_device_translate_screen_coord (device, surface,
root_x, root_y,
WidthOfScreen (xscreen),
HeightOfScreen (xscreen),
j, value,
&axes[j]);
}
break;
default:
_gdk_device_translate_axis (device, j, value, &axes[j]);
break;
}
j++;
}
if (info)
XIFreeDeviceInfo (info);
}
if (mask)
gdk_x11_device_xi2_query_state (device, surface,
NULL,
NULL, NULL,
mask);
}
static void
gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,
@@ -191,7 +267,7 @@ gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
/* Non-logical devices don't have a cursor */
if (device_xi2->device_type != GDK_X11_DEVICE_TYPE_LOGICAL)
if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_LOGICAL)
return;
if (cursor)
@@ -236,6 +312,16 @@ gdk_x11_device_xi2_query_state (GdkDevice *device,
scale = GDK_X11_SURFACE (surface)->surface_scale;
}
if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_PHYSICAL)
{
GdkDevice *logical = gdk_device_get_associated_device (device);
if (logical != NULL)
_gdk_device_query_state (logical, surface, child_surface,
win_x, win_y, mask);
return;
}
if (!GDK_X11_DISPLAY (display)->trusted_client ||
!XIQueryPointer (GDK_DISPLAY_XDISPLAY (display),
device_xi2->device_id,
@@ -774,16 +860,3 @@ gdk_x11_device_xi2_store_axes (GdkX11DeviceXI2 *device,
else
device->last_axes = NULL;
}
GdkX11DeviceType
gdk_x11_device_xi2_get_device_type (GdkX11DeviceXI2 *device)
{
return device->device_type;
}
void
gdk_x11_device_xi2_set_device_type (GdkX11DeviceXI2 *device,
GdkX11DeviceType type)
{
device->device_type = type;
}
+41 -20
View File
@@ -471,7 +471,7 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
{
GdkInputSource input_source;
GdkInputSource touch_source;
GdkX11DeviceType type;
GdkDeviceType type;
GdkDevice *device;
int num_touches = 0;
char *vendor_id = NULL, *product_id = NULL;
@@ -489,7 +489,9 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
tmp_name = g_ascii_strdown (dev->name, -1);
if (strstr (tmp_name, " pad"))
if (strstr (tmp_name, "cursor"))
input_source = GDK_SOURCE_CURSOR;
else if (strstr (tmp_name, " pad"))
input_source = GDK_SOURCE_TABLET_PAD;
else if (strstr (tmp_name, "wacom") ||
strstr (tmp_name, "pen") ||
@@ -515,15 +517,15 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
{
case XIMasterKeyboard:
case XIMasterPointer:
type = GDK_X11_DEVICE_TYPE_LOGICAL;
type = GDK_DEVICE_TYPE_LOGICAL;
break;
case XISlaveKeyboard:
case XISlavePointer:
type = GDK_X11_DEVICE_TYPE_PHYSICAL;
type = GDK_DEVICE_TYPE_PHYSICAL;
break;
case XIFloatingSlave:
default:
type = GDK_X11_DEVICE_TYPE_FLOATING;
type = GDK_DEVICE_TYPE_FLOATING;
break;
}
@@ -545,6 +547,7 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
device = g_object_new (GDK_TYPE_X11_DEVICE_XI2,
"name", dev->name,
"type", type,
"source", input_source,
"has-cursor", (dev->use == XIMasterPointer),
"display", display,
@@ -553,7 +556,6 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
"product-id", product_id,
"num-touches", num_touches,
NULL);
gdk_x11_device_xi2_set_device_type ((GdkX11DeviceXI2 *) device, type);
translate_device_classes (display, device, dev->classes, dev->num_classes);
g_free (vendor_id);
@@ -652,14 +654,13 @@ static void
detach_from_seat (GdkDevice *device)
{
GdkSeat *seat = gdk_device_get_seat (device);
GdkX11DeviceXI2 *device_xi2 = (GdkX11DeviceXI2 *) device;
if (!seat)
return;
if (gdk_x11_device_xi2_get_device_type (device_xi2) == GDK_X11_DEVICE_TYPE_LOGICAL)
if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_LOGICAL)
gdk_display_remove_seat (gdk_device_get_display (device), seat);
else if (gdk_x11_device_xi2_get_device_type (device_xi2) == GDK_X11_DEVICE_TYPE_PHYSICAL)
else if (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_PHYSICAL)
gdk_seat_default_remove_physical_device (GDK_SEAT_DEFAULT (seat), device);
}
@@ -915,7 +916,7 @@ handle_hierarchy_changed (GdkX11DeviceManagerXI2 *device_manager,
else if (ev->info[i].flags & XISlaveAttached ||
ev->info[i].flags & XISlaveDetached)
{
GdkDevice *logical = NULL, *physical;
GdkDevice *logical, *physical;
GdkSeat *seat;
physical = g_hash_table_lookup (device_manager->id_table,
@@ -924,8 +925,17 @@ handle_hierarchy_changed (GdkX11DeviceManagerXI2 *device_manager,
if (!physical)
continue;
seat = gdk_device_get_seat (physical);
gdk_seat_default_remove_physical_device (GDK_SEAT_DEFAULT (seat), physical);
/* Remove old logical device info */
logical = gdk_device_get_associated_device (physical);
if (logical != NULL)
{
_gdk_device_remove_physical_device (logical, physical);
_gdk_device_set_associated_device (physical, NULL);
seat = gdk_device_get_seat (logical);
gdk_seat_default_remove_physical_device (GDK_SEAT_DEFAULT (seat), physical);
}
/* Add new logical device if it's an attachment event */
if (ev->info[i].flags & XISlaveAttached)
@@ -1189,7 +1199,7 @@ translate_axes (GdkDevice *device,
double *vals;
n_axes = gdk_device_get_n_axes (device);
axes = g_new0 (double, GDK_AXIS_LAST);
axes = g_new0 (double, n_axes);
vals = valuators->values;
for (i = 0; i < MIN (valuators->mask_len * 8, n_axes); i++)
@@ -1198,7 +1208,10 @@ translate_axes (GdkDevice *device,
double val;
if (!XIMaskIsSet (valuators->mask, i))
continue;
{
axes[i] = gdk_x11_device_xi2_get_last_axis_value (GDK_X11_DEVICE_XI2 (device), i);
continue;
}
use = gdk_device_get_axis_use (device, i);
val = *vals++;
@@ -1209,13 +1222,13 @@ translate_axes (GdkDevice *device,
case GDK_AXIS_Y:
{
if (use == GDK_AXIS_X)
axes[use] = x;
axes[i] = x;
else
axes[use] = y;
axes[i] = y;
}
break;
default:
_gdk_device_translate_axis (device, i, val, &axes[use]);
_gdk_device_translate_axis (device, i, val, &axes[i]);
break;
}
}
@@ -1432,7 +1445,7 @@ _gdk_device_manager_xi2_handle_focus (GdkSurface *surface,
{
GdkEvent *event;
event = gdk_focus_event_new (surface, device, focus_in);
event = gdk_focus_event_new (surface, device, source_device, focus_in);
gdk_display_put_event (gdk_surface_get_display (surface), event);
gdk_event_unref (event);
}
@@ -1573,6 +1586,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
: GDK_KEY_RELEASE,
surface,
device,
source_device,
xev->time,
xev->detail,
state,
@@ -1638,6 +1652,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
GUINT_TO_POINTER (xev->sourceid));
event = gdk_scroll_event_new_discrete (surface,
device,
source_device,
NULL,
xev->time,
@@ -1671,6 +1686,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
: GDK_BUTTON_RELEASE,
surface,
device,
source_device,
source_device->last_tool,
xev->time,
_gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group),
@@ -1712,7 +1728,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
* source device, we need to explicitly ignore the first event in
* order to get the correct delta for the second.
*/
if (gdk_x11_device_xi2_get_device_type ((GdkX11DeviceXI2 *) device) != GDK_X11_DEVICE_TYPE_PHYSICAL &&
if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL &&
scroll_valuators_changed (GDK_X11_DEVICE_XI2 (source_device),
&xev->valuators, &delta_x, &delta_y))
{
@@ -1723,6 +1739,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event = gdk_scroll_event_new (surface,
device,
source_device,
NULL,
xev->time,
_gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group),
@@ -1743,6 +1760,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event = gdk_motion_event_new (surface,
device,
source_device,
source_device->last_tool,
xev->time,
_gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group),
@@ -1794,6 +1812,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
GUINT_TO_POINTER (xev->detail),
surface,
device,
source_device,
xev->time,
state,
x, y,
@@ -1841,6 +1860,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
GUINT_TO_POINTER (xev->detail),
surface,
device,
source_device,
xev->time,
state,
x, y,
@@ -1887,7 +1907,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
xev->detail != XINotifyInferior && xev->mode != XINotifyPassiveUngrab &&
GDK_IS_TOPLEVEL (surface))
{
if (gdk_x11_device_xi2_get_device_type ((GdkX11DeviceXI2 *) device) != GDK_X11_DEVICE_TYPE_LOGICAL)
if (gdk_device_get_device_type (source_device) != GDK_DEVICE_TYPE_LOGICAL)
_gdk_device_xi2_reset_scroll_valuators (GDK_X11_DEVICE_XI2 (source_device));
else
{
@@ -1907,6 +1927,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
: GDK_LEAVE_NOTIFY,
surface,
device,
source_device,
xev->time,
state,
(double) xev->event_x / scale,
+9 -13
View File
@@ -1760,9 +1760,15 @@ device_grab_update_callback (GdkDisplay *display,
gpointer data,
gulong serial)
{
GdkPointerSurfaceInfo *pointer_info;
GdkDevice *device = data;
_gdk_display_device_grab_update (display, device, serial);
pointer_info = _gdk_display_get_pointer_info (display, device);
_gdk_display_device_grab_update (display, device,
pointer_info->last_physical_device != NULL
? pointer_info->last_physical_device
: device,
serial);
}
#define XSERVER_TIME_IS_LATER(time1, time2) \
@@ -1829,18 +1835,7 @@ gdk_x11_display_has_pending (GdkDisplay *display)
return XPending (GDK_DISPLAY_XDISPLAY (display));
}
/**
* gdk_x11_display_get_default_group:
* @display: a #GdkDisplay
*
* Returns the default group leader surface for all toplevel surfaces
* on @display. This surface is implicitly created by GDK.
* See gdk_surface_set_group().
*
* Returns: (transfer none): The default group leader surface
* for @display
*/
GdkSurface *
static GdkSurface *
gdk_x11_display_get_default_group (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
@@ -2948,6 +2943,7 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
display_class->make_default = gdk_x11_display_make_default;
display_class->has_pending = gdk_x11_display_has_pending;
display_class->queue_events = _gdk_x11_display_queue_events;
display_class->get_default_group = gdk_x11_display_get_default_group;
display_class->get_app_launch_context = _gdk_x11_display_get_app_launch_context;
display_class->get_next_serial = gdk_x11_display_get_next_serial;
+1 -3
View File
@@ -2208,13 +2208,11 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
GdkModifierType state;
GdkDevice *pointer;
GdkSeat *seat;
int dx, dy;
dx = dy = 0;
state = gdk_event_get_modifier_state (event);
seat = gdk_event_get_seat (event);
pointer = gdk_seat_get_pointer (seat);
pointer = gdk_device_get_associated_device (gdk_event_get_device (event));
if (event->event_type == GDK_KEY_PRESS)
{
+2
View File
@@ -117,6 +117,7 @@ handle_focus_change (GdkEvent *event)
focus_event = gdk_focus_event_new (gdk_event_get_surface (event),
gdk_event_get_device (event),
gdk_event_get_source_device (event),
focus_in);
gdk_display_put_event (gdk_event_get_display (event), focus_event);
gdk_event_unref (focus_event);
@@ -137,6 +138,7 @@ create_synth_crossing_event (GdkEventType evtype,
event = gdk_crossing_event_new (evtype,
gdk_event_get_surface (real_event),
gdk_event_get_device (real_event),
gdk_event_get_source_device (real_event),
gdk_event_get_time (real_event),
gdk_event_get_modifier_state (real_event),
x, y,

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