Compare commits

..

21 Commits

Author SHA1 Message Date
Matthias Clasen 40a4824b14 gtk: Remove handling of virtual modifiers
These are going away. We expect to just have
named modifiers in modifier masks now, so we
longer juggle 'real' and 'virtual' modifiers.
2020-04-05 10:26:39 -04:00
Matthias Clasen 38fb231a05 gdk: Clean up GdkModifierType
Remove MOD2..MOD5. Backends are expected to just set
the named modifiers.
2020-04-05 10:24:07 -04:00
Matthias Clasen e39190c5d2 events: Stop doing elaborate virtual modifier handling
These are going away in the GdkModifierType cleanup.
Just compare the modifiers we got.
2020-04-05 10:23:18 -04:00
Matthias Clasen a91e94a18e broadway: Stop using MOD2..MOD5
These are going away in the GdkModifierType cleanup.
2020-04-05 10:08:01 -04:00
Matthias Clasen 06e6af7641 win32: Stop using MOD2..MOD5
These are going away in the GdkModifierType cleanup.
2020-04-05 10:07:32 -04:00
Matthias Clasen a7cc504bc2 wayland: Stop setting MOD2..MOD5
These are going away in the GdkModifierType cleanup.
2020-04-05 10:06:51 -04:00
Matthias Clasen 48e0075140 gdk: Remove reserved bit from GdkModifierType
This really has no purpose and obscures the header.
2020-04-05 10:04:47 -04:00
Matthias Clasen d71c7bc324 tests: Stop using GDK_MODx_MASK
These are going away.
2020-04-05 09:54:02 -04:00
Matthias Clasen be0acd1bea gtk: Stop using GDK_MODx_MASK
These are never used in practice, and we never want to
see them in the UI, so stop supporting them. This is
in preparation for cleaning up GdkModifierType.
2020-04-05 09:53:02 -04:00
Matthias Clasen a044d2841c Rename GDK_MOD1_MASK to GDK_ALT_MASK
We've hardcoded Mod1 = Alt for a long time, there is
no need to keep the confusing naming around anymore.
2020-04-05 09:48:19 -04:00
Matthias Clasen 85e65cdb12 gtk: Stop using keymap apis
Stop using most keymap apis in GTK. Only a few calls
related to virtual modifiers are left.
2020-04-05 08:54:07 -04:00
Matthias Clasen d3e5072aea x11: Notify new device properties 2020-04-05 00:48:02 -04:00
Matthias Clasen 5b4e5c3da8 wayland: Notify new device properties 2020-04-05 00:37:51 -04:00
Matthias Clasen 976f1ad0af gdk: Move modifier mask api to GdkDisplay
GdkKeymap is on the way out.
2020-04-05 00:37:23 -04:00
Matthias Clasen cbc543e1ca gdk: Add keymap properties to GdkDevice
GdkKeymap is on the way out.
2020-04-05 00:36:42 -04:00
Matthias Clasen 4e44574bc6 passwordentry: Show caps lock warning more
Show the caps lock warning regardless of whether we
have the peek icon or not.
2020-04-05 00:30:23 -04:00
Matthias Clasen 61df2373b6 Drop some no longer used code 2020-04-04 20:04:42 -04:00
Matthias Clasen 78b9380d5b cell renderer accel: Use gdk_event_get_match 2020-04-04 20:03:44 -04:00
Matthias Clasen 69b0596607 fixup gdk_event_matches 2020-04-04 20:03:19 -04:00
Matthias Clasen d2087a23fc Add gdk_event_get_match
This is a counterpart to gdk_event_matches() that can
be used to obtain a shortcut matching an event.
2020-04-04 20:02:20 -04:00
Matthias Clasen c9da5e9043 Add gdk_event_matches
Move the elaborate key event matching code from
GtkShortcutTrigger to GdkEvent, which greatly reduces
the amount of keymap api use outside of GDK.
2020-04-04 17:51:32 -04:00
557 changed files with 31970 additions and 43217 deletions
+5 -5
View File
@@ -27,14 +27,14 @@ variables:
style-check-diff:
extends: .only-default
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
stage: .pre
allow_failure: true
script:
- .gitlab-ci/run-style-check-diff.sh
fedora-x86_64:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
stage: build
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
@@ -66,7 +66,7 @@ fedora-x86_64:
<<: *cache-paths
release-build:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
stage: build
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
@@ -168,7 +168,7 @@ flatpak-master:icon-browser:
<<: *flatpak-master
static-scan:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
stage: analysis
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug"
@@ -181,7 +181,7 @@ static-scan:
allow_failure: true
reference:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
stage: docs
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
+1 -1
View File
@@ -82,7 +82,7 @@ RUN dnf -y install \
xorg-x11-server-Xvfb \
&& dnf clean all
RUN pip3 install meson==0.53.1
RUN pip3 install meson==0.52.1
ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID}
+20 -20
View File
@@ -174,7 +174,7 @@ ul.images li {
<div class="failures">
<h4><a name="{{ suite_result.suite_name }}-failed">Failures</a></h4>
<ul class="failed">
{% for failure in suite_result.failures if failure.result in [ 'ERROR', 'FAIL', 'UNEXPECTEDPASS' ] %}
{% for failure in suite_result.failures if failure.result in [ 'FAIL', 'UNEXPECTEDPASS' ] %}
<li><a name="{{ failure.name }}">{{ failure.name }}</a> - result: <span class="result fail">{{ failure.result }}</span><br/>
{% if failure.stdout %}
Output: <pre>{{ failure.stdout }}</pre>
@@ -207,6 +207,24 @@ ul.images li {
</div>
<div class="successes">
<h4><a name="{{ suite_result.suite_name }}-skipped">Skipped</a></h4>
<ul>
{% for success in suite_result.successes if success.result == 'SKIP' %}
<li>{{ success.name }} - result: <span class="result skip">{{ success.result }}</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
<h4><a name="{{ suite_result.suite_name }}-passed">Passed</a></h4>
<ul class="passed">
{% for success in suite_result.successes if success.result == 'OK' %}
<li>{{ success.name }} - result: <span class="result pass">{{ success.result }}</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
<h4><a name="{{ suite_result.suite_name }}-expected-fail">Expected failures</a></h4>
<ul>
{% for success in suite_result.successes if success.result == 'EXPECTEDFAIL' %}
@@ -226,24 +244,6 @@ ul.images li {
<li>None</li>
{% endfor %}
</ul>
<h4><a name="{{ suite_result.suite_name }}-skipped">Skipped</a></h4>
<ul>
{% for success in suite_result.successes if success.result == 'SKIP' %}
<li>{{ success.name }} - result: <span class="result skip">{{ success.result }}</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
<h4><a name="{{ suite_result.suite_name }}-passed">Passed</a></h4>
<ul class="passed">
{% for success in suite_result.successes if success.result == 'OK' %}
<li>{{ success.name }} - result: <span class="result pass">{{ success.result }}</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
</div>
</div>
@@ -331,7 +331,7 @@ for name, units in suites.items():
print('Processing {} suite {}:'.format(project_name, suite_name))
def if_failed(unit):
if unit['result'] in ['FAIL', 'UNEXPECTEDPASS', 'TIMEOUT', 'ERROR',]:
if unit['result'] in ['FAIL', 'UNEXPECTEDPASS', 'TIMEOUT']:
return True
return False
+1 -1
View File
@@ -70,7 +70,7 @@ for name, units in suites.items():
print('Processing suite {} (units: {})'.format(name, len(units)))
def if_failed(unit):
if unit['result'] in ['ERROR', 'FAIL', 'UNEXPECTEDPASS', 'TIMEOUT']:
if unit['result'] in ['FAIL', 'UNEXPECTEDPASS', 'TIMEOUT']:
return True
return False
-76
View File
@@ -1,79 +1,3 @@
Overview of Changes in GTK 3.98.3
=================================
* GtkEntry:
- Support setting attributes in ui files
* GtkScaleButton:
- Don't derive from GtkButton
* GtkAboutDialog:
- Support more common licenses
* GtkEmojiChooser:
- Improve keyboard navigation
* GtkLabel:
- Remove pattern API
* GtkAspectFrame:
- Modernize and simplify
* Chooser buttons:
- Make dialogs modal by default
* Various widgets:
- Replace shadow-type and relief properties by
a simpler has-frame
* CSS:
- Use :focus-visible instead of :focus(visible)
- Add support for :focus-within
* Focus handling
- Fix crossing event generation
- Fix focus handling in various widgets
- Change :can-focus to be recursive
- Fix GtkWindow:is-active setting
* Scrolling
- gtk_container_set_focus_[hv]adjustment has been removed
- gtk_viewport_set_scroll_to_focus has been added
* Accessibility:
- Add a cursor-aspect-ratio setting
- Set focus-related states properly
* Themes:
- Use blue focus outlines more
- Numerous minor improvements
* Wayland:
- Fix .Compose file loading
- Support popup repositioning
- Fix problems with autohide popovers
* GDK:
- Remove GdkKeymap from public API, replaced by
GdkDevice properties
- Add full keyboard translation state to key events
- Simplify modifier support, drop GdkModifierIntent
- Move key event matching to GDK
- Add GdkSurface::enter/leave-monitor signals
- Turn GskEvent into a derivable type, and make
it introspectable
* GSK:
- Turn GskRenderNode into a derivable type, and make
it introspectable
- Fall back to cairo if compiling shaders fails
* Translation updates:
- Japanese
- Lithuanian
- Turkish
Overview of Changes in GTK 3.98.2
=================================
@@ -613,19 +613,19 @@ create_widget_func (gpointer item,
if (GTK_IS_CONSTRAINT (item) || GTK_IS_CONSTRAINT_GUIDE (item))
{
button = gtk_button_new_from_icon_name ("document-edit-symbolic");
gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
g_signal_connect (button, "clicked", G_CALLBACK (row_edit), win);
g_object_set_data (G_OBJECT (row), "edit", button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_from_icon_name ("edit-delete-symbolic");
gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
g_signal_connect (button, "clicked", G_CALLBACK (row_delete), win);
gtk_container_add (GTK_CONTAINER (box), button);
}
else if (GTK_IS_WIDGET (item))
{
button = gtk_button_new_from_icon_name ("edit-delete-symbolic");
gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
g_signal_connect (button, "clicked", G_CALLBACK (row_delete), win);
gtk_container_add (GTK_CONTAINER (box), button);
}
+2 -2
View File
@@ -214,7 +214,7 @@ constraint_view_add_child (ConstraintView *view,
label = gtk_label_new (name);
frame = gtk_frame_new (NULL);
gtk_widget_add_css_class (frame, "child");
gtk_style_context_add_class (gtk_widget_get_style_context (frame), "child");
gtk_widget_set_name (frame, name);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_widget_set_parent (frame, GTK_WIDGET (view));
@@ -257,7 +257,7 @@ constraint_view_add_guide (ConstraintView *view,
G_BINDING_DEFAULT);
frame = gtk_frame_new (NULL);
gtk_widget_add_css_class (frame, "guide");
gtk_style_context_add_class (gtk_widget_get_style_context (frame), "guide");
g_object_set_data (G_OBJECT (frame), "internal", (char *)"yes");
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_widget_insert_after (frame, GTK_WIDGET (view), NULL);
+1 -1
View File
@@ -61,7 +61,7 @@
</child>
<child>
<object class="GtkScrolledWindow">
<property name="has-frame">1</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTextView">
<property name="hexpand">1</property>
+1 -1
View File
@@ -11,7 +11,7 @@
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
<attribute name="accel">&lt;Control&gt;q</attribute>
<attribute name="accel">&lt;Primary&gt;q</attribute>
</item>
</section>
</menu>
+1 -1
View File
@@ -26,7 +26,7 @@
<child>
<object class="GtkScrolledWindow" id="scrolledwindow">
<property name="vexpand">1</property>
<property name="has-frame">1</property>
<property name="shadow-type">in</property>
<property name="min-content-width">150</property>
<layout>
<property name="left-attach">0</property>
+14 -12
View File
@@ -131,11 +131,13 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
GtkAlign valign, halign;
gboolean is_left, is_right, is_top, is_bottom;
gboolean has_left, has_right, has_top, has_bottom;
GtkStyleContext *context;
has_left = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_LEFT);
has_right = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_RIGHT);
has_top = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_TOP);
has_bottom = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_BOTTOM);
context = gtk_widget_get_style_context (child);
has_left = gtk_style_context_has_class (context, GTK_STYLE_CLASS_LEFT);
has_right = gtk_style_context_has_class (context, GTK_STYLE_CLASS_RIGHT);
has_top = gtk_style_context_has_class (context, GTK_STYLE_CLASS_TOP);
has_bottom = gtk_style_context_has_class (context, GTK_STYLE_CLASS_BOTTOM);
is_left = is_right = is_top = is_bottom = FALSE;
@@ -158,24 +160,24 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
is_bottom = (child_allocation->y + child_allocation->height == height);
if (has_left && !is_left)
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_LEFT);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
else if (!has_left && is_left)
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_LEFT);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
if (has_right && !is_right)
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_RIGHT);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
else if (!has_right && is_right)
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_RIGHT);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
if (has_top && !is_top)
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_TOP);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
else if (!has_top && is_top)
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_TOP);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
if (has_bottom && !is_bottom)
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_BOTTOM);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
else if (!has_bottom && is_bottom)
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_BOTTOM);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
}
static void
+1
View File
@@ -90,6 +90,7 @@ do_colorsel (GtkWidget *do_widget)
*/
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (vbox), frame);
da = gtk_drawing_area_new ();
-5
View File
@@ -104,10 +104,6 @@
<file>gtkfishbowl.c</file>
<file>gtkfishbowl.h</file>
</gresource>
<gresource prefix="/gears">
<file>gtkgears.c</file>
<file>gtkgears.h</file>
</gresource>
<gresource prefix="/iconscroll">
<file>iconscroll.ui</file>
</gresource>
@@ -180,7 +176,6 @@
<file>font_features.c</file>
<file>fontplane.c</file>
<file>fontrendering.c</file>
<file>gears.c</file>
<file>gestures.c</file>
<file>glarea.c</file>
<file>headerbar.c</file>
+9 -9
View File
@@ -29,29 +29,29 @@
<item>
<attribute name="label" translatable="yes">_New</attribute>
<attribute name="action">win.new</attribute>
<attribute name="accel">&lt;Control&gt;n</attribute>
<attribute name="accel">&lt;Primary&gt;n</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Open</attribute>
<attribute name="action">win.open</attribute>
<attribute name="accel">&lt;Control&gt;o</attribute>
<attribute name="accel">&lt;Primary&gt;o</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Save</attribute>
<attribute name="action">win.save</attribute>
<attribute name="accel">&lt;Control&gt;s</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Save _As</attribute>
<attribute name="action">win.save-as</attribute>
<attribute name="accel">&lt;Control&gt;q</attribute>
<attribute name="accel">&lt;Primary&gt;q</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">win.quit</attribute>
<attribute name="accel">&lt;Control&gt;&lt;Shift&gt;s</attribute>
<attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;s</attribute>
</item>
</section>
</submenu>
@@ -61,17 +61,17 @@
<item>
<attribute name="label" translatable="yes">_Copy</attribute>
<attribute name="action">win.copy</attribute>
<attribute name="accel">&lt;Control&gt;c</attribute>
<attribute name="accel">&lt;Primary&gt;c</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Cut</attribute>
<attribute name="action">win.cut</attribute>
<attribute name="accel">&lt;Control&gt;x</attribute>
<attribute name="accel">&lt;Primary&gt;x</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Paste</attribute>
<attribute name="action">win.paste</attribute>
<attribute name="accel">&lt;Control&gt;v</attribute>
<attribute name="accel">&lt;Primary&gt;v</attribute>
</item>
</section>
</submenu>
@@ -166,7 +166,7 @@
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="has-frame">1</property>
<property name="shadow-type">in</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
+1 -1
View File
@@ -472,7 +472,7 @@ demo_tagged_entry_tag_set_has_close_button (DemoTaggedEntryTag *tag,
gtk_container_add (GTK_CONTAINER (tag->button), image);
gtk_widget_set_halign (tag->button, GTK_ALIGN_CENTER);
gtk_widget_set_valign (tag->button, GTK_ALIGN_CENTER);
gtk_button_set_has_frame (GTK_BUTTON (tag->button), FALSE);
gtk_button_set_relief (GTK_BUTTON (tag->button), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (tag->box), tag->button);
g_signal_connect (tag->button, "clicked", G_CALLBACK (on_button_clicked), tag);
}
+9 -9
View File
@@ -81,7 +81,7 @@ deserialize_widget (GtkDemoWidget *demo)
else if (demo->type == GTK_TYPE_SPINNER)
{
widget = g_object_new (demo->type, "spinning", demo->active, NULL);
gtk_widget_add_css_class (widget, "demo");
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
}
else
{
@@ -114,7 +114,7 @@ new_spinner_cb (GtkWidget *button,
GtkWidget *widget;
widget = gtk_spinner_new ();
gtk_widget_add_css_class (widget, "demo");
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
gtk_spinner_start (GTK_SPINNER (widget));
gtk_fixed_put (fixed, widget, pos_x, pos_y);
@@ -279,11 +279,11 @@ pressed_cb (GtkGesture *gesture,
gtk_container_add (GTK_CONTAINER (menu), box);
item = gtk_button_new_with_label ("New Label");
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
g_signal_connect (item, "clicked", G_CALLBACK (new_label_cb), widget);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("New Spinner");
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
g_signal_connect (item, "clicked", G_CALLBACK (new_spinner_cb), widget);
gtk_container_add (GTK_CONTAINER (box), item);
@@ -291,7 +291,7 @@ pressed_cb (GtkGesture *gesture,
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Edit");
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect (item, "clicked", G_CALLBACK (edit_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
@@ -300,24 +300,24 @@ pressed_cb (GtkGesture *gesture,
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Cut");
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect (item, "clicked", G_CALLBACK (cut_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Copy");
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect (item, "clicked", G_CALLBACK (copy_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Paste");
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
gtk_widget_set_sensitive (item,
gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GTK_TYPE_DEMO_WIDGET));
g_signal_connect (item, "clicked", G_CALLBACK (paste_cb), widget);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Delete");
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect (item, "clicked", G_CALLBACK (delete_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
+2
View File
@@ -214,6 +214,7 @@ do_drawingarea (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_vexpand (frame, TRUE);
gtk_container_add (GTK_CONTAINER (vbox), frame);
@@ -234,6 +235,7 @@ do_drawingarea (GtkWidget *do_widget)
frame = gtk_frame_new (NULL);
gtk_widget_set_vexpand (frame, TRUE);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (vbox), frame);
da = gtk_drawing_area_new ();
+2 -1
View File
@@ -366,7 +366,8 @@ do_editable_cells (GtkWidget *do_widget)
gtk_label_new ("Shopping list (you can edit the cells!)"));
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
+1 -1
View File
@@ -59,7 +59,7 @@ do_expander (GtkWidget *do_widget)
gtk_widget_set_vexpand (expander, TRUE);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 100);
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
+1 -1
View File
@@ -62,7 +62,7 @@ create_blurred_button (void)
{
GtkWidget *w = gtk_button_new ();
gtk_widget_add_css_class (w, "blurred-button");
gtk_style_context_add_class (gtk_widget_get_style_context (w), "blurred-button");
return w;
}
+1 -1
View File
@@ -49,7 +49,7 @@
<child type="end">
<object class="GtkToggleButton" id="changes_allow">
<property name="icon-name">changes-allow</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
<signal name="notify::active" handler="fishbowl_changes_toggled_cb"/>
</object>
</child>
+1 -1
View File
@@ -52,7 +52,7 @@ create_faces (void)
/* Add a face */
faces[i].face = gtk_frame_new (NULL);
gtk_widget_set_size_request (faces[i].face, face_size, face_size);
gtk_widget_add_css_class (faces[i].face, faces[i].css_class);
gtk_style_context_add_class (gtk_widget_get_style_context (faces[i].face), faces[i].css_class);
gtk_container_add (GTK_CONTAINER (fixed), faces[i].face);
/* Set up the transformation for each face */
+2
View File
@@ -189,6 +189,8 @@ gtk_font_plane_init (GtkFontPlane *plane)
{
GtkGesture *gesture;
gtk_widget_set_can_focus (GTK_WIDGET (plane), TRUE);
gesture = gtk_gesture_drag_new ();
g_signal_connect (gesture, "drag-begin",
G_CALLBACK (plane_drag_gesture_begin), plane);
+1 -1
View File
@@ -193,7 +193,7 @@
<child>
<object class="GtkScrolledWindow">
<property name="propagate-natural-height">1</property>
<property name="has-frame">1</property>
<property name="shadow-type">in</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
-137
View File
@@ -1,137 +0,0 @@
/* OpenGL/Gears
*
* This is a classic OpenGL demo, running in a GtkGLArea.
*/
#include <stdlib.h>
#include <gtk/gtk.h>
#include "gtkgears.h"
/************************************************************************
* DEMO CODE *
************************************************************************/
static void
on_axis_value_change (GtkAdjustment *adjustment,
gpointer data)
{
GtkGears *gears = GTK_GEARS (data);
int axis = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (adjustment), "axis"));
gtk_gears_set_axis (gears, axis, gtk_adjustment_get_value (adjustment));
}
static GtkWidget *
create_axis_slider (GtkGears *gears,
int axis)
{
GtkWidget *box, *label, *slider;
GtkAdjustment *adj;
const char *text;
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
switch (axis)
{
case GTK_GEARS_X_AXIS:
text = "X";
break;
case GTK_GEARS_Y_AXIS:
text = "Y";
break;
case GTK_GEARS_Z_AXIS:
text = "Z";
break;
default:
g_assert_not_reached ();
}
label = gtk_label_new (text);
gtk_container_add (GTK_CONTAINER (box), label);
gtk_widget_show (label);
adj = gtk_adjustment_new (gtk_gears_get_axis (gears, axis), 0.0, 360.0, 1.0, 12.0, 0.0);
g_object_set_data (G_OBJECT (adj), "axis", GINT_TO_POINTER (axis));
g_signal_connect (adj, "value-changed",
G_CALLBACK (on_axis_value_change),
gears);
slider = gtk_scale_new (GTK_ORIENTATION_VERTICAL, adj);
gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE);
gtk_container_add (GTK_CONTAINER (box), slider);
gtk_widget_set_vexpand (slider, TRUE);
gtk_widget_show (slider);
gtk_widget_show (box);
return box;
}
GtkWidget *
do_gears (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *box, *hbox, *fps_label, *gears, *overlay, *frame;
int i;
if (!window)
{
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Gears");
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_default_size (GTK_WINDOW (window), 640, 640);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
overlay = gtk_overlay_new ();
gtk_widget_set_margin_start (overlay, 12);
gtk_widget_set_margin_end (overlay, 12);
gtk_widget_set_margin_top (overlay, 12);
gtk_widget_set_margin_bottom (overlay, 12);
gtk_container_add (GTK_CONTAINER (window), overlay);
frame = gtk_frame_new (NULL);
gtk_widget_set_halign (frame, GTK_ALIGN_START);
gtk_widget_set_valign (frame, GTK_ALIGN_START);
gtk_widget_add_css_class (frame, "app-notification");
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), frame);
fps_label = gtk_label_new ("");
gtk_widget_set_halign (fps_label, GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (frame), fps_label);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
gtk_box_set_spacing (GTK_BOX (box), 6);
gtk_container_add (GTK_CONTAINER (overlay), box);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
gtk_box_set_spacing (GTK_BOX (box), 6);
gtk_container_add (GTK_CONTAINER (box), hbox);
gears = gtk_gears_new ();
gtk_widget_set_hexpand (gears, TRUE);
gtk_widget_set_vexpand (gears, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), gears);
for (i = 0; i < GTK_GEARS_N_AXIS; i++)
gtk_container_add (GTK_CONTAINER (hbox), create_axis_slider (GTK_GEARS (gears), i));
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
gtk_box_set_spacing (GTK_BOX (hbox), 6);
gtk_container_add (GTK_CONTAINER (box), hbox);
gtk_gears_set_fps_label (GTK_GEARS (gears), GTK_LABEL (fps_label));
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}
+1 -1
View File
@@ -1,4 +1,4 @@
/* OpenGL/OpenGL Area
/* OpenGL Area
*
* GtkGLArea is a widget that allows custom drawing using OpenGL calls.
*/
+1 -1
View File
@@ -42,7 +42,7 @@ do_headerbar (GtkWidget *do_widget)
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (box, "linked");
gtk_style_context_add_class (gtk_widget_get_style_context (box), "linked");
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
gtk_container_add (GTK_CONTAINER (box), button);
+2 -1
View File
@@ -277,7 +277,8 @@ do_iconview (GtkWidget *do_widget)
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
+5
View File
@@ -360,6 +360,7 @@ do_images (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
@@ -378,6 +379,7 @@ do_images (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
@@ -394,6 +396,7 @@ do_images (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
@@ -415,6 +418,7 @@ do_images (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
@@ -437,6 +441,7 @@ do_images (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
+2 -1
View File
@@ -272,7 +272,8 @@ do_list_store (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
+10 -8
View File
@@ -40,7 +40,7 @@
<object class="GtkButton" id="button2">
<property name="receives-default">1</property>
<property name="valign">baseline</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
<child>
<object class="GtkLabel" id="source_name">
<property name="valign">baseline</property>
@@ -109,7 +109,7 @@
<object class="GtkLinkButton" id="resent_by_button">
<property name="label" translatable="0">reshareer</property>
<property name="receives-default">1</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
<property name="uri">http://www.gtk.org</property>
</object>
</child>
@@ -126,7 +126,7 @@
<object class="GtkButton" id="expand_button">
<property name="label" translatable="yes">Expand</property>
<property name="receives-default">1</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
<signal name="clicked" handler="expand_clicked" swapped="yes"/>
</object>
</child>
@@ -138,14 +138,14 @@
<object class="GtkButton" id="reply-button">
<property name="label" translatable="yes">Reply</property>
<property name="receives-default">1</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
</object>
</child>
<child>
<object class="GtkButton" id="reshare-button">
<property name="label" translatable="yes">Reshare</property>
<property name="receives-default">1</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
<signal name="clicked" handler="reshare_clicked" swapped="yes"/>
</object>
</child>
@@ -153,7 +153,7 @@
<object class="GtkButton" id="favorite-buttton">
<property name="label" translatable="yes">Favorite</property>
<property name="receives-default">1</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
<signal name="clicked" handler="favorite_clicked" swapped="yes"/>
</object>
</child>
@@ -161,7 +161,7 @@
<object class="GtkMenuButton" id="more-button">
<property name="receives-default">1</property>
<property name="menu-model">menu1</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
<property name="label" translatable="yes">More...</property>
</object>
</child>
@@ -185,6 +185,7 @@
<property name="spacing">8</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="shadow-type">none</property>
<child>
<object class="GtkLabel" id="n_reshares_label">
<property name="label" translatable="0">&lt;b&gt;2&lt;/b&gt;
@@ -197,6 +198,7 @@ Reshares</property>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="shadow-type">none</property>
<child>
<object class="GtkLabel" id="n_favorites_label">
<property name="label" translatable="0">&lt;b&gt;2&lt;/b&gt;
@@ -223,7 +225,7 @@ FAVORITES</property>
<object class="GtkButton" id="button5">
<property name="label" translatable="yes">Details</property>
<property name="receives-default">1</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
<style>
<class name="dim-label"/>
</style>
+2
View File
@@ -612,6 +612,8 @@ display_text (const char *resource)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_NONE);
gtk_container_add (GTK_CONTAINER (sw), textview);
return sw;
+12 -12
View File
@@ -5,7 +5,7 @@
<item>
<attribute name="label" translatable="yes">_New</attribute>
<attribute name="action">app.new</attribute>
<attribute name="accel">&lt;Control&gt;n</attribute>
<attribute name="accel">&lt;Primary&gt;n</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Open</attribute>
@@ -14,19 +14,19 @@
<item>
<attribute name="label" translatable="yes">_Save</attribute>
<attribute name="action">app.save</attribute>
<attribute name="accel">&lt;Control&gt;s</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Save _As...</attribute>
<attribute name="action">app.save-as</attribute>
<attribute name="accel">&lt;Control&gt;s</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
<attribute name="accel">&lt;Control&gt;q</attribute>
<attribute name="accel">&lt;Primary&gt;q</attribute>
</item>
</section>
</menu>
@@ -45,19 +45,19 @@
<attribute name="label" translatable="yes">_Red</attribute>
<attribute name="action">app.color</attribute>
<attribute name="target">red</attribute>
<attribute name="accel">&lt;Control&gt;r</attribute>
<attribute name="accel">&lt;Primary&gt;r</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Green</attribute>
<attribute name="action">app.color</attribute>
<attribute name="target">green</attribute>
<attribute name="accel">&lt;Control&gt;g</attribute>
<attribute name="accel">&lt;Primary&gt;g</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Blue</attribute>
<attribute name="action">app.color</attribute>
<attribute name="target">blue</attribute>
<attribute name="accel">&lt;Control&gt;b</attribute>
<attribute name="accel">&lt;Primary&gt;b</attribute>
</item>
</section>
</submenu>
@@ -68,26 +68,26 @@
<attribute name="label" translatable="yes">_Square</attribute>
<attribute name="action">win.shape</attribute>
<attribute name="target">square</attribute>
<attribute name="accel">&lt;Control&gt;s</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Rectangle</attribute>
<attribute name="action">win.shape</attribute>
<attribute name="target">rectangle</attribute>
<attribute name="accel">&lt;Control&gt;r</attribute>
<attribute name="accel">&lt;Primary&gt;r</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Oval</attribute>
<attribute name="action">win.shape</attribute>
<attribute name="target">oval</attribute>
<attribute name="accel">&lt;Control&gt;o</attribute>
<attribute name="accel">&lt;Primary&gt;o</attribute>
</item>
</section>
</submenu>
<item>
<attribute name="label" translatable="yes">_Bold</attribute>
<attribute name="action">win.bold</attribute>
<attribute name="accel">&lt;Control&gt;&lt;Shift&gt;b</attribute>
<attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;b</attribute>
</item>
</section>
</submenu>
@@ -96,7 +96,7 @@
<item>
<attribute name="label" translatable="yes">_About</attribute>
<attribute name="action">win.about</attribute>
<attribute name="accel">&lt;Control&gt;a</attribute>
<attribute name="accel">&lt;Primary&gt;a</attribute>
</item>
</submenu>
</menu>
-1
View File
@@ -28,7 +28,6 @@ demos = files([
'fishbowl.c',
'fixed.c',
'fontrendering.c',
'gears.c',
'gestures.c',
'glarea.c',
'headerbar.c',
+3
View File
@@ -172,6 +172,7 @@ do_panes (GtkWidget *do_widget)
gtk_paned_add1 (GTK_PANED (vpaned), hpaned);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_widget_set_size_request (frame, 60, 60);
gtk_paned_add1 (GTK_PANED (hpaned), frame);
@@ -179,10 +180,12 @@ do_panes (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER(frame), button);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_widget_set_size_request (frame, 80, 60);
gtk_paned_add2 (GTK_PANED (hpaned), frame);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_widget_set_size_request (frame, 60, 80);
gtk_paned_add2 (GTK_PANED (vpaned), frame);
+1 -1
View File
@@ -74,7 +74,7 @@ do_password_entry (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (box), entry2);
button = gtk_button_new_with_mnemonic ("_Done");
gtk_widget_add_css_class (button, "suggested-action");
gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
gtk_widget_set_sensitive (button, FALSE);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
+2 -1
View File
@@ -190,7 +190,8 @@ do_rotated_text (GtkWidget *do_widget)
/* Add a drawing area */
drawing_area = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (box), drawing_area);
gtk_widget_add_css_class (drawing_area, GTK_STYLE_CLASS_VIEW);
gtk_style_context_add_class (gtk_widget_get_style_context (drawing_area),
GTK_STYLE_CLASS_VIEW);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area),
rotated_text_draw,
+1 -1
View File
@@ -63,7 +63,7 @@ do_sidebar (GtkWidget *do_widget)
if (i == 0)
{
widget = gtk_image_new_from_icon_name ("org.gtk.Demo4");
gtk_widget_add_css_class (widget, "icon-dropshadow");
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "icon-dropshadow");
gtk_image_set_pixel_size (GTK_IMAGE (widget), 256);
}
else
+3 -4
View File
@@ -279,8 +279,7 @@ start_puzzle (GdkPaintable *paintable)
aspect_ratio = gdk_paintable_get_intrinsic_aspect_ratio (paintable);
if (aspect_ratio == 0.0)
aspect_ratio = 1.0;
gtk_aspect_frame_set_ratio (GTK_ASPECT_FRAME (frame), aspect_ratio);
gtk_aspect_frame_set_obey_child (GTK_ASPECT_FRAME (frame), FALSE);
gtk_aspect_frame_set (GTK_ASPECT_FRAME (frame), 0.5, 0.5, aspect_ratio, FALSE);
/* Add shortcuts so people can use the arrow
* keys to move the puzzle */
@@ -420,7 +419,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (tweaks, 10);
choices = gtk_flow_box_new ();
gtk_widget_add_css_class (choices, GTK_STYLE_CLASS_VIEW);
gtk_style_context_add_class (gtk_widget_get_style_context (choices), GTK_STYLE_CLASS_VIEW);
add_choice (choices, puzzle);
add_choice (choices, gtk_nuclear_animation_new ());
media = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
@@ -467,7 +466,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
frame = gtk_aspect_frame_new (0.5, 0.5, (float) gdk_paintable_get_intrinsic_aspect_ratio (puzzle), FALSE);
frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, (float) gdk_paintable_get_intrinsic_aspect_ratio (puzzle), FALSE);
gtk_container_add (GTK_CONTAINER (window), frame);
start_puzzle (puzzle);
+2 -2
View File
@@ -25,7 +25,7 @@ add_tag (GtkButton *button, DemoTaggedEntry *entry)
DemoTaggedEntryTag *tag;
tag = demo_tagged_entry_tag_new ("Blue");
gtk_widget_add_css_class (GTK_WIDGET (tag), "blue");
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (tag)), "blue");
demo_tagged_entry_tag_set_has_close_button (tag, TRUE);
g_signal_connect (tag, "button-clicked", G_CALLBACK (closed_cb), entry);
@@ -98,7 +98,7 @@ do_tagged_entry (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (box2), button);
button = gtk_button_new_with_mnemonic ("_Done");
gtk_widget_add_css_class (button, "suggested-action");
gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
+2 -1
View File
@@ -408,7 +408,8 @@ do_tree_store (GtkWidget *do_widget)
gtk_label_new ("Jonathan's Holiday Card Planning Sheet"));
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
+1 -1
View File
@@ -83,7 +83,6 @@
<property name="title" translatable="yes">GTK Node Editor</property>
<property name="default-width">1024</property>
<property name="default-height">768</property>
<property name="focus-widget">text_view</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="header">
<property name="title" translatable="yes">GTK Node Editor</property>
@@ -140,6 +139,7 @@
<object class="GtkTextView" id="text_view">
<property name="wrap-mode">word</property>
<property name="monospace">1</property>
<property name="has-focus">1</property>
<property name="top-margin">6</property>
<property name="left-margin">6</property>
<property name="right-margin">6</property>
+7 -7
View File
@@ -13,13 +13,13 @@
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="accelerator">&lt;Control&gt;q</property>
<property name="accelerator">&lt;Primary&gt;q</property>
<property name="title">Quit</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="accelerator">&lt;Control&gt;d</property>
<property name="accelerator">&lt;Primary&gt;d</property>
<property name="title">Switch to dark theme</property>
</object>
</child>
@@ -31,7 +31,7 @@
<property name="view">page2</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="accelerator">&lt;Control&gt;s</property>
<property name="accelerator">&lt;Primary&gt;s</property>
<property name="title">Search</property>
</object>
</child>
@@ -43,7 +43,7 @@
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="accelerator">&lt;Control&gt;b</property>
<property name="accelerator">&lt;Primary&gt;b</property>
<property name="title">Set background</property>
</object>
</child>
@@ -55,19 +55,19 @@
<property name="view">page3</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="accelerator">&lt;Control&gt;o</property>
<property name="accelerator">&lt;Primary&gt;o</property>
<property name="title">Open a file</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="accelerator">&lt;Control&gt;r</property>
<property name="accelerator">&lt;Primary&gt;r</property>
<property name="title">Start recording</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="accelerator">&lt;Control&gt;l</property>
<property name="accelerator">&lt;Primary&gt;l</property>
<property name="title">Lock or unlock</property>
</object>
</child>
+42 -30
View File
@@ -442,17 +442,24 @@ on_entry_icon_release (GtkEntry *entry,
#define EPSILON (1e-10)
static void
on_scale_button_value_changed (GtkScaleButton *button,
gdouble value,
gpointer user_data)
static gboolean
on_scale_button_query_tooltip (GtkWidget *button,
gint x,
gint y,
gboolean keyboard_mode,
GtkTooltip *tooltip,
gpointer user_data)
{
GtkScaleButton *scale_button = GTK_SCALE_BUTTON (button);
GtkAdjustment *adjustment;
gdouble val;
gchar *str;
AtkImage *image;
adjustment = gtk_scale_button_get_adjustment (button);
val = gtk_scale_button_get_value (button);
image = ATK_IMAGE (gtk_widget_get_accessible (button));
adjustment = gtk_scale_button_get_adjustment (scale_button);
val = gtk_scale_button_get_value (scale_button);
if (val < (gtk_adjustment_get_lower (adjustment) + EPSILON))
{
@@ -471,21 +478,32 @@ on_scale_button_value_changed (GtkScaleButton *button,
str = g_strdup_printf (C_("volume percentage", "%d%%"), percent);
}
gtk_widget_set_tooltip_text (GTK_WIDGET (button), str);
atk_object_set_description (gtk_widget_get_accessible (GTK_WIDGET (button)), str);
gtk_tooltip_set_text (tooltip, str);
atk_image_set_image_description (image, str);
g_free (str);
return TRUE;
}
static void
on_scale_button_value_changed (GtkScaleButton *button,
gdouble value,
gpointer user_data)
{
gtk_widget_trigger_tooltip_query (GTK_WIDGET (button));
}
static void
on_record_button_toggled (GtkToggleButton *button,
gpointer user_data)
{
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (button));
if (gtk_toggle_button_get_active (button))
gtk_widget_remove_css_class (GTK_WIDGET (button), "destructive-action");
gtk_style_context_remove_class (context, "destructive-action");
else
gtk_widget_add_css_class (GTK_WIDGET (button), "destructive-action");
gtk_style_context_add_class (context, "destructive-action");
}
static void
@@ -839,7 +857,6 @@ overshot (GtkScrolledWindow *sw, GtkPositionType pos, GtkWidget *widget)
gdk_rgba_parse (&rgba, color);
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
"rgba", &rgba,
"can-focus", FALSE,
"selectable", FALSE,
"halign", GTK_ALIGN_END,
"valign", GTK_ALIGN_CENTER,
@@ -958,7 +975,6 @@ populate_colors (GtkWidget *widget, GtkWidget *chooser)
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
"rgba", &rgba,
"selectable", FALSE,
"can-focus", FALSE,
"halign", GTK_ALIGN_END,
"valign", GTK_ALIGN_CENTER,
"margin-start", 6,
@@ -1722,23 +1738,22 @@ activate (GApplication *app)
const gchar *accelerators[2];
} accels[] = {
{ "app.about", { "F1", NULL } },
{ "app.quit", { "<Control>q", NULL } },
{ "app.open-in", { "<Control>n", NULL } },
{ "app.cut", { "<Control>x", NULL } },
{ "app.copy", { "<Control>c", NULL } },
{ "app.paste", { "<Control>v", NULL } },
{ "win.dark", { "<Control>d", NULL } },
{ "win.search", { "<Control>s", NULL } },
{ "app.quit", { "<Primary>q", NULL } },
{ "app.open-in", { "<Primary>n", NULL } },
{ "app.cut", { "<Primary>x", NULL } },
{ "app.copy", { "<Primary>c", NULL } },
{ "app.paste", { "<Primary>v", NULL } },
{ "win.dark", { "<Primary>d", NULL } },
{ "win.search", { "<Primary>s", NULL } },
{ "win.delete", { "Delete", NULL } },
{ "win.background", { "<Control>b", NULL } },
{ "win.open", { "<Control>o", NULL } },
{ "win.record", { "<Control>r", NULL } },
{ "win.lock", { "<Control>l", NULL } },
{ "win.background", { "<Primary>b", NULL } },
{ "win.open", { "<Primary>o", NULL } },
{ "win.record", { "<Primary>r", NULL } },
{ "win.lock", { "<Primary>l", NULL } },
};
gint i;
GPermission *permission;
GAction *action;
GError *error = NULL;
g_object_get (gtk_settings_get_default (),
"gtk-theme-name", &current_theme,
@@ -1759,6 +1774,7 @@ activate (GApplication *app)
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
"on_entry_icon_release", (GCallback)on_entry_icon_release,
"on_scale_button_value_changed", (GCallback)on_scale_button_value_changed,
"on_scale_button_query_tooltip", (GCallback)on_scale_button_query_tooltip,
"on_record_button_toggled", (GCallback)on_record_button_toggled,
"on_page_combo_changed", (GCallback)on_page_combo_changed,
"on_range_from_changed", (GCallback)on_range_from_changed,
@@ -1771,11 +1787,7 @@ activate (GApplication *app)
NULL);
gtk_builder_set_scope (builder, scope);
g_object_unref (scope);
if (!gtk_builder_add_from_resource (builder, "/org/gtk/WidgetFactory4/widget-factory.ui", &error))
{
g_critical ("%s", error->message);
g_clear_error (&error);
}
gtk_builder_add_from_resource (builder, "/org/gtk/WidgetFactory4/widget-factory.ui", NULL);
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
gtk_application_add_window (GTK_APPLICATION (app), window);
+16 -17
View File
@@ -864,7 +864,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="label" translatable="yes">link button</property>
<property name="receives-default">1</property>
<property name="has-tooltip">1</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
<property name="uri">http://www.gtk.org</property>
</object>
</child>
@@ -1113,7 +1113,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="width-request">150</property>
<property name="vscrollbar-policy">always</property>
<property name="has-frame">1</property>
<property name="shadow-type">in</property>
<property name="vexpand">1</property>
<child>
<object class="GtkTreeView" id="treeview1">
@@ -1187,7 +1187,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="has-frame">1</property>
<property name="shadow-type">in</property>
<property name="vexpand">1</property>
<child>
<object class="GtkTextView" id="textview1">
@@ -1449,7 +1449,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkButton" id="page2dismiss">
<property name="focus-on-click">0</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
<property name="icon-name">window-close-symbolic</property>
</object>
</child>
@@ -1510,6 +1510,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="value">.5</property>
<property name="halign">center</property>
<signal name="query-tooltip" handler="on_scale_button_query_tooltip" swapped="no"/>
<signal name="value-changed" handler="on_scale_button_value_changed" swapped="no"/>
<layout>
<property name="left-attach">0</property>
@@ -1597,7 +1598,7 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="has-frame">1</property>
<property name="shadow-type">in</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-height">200</property>
<property name="hexpand">0</property>
@@ -1999,7 +2000,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow3">
<property name="has-frame">1</property>
<property name="shadow-type">in</property>
<property name="margin-top">6</property>
<property name="height-request">226</property>
<child>
@@ -2105,7 +2106,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">always</property>
<property name="height-request">300</property>
<property name="has-frame">1</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView" id="charletree">
<property name="enable-grid-lines">vertical</property>
@@ -2171,7 +2172,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="vexpand">1</property>
<property name="has-frame">1</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkListBox" id="munsell">
<property name="selection-mode">multiple</property>
@@ -2271,7 +2272,7 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkMenuButton">
<property name="icon-name">view-more-symbolic</property>
<property name="menu-model">new_style_menu_model</property>
<property name="popover">new_style_menu</property>
</object>
</child>
</object>
@@ -2639,7 +2640,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover2</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
<style>
<class name="circular"/>
</style>
@@ -2664,7 +2665,7 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkButton">
<property name="has-frame">0</property>
<property name="relief">none</property>
<property name="focus-on-click">0</property>
<property name="icon-name">window-close-symbolic</property>
<signal name="clicked" handler="tab_close_cb" object="closable_page_1"/>
@@ -2696,7 +2697,7 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkButton">
<property name="has-frame">0</property>
<property name="relief">none</property>
<property name="focus-on-click">0</property>
<property name="icon-name">window-close-symbolic</property>
<signal name="clicked" handler="tab_close_cb" object="closable_page_2"/>
@@ -2783,7 +2784,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
<style>
<class name="circular"/>
</style>
@@ -3141,7 +3142,7 @@ bad things might happen.</property>
<child>
<object class="GtkScrolledWindow">
<property name="valign">start</property>
<property name="has-frame">1</property>
<property name="shadow-type">in</property>
<property name="min-content-height">70</property>
<property name="max-content-height">120</property>
<property name="min-content-width">100</property>
@@ -3275,7 +3276,7 @@ bad things might happen.</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover3</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="has-frame">0</property>
<property name="relief">none</property>
<style>
<class name="circular"/>
</style>
@@ -3285,7 +3286,6 @@ bad things might happen.</property>
</child>
</object>
<object class="GtkPopover" id="new_style_menu">
<style><class name="menu"/></style>
<child>
<object class="GtkStack">
<child>
@@ -3597,7 +3597,6 @@ bad things might happen.</property>
</submenu>
</section>
<section>
<attribute name="label" translatable="yes">Size</attribute>
<item>
<attribute name="label" translatable="yes">Large</attribute>
<attribute name="action">app.size</attribute>
+47 -11
View File
@@ -98,10 +98,7 @@ gdk_display_get_monitor_at_surface
gdk_display_get_clipboard
gdk_display_get_primary_clipboard
gdk_display_get_setting
<SUBSECTION>
gdk_display_map_keyval
gdk_display_map_keycode
gdk_display_get_keymap
<SUBSECTION Standard>
GDK_DISPLAY
@@ -171,6 +168,8 @@ gdk_rgba_get_type
<TITLE>GdkSurface</TITLE>
<FILE>gdksurface</FILE>
GdkSurface
GdkSurfaceHints
GdkGeometry
GdkGravity
GdkSurfaceEdge
GdkSurfaceTypeHint
@@ -188,6 +187,7 @@ gdk_surface_get_height
gdk_surface_translate_coordinates
gdk_surface_begin_resize_drag
gdk_surface_begin_move_drag
gdk_surface_constrain_size
gdk_surface_beep
gdk_surface_get_scale_factor
gdk_surface_set_opaque_region
@@ -212,7 +212,7 @@ gdk_surface_get_height
gdk_surface_set_shadow_width
gdk_surface_get_device_position
GdkModifierType
GDK_MODIFIER_MASK
GdkModifierIntent
<SUBSECTION>
gdk_surface_get_support_multidevice
@@ -337,16 +337,49 @@ gdk_rectangle_get_type
<SECTION>
<TITLE>Keyboard Handling</TITLE>
<FILE>keys</FILE>
GdkKeymap
GdkKeymapKey
gdk_keymap_lookup_key
gdk_keymap_translate_keyboard_state
gdk_keymap_get_entries_for_keyval
gdk_keymap_get_entries_for_keycode
gdk_keymap_get_direction
gdk_keymap_have_bidi_layouts
gdk_keymap_get_caps_lock_state
gdk_keymap_get_num_lock_state
gdk_keymap_get_scroll_lock_state
gdk_keymap_get_modifier_state
gdk_keymap_add_virtual_modifiers
gdk_keymap_map_virtual_modifiers
gdk_keymap_get_modifier_mask
gdk_keymap_get_display
<SUBSECTION>
gdk_keyval_name
gdk_keyval_from_name
<SUBSECTION>
gdk_keyval_convert_case
gdk_keyval_to_upper
gdk_keyval_to_lower
gdk_keyval_is_upper
gdk_keyval_is_lower
<SUBSECTION>
gdk_keyval_to_unicode
gdk_unicode_to_keyval
<SUBSECTION Standard>
GDK_KEYMAP
GDK_IS_KEYMAP
GDK_TYPE_KEYMAP
GDK_KEYMAP_CLASS
GDK_IS_KEYMAP_CLASS
GDK_KEYMAP_GET_CLASS
<SUBSECTION Private>
GdkKeymapClass
gdk_keymap_get_type
</SECTION>
<SECTION>
@@ -508,13 +541,9 @@ gdk_scroll_event_get_deltas
gdk_scroll_event_is_stop
gdk_key_event_get_keyval
gdk_key_event_get_keycode
gdk_key_event_get_consumed_modifiers
gdk_key_event_get_layout
gdk_key_event_get_level
gdk_key_event_get_scancode
gdk_key_event_get_group
gdk_key_event_is_modifier
GdkEventMatch
gdk_key_event_matches
gdk_key_event_get_match
gdk_focus_event_get_in
gdk_touch_event_get_emulating_pointer
gdk_crossing_event_get_mode
@@ -537,6 +566,11 @@ gdk_events_get_angle
gdk_events_get_center
gdk_events_get_distance
<SUBSECTION>
GdkEventMatch
gdk_event_matches
gdk_event_get_match
<SUBSECTION Standard>
GDK_TYPE_EVENT
GDK_TYPE_EVENT_MASK
@@ -652,6 +686,8 @@ gdk_toplevel_set_transient_for
gdk_toplevel_set_modal
gdk_toplevel_set_icon_list
gdk_toplevel_show_window_menu
gdk_toplevel_set_accept_focus
gdk_toplevel_set_focus_on_map
gdk_toplevel_set_decorated
gdk_toplevel_set_deletable
gdk_toplevel_supports_edge_constraints
+1
View File
@@ -17,6 +17,7 @@ gdk_event_get_type
gdk_frame_clock_get_type
gdk_gl_context_get_type
gdk_gl_texture_get_type
gdk_keymap_get_type
gdk_memory_texture_get_type
gdk_monitor_get_type
gdk_paintable_get_type
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -203,12 +203,12 @@
<title>Hierarchical drawing</title>
<para>
During the Paint phase GTK receives a single #GdkSurface::render signal on
the toplevel surface. The signal handler will create a snapshot object
(which is a helper for creating a scene graph) and call the
#GtkWidget::snapshot() vfunc, which will propagate down the widget hierarchy.
This lets each widget snapshot its content at the right place and time,
correctly handling things like partial transparencies and overlapping widgets.
During the Paint phase GTK receives a single ::render signal on the toplevel
window. The signal handler will create a snapshot object (which is a
helper for creating a scene graph) and emit a GtkWidget::snapshot() signal,
which will propagate down the widget hierarchy. This lets each widget
snapshot its content at the right place and time, correctly handling things
like partial transparencies and overlapping widgets.
</para>
<para>
@@ -217,7 +217,7 @@
the render nodes of children, and grandchildren, and so on), and will reuse
that node during the Paint phase. Invalidating a widget (by calling
gtk_widget_queue_draw()) discards the cached render node, forcing the widget
to regenerate it the next time it needs to produce a snapshot.
to regenerate it the next time it needs to handle a ::snapshot.
</para>
</refsect2>
+3 -8
View File
@@ -19,15 +19,11 @@
</bookinfo>
<part id="gtk">
<title>Introduction</title>
<title>GTK Overview</title>
<xi:include href="overview.xml"/>
<xi:include href="xml/getting_started.xml"/>
<xi:include href="resources.xml" />
<xi:include href="xml/question_index.xml" />
</part>
<part id="concepts">
<title>GTK Concepts</title>
<xi:include href="xml/drawing-model.xml" />
<xi:include href="xml/input-handling.xml" />
<xi:include href="xml/actions.xml" />
@@ -117,10 +113,9 @@
<xi:include href="xml/gtklayoutchild.xml" />
<xi:include href="xml/gtkbinlayout.xml" />
<xi:include href="xml/gtkboxlayout.xml" />
<xi:include href="xml/gtkcenterlayout.xml" />
<xi:include href="xml/gtkcustomlayout.xml" />
<xi:include href="xml/gtkfixedlayout.xml" />
<xi:include href="xml/gtkgridlayout.xml" />
<xi:include href="xml/gtkcustomlayout.xml" />
<xi:include href="xml/gtkconstraintlayout.xml" />
<xi:include href="xml/gtkconstraint.xml" />
<xi:include href="xml/gtkconstraintguide.xml" />
@@ -285,7 +280,6 @@
<xi:include href="xml/gtkshortcutssection.xml" />
<xi:include href="xml/gtkshortcutsgroup.xml" />
<xi:include href="xml/gtkshortcutsshortcut.xml" />
<xi:include href="xml/gtkshortcutlabel.xml" />
</chapter>
<chapter id="MiscObjects">
@@ -377,6 +371,7 @@
<part id="theming">
<title>Theming in GTK</title>
<xi:include href="css-overview.xml" />
<xi:include href="css-properties.xml" />
<xi:include href="xml/gtkstylecontext.xml" />
<xi:include href="xml/gtkcssprovider.xml" />
<xi:include href="xml/gtkstyleprovider.xml" />
+36 -75
View File
@@ -60,6 +60,7 @@ gtk_accelerator_get_label
gtk_accelerator_parse_with_keycode
gtk_accelerator_name_with_keycode
gtk_accelerator_get_label_with_keycode
gtk_accelerator_set_default_mod_mask
gtk_accelerator_get_default_mod_mask
</SECTION>
@@ -74,8 +75,6 @@ gtk_accel_label_get_accel
gtk_accel_label_refetch
gtk_accel_label_set_label
gtk_accel_label_get_label
gtk_accel_label_get_use_underline
gtk_accel_label_set_use_underline
<SUBSECTION Standard>
GTK_ACCEL_LABEL
GTK_IS_ACCEL_LABEL
@@ -182,7 +181,6 @@ GTK_ASSISTANT_GET_CLASS
<SUBSECTION Private>
GtkAssistantPrivate
gtk_assistant_get_type
gtk_assistant_page_get_type
</SECTION>
<SECTION>
@@ -190,14 +188,7 @@ gtk_assistant_page_get_type
<TITLE>GtkAspectFrame</TITLE>
GtkAspectFrame
gtk_aspect_frame_new
gtk_aspect_frame_set_xalign
gtk_aspect_frame_get_xalign
gtk_aspect_frame_set_yalign
gtk_aspect_frame_get_yalign
gtk_aspect_frame_set_ratio
gtk_aspect_frame_get_ratio
gtk_aspect_frame_set_obey_child
gtk_aspect_frame_get_obey_child
gtk_aspect_frame_set
<SUBSECTION Standard>
GTK_ASPECT_FRAME
GTK_IS_ASPECT_FRAME
@@ -206,6 +197,7 @@ GTK_ASPECT_FRAME_CLASS
GTK_IS_ASPECT_FRAME_CLASS
GTK_ASPECT_FRAME_GET_CLASS
<SUBSECTION Private>
GtkAspectFramePrivate
gtk_aspect_frame_get_type
</SECTION>
@@ -529,8 +521,8 @@ gtk_button_new
gtk_button_new_with_label
gtk_button_new_with_mnemonic
gtk_button_new_from_icon_name
gtk_button_set_has_frame
gtk_button_get_has_frame
gtk_button_set_relief
gtk_button_get_relief
gtk_button_get_label
gtk_button_set_label
gtk_button_get_use_underline
@@ -562,12 +554,6 @@ gtk_calendar_mark_day
gtk_calendar_unmark_day
gtk_calendar_get_day_is_marked
gtk_calendar_clear_marks
gtk_calendar_get_show_day_names
gtk_calendar_set_show_day_names
gtk_calendar_get_show_heading
gtk_calendar_set_show_heading
gtk_calendar_get_show_week_numbers
gtk_calendar_set_show_week_numbers
<SUBSECTION>
gtk_calendar_get_date
@@ -614,8 +600,6 @@ gtk_color_button_new
gtk_color_button_new_with_rgba
gtk_color_button_set_title
gtk_color_button_get_title
gtk_color_button_set_modal
gtk_color_button_get_modal
<SUBSECTION Standard>
GTK_COLOR_BUTTON
GTK_IS_COLOR_BUTTON
@@ -709,6 +693,10 @@ gtk_container_add
gtk_container_remove
gtk_container_foreach
gtk_container_get_children
gtk_container_get_focus_vadjustment
gtk_container_set_focus_vadjustment
gtk_container_get_focus_hadjustment
gtk_container_set_focus_hadjustment
gtk_container_child_type
gtk_container_forall
@@ -1168,8 +1156,6 @@ gtk_file_chooser_button_get_title
gtk_file_chooser_button_set_title
gtk_file_chooser_button_get_width_chars
gtk_file_chooser_button_set_width_chars
gtk_file_chooser_button_get_modal
gtk_file_chooser_button_set_modal
<SUBSECTION Standard>
GTK_FILE_CHOOSER_BUTTON
@@ -1284,8 +1270,6 @@ gtk_font_button_set_use_size
gtk_font_button_get_use_size
gtk_font_button_set_title
gtk_font_button_get_title
gtk_font_button_set_modal
gtk_font_button_get_modal
<SUBSECTION Standard>
GTK_FONT_BUTTON
GTK_IS_FONT_BUTTON
@@ -1383,11 +1367,13 @@ GtkFrame
GtkFrameClass
gtk_frame_new
gtk_frame_set_label
gtk_frame_get_label
gtk_frame_set_label_widget
gtk_frame_get_label_widget
gtk_frame_set_label_align
gtk_frame_set_shadow_type
gtk_frame_get_label
gtk_frame_get_label_align
gtk_frame_get_label_widget
gtk_frame_get_shadow_type
<SUBSECTION Standard>
GTK_FRAME
GTK_IS_FRAME
@@ -1600,6 +1586,7 @@ gtk_label_set_text
gtk_label_set_attributes
gtk_label_set_markup
gtk_label_set_markup_with_mnemonic
gtk_label_set_pattern
gtk_label_set_justify
gtk_label_set_xalign
gtk_label_set_yalign
@@ -1640,6 +1627,8 @@ gtk_label_set_use_markup
gtk_label_set_use_underline
gtk_label_set_single_line_mode
gtk_label_get_current_uri
gtk_label_set_track_visited_links
gtk_label_get_track_visited_links
gtk_label_set_extra_menu
gtk_label_get_extra_menu
@@ -1718,10 +1707,8 @@ gtk_menu_button_set_icon_name
gtk_menu_button_get_icon_name
gtk_menu_button_set_label
gtk_menu_button_get_label
gtk_menu_button_set_has_frame
gtk_menu_button_get_has_frame
gtk_menu_button_get_use_underline
gtk_menu_button_set_use_underline
gtk_menu_button_set_relief
gtk_menu_button_get_relief
gtk_menu_button_popup
gtk_menu_button_popdown
GtkMenuButtonCreatePopupFunc
@@ -2213,8 +2200,8 @@ GtkCornerType
gtk_scrolled_window_get_placement
gtk_scrolled_window_set_placement
gtk_scrolled_window_unset_placement
gtk_scrolled_window_get_has_frame
gtk_scrolled_window_set_has_frame
gtk_scrolled_window_get_shadow_type
gtk_scrolled_window_set_shadow_type
gtk_scrolled_window_get_kinetic_scrolling
gtk_scrolled_window_set_kinetic_scrolling
gtk_scrolled_window_get_capture_button_press
@@ -3851,8 +3838,8 @@ gtk_list_store_get_type
<TITLE>GtkViewport</TITLE>
GtkViewport
gtk_viewport_new
gtk_viewport_set_scroll_to_focus
gtk_viewport_get_scroll_to_focus
gtk_viewport_set_shadow_type
gtk_viewport_get_shadow_type
<SUBSECTION Standard>
GTK_VIEWPORT
GTK_IS_VIEWPORT
@@ -3981,9 +3968,7 @@ gtk_widget_allocate
gtk_widget_class_add_shortcut
gtk_widget_class_add_binding
gtk_widget_class_add_binding_signal
gtk_widget_class_add_binding_action
gtk_widget_class_set_layout_manager_type
gtk_widget_class_get_layout_manager_type
gtk_widget_can_activate_accel
gtk_widget_activate
gtk_widget_is_focus
gtk_widget_grab_focus
@@ -4078,6 +4063,7 @@ gtk_widget_get_support_multidevice
gtk_widget_get_realized
gtk_widget_get_mapped
gtk_widget_device_is_shadowed
gtk_widget_get_modifier_mask
gtk_widget_get_opacity
gtk_widget_set_opacity
gtk_widget_get_overflow
@@ -4303,6 +4289,12 @@ gtk_init_check
<SUBSECTION>
GTK_PRIORITY_RESIZE
<SUBSECTION>
gtk_get_current_event
gtk_get_current_event_time
gtk_get_current_event_state
gtk_get_current_event_device
<SUBSECTION Private>
gtk_init_abi_check
gtk_init_check_abi_check
@@ -4447,6 +4439,7 @@ gtk_style_context_get_margin
gtk_style_context_lookup_color
gtk_style_context_remove_provider
gtk_style_context_remove_provider_for_display
gtk_style_context_reset_widgets
gtk_style_context_restore
gtk_style_context_save
gtk_style_context_add_class
@@ -4548,9 +4541,11 @@ GtkMovementStep
GtkOrientation
GtkPackType
GtkPositionType
GtkReliefStyle
GtkScrollStep
GtkScrollType
GtkSelectionMode
GtkShadowType
GtkStateFlags
GtkSortType
GtkIconSize
@@ -5119,9 +5114,7 @@ gtk_mount_operation_set_parent
gtk_mount_operation_get_parent
gtk_mount_operation_set_display
gtk_mount_operation_get_display
gtk_show_uri_full
gtk_show_uri_full_finish
gtk_show_uri
gtk_show_uri_on_window
<SUBSECTION Standard>
GTK_IS_MOUNT_OPERATION
GTK_IS_MOUNT_OPERATION_CLASS
@@ -5351,8 +5344,6 @@ gtk_app_chooser_button_get_show_dialog_item
gtk_app_chooser_button_set_show_dialog_item
gtk_app_chooser_button_get_heading
gtk_app_chooser_button_set_heading
gtk_app_chooser_button_get_modal
gtk_app_chooser_button_set_modal
<SUBSECTION Standard>
GTK_TYPE_APP_CHOOSER_BUTTON
@@ -5826,14 +5817,6 @@ gtk_event_controller_get_propagation_limit
gtk_event_controller_set_propagation_limit
gtk_event_controller_get_widget
gtk_event_controller_reset
gtk_event_controller_get_name
gtk_event_controller_set_name
<SUBSECTION>
gtk_event_controller_get_current_event
gtk_event_controller_get_current_event_device
gtk_event_controller_get_current_event_state
gtk_event_controller_get_current_event_time
<SUBSECTION Standard>
GTK_TYPE_EVENT_CONTROLLER
@@ -6002,7 +5985,6 @@ gtk_mnemonic_trigger_get_keyval
GtkAlternativeTrigger
gtk_alternative_trigger_new
gtk_alternative_trigger_get_first
gtk_alternative_trigger_get_second
<SUBSECTION>
GtkNeverTrigger
@@ -6088,7 +6070,7 @@ GtkShortcutManagerInterface
<TITLE>GtkShortcutController</TITLE>
GtkShortcutController
gtk_shortcut_controller_new
gtk_shortcut_controller_new_for_model
gtk_shortcut_controller_new_with_model
GtkShortcutScope
GtkShortcutManager
GtkShortcutManagerInterface
@@ -6469,8 +6451,8 @@ GTK_SHORTCUTS_SHORTCUT_GET_CLASS
GtkShortcutLabel
gtk_shortcut_label_new
gtk_shortcut_label_get_accelerator
gtk_shortcut_label_set_accelerator
gtk_shortcut_label_get_disabled_text
gtk_shortcut_label_set_accelerator
gtk_shortcut_label_set_disabled_text
<SUBSECTION Private>
@@ -6654,27 +6636,6 @@ GTK_TYPE_BOX_LAYOUT
gtk_box_layout_get_type
</SECTION>
<SECTION>
<FILE>gtkcenterlayout</FILE>
GtkCenterLayout
gtk_center_layout_new
gtk_center_layout_set_orientation
gtk_center_layout_get_orientation
gtk_center_layout_set_baseline_position
gtk_center_layout_get_baseline_position
gtk_center_layout_set_start_widget
gtk_center_layout_get_start_widget
gtk_center_layout_set_center_widget
gtk_center_layout_get_center_widget
gtk_center_layout_set_end_widget
gtk_center_layout_get_end_widget
<SUBSECTION Standard>
GTK_TYPE_CENTER_LAYOUT
gtk_center_layout_get_type
</SECTION>
<SECTION>
<FILE>gtkcustomlayout</FILE>
GtkCustomLayout
-1
View File
@@ -41,7 +41,6 @@ gtk_cell_renderer_spinner_get_type
gtk_cell_renderer_text_get_type
gtk_cell_renderer_toggle_get_type
gtk_cell_view_get_type
gtk_center_layout_get_type
gtk_check_button_get_type
gtk_color_button_get_type
gtk_color_chooser_get_type
+11 -6
View File
@@ -73,12 +73,6 @@
between different events by looking at their type, using
gdk_event_get_event_type().
</para>
<para>
Some events, such as touch events or button press-release pairs,
are connected in to each other in an “event sequence” that
univocally identifies events that are related to the same
interaction.
</para>
<para>
When GTK creates a GdkSurface, it connects to the #GdkSurface::event
signal on it, which receives all of these input events. Surfaces have
@@ -187,6 +181,17 @@
</para>
</refsect2>
<refsect2>
<title>Touch events</title>
<para>
Touch events are emitted as events of type %GDK_TOUCH_BEGIN,
%GDK_TOUCH_UPDATE or %GDK_TOUCH_END, those events contain an
“event sequence” that univocally identifies the physical touch
until it is lifted from the device.
</para>
</refsect2>
<refsect2>
<title>Keyboard input</title>
+2
View File
@@ -23,6 +23,7 @@ private_headers = [
'gtkcolorscaleprivate.h',
'gtkcolorswatchprivate.h',
'gtkcomboboxprivate.h',
'gtkcontainerprivate.h',
'gtkconstraintexpressionprivate.h',
'gtkconstraintguideprivate.h',
'gtkconstraintlayoutprivate.h',
@@ -342,6 +343,7 @@ content_files = [
'building.xml',
'compiling.xml',
'css-overview.xml',
'css-properties.xml',
'drawing-model.xml',
'glossary.xml',
'gtk4-broadwayd.xml',
+16 -125
View File
@@ -299,9 +299,8 @@
in GTK 4.
</para>
<para>
GdkEvent is now a strictly read-only type, and you
can no longer change any of its fields, or construct new
events.
GdkEvent is now a strictly read-only boxed type, and you
can no longer change any of its fields.
</para>
</section>
@@ -309,7 +308,7 @@
<title>Stop using gdk_surface_set_event_compression</title>
<para>
Event compression is now always enabled. If you need to see the uncoalesced
motion history, use gdk_motion_event_get_history() on the latest motion event.
motion history, use gdk_event_get_motion_history().
</para>
</section>
@@ -319,8 +318,8 @@
Warping the pointer is disorienting and unfriendly to users.
GTK 4 does not support it. In special circumstances (such as when
implementing remote connection UIs) it can be necessary to
warp the pointer; in this case, use platform APIs such as
<function>XWarpPointer()</function> directly.
warp the pointer; in this case, use platform APIs such as XWarpPointer
directly.
</para>
</section>
@@ -340,15 +339,6 @@
</para>
</section>
<section>
<title>Stop using gtk_get_current_... APIs</title>
<para>
The function gtk_get_current_event() and its variants have been
replaced by equivalent event controller APIs:
gtk_event_controller_get_current_event(), etc.
</para>
</section>
<section>
<title>Adapt to surface API changes</title>
<para>
@@ -407,29 +397,8 @@
<section>
<title>Adapt to GdkKeymap API changes</title>
<para>
GdkKeymap no longer exists as an independent object.
</para>
<para>
If you need access to keymap state, it is now exposed as properties
on the #GdkDevice representing the keyboard: #GdkDevice:direction,
#GdkDevice:has-bidi-layouts, #GdkDevice:caps-lock-state,
#GdkDevice:num-lock-state, #GdkDevice:scroll-lock-state and
#GdkDevice:modifier-state.
To obtain the keyboard device, you can use
<literal>gdk_seat_get_keyboard (gdk_display_get_default_seat (display))</literal>.
</para>
<para>
If you need access to translated keys for event handling, #GdkEvent
now includes all of the translated key state, including consumed
modifiers, group and shift level, so there should be no need to
do manually call gdk_keymap_translate_keyboard_state() (which has
been removed).
</para>
<para>
If you need to do forward or backward mapping between key codes
and key values, use gdk_display_map_keycode() and gdk_display_map_keyval(),
which is the replacement for gdk_keymap_get_entries_for_keycode()
and gdk_keymap_get_entries_for_keycode().
The way to get a keymap has changed slightly. gdk_keymap_get_for_display() has
been renamed to gdk_display_get_keymap().
</para>
</section>
@@ -448,60 +417,6 @@
</para>
</section>
<section>
<title>Adapt to changes in keyboard modifier handling</title>
<para>
GTK 3 has the idea that use of modifiers may differ between different
platforms, and has a #GdkModifierIntent api to let platforms provide
hint about how modifiers are expected to be used. It also promoted
the use of &lt;Primary&gt; instead of &lt;Control&gt; to specify
accelerators that adapt to platform conventions.
</para>
<para>
In GTK 4, the meaning of modifiers has been fixed, and backends are
expected to map the platform conventions to the existing modifiers.
The expected use of modifiers in GTK 4 is:
<simplelist>
<member>GDK_CONTROL_MASK - Primary accelerators</member>
<member>GDK_ALT_MASK - Mnemonics</member>
<member>GDK_SHIFT_MASK - Extending selections</member>
<member>GDK_CONTROL_MASK - Modifying selections</member>
<member>GDK_CONTROL_MASK|GDK_ALT_MASK - Prevent text input</member>
</simplelist>
</para>
<para>
Consequently, #GdkModifierIntent and related APIs have been removed,
and &lt;Control&gt; is preferred over &lt;Primary&gt; in accelerators.
</para>
<para>
A related change is that GTK 4 no longer supports the use of archaic
X11 'real' modifiers with the names Mod1,..., Mod5, and %GDK_MOD1_MASK
has been renamed to %GDK_ALT_MASK.
</para>
</section>
<section>
<title>Focus handling changes</title>
<para>
The semantics of the #GtkWidget:can-focus property have changed.
In GTK 3, this property only meant that the widget itself would not
accept keyboard input, but its children still might (in the case of
containers). In GTK 4, if :can-focus is %FALSE, the focus cannot enter
the widget or any of its descendents, and the default value has changed
from %FALSE to %TRUE.
</para>
<para>
The recommended way to influence focus behavior of custom widgets
in GTK 4 is to override the focus() and grab_focus() vfuncs.
</para>
<para>
The feature to automatically keep the focus widget scrolled into view
with gtk_container_set_focus_vadjustment() has been removed from
GtkContainer, and is provided by scrollables instead. In the common case
that the scrollable is a #GtkViewport, use #GtkViewport:scroll-to-focus.
</para>
</section>
<section>
<title>Stop using GtkEventBox</title>
<para>
@@ -569,12 +484,6 @@
and always use the context's current state. Update all callers
to omit the state argument.
</para>
<para>
The most commonly used GtkStyleContext API, gtk_style_context_add_class(),
has been moved to GtkWidget as gtk_widget_add_css_class(), as have the
corresponding gtk_style_context_remove_class() and
gtk_style_context_has_class() APIs.
</para>
</section>
<section>
@@ -599,17 +508,6 @@
</para>
</section>
<section>
<title>Stop using GtkShadowType and GtkRelief properties</title>
<para>
The shadow-type properties in GtkScrolledWindow, GtkViewport,
and GtkFrame, as well as the relief properties in GtkButton
and its subclasses have been removed. GtkScrolledWindow, GtkButton
and GtkMenuButton have instead gained a boolean has-frame
property.
</para>
</section>
<section>
<title>Adapt to GtkWidget's size request changes</title>
<para>
@@ -910,6 +808,15 @@
</para>
</section>
<section>
<title>Stop using tabular menus</title>
<para>
Tabular menus were rarely used and complicated the menu code,
so they have been removed. If you need complex layout in menu-like
popups, consider using a #GtkPopover instead.
</para>
</section>
<section>
<title>Stop using gtk_menu_set_display()</title>
<para>
@@ -1036,13 +943,6 @@
can only be constructed from menu models, so the porting effort involves
switching to menu models and actions.
</para>
<para>
Tabular menus were rarely used and complicated the menu code,
so they have not been brought over to #GtkPopoverMenu. If you need
complex layout in menu-like popups, consider directly using a
#GtkPopover instead.
</para>
<para>
Since menus are gone, GtkMenuButton also lost its ability to show menus,
and needs to be used with popovers in GTK 4.
@@ -1060,15 +960,6 @@
</para>
</section>
<section>
<title>GtkAspectFrame is no longer a frame</title>
<para>
GtkAspectFrame is no longer derived from GtkFrame and does not
place a label and frame around its child anymore. It still lets
you control the aspect ratio of its child.
</para>
</section>
<section>
<title>Stop using custom tooltip windows</title>
<para>
+2 -3
View File
@@ -3,9 +3,8 @@ if get_option('gtk_doc')
error('Building the GTK documentation requires Meson 0.52.0')
endif
# Use gtk-doc as a sub-project from the gtk-doc-for-gtk4 branch
# for the time being
dependency('gtk-doc', version: '>=1.99',
# Use gtk-doc as a sub-project if the version isn't new enough
dependency('gtk-doc', version: '>=1.32',
fallback: ['gtk-doc', 'dummy_dep'],
default_options: ['tests=false'])
+19 -5
View File
@@ -455,6 +455,7 @@ create_text_view (void)
GtkWidget *text_view;
widget = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
text_view = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (widget), text_view);
/* Bad hack to add some size to the widget */
@@ -475,6 +476,7 @@ create_tree_view (void)
WidgetInfo *info;
widget = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
store = gtk_tree_store_new (3, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING);
gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter, 0, "Line One", 1, FALSE, 2, "A", -1);
@@ -518,6 +520,7 @@ create_icon_view (void)
WidgetInfo *info;
widget = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
list_store = gtk_list_store_new (2, G_TYPE_STRING, GDK_TYPE_PIXBUF);
gtk_list_store_append (list_store, &iter);
pixbuf = gdk_pixbuf_new_from_file ("folder.png", NULL);
@@ -662,19 +665,27 @@ create_panes (void)
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_paned_pack1 (GTK_PANED (pane),
g_object_new (GTK_TYPE_FRAME, NULL),
g_object_new (GTK_TYPE_FRAME,
"shadow-type", GTK_SHADOW_IN,
NULL),
FALSE, FALSE);
gtk_paned_pack2 (GTK_PANED (pane),
g_object_new (GTK_TYPE_FRAME, NULL),
g_object_new (GTK_TYPE_FRAME,
"shadow-type", GTK_SHADOW_IN,
NULL),
FALSE, FALSE);
gtk_container_add (GTK_CONTAINER (hbox),
pane);
pane = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_paned_pack1 (GTK_PANED (pane),
g_object_new (GTK_TYPE_FRAME, NULL),
g_object_new (GTK_TYPE_FRAME,
"shadow-type", GTK_SHADOW_IN,
NULL),
FALSE, FALSE);
gtk_paned_pack2 (GTK_PANED (pane),
g_object_new (GTK_TYPE_FRAME, NULL),
g_object_new (GTK_TYPE_FRAME,
"shadow-type", GTK_SHADOW_IN,
NULL),
FALSE, FALSE);
gtk_container_add (GTK_CONTAINER (hbox),
pane);
@@ -1215,7 +1226,7 @@ create_sidebar (void)
stack = gtk_stack_new ();
gtk_widget_set_size_request (stack, 120, 120);
view = gtk_label_new ("Sidebar");
gtk_widget_add_css_class (view, "view");
gtk_style_context_add_class (gtk_widget_get_style_context (view), "view");
gtk_widget_set_halign (view, GTK_ALIGN_FILL);
gtk_widget_set_valign (view, GTK_ALIGN_FILL);
gtk_widget_show (view);
@@ -1248,6 +1259,7 @@ create_list_box (void)
WidgetInfo *info;
widget = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_BROWSE);
@@ -1300,6 +1312,7 @@ create_flow_box (void)
WidgetInfo *info;
widget = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
box = gtk_flow_box_new ();
gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (box), 2);
@@ -1338,6 +1351,7 @@ create_gl_area (void)
GtkWidget *gears;
widget = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
gears = gtk_gears_new ();
gtk_container_add (GTK_CONTAINER (widget), gears);
+8 -8
View File
@@ -517,13 +517,13 @@ bloat_pad_startup (GApplication *application)
const gchar *action_and_target;
const gchar *accelerators[2];
} accels[] = {
{ "app.new", { "<Control>n", NULL } },
{ "app.quit", { "<Control>q", NULL } },
{ "win.copy", { "<Control>c", NULL } },
{ "win.paste", { "<Control>p", NULL } },
{ "win.justify::left", { "<Control>l", NULL } },
{ "win.justify::center", { "<Control>m", NULL } },
{ "win.justify::right", { "<Control>r", NULL } }
{ "app.new", { "<Primary>n", NULL } },
{ "app.quit", { "<Primary>q", NULL } },
{ "win.copy", { "<Primary>c", NULL } },
{ "win.paste", { "<Primary>p", NULL } },
{ "win.justify::left", { "<Primary>l", NULL } },
{ "win.justify::center", { "<Primary>m", NULL } },
{ "win.justify::right", { "<Primary>r", NULL } }
};
G_APPLICATION_CLASS (bloat_pad_parent_class)
@@ -592,7 +592,7 @@ bloat_pad_startup (GApplication *application)
g_object_unref (item);
g_object_unref (icon);
const gchar *new_accels[] = { "<Control>n", "<Control>t", NULL };
const gchar *new_accels[] = { "<Primary>n", "<Primary>t", NULL };
gtk_application_set_accels_for_action (GTK_APPLICATION (application), "app.new", new_accels);
dump_accels (GTK_APPLICATION (application));
+1
View File
@@ -143,6 +143,7 @@ activate (GtkApplication *app,
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (window), frame);
drawing_area = gtk_drawing_area_new ();
+15 -19
View File
@@ -100,7 +100,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_crossing_event_new (GDK_ENTER_NOTIFY,
event = gdk_event_crossing_new (GDK_ENTER_NOTIFY,
surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
@@ -119,7 +119,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY,
event = gdk_event_crossing_new (GDK_LEAVE_NOTIFY,
surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
@@ -141,7 +141,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_motion_event_new (surface,
event = gdk_event_motion_new (surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
NULL,
@@ -165,7 +165,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_button_event_new (message->base.type == BROADWAY_EVENT_BUTTON_PRESS
event = gdk_event_button_new (message->base.type == BROADWAY_EVENT_BUTTON_PRESS
? GDK_BUTTON_PRESS
: GDK_BUTTON_RELEASE,
surface,
@@ -188,7 +188,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_scroll_event_new_discrete (surface,
event = gdk_event_discrete_scroll_new (surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
NULL,
@@ -243,7 +243,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
if (event_type == GDK_TOUCH_BEGIN || event_type == GDK_TOUCH_UPDATE)
state |= GDK_BUTTON1_MASK;
event = gdk_touch_event_new (event_type,
event = gdk_event_touch_new (event_type,
GUINT_TO_POINTER (message->touch.sequence_id),
surface,
gdk_seat_get_pointer (seat),
@@ -266,23 +266,19 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
GINT_TO_POINTER (message->key.surface_id));
if (surface)
{
GdkTranslatedKey translated;
translated.keyval = message->key.key;
translated.consumed = 0;
translated.layout = 0;
translated.level = 0;
event = gdk_key_event_new (message->base.type == BROADWAY_EVENT_KEY_PRESS
event = gdk_event_key_new (message->base.type == BROADWAY_EVENT_KEY_PRESS
? GDK_KEY_PRESS
: GDK_KEY_RELEASE,
surface,
gdk_seat_get_keyboard (seat),
gdk_seat_get_keyboard (seat),
message->base.time,
message->key.key,
message->key.state,
FALSE,
&translated,
&translated);
message->key.key,
message->key.key,
message->key.key,
0,
FALSE);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
@@ -298,7 +294,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->configure_notify.id));
if (surface)
{
event = gdk_configure_event_new (surface,
event = gdk_event_configure_new (surface,
message->configure_notify.width,
message->configure_notify.height);
@@ -329,7 +325,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.old_id));
if (surface)
{
event = gdk_focus_event_new (surface,
event = gdk_event_focus_new (surface,
gdk_seat_get_keyboard (seat),
gdk_seat_get_keyboard (seat),
FALSE);
@@ -340,7 +336,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.new_id));
if (surface)
{
event = gdk_focus_event_new (surface,
event = gdk_event_focus_new (surface,
gdk_seat_get_keyboard (seat),
gdk_seat_get_keyboard (seat),
TRUE);
+15
View File
@@ -187,6 +187,19 @@ gdk_broadway_keymap_translate_keyboard_state (GdkKeymap *keymap,
return TRUE;
}
static void
gdk_broadway_keymap_add_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
}
static gboolean
gdk_broadway_keymap_map_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
return TRUE;
}
static void
gdk_broadway_keymap_class_init (GdkBroadwayKeymapClass *klass)
{
@@ -204,5 +217,7 @@ gdk_broadway_keymap_class_init (GdkBroadwayKeymapClass *klass)
keymap_class->get_entries_for_keycode = gdk_broadway_keymap_get_entries_for_keycode;
keymap_class->lookup_key = gdk_broadway_keymap_lookup_key;
keymap_class->translate_keyboard_state = gdk_broadway_keymap_translate_keyboard_state;
keymap_class->add_virtual_modifiers = gdk_broadway_keymap_add_virtual_modifiers;
keymap_class->map_virtual_modifiers = gdk_broadway_keymap_map_virtual_modifiers;
}
-1
View File
@@ -27,7 +27,6 @@
#include <gdk/gdksurfaceprivate.h>
#include "gdkbroadwaysurface.h"
#include "gdkinternals.h"
G_BEGIN_DECLS
+8 -30
View File
@@ -1,43 +1,21 @@
#!/usr/bin/env python3
import os
import argparse
import sys
import filecmp
def replace_if_changed(new, old):
'''
Compare contents and only replace if changed to avoid triggering a rebuild.
'''
try:
changed = not filecmp.cmp(new, old, shallow=False)
except FileNotFoundError:
changed = True
if changed:
os.replace(new, old)
else:
os.remove(new)
parser = argparse.ArgumentParser()
parser.add_argument('--array-name', help='The name of the array variable')
parser.add_argument('--output', metavar='STRING', help='Output filename',
default=None)
parser.add_argument('--output', metavar='FILE', help='Output file',
type=argparse.FileType('w'),
default=sys.stdout)
parser.add_argument('input', metavar='FILE', help='The input file',
type=argparse.FileType('r'))
args = parser.parse_args()
if args.output is None:
output = sys.stdout
else:
output = args.output + '~'
args.output.write('static const char {}[] = {{\n'.format(args.array_name))
for line in args.input:
for ch in line:
args.output.write(' 0x{:02x},\n'.format(ord(ch)))
with open(output, 'w') as f:
f.write('static const char {}[] = {{\n'.format(args.array_name))
for line in args.input:
for ch in line:
f.write(' 0x{:02x},\n'.format(ord(ch)))
f.write('};')
if args.output is not None:
replace_if_changed(output, args.output)
args.output.write('};')
+1 -1
View File
@@ -67,7 +67,7 @@ libgdk_broadway = static_library('gdk-broadway',
broadwayd_syslib = os_win32 ? find_library('ws2_32') : shmlib
executable('gtk4-broadwayd',
clienthtml_h, broadwayjs_h, gdkconfig, gdkenum_h,
clienthtml_h, broadwayjs_h,
'broadwayd.c', 'broadway-server.c', 'broadway-output.c',
include_directories: [confinc, gdkinc, include_directories('.')],
c_args: ['-DGTK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"', ],
+1
View File
@@ -32,6 +32,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrag, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameClock, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkKeymap, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkMonitor, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkSeat, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkPopupLayout, gdk_popup_layout_unref)
+1 -1
View File
@@ -24,7 +24,7 @@
#include "gdkdisplayprivate.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkkeysprivate.h"
#include "gdkkeys.h"
/* for the use of round() */
#include "fallback-c89.c"
+5 -70
View File
@@ -505,7 +505,7 @@ generate_grab_broken_event (GdkDisplay *display,
{
GdkEvent *event;
event = gdk_grab_broken_event_new (surface,
event = gdk_event_grab_broken_new (surface,
device,
device,
grab_surface,
@@ -1712,74 +1712,9 @@ gdk_display_set_cursor_theme (GdkDisplay *display,
GDK_DISPLAY_GET_CLASS (display)->set_cursor_theme (display, name, size);
}
/**
* gdk_display_map_keyval:
* @display: a #GdkDisplay
* @keyval: a keyval, such as %GDK_KEY_a, %GDK_KEY_Up, %GDK_KEY_Return, etc.
* @keys: (out) (array length=n_keys) (transfer full): return location
* for an array of #GdkKeymapKey
* @n_keys: return location for number of elements in returned array
*
* Obtains a list of keycode/group/level combinations that will
* generate @keyval. Groups and levels are two kinds of keyboard mode;
* in general, the level determines whether the top or bottom symbol
* on a key is used, and the group determines whether the left or
* right symbol is used.
*
* On US keyboards, the shift key changes the keyboard level, and there
* are no groups. A group switch key might convert a keyboard between
* Hebrew to English modes, for example.
*
* #GdkEventKey contains a %group field that indicates the active
* keyboard group. The level is computed from the modifier mask.
*
* The returned array should be freed with g_free().
*
* Returns: %TRUE if keys were found and returned
*/
gboolean
gdk_display_map_keyval (GdkDisplay *display,
guint keyval,
GdkKeymapKey **keys,
int *n_keys)
GdkModifierType
gdk_display_get_modifier_mask (GdkDisplay *display,
GdkModifierIntent intent)
{
return gdk_keymap_get_entries_for_keyval (gdk_display_get_keymap (display),
keyval,
keys,
n_keys);
}
/**
* gdk_display_map_keycode:
* @display: a #GdkDisplay
* @keycode: a keycode
* @keys: (out) (array length=n_entries) (transfer full) (optional): return
* location for array of #GdkKeymapKey, or %NULL
* @keyvals: (out) (array length=n_entries) (transfer full) (optional): return
* location for array of keyvals, or %NULL
* @n_entries: length of @keys and @keyvals
*
* Returns the keyvals bound to @keycode. The Nth #GdkKeymapKey
* in @keys is bound to the Nth keyval in @keyvals.
*
* When a keycode is pressed by the user, the keyval from
* this list of entries is selected by considering the effective
* keyboard group and level.
*
* Free the returned arrays with g_free().
*
* Returns: %TRUE if there were any entries
*/
gboolean
gdk_display_map_keycode (GdkDisplay *display,
guint keycode,
GdkKeymapKey **keys,
guint **keyvals,
int *n_entries)
{
return gdk_keymap_get_entries_for_keycode (gdk_display_get_keymap (display),
keycode,
keys,
keyvals,
n_entries);
return gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display), intent);
}
+3 -9
View File
@@ -116,17 +116,11 @@ GdkMonitor * gdk_display_get_monitor_at_surface (GdkDisplay *display,
GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
gboolean gdk_display_map_keyval (GdkDisplay *display,
guint keyval,
GdkKeymapKey **keys,
int *n_keys);
GdkKeymap * gdk_display_get_keymap (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
gboolean gdk_display_map_keycode (GdkDisplay *display,
guint keycode,
GdkKeymapKey **keys,
guint **keyvals,
int *n_entries);
GdkModifierType gdk_display_get_modifier_mask (GdkDisplay *display,
GdkModifierIntent intent);
GDK_AVAILABLE_IN_ALL
gboolean gdk_display_get_setting (GdkDisplay *display,
+24 -24
View File
@@ -915,12 +915,12 @@ gdk_drop_emit_enter_event (GdkDrop *self,
g_warn_if_fail (!priv->entered);
event = gdk_dnd_event_new (GDK_DRAG_ENTER,
priv->surface,
priv->device,
self,
time,
0, 0);
event = gdk_event_drag_new (GDK_DRAG_ENTER,
priv->surface,
priv->device,
self,
time,
0, 0);
priv->entered = TRUE;
@@ -939,12 +939,12 @@ gdk_drop_emit_motion_event (GdkDrop *self,
g_warn_if_fail (priv->entered);
event = gdk_dnd_event_new (GDK_DRAG_MOTION,
priv->surface,
priv->device,
self,
time,
x, y);
event = gdk_event_drag_new (GDK_DRAG_MOTION,
priv->surface,
priv->device,
self,
time,
x, y);
gdk_drop_do_emit_event (event, dont_queue);
}
@@ -959,12 +959,12 @@ gdk_drop_emit_leave_event (GdkDrop *self,
g_warn_if_fail (priv->entered);
event = gdk_dnd_event_new (GDK_DRAG_LEAVE,
priv->surface,
priv->device,
self,
time,
0, 0);
event = gdk_event_drag_new (GDK_DRAG_LEAVE,
priv->surface,
priv->device,
self,
time,
0, 0);
priv->entered = FALSE;
@@ -984,12 +984,12 @@ gdk_drop_emit_drop_event (GdkDrop *self,
g_warn_if_fail (priv->entered);
g_warn_if_fail (priv->state == GDK_DROP_STATE_NONE);
event = gdk_dnd_event_new (GDK_DROP_START,
priv->surface,
priv->device,
self,
time,
x, y);
event = gdk_event_drag_new (GDK_DROP_START,
priv->surface,
priv->device,
self,
time,
x, y);
priv->state = GDK_DROP_STATE_DROPPING;
+1423 -2154
View File
File diff suppressed because it is too large Load Diff
+31 -98
View File
@@ -41,10 +41,6 @@ G_BEGIN_DECLS
#define GDK_TYPE_EVENT (gdk_event_get_type ())
#define GDK_TYPE_EVENT_SEQUENCE (gdk_event_sequence_get_type ())
#define GDK_IS_EVENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_EVENT))
#define GDK_EVENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_EVENT, GdkEvent))
#define GDK_IS_EVENT_TYPE(event, type) (gdk_event_get_event_type ((event)) == (type))
/**
* GDK_PRIORITY_EVENTS:
@@ -102,38 +98,9 @@ G_BEGIN_DECLS
*/
#define GDK_BUTTON_SECONDARY (3)
typedef struct _GdkEventSequence GdkEventSequence;
typedef struct _GdkEvent GdkEvent;
#define GDK_TYPE_BUTTON_EVENT (gdk_button_event_get_type())
#define GDK_TYPE_CONFIGURE_EVENT (gdk_configure_event_get_type())
#define GDK_TYPE_CROSSING_EVENT (gdk_crossing_event_get_type())
#define GDK_TYPE_DELETE_EVENT (gdk_delete_event_get_type())
#define GDK_TYPE_DND_EVENT (gdk_dnd_event_get_type())
#define GDK_TYPE_FOCUS_EVENT (gdk_focus_event_get_type())
#define GDK_TYPE_GRAB_BROKEN_EVENT (gdk_grab_broken_event_get_type())
#define GDK_TYPE_KEY_EVENT (gdk_key_event_get_type())
#define GDK_TYPE_MOTION_EVENT (gdk_motion_event_get_type())
#define GDK_TYPE_PAD_EVENT (gdk_pad_event_get_type())
#define GDK_TYPE_PROXIMITY_EVENT (gdk_proximity_event_get_type())
#define GDK_TYPE_SCROLL_EVENT (gdk_scroll_event_get_type())
#define GDK_TYPE_TOUCH_EVENT (gdk_touch_event_get_type())
#define GDK_TYPE_TOUCHPAD_EVENT (gdk_touchpad_event_get_type())
typedef struct _GdkButtonEvent GdkButtonEvent;
typedef struct _GdkConfigureEvent GdkConfigureEvent;
typedef struct _GdkCrossingEvent GdkCrossingEvent;
typedef struct _GdkDeleteEvent GdkDeleteEvent;
typedef struct _GdkDNDEvent GdkDNDEvent;
typedef struct _GdkFocusEvent GdkFocusEvent;
typedef struct _GdkGrabBrokenEvent GdkGrabBrokenEvent;
typedef struct _GdkKeyEvent GdkKeyEvent;
typedef struct _GdkMotionEvent GdkMotionEvent;
typedef struct _GdkPadEvent GdkPadEvent;
typedef struct _GdkProximityEvent GdkProximityEvent;
typedef struct _GdkScrollEvent GdkScrollEvent;
typedef struct _GdkTouchEvent GdkTouchEvent;
typedef struct _GdkTouchpadEvent GdkTouchpadEvent;
typedef struct _GdkEventSequence GdkEventSequence;
typedef union _GdkEvent GdkEvent;
/**
* GdkEventType:
@@ -330,6 +297,7 @@ typedef enum
GDK_AVAILABLE_IN_ALL
GType gdk_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GType gdk_event_sequence_get_type (void) G_GNUC_CONST;
@@ -380,13 +348,9 @@ gboolean gdk_event_get_axis (GdkEvent *event,
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_pointer_emulated (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_button_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
guint gdk_button_event_get_button (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_scroll_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkScrollDirection gdk_scroll_event_get_direction (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
void gdk_scroll_event_get_deltas (GdkEvent *event,
@@ -395,44 +359,28 @@ void gdk_scroll_event_get_deltas (GdkEvent *event,
GDK_AVAILABLE_IN_ALL
gboolean gdk_scroll_event_is_stop (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_key_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
guint gdk_key_event_get_keyval (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
guint gdk_key_event_get_keycode (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkModifierType gdk_key_event_get_consumed_modifiers (GdkEvent *event);
guint gdk_key_event_get_scancode (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
guint gdk_key_event_get_layout (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
guint gdk_key_event_get_level (GdkEvent *event);
guint gdk_key_event_get_group (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_key_event_is_modifier (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_focus_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
gboolean gdk_focus_event_get_in (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_touch_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
gboolean gdk_touch_event_get_emulating_pointer (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_crossing_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkCrossingMode gdk_crossing_event_get_mode (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkNotifyType gdk_crossing_event_get_detail (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_crossing_event_get_focus (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_configure_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
void gdk_configure_event_get_size (GdkEvent *event,
int *width,
int *height);
GDK_AVAILABLE_IN_ALL
GType gdk_touchpad_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkTouchpadGesturePhase
gdk_touchpad_event_get_gesture_phase (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
@@ -442,41 +390,26 @@ void gdk_touchpad_event_get_deltas (GdkEvent *event,
double *dx,
double *dy);
GDK_AVAILABLE_IN_ALL
double gdk_touchpad_event_get_pinch_angle_delta (GdkEvent *event);
double gdk_touchpad_pinch_event_get_angle_delta (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
double gdk_touchpad_event_get_pinch_scale (GdkEvent *event);
double gdk_touchpad_pinch_event_get_scale (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_pad_event_get_type (void) G_GNUC_CONST;
guint gdk_pad_button_event_get_button (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
guint gdk_pad_event_get_button (GdkEvent *event);
void gdk_pad_axis_event_get_value (GdkEvent *event,
guint *index,
double *value);
GDK_AVAILABLE_IN_ALL
void gdk_pad_event_get_axis_value (GdkEvent *event,
guint *index,
double *value);
void gdk_pad_event_get_group_mode (GdkEvent *event,
guint *group,
guint *mode);
GDK_AVAILABLE_IN_ALL
void gdk_pad_event_get_group_mode (GdkEvent *event,
guint *group,
guint *mode);
GDK_AVAILABLE_IN_ALL
GType gdk_dnd_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkDrop * gdk_dnd_event_get_drop (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_grab_broken_event_get_type (void) G_GNUC_CONST;
GdkDrop * gdk_drag_event_get_drop (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_grab_broken_event_get_grab_surface (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_grab_broken_event_get_implicit (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_motion_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GList * gdk_motion_event_get_history (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_delete_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GType gdk_proximity_event_get_type (void) G_GNUC_CONST;
GList * gdk_event_get_motion_history (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_triggers_context_menu (GdkEvent *event);
@@ -496,30 +429,30 @@ gboolean gdk_events_get_center (GdkEvent *event1,
double *y);
/**
* GdkKeyMatch:
* @GDK_KEY_MATCH_NONE: The key event does not match
* @GDK_KEY_MATCH_PARTIAL: The key event matches if keyboard state
* GdkEventMatch:
* @GDK_EVENT_MATCH_NONE: The key event does not match
* @GDK_EVENT_MATCH_PARTIAL: The key event matches if keyboard state
* (specifically, the currently active group) is ignored
* @GDK_KEY_MATCH_EXACT: The key event matches
* @GDK_EVENT_MATCH_EXACT: The key event matches
*
* The possible return values from gdk_key_event_matches()
* The possible return values from gdk_event_matches()
* describe how well an event matches a given keyval and modifiers.
*/
typedef enum {
GDK_KEY_MATCH_NONE,
GDK_KEY_MATCH_PARTIAL,
GDK_KEY_MATCH_EXACT
} GdkKeyMatch;
GDK_EVENT_MATCH_NONE,
GDK_EVENT_MATCH_PARTIAL,
GDK_EVENT_MATCH_EXACT
} GdkEventMatch;
GDK_AVAILABLE_IN_ALL
GdkKeyMatch gdk_key_event_matches (GdkEvent *event,
guint keyval,
GdkModifierType modifiers);
GdkEventMatch gdk_event_matches (GdkEvent *event,
guint keyval,
GdkModifierType modifiers);
GDK_AVAILABLE_IN_ALL
gboolean gdk_key_event_get_match (GdkEvent *event,
guint *keyval,
GdkModifierType *modifiers);
gboolean gdk_event_get_match (GdkEvent *event,
guint *keyval,
GdkModifierType *modifiers);
G_END_DECLS
+322 -212
View File
@@ -30,98 +30,74 @@
#include <gdk/gdkdevice.h>
#include <gdk/gdkdevicetool.h>
G_BEGIN_DECLS
#define GDK_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_EVENT, GdkEventClass))
typedef struct _GdkEventAny GdkEventAny;
typedef struct _GdkEventMotion GdkEventMotion;
typedef struct _GdkEventButton GdkEventButton;
typedef struct _GdkEventTouch GdkEventTouch;
typedef struct _GdkEventScroll GdkEventScroll;
typedef struct _GdkEventKey GdkEventKey;
typedef struct _GdkEventFocus GdkEventFocus;
typedef struct _GdkEventCrossing GdkEventCrossing;
typedef struct _GdkEventConfigure GdkEventConfigure;
typedef struct _GdkEventProximity GdkEventProximity;
typedef struct _GdkEventDND GdkEventDND;
typedef struct _GdkEventSetting GdkEventSetting;
typedef struct _GdkEventGrabBroken GdkEventGrabBroken;
typedef struct _GdkEventTouchpadSwipe GdkEventTouchpadSwipe;
typedef struct _GdkEventTouchpadPinch GdkEventTouchpadPinch;
typedef struct _GdkEventPadButton GdkEventPadButton;
typedef struct _GdkEventPadAxis GdkEventPadAxis;
typedef struct _GdkEventPadGroupMode GdkEventPadGroupMode;
typedef struct _GdkEventClass GdkEventClass;
/*< private >
* GdkEvent:
* @ref_count: the reference count of the event
* @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
/*
* GdkEventAny:
* @type: the type of the event.
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
*
* The abstract type for all windowing system events.
* Contains the fields which are common to all event structs.
* Any event pointer can safely be cast to a pointer to a #GdkEventAny to
* access these fields.
*/
struct _GdkEvent
struct _GdkEventAny
{
GTypeInstance parent_instance;
grefcount ref_count;
/* Specialised event type */
GdkEventType event_type;
/* The surface of the event */
int ref_count;
GdkEventType type;
GdkSurface *surface;
/* The devices associated to the event */
GdkDevice *device;
GdkDevice *source_device;
guint32 time;
guint16 flags;
};
/*< private >
* GdkEventClass:
* @finalize: a function called when the last reference held on an event is
* released; implementations of GdkEvent must chain up to the parent class
*
* The base class for events.
*/
struct _GdkEventClass
{
GTypeClass parent_class;
void (* finalize) (GdkEvent *event);
GdkModifierType (* get_state) (GdkEvent *event);
gboolean (* get_position) (GdkEvent *event,
double *x,
double *y);
GdkEventSequence * (* get_sequence) (GdkEvent *event);
GdkDeviceTool * (* get_tool) (GdkEvent *event);
gboolean (* get_axes) (GdkEvent *event,
double **axes,
guint *n_axes);
guint pointer_emulated : 1;
guint touch_emulating : 1;
guint scroll_is_stop : 1;
guint key_is_modifier : 1;
guint focus_in : 1;
GdkDevice *device;
GdkDevice *source_device;
};
/*
* GdkDeleteEvent:
*
* Generated when a surface is deleted.
*/
struct _GdkDeleteEvent
{
GdkEvent parent_instance;
};
/*
* GdkMotionEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) set during the motion
* event. See #GdkModifierType.
* GdkEventMotion:
* @type: the type of the event.
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is
* the mouse.
* @history: (element-type GdkTimeCoord): a list of time and coordinates
* for other motion events that were compressed before delivering the
* current event
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* screen.
*
* Generated when the pointer moves.
*/
struct _GdkMotionEvent
struct _GdkEventMotion
{
GdkEvent parent_instance;
GdkEventAny any;
GdkModifierType state;
double x;
double y;
@@ -131,7 +107,15 @@ struct _GdkMotionEvent
};
/*
* GdkButtonEvent:
* GdkEventButton:
* @type: the type of the event (%GDK_BUTTON_PRESS or %GDK_BUTTON_RELEASE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is
* the mouse.
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
@@ -139,19 +123,16 @@ struct _GdkMotionEvent
* Normally button 1 is the left mouse button, 2 is the middle button,
* and 3 is the right button. On 2-button mice, the middle button can
* often be simulated by pressing both mouse buttons together.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is
* the mouse.
* @tool: a #GdkDeviceTool
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* screen.
*
* Used for button press and button release events. The
* @type field will be one of %GDK_BUTTON_PRESS or %GDK_BUTTON_RELEASE,
*/
struct _GdkButtonEvent
struct _GdkEventButton
{
GdkEvent parent_instance;
GdkEventAny any;
GdkModifierType state;
guint button;
double x;
@@ -161,16 +142,25 @@ struct _GdkButtonEvent
};
/*
* GdkTouchEvent:
* GdkEventTouch:
* @type: the type of the event (%GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
* %GDK_TOUCH_END, %GDK_TOUCH_CANCEL)
* @surface: the surface which received the event
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @x: the x coordinate of the pointer relative to the surface
* @y: the y coordinate of the pointer relative to the surface
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is
* the mouse
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType
* @x: the x coordinate of the pointer relative to the surface
* @y: the y coordinate of the pointer relative to the surface
* @axes: @x, @y translated to the axes of the event's device, or %NULL
* if @device is the mouse
* @sequence: the event sequence that the event belongs to
* @emulated: whether the event is the result of a pointer emulation
* @emulating_pointer: whether the event should be used for emulating
* pointer event
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* screen
*
* Used for touch events.
* @type field will be one of %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
@@ -183,21 +173,22 @@ struct _GdkButtonEvent
* (or %GDK_TOUCH_CANCEL) event. With multitouch devices, there may be
* several active sequences at the same time.
*/
struct _GdkTouchEvent
struct _GdkEventTouch
{
GdkEvent parent_instance;
GdkEventAny any;
GdkModifierType state;
double x;
double y;
double *axes;
GdkEventSequence *sequence;
gboolean touch_emulating;
gboolean pointer_emulated;
};
/*
* GdkScrollEvent:
* GdkEventScroll:
* @type: the type of the event (%GDK_SCROLL).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @state: (type GdkModifierType): a bit-mask representing the state of
@@ -206,11 +197,10 @@ struct _GdkTouchEvent
* @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
* %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT, %GDK_SCROLL_RIGHT or
* %GDK_SCROLL_SMOOTH).
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* @delta_x: the x coordinate of the scroll delta
* @delta_y: the y coordinate of the scroll delta
* @pointer_emulated: whether the scroll event was the result of
* a pointer emulation
* @tool: a #GdkDeviceTool
*
* Generated from button presses for the buttons 4 to 7. Wheel mice are
* usually configured to generate button press events for buttons 4 and 5
@@ -221,82 +211,74 @@ struct _GdkTouchEvent
* these, the scroll deltas can be obtained with
* gdk_event_get_scroll_deltas().
*/
struct _GdkScrollEvent
struct _GdkEventScroll
{
GdkEvent parent_instance;
GdkEventAny any;
double x;
double y;
GdkModifierType state;
GdkScrollDirection direction;
double delta_x;
double delta_y;
gboolean pointer_emulated;
gboolean is_stop;
GdkDeviceTool *tool;
};
/*
* GdkTranslatedKey:
* @keyval: the translated key symbol
* @consumed: the consumed modifiers
* @layout: the keyboard layout
* @level: the layout level
*
* Describes a translated key code.
*/
typedef struct {
guint keyval;
GdkModifierType consumed;
guint layout;
guint level;
} GdkTranslatedKey;
/*
* GdkKeyEvent:
* GdkEventKey:
* @type: the type of the event (%GDK_KEY_PRESS or %GDK_KEY_RELEASE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
* @keycode: the raw code of the key that was pressed or released.
* @translated: the result of translating @keycode. First with the full
* @state, then while ignoring Caps Lock.
* @keyval: the key that was pressed or released. See the
* `gdk/gdkkeysyms.h` header file for a
* complete list of GDK key codes.
* @hardware_keycode: the raw code of the key that was pressed or released.
* @group: the keyboard group.
* @is_modifier: a flag that indicates if @hardware_keycode is mapped to a
* modifier
*
* Describes a key press or key release event.
*/
struct _GdkKeyEvent
struct _GdkEventKey
{
GdkEvent parent_instance;
GdkEventAny any;
GdkModifierType state;
guint32 keycode;
gboolean key_is_modifier;
GdkTranslatedKey translated[2];
guint keyval;
guint16 hardware_keycode;
guint16 key_scancode;
guint8 group;
};
/*
* GdkCrossingEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
* GdkEventCrossing:
* @type: the type of the event (%GDK_ENTER_NOTIFY or %GDK_LEAVE_NOTIFY).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @child_surface: the surface that was entered or left.
* @time: the time of the event in milliseconds.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB,
* %GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or
* %GDK_CROSSING_STATE_CHANGED). %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB,
* and %GDK_CROSSING_STATE_CHANGED were added in 2.14 and are always synthesized,
* never native.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @detail: the kind of crossing that happened (%GDK_NOTIFY_INFERIOR,
* %GDK_NOTIFY_ANCESTOR, %GDK_NOTIFY_VIRTUAL, %GDK_NOTIFY_NONLINEAR or
* %GDK_NOTIFY_NONLINEAR_VIRTUAL).
* @focus: %TRUE if @surface is the focus surface or an inferior.
* @child_surface: the surface that was entered or left.
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
*
* Generated when the pointer enters or leaves a surface.
*/
struct _GdkCrossingEvent
struct _GdkEventCrossing
{
GdkEvent parent_instance;
GdkEventAny any;
GdkModifierType state;
GdkCrossingMode mode;
double x;
@@ -307,7 +289,10 @@ struct _GdkCrossingEvent
};
/*
* GdkFocusEvent:
* GdkEventFocus:
* @type: the type of the event (%GDK_FOCUS_CHANGE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @in: %TRUE if the surface has gained the keyboard focus, %FALSE if
* it has lost the focus.
* @mode: the crossing mode
@@ -315,15 +300,19 @@ struct _GdkCrossingEvent
*
* Describes a change of keyboard focus.
*/
struct _GdkFocusEvent
struct _GdkEventFocus
{
GdkEvent parent_instance;
gboolean focus_in;
GdkEventAny any;
gint16 in;
GdkCrossingMode mode;
GdkNotifyType detail;
};
/*
* GdkConfigureEvent:
* GdkEventConfigure:
* @type: the type of the event (%GDK_CONFIGURE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @x: the new x coordinate of the surface, relative to its parent.
* @y: the new y coordinate of the surface, relative to its parent.
* @width: the new width of the surface.
@@ -331,10 +320,9 @@ struct _GdkFocusEvent
*
* Generated when a surface size or position has changed.
*/
struct _GdkConfigureEvent
struct _GdkEventConfigure
{
GdkEvent parent_instance;
GdkEventAny any;
int x;
int y;
int width;
@@ -342,23 +330,36 @@ struct _GdkConfigureEvent
};
/*
* GdkProximityEvent:
* @tool: the #GdkDeviceTool associated to the event
* GdkEventProximity:
* @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
*
* A proximity event indicates that a tool of a graphic tablet, or similar
* devices that report proximity, has moved in or out of contact with the
* tablet, or perhaps that the users finger has moved in or out of contact
* with a touch screen.
* Proximity events are generated when using GDKs wrapper for the
* XInput extension. The XInput extension is an add-on for standard X
* that allows you to use nonstandard devices such as graphics tablets.
* A proximity event indicates that the stylus has moved in or out of
* contact with the tablet, or perhaps that the users finger has moved
* in or out of contact with a touch screen.
*
* This event type will be used pretty rarely. It only is important for
* XInput aware programs that are drawing their own cursor.
*/
struct _GdkProximityEvent
struct _GdkEventProximity
{
GdkEvent parent_instance;
GdkEventAny any;
GdkDeviceTool *tool;
};
/*
* GdkGrabBrokenEvent:
* GdkEventGrabBroken:
* @type: the type of the event (%GDK_GRAB_BROKEN)
* @surface: the surface which received the event, i.e. the surface
* that previously owned the grab
* @send_event: %TRUE if the event was sent explicitly.
* @keyboard: %TRUE if a keyboard grab was broken, %FALSE if a pointer
* grab was broken
* @implicit: %TRUE if the broken grab was implicit
@@ -370,39 +371,67 @@ struct _GdkProximityEvent
* when the grab surface becomes unviewable (i.e. it or one of its ancestors
* is unmapped), or if the same application grabs the pointer or keyboard
* again. Note that implicit grabs (which are initiated by button presses)
* can also cause #GdkGrabBrokenEvent events.
* can also cause #GdkEventGrabBroken events.
*/
struct _GdkGrabBrokenEvent
{
GdkEvent parent_instance;
struct _GdkEventGrabBroken {
GdkEventAny any;
gboolean keyboard;
gboolean implicit;
GdkSurface *grab_surface;
};
/*
* GdkDNDEvent:
* GdkEventDND:
* @type: the type of the event (%GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
* %GDK_DRAG_MOTION or %GDK_DROP_START)
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @drop: the #GdkDrop for the current DND operation.
* @x: the X coordinate of the pointer
* @y: the Y coordinate of the pointer
* @time: the time of the event in milliseconds.
*
* Generated during DND operations.
*/
struct _GdkDNDEvent
{
GdkEvent parent_instance;
struct _GdkEventDND {
GdkEventAny any;
GdkDrop *drop;
double x;
double y;
};
/*
* GdkTouchpadEvent:
* GdkEventTouchpadSwipe:
* @type: the type of the event (%GDK_TOUCHPAD_SWIPE)
* @surface: the surface which received the event
* @send_event: %TRUE if the event was sent explicitly
* @phase: (type GdkTouchpadGesturePhase): the current phase of the gesture
* @n_fingers: The number of fingers triggering the swipe
* @time: the time of the event in milliseconds
* @x: The X coordinate of the pointer
* @y: The Y coordinate of the pointer
* @dx: Movement delta in the X axis of the swipe focal point
* @dy: Movement delta in the Y axis of the swipe focal point
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
*
* Generated during touchpad swipe gestures.
*/
struct _GdkEventTouchpadSwipe {
GdkEventAny any;
GdkModifierType state;
gint8 phase;
gint8 n_fingers;
double x;
double y;
double dx;
double dy;
};
/*
* GdkEventTouchpadPinch:
* @type: the type of the event (%GDK_TOUCHPAD_PINCH)
* @surface: the surface which received the event
* @send_event: %TRUE if the event was sent explicitly
* @phase: (type GdkTouchpadGesturePhase): the current phase of the gesture
* @n_fingers: The number of fingers triggering the pinch
* @time: the time of the event in milliseconds
@@ -410,17 +439,18 @@ struct _GdkDNDEvent
* @y: The Y coordinate of the pointer
* @dx: Movement delta in the X axis of the swipe focal point
* @dy: Movement delta in the Y axis of the swipe focal point
* @angle_delta: For pinch events, the angle change in radians, negative angles
* @angle_delta: The angle change in radians, negative angles
* denote counter-clockwise movements
* @scale: For pinch events, the current scale, relative to that at the time of
* @scale: The current scale, relative to that at the time of
* the corresponding %GDK_TOUCHPAD_GESTURE_PHASE_BEGIN event
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
*
* Generated during touchpad gestures.
* Generated during touchpad swipe gestures.
*/
struct _GdkTouchpadEvent
{
GdkEvent parent_instance;
struct _GdkEventTouchpadPinch {
GdkEventAny any;
GdkModifierType state;
gint8 phase;
gint8 n_fingers;
@@ -432,20 +462,99 @@ struct _GdkTouchpadEvent
double scale;
};
struct _GdkPadEvent
{
GdkEvent parent_instance;
/*
* GdkEventPadButton:
* @type: the type of the event (%GDK_PAD_BUTTON_PRESS or %GDK_PAD_BUTTON_RELEASE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @group: the pad group the button belongs to. A %GDK_SOURCE_TABLET_PAD device
* may have one or more groups containing a set of buttons/rings/strips each.
* @button: The pad button that was pressed.
* @mode: The current mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
* device may have different current modes.
*
* Generated during %GDK_SOURCE_TABLET_PAD button presses and releases.
*/
struct _GdkEventPadButton {
GdkEventAny any;
guint group;
guint mode;
guint button;
guint mode;
};
/*
* GdkEventPadAxis:
* @type: the type of the event (%GDK_PAD_RING or %GDK_PAD_STRIP).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @group: the pad group the ring/strip belongs to. A %GDK_SOURCE_TABLET_PAD
* device may have one or more groups containing a set of buttons/rings/strips
* each.
* @index: number of strip/ring that was interacted. This number is 0-indexed.
* @mode: The current mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
* device may have different current modes.
* @value: The current value for the given axis.
*
* Generated during %GDK_SOURCE_TABLET_PAD interaction with tactile sensors.
*/
struct _GdkEventPadAxis {
GdkEventAny any;
guint group;
guint index;
guint mode;
double value;
};
void gdk_event_init_types (void);
/*
* GdkEventPadGroupMode:
* @type: the type of the event (%GDK_PAD_GROUP_MODE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @group: the pad group that is switching mode. A %GDK_SOURCE_TABLET_PAD
* device may have one or more groups containing a set of buttons/rings/strips
* each.
* @mode: The new mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
* device may have different current modes.
*
* Generated during %GDK_SOURCE_TABLET_PAD mode switches in a group.
*/
struct _GdkEventPadGroupMode {
GdkEventAny any;
guint group;
guint mode;
};
GdkEvent * gdk_button_event_new (GdkEventType type,
/*
* GdkEvent:
*
* The GdkEvent struct is private and should only be accessed
* using the accessor functions.
*/
union _GdkEvent
{
GdkEventAny any;
GdkEventMotion motion;
GdkEventButton button;
GdkEventTouch touch;
GdkEventScroll scroll;
GdkEventKey key;
GdkEventCrossing crossing;
GdkEventFocus focus_change;
GdkEventConfigure configure;
GdkEventProximity proximity;
GdkEventDND dnd;
GdkEventGrabBroken grab_broken;
GdkEventTouchpadSwipe touchpad_swipe;
GdkEventTouchpadPinch touchpad_pinch;
GdkEventPadButton pad_button;
GdkEventPadAxis pad_axis;
GdkEventPadGroupMode pad_group_mode;
};
GdkEvent * gdk_event_button_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
@@ -457,7 +566,7 @@ GdkEvent * gdk_button_event_new (GdkEventType type,
double y,
double *axes);
GdkEvent * gdk_motion_event_new (GdkSurface *surface,
GdkEvent * gdk_event_motion_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
@@ -467,7 +576,7 @@ GdkEvent * gdk_motion_event_new (GdkSurface *surface,
double y,
double *axes);
GdkEvent * gdk_crossing_event_new (GdkEventType type,
GdkEvent * gdk_event_crossing_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
@@ -478,36 +587,37 @@ GdkEvent * gdk_crossing_event_new (GdkEventType type,
GdkCrossingMode mode,
GdkNotifyType notify);
GdkEvent * gdk_proximity_event_new (GdkEventType type,
GdkEvent * gdk_event_proximity_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,
gboolean is_modifier,
GdkTranslatedKey *translated,
GdkTranslatedKey *no_lock);
GdkEvent * gdk_event_key_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
GdkModifierType state,
guint keyval,
guint16 keycode,
guint16 scancode,
guint8 group,
gboolean is_modifier);
GdkEvent * gdk_focus_event_new (GdkSurface *surface,
GdkEvent * gdk_event_focus_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
gboolean focus_in);
GdkEvent * gdk_configure_event_new (GdkSurface *surface,
GdkEvent * gdk_event_configure_new (GdkSurface *surface,
int width,
int height);
GdkEvent * gdk_delete_event_new (GdkSurface *surface);
GdkEvent * gdk_event_delete_new (GdkSurface *surface);
GdkEvent * gdk_scroll_event_new (GdkSurface *surface,
GdkEvent * gdk_event_scroll_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
@@ -517,7 +627,7 @@ GdkEvent * gdk_scroll_event_new (GdkSurface *surface,
double delta_y,
gboolean is_stop);
GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
GdkEvent * gdk_event_discrete_scroll_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
@@ -526,7 +636,7 @@ GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
GdkScrollDirection direction,
gboolean emulated);
GdkEvent * gdk_touch_event_new (GdkEventType type,
GdkEvent * gdk_event_touch_new (GdkEventType type,
GdkEventSequence *sequence,
GdkSurface *surface,
GdkDevice *device,
@@ -538,7 +648,7 @@ GdkEvent * gdk_touch_event_new (GdkEventType type,
double *axes,
gboolean emulating);
GdkEvent * gdk_touchpad_event_new_swipe (GdkSurface *surface,
GdkEvent * gdk_event_touchpad_swipe_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
@@ -550,7 +660,7 @@ GdkEvent * gdk_touchpad_event_new_swipe (GdkSurface *surface,
double dx,
double dy);
GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
GdkEvent * gdk_event_touchpad_pinch_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
@@ -564,7 +674,7 @@ GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
double scale,
double angle_delta);
GdkEvent * gdk_pad_event_new_ring (GdkSurface *surface,
GdkEvent * gdk_event_pad_ring_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
@@ -573,7 +683,7 @@ GdkEvent * gdk_pad_event_new_ring (GdkSurface *surface,
guint mode,
double value);
GdkEvent * gdk_pad_event_new_strip (GdkSurface *surface,
GdkEvent * gdk_event_pad_strip_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
@@ -582,7 +692,7 @@ GdkEvent * gdk_pad_event_new_strip (GdkSurface *surface,
guint mode,
double value);
GdkEvent * gdk_pad_event_new_button (GdkEventType type,
GdkEvent * gdk_event_pad_button_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
@@ -591,14 +701,14 @@ GdkEvent * gdk_pad_event_new_button (GdkEventType type,
guint button,
guint mode);
GdkEvent * gdk_pad_event_new_group_mode (GdkSurface *surface,
GdkEvent * gdk_event_pad_group_mode_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint group,
guint mode);
GdkEvent * gdk_dnd_event_new (GdkEventType type,
GdkEvent * gdk_event_drag_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDrop *drop,
@@ -606,12 +716,12 @@ GdkEvent * gdk_dnd_event_new (GdkEventType type,
double x,
double y);
GdkEvent * gdk_grab_broken_event_new (GdkSurface *surface,
GdkEvent * gdk_event_grab_broken_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkSurface *grab_surface,
gboolean implicit);
G_END_DECLS
#endif /* __GDK_EVENTS_PRIVATE_H__ */
-43
View File
@@ -33,7 +33,6 @@
#include "gdksurfaceprivate.h"
#include "gdkenumtypes.h"
#include "gdkdragprivate.h"
#include "gdkkeysprivate.h"
G_BEGIN_DECLS
@@ -185,11 +184,6 @@ gboolean gdk_surface_handle_event (GdkEvent *event);
GdkSeat * gdk_surface_get_seat_from_event (GdkSurface *surface,
GdkEvent *event);
void gdk_surface_enter_monitor (GdkSurface *surface,
GdkMonitor *monitor);
void gdk_surface_leave_monitor (GdkSurface *surface,
GdkMonitor *monitor);
/*****************************************
* Interfaces provided by windowing code *
*****************************************/
@@ -301,42 +295,6 @@ void gdk_surface_get_geometry (GdkSurface *surface,
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;
struct _GdkGeometry
{
gint min_width;
gint min_height;
gint max_width;
gint max_height;
gint base_width;
gint base_height;
gint width_inc;
gint height_inc;
gdouble min_aspect;
gdouble max_aspect;
GdkGravity win_gravity;
};
GDK_AVAILABLE_IN_ALL
void gdk_surface_constrain_size (GdkGeometry *geometry,
GdkSurfaceHints flags,
gint width,
gint height,
gint *new_width,
gint *new_height);
/*
* GdkSeatGrabPrepareFunc:
* @seat: the #GdkSeat being grabbed
@@ -364,7 +322,6 @@ void gdk_seat_ungrab (GdkSeat *seat);
GdkSurface * gdk_surface_new_temp (GdkDisplay *display,
const GdkRectangle *position);
GdkKeymap * gdk_display_get_keymap (GdkDisplay *display);
G_END_DECLS
+152 -82
View File
@@ -36,9 +36,8 @@
* @Title: Key Values
*
* Key values are the codes which are sent whenever a key is pressed or released.
* They are included in the data contained in a key press or release #GdkEvent.
* The complete list of key values can be found in the `gdk/gdkkeysyms.h` header
* file.
* They appear in the #GdkEventKey.keyval field of the #GdkEventKey structure.
* The complete list of key values can be found in the `gdk/gdkkeysyms.h` header file.
*
* Key values are regularly updated from the upstream X.org X11 implementation,
* so new values are added regularly. They will be prefixed with GDK_KEY_ rather
@@ -57,87 +56,43 @@
*
* # Groups # {#key-group-explanation}
*
* At the lowest level, physical keys on the keyboard are represented by
* numeric keycodes, and GDK knows how to translate these keycodes into
* key values according to the configured keyboard layout and the current
* state of the keyboard. In the GDK api, the mapping from keycodes to key
* values is available via gdk_display_map_keycode(), and the reverse mapping
* is available via gdk_display_map_keyval(). The results of these functions
* are returned in #GdkKeymapKey structs.
* One #GdkKeymap object exists for each user display. To obtain keymaps for
* a display, use gdk_display_get_keymap(). A keymap is a mapping from
* #GdkKeymapKey to key values. You can think of a #GdkKeymapKey as a
* representation of a symbol printed on a physical keyboard key. That is, it
* contains three pieces of information. First, it contains the hardware keycode;
* this is an identifying number for a physical key. Second, it contains the
* level of the key. The level indicates which symbol on the
* key will be used, in a vertical direction. So on a standard US keyboard, the key
* with the number 1 on it also has the exclamation point (!) character on
* it. The level indicates whether to use the 1 or the ! symbol. The letter
* keys are considered to have a lowercase letter at level 0, and an uppercase
* letter at level 1, though only the uppercase letter is printed. Third, the
* #GdkKeymapKey contains a group; groups are not used on standard US keyboards,
* but are used in many other countries. On a keyboard with groups, there can be 3
* or 4 symbols printed on a single key. The group indicates movement in a
* horizontal direction. Usually groups are used for two different languages. In
* group 0, a key might have two English characters, and in group 1 it might have
* two Hebrew characters. The Hebrew characters will be printed on the key next to
* the English characters.
*
* You can think of a #GdkKeymapKey as a representation of a symbol printed on
* a physical keyboard key. That is, it contains three pieces of information.
* First, it contains the hardware keycode; this is an identifying number for
* a physical key. Second, it contains the level of the key. The level indicates
* which symbol on the key will be used, in a vertical direction. So on a standard
* US keyboard, the key with the number 1 on it also has the exclamation point
* (!) character on it. The level indicates whether to use the 1 or the !
* symbol. The letter keys are considered to have a lowercase letter at level 0,
* and an uppercase letter at level 1, though normally only the uppercase letter
* is printed on the key. Third, the #GdkKeymapKey contains a group; groups are
* not used on standard US keyboards, but are used in many other countries. On a
* keyboard with groups, there can be 3 or 4 symbols printed on a single key.
* The group indicates movement in a horizontal direction. Usually groups are
* used for two different languages. In group 0, a key might have two English
* characters, and in group 1 it might have two Hebrew characters. The Hebrew
* characters will be printed on the key next to the English characters.
* In order to use a keymap to interpret a key event, its necessary to first
* convert the keyboard state into an effective group and level. This is done via a
* set of rules that varies widely according to type of keyboard and user
* configuration. The function gdk_keymap_translate_keyboard_state() accepts a
* keyboard state -- consisting of hardware keycode pressed, active modifiers, and
* active group -- applies the appropriate rules, and returns the group/level to be
* used to index the keymap, along with the modifiers which did not affect the
* group and level. i.e. it returns unconsumed modifiers. The keyboard group may
* differ from the effective group used for keymap lookups because some keys don't
* have multiple groups - e.g. the Enter key is always in group 0 regardless of
* keyboard state.
*
* When GDK creates a key event in order to deliver a key press or release,
* it first converts the current keyboard state into an effective group and
* level. This is done via a set of rules that varies widely according to
* type of keyboard and user configuration. The input to this translation
* consists of the hardware keycode pressed, the active modifiers, and the
* active group. It then applies the appropriate rules, and returns the
* group/level to be used to index the keymap, along with the modifiers
* which did not affect the group and level. i.e. it returns unconsumed
* modifiers. The keyboard group may differ from the effective group used
* for lookups because some keys don't have multiple groups - e.g. the Enter
* key is always in group 0 regardless of keyboard state.
*
* The results of the translation, including the keyval, are all included
* in the key event and can be obtained via #GdkEvent getters.
*
* # Consumed modifiers
*
* The @consumed_modifiers in a key event are modifiers that should be masked
* out from @state when comparing this key press to a hot key. For instance,
* on a US keyboard, the `plus` symbol is shifted, so when comparing a key
* press to a `<Control>plus` accelerator `<Shift>` should be masked out.
*
* |[<!-- language="C" -->
* // We want to ignore irrelevant modifiers like ScrollLock
* #define ALL_ACCELS_MASK (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_ALT_MASK)
* state = gdk_event_get_modifier_state (event);
* gdk_keymap_translate_keyboard_state (keymap,
* gdk_key_event_get_keycode (event),
* state,
* gdk_key_event_get_group (event),
* &keyval, NULL, NULL, &consumed);
* if (keyval == GDK_PLUS &&
* (state & ~consumed & ALL_ACCELS_MASK) == GDK_CONTROL_MASK)
* // Control was pressed
* ]|
*
* An older interpretation @consumed_modifiers was that it contained
* all modifiers that might affect the translation of the key;
* this allowed accelerators to be stored with irrelevant consumed
* modifiers, by doing:
* |[<!-- language="C" -->
* // XXX Dont do this XXX
* if (keyval == accel_keyval &&
* (state & ~consumed & ALL_ACCELS_MASK) == (accel_mods & ~consumed))
* // Accelerator was pressed
* ]|
*
* However, this did not work if multi-modifier combinations were
* used in the keymap, since, for instance, `<Control>` would be
* masked out even if only `<Control><Alt>` was used in the keymap.
* To support this usage as well as well as possible, all single
* modifier combinations that could affect the key for any combination
* of modifiers will be returned in @consumed_modifiers; multi-modifier
* combinations are returned only when actually found in @state. When
* you store accelerators, you should always store them with consumed
* modifiers removed. Store `<Control>plus`, not `<Control><Shift>plus`.
* Note that gdk_keymap_translate_keyboard_state() also returns the keyval, i.e. it
* goes ahead and performs the keymap lookup in addition to telling you which
* effective group/level values were used for the lookup. #GdkEventKey already
* contains this keyval, however, so you dont normally need to call
* gdk_keymap_translate_keyboard_state() just to get the keyval.
*/
enum {
@@ -156,6 +111,9 @@ enum {
static GParamSpec *props[LAST_PROP] = { NULL, };
static guint signals[LAST_SIGNAL] = { 0 };
static GdkModifierType gdk_keymap_real_get_modifier_mask (GdkKeymap *keymap,
GdkModifierIntent intent);
G_DEFINE_TYPE (GdkKeymap, gdk_keymap, G_TYPE_OBJECT)
static void
@@ -203,6 +161,8 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
object_class->get_property = gdk_keymap_get_property;
object_class->set_property = gdk_keymap_set_property;
klass->get_modifier_mask = gdk_keymap_real_get_modifier_mask;
props[PROP_DISPLAY] =
g_param_spec_object ("display",
"Display",
@@ -655,6 +615,116 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
consumed_modifiers);
}
/**
* gdk_keymap_add_virtual_modifiers:
* @keymap: a #GdkKeymap
* @state: (inout): pointer to the modifier mask to change
*
* Maps the non-virtual modifiers (i.e Mod2, Mod3, ...) which are set
* in @state to the virtual modifiers (i.e. Super, Hyper and Meta) and
* set the corresponding bits in @state.
*
* GDK already does this before delivering key events, but for
* compatibility reasons, it only sets the first virtual modifier
* it finds, whereas this function sets all matching virtual modifiers.
*
* This function is useful when matching key events against
* accelerators.
*/
void
gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
g_return_if_fail (GDK_IS_KEYMAP (keymap));
GDK_KEYMAP_GET_CLASS (keymap)->add_virtual_modifiers (keymap, state);
}
/**
* gdk_keymap_map_virtual_modifiers:
* @keymap: a #GdkKeymap
* @state: (inout): pointer to the modifier state to map
*
* Maps the virtual modifiers (i.e. Super, Hyper and Meta) which
* are set in @state to their non-virtual counterparts (i.e. Mod2,
* Mod3,...) and set the corresponding bits in @state.
*
* This function is useful when matching key events against
* accelerators.
*
* Returns: %FALSE if two virtual modifiers were mapped to the
* same non-virtual modifier. Note that %FALSE is also returned
* if a virtual modifier is mapped to a non-virtual modifier that
* was already set in @state.
*/
gboolean
gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), FALSE);
return GDK_KEYMAP_GET_CLASS(keymap)->map_virtual_modifiers (keymap, state);
}
static GdkModifierType
gdk_keymap_real_get_modifier_mask (GdkKeymap *keymap,
GdkModifierIntent intent)
{
switch (intent)
{
case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
return GDK_CONTROL_MASK;
case GDK_MODIFIER_INTENT_CONTEXT_MENU:
return 0;
case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
return GDK_SHIFT_MASK;
case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
return GDK_CONTROL_MASK;
case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
return GDK_ALT_MASK | GDK_CONTROL_MASK;
case GDK_MODIFIER_INTENT_SHIFT_GROUP:
return 0;
case GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK:
return (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_ALT_MASK |
GDK_SUPER_MASK | GDK_HYPER_MASK | GDK_META_MASK);
default:
g_return_val_if_reached (0);
}
}
/**
* gdk_keymap_get_modifier_mask:
* @keymap: a #GdkKeymap
* @intent: the use case for the modifier mask
*
* Returns the modifier mask the @keymaps windowing system backend
* uses for a particular purpose.
*
* Note that this function always returns real hardware modifiers, not
* virtual ones (e.g. it will return #GDK_ALT_MASK rather than
* #GDK_META_MASK if the backend maps MOD1 to META), so there are use
* cases where the return value of this function has to be transformed
* by gdk_keymap_add_virtual_modifiers() in order to contain the
* expected result.
*
* Returns: the modifier mask used for @intent.
**/
GdkModifierType
gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
GdkModifierIntent intent)
{
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), 0);
return GDK_KEYMAP_GET_CLASS (keymap)->get_modifier_mask (keymap, intent);
}
#include "gdkkeynames.c"
/**
+98
View File
@@ -34,6 +34,104 @@
G_BEGIN_DECLS
typedef struct _GdkKeymapKey GdkKeymapKey;
/**
* GdkKeymapKey:
* @keycode: the hardware keycode. This is an identifying number for a
* physical key.
* @group: indicates movement in a horizontal direction. Usually groups are used
* for two different languages. In group 0, a key might have two English
* characters, and in group 1 it might have two Hebrew characters. The Hebrew
* characters will be printed on the key next to the English characters.
* @level: indicates which symbol on the key will be used, in a vertical direction.
* So on a standard US keyboard, the key with the number 1 on it also has the
* exclamation point ("!") character on it. The level indicates whether to use
* the 1 or the ! symbol. The letter keys are considered to have a lowercase
* letter at level 0, and an uppercase letter at level 1, though only the
* uppercase letter is printed.
*
* A #GdkKeymapKey is a hardware key that can be mapped to a keyval.
*/
struct _GdkKeymapKey
{
guint keycode;
gint group;
gint level;
};
#define GDK_TYPE_KEYMAP (gdk_keymap_get_type ())
#define GDK_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_KEYMAP, GdkKeymap))
#define GDK_IS_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_KEYMAP))
/**
* GdkKeymap:
*
* A #GdkKeymap defines the translation from keyboard state
* (including a hardware key, a modifier mask, and active keyboard group)
* to a keyval. This translation has two phases. The first phase is
* to determine the effective keyboard group and level for the keyboard
* state; the second phase is to look up the keycode/group/level triplet
* in the keymap and see what keyval it corresponds to.
*/
GDK_AVAILABLE_IN_ALL
GType gdk_keymap_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkDisplay * gdk_keymap_get_display (GdkKeymap *keymap);
GDK_AVAILABLE_IN_ALL
guint gdk_keymap_lookup_key (GdkKeymap *keymap,
const GdkKeymapKey *key);
GDK_AVAILABLE_IN_ALL
gboolean gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
guint hardware_keycode,
GdkModifierType state,
gint group,
guint *keyval,
gint *effective_group,
gint *level,
GdkModifierType *consumed_modifiers);
GDK_AVAILABLE_IN_ALL
gboolean gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
guint keyval,
GdkKeymapKey **keys,
gint *n_keys);
GDK_AVAILABLE_IN_ALL
gboolean gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
guint hardware_keycode,
GdkKeymapKey **keys,
guint **keyvals,
gint *n_entries);
GDK_AVAILABLE_IN_ALL
PangoDirection gdk_keymap_get_direction (GdkKeymap *keymap);
GDK_AVAILABLE_IN_ALL
gboolean gdk_keymap_have_bidi_layouts (GdkKeymap *keymap);
GDK_AVAILABLE_IN_ALL
gboolean gdk_keymap_get_caps_lock_state (GdkKeymap *keymap);
GDK_AVAILABLE_IN_ALL
gboolean gdk_keymap_get_num_lock_state (GdkKeymap *keymap);
GDK_AVAILABLE_IN_ALL
gboolean gdk_keymap_get_scroll_lock_state (GdkKeymap *keymap);
GDK_AVAILABLE_IN_ALL
guint gdk_keymap_get_modifier_state (GdkKeymap *keymap);
GDK_AVAILABLE_IN_ALL
void gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state);
GDK_AVAILABLE_IN_ALL
gboolean gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state);
GDK_AVAILABLE_IN_ALL
GdkModifierType gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
GdkModifierIntent intent);
/* Key values
*/
GDK_AVAILABLE_IN_ALL
const char *gdk_keyval_name (guint keyval) G_GNUC_CONST;
+6 -35
View File
@@ -22,14 +22,10 @@
G_BEGIN_DECLS
#define GDK_TYPE_KEYMAP (gdk_keymap_get_type ())
#define GDK_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_KEYMAP, GdkKeymap))
#define GDK_IS_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_KEYMAP))
#define GDK_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_KEYMAP, GdkKeymapClass))
#define GDK_IS_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_KEYMAP))
#define GDK_KEYMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_KEYMAP, GdkKeymapClass))
typedef struct _GdkKeymap GdkKeymap;
typedef struct _GdkKeymapClass GdkKeymapClass;
struct _GdkKeymapClass
@@ -60,6 +56,12 @@ struct _GdkKeymapClass
gint *effective_group,
gint *level,
GdkModifierType *consumed_modifiers);
void (* add_virtual_modifiers) (GdkKeymap *keymap,
GdkModifierType *state);
gboolean (* map_virtual_modifiers) (GdkKeymap *keymap,
GdkModifierType *state);
GdkModifierType (*get_modifier_mask) (GdkKeymap *keymap,
GdkModifierIntent intent);
guint (* get_modifier_state) (GdkKeymap *keymap);
@@ -75,37 +77,6 @@ struct _GdkKeymap
GdkDisplay *display;
};
GType gdk_keymap_get_type (void) G_GNUC_CONST;
GdkDisplay * gdk_keymap_get_display (GdkKeymap *keymap);
guint gdk_keymap_lookup_key (GdkKeymap *keymap,
const GdkKeymapKey *key);
gboolean gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
guint hardware_keycode,
GdkModifierType state,
gint group,
guint *keyval,
gint *effective_group,
gint *level,
GdkModifierType *consumed_modifiers);
gboolean gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
guint keyval,
GdkKeymapKey **keys,
gint *n_keys);
gboolean gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
guint hardware_keycode,
GdkKeymapKey **keys,
guint **keyvals,
gint *n_entries);
PangoDirection gdk_keymap_get_direction (GdkKeymap *keymap);
gboolean gdk_keymap_have_bidi_layouts (GdkKeymap *keymap);
gboolean gdk_keymap_get_caps_lock_state (GdkKeymap *keymap);
gboolean gdk_keymap_get_num_lock_state (GdkKeymap *keymap);
gboolean gdk_keymap_get_scroll_lock_state (GdkKeymap *keymap);
guint gdk_keymap_get_modifier_state (GdkKeymap *keymap);
G_END_DECLS
#endif
+69 -85
View File
@@ -76,8 +76,6 @@ enum {
SIZE_CHANGED,
RENDER,
EVENT,
ENTER_MONITOR,
LEAVE_MONITOR,
LAST_SIGNAL
};
@@ -473,9 +471,6 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* @height: the new height
*
* Emitted when the size of @surface is changed.
*
* Surface size is reported in application pixels, not
* device pixels (see gdk_surface_get_scale_factor()).
*/
signals[SIZE_CHANGED] =
g_signal_new (g_intern_static_string ("size-changed"),
@@ -530,51 +525,13 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
0,
g_signal_accumulator_true_handled,
NULL,
_gdk_marshal_BOOLEAN__POINTER,
_gdk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN,
1,
GDK_TYPE_EVENT);
g_signal_set_va_marshaller (signals[EVENT],
G_OBJECT_CLASS_TYPE (object_class),
_gdk_marshal_BOOLEAN__POINTERv);
/**
* GdkSurface::enter-montor:
* @surface: the #GdkSurface
* @monitor: the monitor
*
* Emitted when @surface starts being present on the monitor.
*/
signals[ENTER_MONITOR] =
g_signal_new (g_intern_static_string ("enter-monitor"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0,
NULL,
NULL,
NULL,
G_TYPE_NONE,
1,
GDK_TYPE_MONITOR);
/**
* GdkSurface::leave-montor:
* @surface: the #GdkSurface
* @monitor: the monitor
*
* Emitted when @surface stops being present on the monitor.
*/
signals[LEAVE_MONITOR] =
g_signal_new (g_intern_static_string ("leave-monitor"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0,
NULL,
NULL,
NULL,
G_TYPE_NONE,
1,
GDK_TYPE_MONITOR);
_gdk_marshal_BOOLEAN__BOXEDv);
}
static void
@@ -1984,8 +1941,9 @@ gdk_surface_get_geometry (GdkSurface *surface,
*
* Returns the width of the given @surface.
*
* Surface size is reported in application pixels, not
* device pixels (see gdk_surface_get_scale_factor()).
* On the X11 platform the returned size is the size reported in the
* most-recently-processed configure event, rather than the current
* size on the X server.
*
* Returns: The width of @surface
*/
@@ -2003,8 +1961,9 @@ gdk_surface_get_width (GdkSurface *surface)
*
* Returns the height of the given @surface.
*
* Surface size is reported in application pixels, not
* device pixels (see gdk_surface_get_scale_factor()).
* On the X11 platform the returned size is the size reported in the
* most-recently-processed configure event, rather than the current
* size on the X server.
*
* Returns: The height of @surface
*/
@@ -2783,18 +2742,6 @@ gdk_synthesize_surface_state (GdkSurface *surface,
gdk_surface_set_state (surface, (surface->state | set_flags) & ~unset_flags);
}
static void
hide_popup_chain (GdkSurface *surface)
{
GdkSurface *parent;
gdk_surface_hide (surface);
parent = surface->parent;
if (parent->autohide)
hide_popup_chain (parent);
}
static gboolean
check_autohide (GdkEvent *event)
{
@@ -2824,7 +2771,7 @@ check_autohide (GdkEvent *event)
if (grab_surface != gdk_event_get_surface (event) &&
grab_surface->autohide)
{
hide_popup_chain (grab_surface);
gdk_surface_hide (grab_surface);
return TRUE;
}
}
@@ -2835,6 +2782,52 @@ check_autohide (GdkEvent *event)
return FALSE;
}
static gboolean
is_keyboard_event (GdkEvent *event)
{
switch ((guint) gdk_event_get_event_type (event))
{
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
case GDK_FOCUS_CHANGE:
return TRUE;
default:;
}
return FALSE;
}
static GdkEvent *
rewrite_event_for_toplevel (GdkEvent *event)
{
GdkSurface *surface;
surface = gdk_event_get_surface (event);
if (!surface->parent)
return gdk_event_ref (event);
while (surface->parent)
surface = surface->parent;
if (gdk_event_get_event_type (event) == GDK_FOCUS_CHANGE)
return gdk_event_focus_new (surface,
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_focus_event_get_in (event));
else
return gdk_event_key_new (gdk_event_get_event_type (event),
surface,
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_event_get_time (event),
gdk_event_get_modifier_state (event),
gdk_key_event_get_keyval (event),
gdk_key_event_get_keycode (event),
gdk_key_event_get_scancode (event),
gdk_key_event_get_group (event),
gdk_key_event_is_modifier (event));
}
static void
add_event_mark (GdkEvent *event,
gint64 time,
@@ -2852,7 +2845,7 @@ add_event_mark (GdkEvent *event,
g_type_class_unref (class);
kind = value ? value->value_nick : "event";
switch ((int) event_type)
switch (event_type)
{
case GDK_MOTION_NOTIFY:
{
@@ -2881,13 +2874,13 @@ add_event_mark (GdkEvent *event,
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
{
message = g_strdup_printf ("%s {keyval=%u, state=0x%x, keycode=%u layout=%u level=%u is_modifier=%u}",
message = g_strdup_printf ("%s {keyval=%u, state=0x%x, hardware_keycode=%u key_scancode=%u group=%u is_modifier=%u}",
kind,
gdk_key_event_get_keyval (event),
gdk_event_get_modifier_state (event),
gdk_key_event_get_keycode (event),
gdk_key_event_get_layout (event),
gdk_key_event_get_level (event),
gdk_key_event_get_scancode (event),
gdk_key_event_get_group (event),
gdk_key_event_is_modifier (event));
break;
}
@@ -2944,16 +2937,21 @@ gdk_surface_handle_event (GdkEvent *event)
if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
{
int width, height;
gdk_configure_event_get_size (event, &width, &height);
g_signal_emit (gdk_event_get_surface (event), signals[SIZE_CHANGED], 0,
width, height);
event->configure.width, event->configure.height);
handled = TRUE;
}
else
{
g_signal_emit (gdk_event_get_surface (event), signals[EVENT], 0, event, &handled);
GdkEvent *emitted;
if (is_keyboard_event (event))
emitted = rewrite_event_for_toplevel (event);
else
emitted = gdk_event_ref (event);
g_signal_emit (gdk_event_get_surface (emitted), signals[EVENT], 0, emitted, &handled);
gdk_event_unref (emitted);
}
if (GDK_PROFILER_IS_RUNNING)
@@ -3036,17 +3034,3 @@ gdk_surface_get_seat_from_event (GdkSurface *surface,
}
return gdk_display_get_default_seat (surface->display);
}
void
gdk_surface_enter_monitor (GdkSurface *surface,
GdkMonitor *monitor)
{
g_signal_emit (surface, signals[ENTER_MONITOR], 0, monitor);
}
void
gdk_surface_leave_monitor (GdkSurface *surface,
GdkMonitor *monitor)
{
g_signal_emit (surface, signals[LEAVE_MONITOR], 0, monitor);
}
+137
View File
@@ -38,6 +38,44 @@
G_BEGIN_DECLS
/* Size restriction enumeration.
*/
/**
* GdkSurfaceHints:
* @GDK_HINT_POS: indicates that the program has positioned the surface
* @GDK_HINT_MIN_SIZE: min size fields are set
* @GDK_HINT_MAX_SIZE: max size fields are set
* @GDK_HINT_BASE_SIZE: base size fields are set
* @GDK_HINT_ASPECT: aspect ratio fields are set
* @GDK_HINT_RESIZE_INC: resize increment fields are set
* @GDK_HINT_WIN_GRAVITY: surface gravity field is set
* @GDK_HINT_USER_POS: indicates that the surfaces position was explicitly set
* by the user
* @GDK_HINT_USER_SIZE: indicates that the surfaces size was explicitly set by
* the user
*
* Used to indicate which fields of a #GdkGeometry struct should be paid
* attention to. Also, the presence/absence of @GDK_HINT_POS,
* @GDK_HINT_USER_POS, and @GDK_HINT_USER_SIZE is significant, though they don't
* directly refer to #GdkGeometry fields. @GDK_HINT_USER_POS will be set
* automatically by #GtkWindow if you call gtk_window_move().
* @GDK_HINT_USER_POS and @GDK_HINT_USER_SIZE should be set if the user
* specified a size/position using a --geometry command-line argument;
* gtk_window_parse_geometry() automatically sets these flags.
*/
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;
/**
* GdkSurfaceEdge:
* @GDK_SURFACE_EDGE_NORTH_WEST: the top left corner.
@@ -77,6 +115,97 @@ typedef enum
GDK_FULLSCREEN_ON_ALL_MONITORS
} GdkFullscreenMode;
/**
* GdkGeometry:
* @min_width: minimum width of surface (or -1 to use requisition, with
* #GtkWindow only)
* @min_height: minimum height of surface (or -1 to use requisition, with
* #GtkWindow only)
* @max_width: maximum width of surface (or -1 to use requisition, with
* #GtkWindow only)
* @max_height: maximum height of surface (or -1 to use requisition, with
* #GtkWindow only)
* @base_width: allowed surface widths are @base_width + @width_inc * N where N
* is any integer (-1 allowed with #GtkWindow)
* @base_height: allowed surface widths are @base_height + @height_inc * N where
* N is any integer (-1 allowed with #GtkWindow)
* @width_inc: width resize increment
* @height_inc: height resize increment
* @min_aspect: minimum width/height ratio
* @max_aspect: maximum width/height ratio
* @win_gravity: surface gravity, see gtk_window_set_gravity()
*
* The #GdkGeometry struct gives the window manager information about
* a surfaces geometry constraints. Normally you would set these on
* the GTK+ level using gtk_window_set_geometry_hints(). #GtkWindow
* then sets the hints on the #GdkSurface it creates.
*
* gdk_surface_set_geometry_hints() expects the hints to be fully valid already
* and simply passes them to the window manager; in contrast,
* gtk_window_set_geometry_hints() performs some interpretation. For example,
* #GtkWindow will apply the hints to the geometry widget instead of the
* toplevel window, if you set a geometry widget. Also, the
* @min_width/@min_height/@max_width/@max_height fields may be set to -1, and
* #GtkWindow will substitute the size request of the surface or geometry widget.
* If the minimum size hint is not provided, #GtkWindow will use its requisition
* as the minimum size. If the minimum size is provided and a geometry widget is
* set, #GtkWindow will take the minimum size as the minimum size of the
* geometry widget rather than the entire surface. The base size is treated
* similarly.
*
* The canonical use-case for gtk_window_set_geometry_hints() is to get a
* terminal widget to resize properly. Here, the terminal text area should be
* the geometry widget; #GtkWindow will then automatically set the base size to
* the size of other widgets in the terminal window, such as the menubar and
* scrollbar. Then, the @width_inc and @height_inc fields should be set to the
* size of one character in the terminal. Finally, the base size should be set
* to the size of one character. The net effect is that the minimum size of the
* terminal will have a 1x1 character terminal area, and only terminal sizes on
* the character grid will be allowed.
*
* Heres an example of how the terminal example would be implemented, assuming
* a terminal area widget called terminal and a toplevel window toplevel:
*
* |[<!-- language="C" -->
* GdkGeometry hints;
*
* hints.base_width = terminal->char_width;
* hints.base_height = terminal->char_height;
* hints.min_width = terminal->char_width;
* hints.min_height = terminal->char_height;
* hints.width_inc = terminal->char_width;
* hints.height_inc = terminal->char_height;
*
* gtk_window_set_geometry_hints (GTK_WINDOW (toplevel),
* GTK_WIDGET (terminal),
* &hints,
* GDK_HINT_RESIZE_INC |
* GDK_HINT_MIN_SIZE |
* GDK_HINT_BASE_SIZE);
* ]|
*
* The other useful fields are the @min_aspect and @max_aspect fields; these
* contain a width/height ratio as a floating point number. If a geometry widget
* is set, the aspect applies to the geometry widget rather than the entire
* window. The most common use of these hints is probably to set @min_aspect and
* @max_aspect to the same value, thus forcing the window to keep a constant
* aspect ratio.
*/
struct _GdkGeometry
{
gint min_width;
gint min_height;
gint max_width;
gint max_height;
gint base_width;
gint base_height;
gint width_inc;
gint height_inc;
gdouble min_aspect;
gdouble max_aspect;
GdkGravity win_gravity;
};
/**
* GdkSurfaceState:
* @GDK_SURFACE_STATE_WITHDRAWN: the surface is not shown
@@ -233,6 +362,14 @@ void gdk_surface_freeze_updates (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_thaw_updates (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_constrain_size (GdkGeometry *geometry,
GdkSurfaceHints flags,
gint width,
gint height,
gint *new_width,
gint *new_height);
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_support_multidevice (GdkSurface *surface,
gboolean support_multidevice);
-3
View File
@@ -61,9 +61,6 @@ G_DEFINE_BOXED_TYPE (GdkToplevelLayout, gdk_toplevel_layout,
* Used together with gdk_toplevel_present() to describe
* how a toplevel surface should be placed and behave on-screen.
*
* The size is in application pixels, not
* device pixels (see gdk_surface_get_scale_factor()).
*
* Returns: (transfer full): newly created instance of #GdkToplevelLayout
*/
GdkToplevelLayout *
+81 -58
View File
@@ -122,6 +122,7 @@ typedef struct _GdkClipboard GdkClipboard;
typedef struct _GdkDisplayManager GdkDisplayManager;
typedef struct _GdkDisplay GdkDisplay;
typedef struct _GdkSurface GdkSurface;
typedef struct _GdkKeymap GdkKeymap;
typedef struct _GdkAppLaunchContext GdkAppLaunchContext;
typedef struct _GdkSeat GdkSeat;
typedef struct _GdkSnapshot GdkSnapshot;
@@ -201,22 +202,57 @@ typedef enum
* @GDK_ALT_MASK: the fourth modifier key (it depends on the modifier
* mapping of the X server which key is interpreted as this modifier, but
* normally it is the Alt key).
* @GDK_MOD2_MASK: the fifth modifier key (it depends on the modifier
* mapping of the X server which key is interpreted as this modifier).
* @GDK_MOD3_MASK: the sixth modifier key (it depends on the modifier
* mapping of the X server which key is interpreted as this modifier).
* @GDK_MOD4_MASK: the seventh modifier key (it depends on the modifier
* mapping of the X server which key is interpreted as this modifier).
* @GDK_MOD5_MASK: the eighth modifier key (it depends on the modifier
* mapping of the X server which key is interpreted as this modifier).
* @GDK_BUTTON1_MASK: the first mouse button.
* @GDK_BUTTON2_MASK: the second mouse button.
* @GDK_BUTTON3_MASK: the third mouse button.
* @GDK_BUTTON4_MASK: the fourth mouse button.
* @GDK_BUTTON5_MASK: the fifth mouse button.
* @GDK_MODIFIER_RESERVED_13_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_RESERVED_14_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_RESERVED_15_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_RESERVED_16_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_RESERVED_17_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_RESERVED_18_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_RESERVED_19_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_RESERVED_20_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_RESERVED_21_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_RESERVED_22_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_RESERVED_23_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_RESERVED_24_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_RESERVED_25_MASK: A reserved bit flag; do not use in your own code
* @GDK_SUPER_MASK: the Super modifier
* @GDK_HYPER_MASK: the Hyper modifier
* @GDK_META_MASK: the Meta modifier
* @GDK_MODIFIER_RESERVED_29_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_RESERVED_30_MASK: A reserved bit flag; do not use in your own code
* @GDK_MODIFIER_MASK: a mask covering all modifier types.
*
* A set of bit-flags to indicate the state of modifier keys and mouse buttons
* in various event types. Typical modifier keys are Shift, Control, Meta,
* Super, Hyper, Alt, Compose, Apple, CapsLock or ShiftLock.
*
* Note that GDK may add internal values to events which include values outside
* of this enumeration. Your code should preserve and ignore them. You can use
* %GDK_MODIFIER_MASK to remove all private values.
* Like the X Window System, GDK supports 8 modifier keys and 5 mouse buttons.
*
* GDK recognizes which of the Meta, Super or Hyper keys are mapped
* to Mod2 - Mod5, and indicates this by setting %GDK_SUPER_MASK,
* %GDK_HYPER_MASK or %GDK_META_MASK in the state field of key events.
*
* Note that GDK may add internal values to events which include
* reserved values such as %GDK_MODIFIER_RESERVED_13_MASK. Your code
* should preserve and ignore them. You can use %GDK_MODIFIER_MASK to
* remove all reserved values.
*
* Also note that the GDK X backend interprets button press events for button
* 4-7 as scroll events, so %GDK_BUTTON4_MASK and %GDK_BUTTON5_MASK will never
* be set.
*/
typedef enum
{
@@ -234,18 +270,54 @@ typedef enum
GDK_SUPER_MASK = 1 << 26,
GDK_HYPER_MASK = 1 << 27,
GDK_META_MASK = 1 << 28,
} GdkModifierType;
/**
* GDK_MODIFIER_MASK:
*
* A mask covering all entries in #GdkModifierType.
*/
#define GDK_MODIFIER_MASK (GDK_SHIFT_MASK|GDK_LOCK_MASK|GDK_CONTROL_MASK| \
GDK_ALT_MASK|GDK_SUPER_MASK|GDK_HYPER_MASK|GDK_META_MASK| \
GDK_SUPER_MASK|GDK_HYPER_MASK|GDK_META_MASK| \
GDK_BUTTON1_MASK|GDK_BUTTON2_MASK|GDK_BUTTON3_MASK| \
GDK_BUTTON4_MASK|GDK_BUTTON5_MASK)
/**
* GdkModifierIntent:
* @GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR: the primary modifier used to invoke
* menu accelerators.
* @GDK_MODIFIER_INTENT_CONTEXT_MENU: the modifier used to invoke context menus.
* Note that mouse button 3 always triggers context menus. When this modifier
* is not 0, it additionally triggers context menus when used with mouse button 1.
* @GDK_MODIFIER_INTENT_EXTEND_SELECTION: the modifier used to extend selections
* using `modifier`-click or `modifier`-cursor-key
* @GDK_MODIFIER_INTENT_MODIFY_SELECTION: the modifier used to modify selections,
* which in most cases means toggling the clicked item into or out of the selection.
* @GDK_MODIFIER_INTENT_NO_TEXT_INPUT: when any of these modifiers is pressed, the
* key event cannot produce a symbol directly. This is meant to be used for
* input methods, and for use cases like typeahead search.
* @GDK_MODIFIER_INTENT_SHIFT_GROUP: the modifier that switches between keyboard
* groups (AltGr on X11/Windows and Option/Alt on OS X).
* @GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK: The set of modifier masks accepted
* as modifiers in accelerators. Needed because Command is mapped to MOD2 on
* OSX, which is widely used, but on X11 MOD2 is NumLock and using that for a
* mod key is problematic at best.
* Ref: https://bugzilla.gnome.org/show_bug.cgi?id=736125.
*
* This enum is used with gdk_keymap_get_modifier_mask()
* in order to determine what modifiers the
* currently used windowing system backend uses for particular
* purposes. For example, on X11/Windows, the Control key is used for
* invoking menu shortcuts (accelerators), whereas on Apple computers
* its the Command key (which correspond to %GDK_CONTROL_MASK and
* %GDK_MOD2_MASK, respectively).
**/
typedef enum
{
GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR,
GDK_MODIFIER_INTENT_CONTEXT_MENU,
GDK_MODIFIER_INTENT_EXTEND_SELECTION,
GDK_MODIFIER_INTENT_MODIFY_SELECTION,
GDK_MODIFIER_INTENT_NO_TEXT_INPUT,
GDK_MODIFIER_INTENT_SHIFT_GROUP,
GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK,
} GdkModifierIntent;
/**
* GdkEventMask:
@@ -528,55 +600,6 @@ typedef enum
return G_TYPE_INSTANCE_GET_CLASS (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \
G_GNUC_END_IGNORE_DEPRECATIONS
typedef struct _GdkKeymapKey GdkKeymapKey;
/**
* GdkKeymapKey:
* @keycode: the hardware keycode. This is an identifying number for a
* physical key.
* @group: indicates movement in a horizontal direction. Usually groups are used
* for two different languages. In group 0, a key might have two English
* characters, and in group 1 it might have two Hebrew characters. The Hebrew
* characters will be printed on the key next to the English characters.
* @level: indicates which symbol on the key will be used, in a vertical direction.
* So on a standard US keyboard, the key with the number 1 on it also has the
* exclamation point ("!") character on it. The level indicates whether to use
* the 1 or the ! symbol. The letter keys are considered to have a lowercase
* letter at level 0, and an uppercase letter at level 1, though only the
* uppercase letter is printed.
*
* A #GdkKeymapKey is a hardware key that can be mapped to a keyval.
*/
struct _GdkKeymapKey
{
guint keycode;
gint group;
gint level;
};
G_END_DECLS
/*< private >
* GDK_EXTERN_VAR:
*
* A macro to annotate extern variables so that they show up properly in
* Windows DLLs.
*/
#ifndef GDK_EXTERN_VAR
# ifdef G_PLATFORM_WIN32
# ifdef GTK_COMPILATION
# ifdef DLL_EXPORT
# define GDK_EXTERN_VAR __declspec(dllexport)
# else /* !DLL_EXPORT */
# define GDK_EXTERN_VAR extern
# endif /* !DLL_EXPORT */
# else /* !GTK_COMPILATION */
# define GDK_EXTERN_VAR extern __declspec(dllimport)
# endif /* !GTK_COMPILATION */
# else /* !G_PLATFORM_WIN32 */
# define GDK_EXTERN_VAR _GDK_EXTERN
# endif /* !G_PLATFORM_WIN32 */
#endif /* GDK_EXTERN_VAR */
#endif /* __GDK_TYPES_H__ */
+3 -18
View File
@@ -5,20 +5,6 @@
# Usage: gen-gdk-gresources-xml SRCDIR_GDK [OUTPUT-FILE]
import os, sys
import filecmp
def replace_if_changed(new, old):
'''
Compare contents and only replace if changed to avoid triggering a rebuild.
'''
try:
changed = not filecmp.cmp(new, old, shallow=False)
except FileNotFoundError:
changed = True
if changed:
os.replace(new, old)
else:
os.remove(new)
srcdir = sys.argv[1]
@@ -40,9 +26,8 @@ xml += '''
if len(sys.argv) > 2:
outfile = sys.argv[2]
tmpfile = outfile + '~'
with open(tmpfile, 'w') as f:
f.write(xml)
replace_if_changed(tmpfile, outfile)
f = open(outfile, 'w')
f.write(xml)
f.close()
else:
print(xml)
+35
View File
@@ -735,6 +735,40 @@ gdk_quartz_keymap_map_virtual_modifiers (GdkKeymap *keymap,
return TRUE;
}
static GdkModifierType
gdk_quartz_keymap_get_modifier_mask (GdkKeymap *keymap,
GdkModifierIntent intent)
{
switch (intent)
{
case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
return GDK_MOD2_MASK;
case GDK_MODIFIER_INTENT_CONTEXT_MENU:
return GDK_CONTROL_MASK;
case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
return GDK_SHIFT_MASK;
case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
return GDK_MOD2_MASK;
case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
return GDK_MOD2_MASK | GDK_CONTROL_MASK;
case GDK_MODIFIER_INTENT_SHIFT_GROUP:
return GDK_ALT_MASK;
case GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK:
return (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_ALT_MASK |
GDK_MOD2_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK |
GDK_META_MASK);
default:
g_return_val_if_reached (0);
}
}
/* What sort of key event is this? Returns one of
* GDK_KEY_PRESS, GDK_KEY_RELEASE, GDK_NOTHING (should be ignored)
*/
@@ -847,4 +881,5 @@ gdk_quartz_keymap_class_init (GdkQuartzKeymapClass *klass)
keymap_class->translate_keyboard_state = gdk_quartz_keymap_translate_keyboard_state;
keymap_class->add_virtual_modifiers = gdk_quartz_keymap_add_virtual_modifiers;
keymap_class->map_virtual_modifiers = gdk_quartz_keymap_map_virtual_modifiers;
keymap_class->get_modifier_mask = gdk_quartz_keymap_get_modifier_mask;
}
+39 -77
View File
@@ -30,7 +30,6 @@
#include "gdkseat-wayland.h"
#include "gdkwayland.h"
#include "gdkkeysyms.h"
#include "gdkkeysprivate.h"
#include "gdkcursorprivate.h"
#include "gdkdeviceprivate.h"
#include "gdkdevicepadprivate.h"
@@ -589,7 +588,7 @@ emulate_crossing (GdkSurface *surface,
double x, y;
gdk_surface_get_device_position (surface, device, &x, &y, &state);
event = gdk_crossing_event_new (type,
event = gdk_event_crossing_new (type,
surface,
device,
device,
@@ -614,7 +613,7 @@ emulate_touch_crossing (GdkSurface *surface,
{
GdkEvent *event;
event = gdk_crossing_event_new (type,
event = gdk_event_crossing_new (type,
surface,
device,
source,
@@ -633,7 +632,7 @@ emulate_focus (GdkSurface *surface,
gboolean focus_in,
guint32 time_)
{
GdkEvent *event = gdk_focus_event_new (surface, device, device, focus_in);
GdkEvent *event = gdk_event_focus_new (surface, device, device, focus_in);
_gdk_wayland_display_deliver_event (gdk_surface_get_display (surface), event);
}
@@ -1360,7 +1359,7 @@ flush_discrete_scroll_event (GdkWaylandSeat *seat,
GdkDevice *source;
source = get_scroll_device (seat, seat->pointer_info.frame.source);
event = gdk_scroll_event_new_discrete (seat->pointer_info.focus,
event = gdk_event_discrete_scroll_new (seat->pointer_info.focus,
seat->master_pointer,
source,
NULL,
@@ -1382,7 +1381,7 @@ flush_smooth_scroll_event (GdkWaylandSeat *seat,
GdkDevice *source;
source = get_scroll_device (seat, seat->pointer_info.frame.source);
event = gdk_scroll_event_new (seat->pointer_info.focus,
event = gdk_event_scroll_new (seat->pointer_info.focus,
seat->master_pointer,
source,
NULL,
@@ -1498,7 +1497,7 @@ pointer_handle_enter (void *data,
seat->pointer_info.surface_y = wl_fixed_to_double (sy);
seat->pointer_info.enter_serial = serial;
event = gdk_crossing_event_new (GDK_ENTER_NOTIFY,
event = gdk_event_crossing_new (GDK_ENTER_NOTIFY,
seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
@@ -1541,7 +1540,7 @@ pointer_handle_leave (void *data,
_gdk_wayland_display_update_serial (display_wayland, serial);
event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY,
event = gdk_event_crossing_new (GDK_LEAVE_NOTIFY,
seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
@@ -1586,7 +1585,7 @@ pointer_handle_motion (void *data,
seat->pointer_info.surface_x = wl_fixed_to_double (sx);
seat->pointer_info.surface_y = wl_fixed_to_double (sy);
event = gdk_motion_event_new (seat->pointer_info.focus,
event = gdk_event_motion_new (seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
NULL,
@@ -1649,7 +1648,7 @@ pointer_handle_button (void *data,
if (state)
seat->pointer_info.press_serial = serial;
event = gdk_button_event_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE,
event = gdk_event_button_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE,
seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
@@ -1914,7 +1913,7 @@ keyboard_handle_enter (void *data,
g_object_ref (seat->keyboard_focus);
seat->repeat_key = 0;
event = gdk_focus_event_new (seat->keyboard_focus,
event = gdk_event_focus_new (seat->keyboard_focus,
seat->master_keyboard,
seat->keyboard,
TRUE);
@@ -1949,7 +1948,7 @@ keyboard_handle_leave (void *data,
_gdk_wayland_display_update_serial (display, serial);
event = gdk_focus_event_new (seat->keyboard_focus,
event = gdk_event_focus_new (seat->keyboard_focus,
seat->master_keyboard,
seat->keyboard,
FALSE);
@@ -2021,13 +2020,9 @@ deliver_key_event (GdkWaylandSeat *seat,
struct xkb_state *xkb_state;
struct xkb_keymap *xkb_keymap;
GdkKeymap *keymap;
xkb_keysym_t sym;
guint delay, interval, timeout;
gint64 begin_time, now;
xkb_mod_mask_t consumed;
GdkTranslatedKey translated;
GdkTranslatedKey no_lock;
xkb_mod_mask_t modifiers;
xkb_mod_index_t caps_lock;
begin_time = g_get_monotonic_time ();
@@ -2037,69 +2032,36 @@ deliver_key_event (GdkWaylandSeat *seat,
xkb_state = _gdk_wayland_keymap_get_xkb_state (keymap);
xkb_keymap = _gdk_wayland_keymap_get_xkb_keymap (keymap);
translated.keyval = xkb_state_key_get_one_sym (xkb_state, key);
modifiers = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
consumed = modifiers & ~xkb_state_mod_mask_remove_consumed (xkb_state, key, modifiers);
translated.consumed = gdk_wayland_keymap_get_gdk_modifiers (keymap, consumed);
translated.layout = xkb_state_key_get_layout (xkb_state, key);
translated.level = xkb_state_key_get_level (xkb_state, key, translated.layout);
if (translated.keyval == XKB_KEY_NoSymbol)
sym = xkb_state_key_get_one_sym (xkb_state, key);
if (sym == XKB_KEY_NoSymbol)
return;
seat->pointer_info.time = time_;
seat->key_modifiers = gdk_keymap_get_modifier_state (keymap);
modifiers = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
caps_lock = xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CAPS);
if (modifiers & (1 << caps_lock))
{
struct xkb_state *tmp_state = xkb_state_new (xkb_keymap);
xkb_layout_index_t layout;
modifiers &= ~(1 << caps_lock);
layout = xkb_state_serialize_layout (xkb_state, XKB_STATE_LAYOUT_EFFECTIVE);
xkb_state_update_mask (tmp_state, modifiers, 0, 0, layout, 0, 0);
no_lock.keyval = xkb_state_key_get_one_sym (tmp_state, key);
consumed = modifiers & ~xkb_state_mod_mask_remove_consumed (tmp_state, key, modifiers);
no_lock.consumed = gdk_wayland_keymap_get_gdk_modifiers (keymap, consumed);
no_lock.layout = xkb_state_key_get_layout (tmp_state, key);
no_lock.level = xkb_state_key_get_level (tmp_state, key, no_lock.layout);
xkb_state_unref (tmp_state);
}
else
{
no_lock = translated;
}
event = gdk_key_event_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
event = gdk_event_key_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
seat->keyboard_focus,
seat->master_keyboard,
seat->keyboard,
time_,
key,
device_get_modifiers (seat->master_pointer),
_gdk_wayland_keymap_key_is_modifier (keymap, key),
&translated,
&no_lock);
sym,
key,
key,
0,
_gdk_wayland_keymap_key_is_modifier (keymap, key));
_gdk_wayland_display_deliver_event (seat->display, event);
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("keyboard %s event%s, surface %p, code %d, sym %d, "
"mods 0x%x, consumed 0x%x, layout %d level %d",
"mods 0x%x",
(state ? "press" : "release"),
(from_key_repeat ? " (repeat)" : ""),
gdk_event_get_surface (event),
gdk_key_event_get_keycode (event),
gdk_key_event_get_keyval (event),
gdk_event_get_modifier_state (event),
gdk_key_event_get_consumed_modifiers (event),
gdk_key_event_get_layout (event),
gdk_key_event_get_level (event)));
gdk_event_get_modifier_state (event)));
if (!xkb_keymap_key_repeats (xkb_keymap, key))
return;
@@ -2375,7 +2337,7 @@ touch_handle_down (void *data,
touch->y = wl_fixed_to_double (y);
touch->touch_down_serial = serial;
event = gdk_touch_event_new (GDK_TOUCH_BEGIN,
event = gdk_event_touch_new (GDK_TOUCH_BEGIN,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->touch_master,
@@ -2418,7 +2380,7 @@ touch_handle_up (void *data,
_gdk_wayland_display_update_serial (display, serial);
touch = gdk_wayland_seat_get_touch (seat, id);
event = gdk_touch_event_new (GDK_TOUCH_END,
event = gdk_event_touch_new (GDK_TOUCH_END,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->touch_master,
@@ -2463,7 +2425,7 @@ touch_handle_motion (void *data,
if (touch->initial_touch)
mimic_pointer_emulating_touch_info (seat->touch_master, touch);
event = gdk_touch_event_new (GDK_TOUCH_UPDATE,
event = gdk_event_touch_new (GDK_TOUCH_UPDATE,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->touch_master,
@@ -2509,7 +2471,7 @@ touch_handle_cancel (void *data,
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
{
event = gdk_touch_event_new (GDK_TOUCH_CANCEL,
event = gdk_event_touch_new (GDK_TOUCH_CANCEL,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->touch_master,
@@ -2541,7 +2503,7 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
seat->pointer_info.time = _time;
event = gdk_touchpad_event_new_swipe (seat->pointer_info.focus,
event = gdk_event_touchpad_swipe_new (seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
_time,
@@ -2638,7 +2600,7 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
seat->pointer_info.time = _time;
event = gdk_touchpad_event_new_pinch (seat->pointer_info.focus,
event = gdk_event_touchpad_pinch_new (seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
_time,
@@ -3469,7 +3431,7 @@ tablet_tool_handle_proximity_in (void *data,
gdk_wayland_device_tablet_clone_tool_axes (tablet, tool->tool);
gdk_wayland_mimic_device_axes (tablet->master, tablet->current_device);
event = gdk_proximity_event_new (GDK_PROXIMITY_IN,
event = gdk_event_proximity_new (GDK_PROXIMITY_IN,
tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
@@ -3500,7 +3462,7 @@ tablet_tool_handle_proximity_out (void *data,
g_message ("proximity out, seat %p, tool %d", tool->seat,
gdk_device_tool_get_tool_type (tool->tool)));
event = gdk_proximity_event_new (GDK_PROXIMITY_OUT,
event = gdk_event_proximity_new (GDK_PROXIMITY_OUT,
tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
@@ -3537,7 +3499,7 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet,
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
GdkEvent *event;
event = gdk_button_event_new (evtype,
event = gdk_event_button_new (evtype,
tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
@@ -3603,7 +3565,7 @@ tablet_tool_handle_motion (void *data,
tablet->pointer_info.surface_x,
tablet->pointer_info.surface_y));
event = gdk_motion_event_new (tablet->pointer_info.focus,
event = gdk_event_motion_new (tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
tool->tool,
@@ -3765,7 +3727,7 @@ tablet_tool_handle_wheel (void *data,
return;
/* Send smooth event */
event = gdk_scroll_event_new (tablet->pointer_info.focus,
event = gdk_event_scroll_new (tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
tablet->current_tool->tool,
@@ -3777,7 +3739,7 @@ tablet_tool_handle_wheel (void *data,
_gdk_wayland_display_deliver_event (seat->display, event);
/* Send discrete event */
event = gdk_scroll_event_new_discrete (tablet->pointer_info.focus,
event = gdk_event_discrete_scroll_new (tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
tablet->current_tool->tool,
@@ -3888,7 +3850,7 @@ tablet_pad_ring_handle_frame (void *data,
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring));
event = gdk_pad_event_new_ring (seat->keyboard_focus,
event = gdk_event_pad_ring_new (seat->keyboard_focus,
pad->device,
pad->device,
time,
@@ -3963,7 +3925,7 @@ tablet_pad_strip_handle_frame (void *data,
g_message ("tablet pad strip handle frame, strip = %p",
wp_tablet_pad_strip));
event = gdk_pad_event_new_strip (seat->keyboard_focus,
event = gdk_event_pad_strip_new (seat->keyboard_focus,
pad->device,
pad->device,
time,
@@ -4089,7 +4051,7 @@ tablet_pad_group_handle_mode (void *data,
group->current_mode = mode;
n_group = g_list_index (pad->mode_groups, group);
event = gdk_pad_event_new_group_mode (seat->keyboard_focus,
event = gdk_event_pad_group_mode_new (seat->keyboard_focus,
pad->device,
pad->device,
time,
@@ -4201,7 +4163,7 @@ tablet_pad_handle_button (void *data,
g_assert (group != NULL);
n_group = g_list_index (pad->mode_groups, group);
event = gdk_pad_event_new_button (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED
event = gdk_event_pad_button_new (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED
? GDK_PAD_BUTTON_PRESS
: GDK_PAD_BUTTON_RELEASE,
GDK_WAYLAND_SEAT (pad->seat)->keyboard_focus,
@@ -5031,7 +4993,7 @@ gdk_wayland_device_unset_touch_grab (GdkDevice *gdk_device,
GDK_CURRENT_TIME);
}
event = gdk_touch_event_new (GDK_TOUCH_CANCEL,
event = gdk_event_touch_new (GDK_TOUCH_CANCEL,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->touch_master,
+1 -10
View File
@@ -431,7 +431,6 @@ gdk_registry_handle_global (void *data,
else if (strcmp (interface, "xdg_wm_base") == 0)
{
display_wayland->xdg_wm_base_id = id;
display_wayland->xdg_wm_base_version = version;
}
else if (strcmp (interface, "zxdg_shell_v6") == 0)
{
@@ -660,8 +659,7 @@ _gdk_wayland_display_open (const gchar *display_name)
display_wayland->xdg_wm_base =
wl_registry_bind (display_wayland->wl_registry,
display_wayland->xdg_wm_base_id,
&xdg_wm_base_interface,
MIN (display_wayland->xdg_wm_base_version, 3));
&xdg_wm_base_interface, 1);
xdg_wm_base_add_listener (display_wayland->xdg_wm_base,
&xdg_wm_base_listener,
display_wayland);
@@ -2539,13 +2537,6 @@ get_monitor_for_output (GdkWaylandDisplay *display_wayland,
return NULL;
}
GdkMonitor *
gdk_wayland_display_get_monitor_for_output (GdkDisplay *display,
struct wl_output *output)
{
return (GdkMonitor *)get_monitor_for_output (GDK_WAYLAND_DISPLAY (display), output);
}
static void
gdk_wayland_display_remove_output (GdkWaylandDisplay *display_wayland,
guint32 id)
-1
View File
@@ -86,7 +86,6 @@ struct _GdkWaylandDisplay
guint32 serial;
uint32_t xdg_wm_base_id;
int xdg_wm_base_version;
uint32_t zxdg_shell_v6_id;
GdkWaylandShellVariant shell_variant;
+64 -9
View File
@@ -300,15 +300,6 @@ get_gdk_modifiers (struct xkb_keymap *xkb_keymap,
return state;
}
GdkModifierType
gdk_wayland_keymap_get_gdk_modifiers (GdkKeymap *keymap,
guint32 mods)
{
struct xkb_keymap *xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
return get_gdk_modifiers (xkb_keymap, mods);
}
static gboolean
gdk_wayland_keymap_translate_keyboard_state (GdkKeymap *keymap,
guint hardware_keycode,
@@ -369,6 +360,68 @@ gdk_wayland_keymap_get_modifier_state (GdkKeymap *keymap)
return get_gdk_modifiers (xkb_keymap, mods);
}
static void
gdk_wayland_keymap_add_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
struct xkb_keymap *xkb_keymap;
struct xkb_state *xkb_state;
xkb_mod_index_t idx;
uint32_t mods, real;
struct { const char *name; GdkModifierType mask; } vmods[] = {
{ "Super", GDK_SUPER_MASK },
{ "Hyper", GDK_HYPER_MASK },
{ "Meta", GDK_META_MASK },
{ NULL, 0 }
};
int i;
xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
mods = get_xkb_modifiers (xkb_keymap, *state);
xkb_state = xkb_state_new (xkb_keymap);
for (i = 0; vmods[i].name; i++)
{
idx = xkb_keymap_mod_get_index (xkb_keymap, vmods[i].name);
if (idx == XKB_MOD_INVALID)
continue;
xkb_state_update_mask (xkb_state, 1 << idx, 0, 0, 0, 0, 0);
real = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
real &= 0xf0; /* ignore mapping to Lock, Shift, Control, Mod1 */
if (mods & real)
*state |= vmods[i].mask;
xkb_state_update_mask (xkb_state, 0, 0, 0, 0, 0, 0);
}
xkb_state_unref (xkb_state);
}
static gboolean
gdk_wayland_keymap_map_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
struct xkb_keymap *xkb_keymap;
struct xkb_state *xkb_state;
uint32_t mods, mapped;
gboolean ret = TRUE;
xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
mods = get_xkb_modifiers (xkb_keymap, *state);
xkb_state = xkb_state_new (xkb_keymap);
xkb_state_update_mask (xkb_state, mods & ~0xff, 0, 0, 0, 0, 0);
mapped = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
if ((mapped & mods & 0xff) != 0)
ret = FALSE;
*state |= get_gdk_modifiers (xkb_keymap, mapped);
xkb_state_unref (xkb_state);
return ret;
}
static void
_gdk_wayland_keymap_class_init (GdkWaylandKeymapClass *klass)
{
@@ -387,6 +440,8 @@ _gdk_wayland_keymap_class_init (GdkWaylandKeymapClass *klass)
keymap_class->lookup_key = gdk_wayland_keymap_lookup_key;
keymap_class->translate_keyboard_state = gdk_wayland_keymap_translate_keyboard_state;
keymap_class->get_modifier_state = gdk_wayland_keymap_get_modifier_state;
keymap_class->add_virtual_modifiers = gdk_wayland_keymap_add_virtual_modifiers;
keymap_class->map_virtual_modifiers = gdk_wayland_keymap_map_virtual_modifiers;
}
static void
-4
View File
@@ -163,8 +163,6 @@ guint32 gdk_wayland_display_get_output_scale (GdkWaylandDisplay *display_wayland
struct wl_output *output);
struct wl_output *gdk_wayland_display_get_wl_output (GdkDisplay *display,
int monitor_num);
GdkMonitor *gdk_wayland_display_get_monitor_for_output (GdkDisplay *display,
struct wl_output *output);
void _gdk_wayland_surface_set_grab_seat (GdkSurface *surface,
GdkSeat *seat);
@@ -203,7 +201,5 @@ void gdk_wayland_surface_update_scale (GdkSurface *surface);
GdkSurface * create_dnd_surface (GdkDisplay *display);
GdkModifierType gdk_wayland_keymap_get_gdk_modifiers (GdkKeymap *keymap,
guint32 mods);
#endif /* __GDK_PRIVATE_WAYLAND_H__ */
+113 -255
View File
@@ -59,7 +59,6 @@ static guint signals[LAST_SIGNAL];
typedef enum _PopupState
{
POPUP_STATE_IDLE,
POPUP_STATE_WAITING_FOR_REPOSITIONED,
POPUP_STATE_WAITING_FOR_CONFIGURE,
POPUP_STATE_WAITING_FOR_FRAME,
} PopupState;
@@ -95,9 +94,6 @@ struct _GdkWaylandSurface
EGLSurface egl_surface;
EGLSurface dummy_egl_surface;
uint32_t reposition_token;
uint32_t received_reposition_token;
PopupState popup_state;
unsigned int initial_configure_received : 1;
@@ -107,6 +103,8 @@ struct _GdkWaylandSurface
unsigned int awaiting_frame_frozen : 1;
unsigned int is_drag_surface : 1;
GdkSurfaceTypeHint hint;
GdkSurface *transient_for;
GdkSurface *popup_parent;
int pending_buffer_offset_x;
int pending_buffer_offset_y;
@@ -169,18 +167,12 @@ struct _GdkWaylandSurface
int y;
int width;
int height;
uint32_t repositioned_token;
gboolean has_repositioned_token;
} popup;
gboolean is_initial_configure;
uint32_t serial;
gboolean is_dirty;
} pending;
uint32_t last_configure_serial;
int state_freeze_count;
struct {
@@ -198,76 +190,6 @@ struct _GdkWaylandSurfaceClass
GdkSurfaceClass parent_class;
};
G_DEFINE_TYPE (GdkWaylandSurface, gdk_wayland_surface, GDK_TYPE_SURFACE)
typedef struct _GdkWaylandToplevel GdkWaylandToplevel;
struct _GdkWaylandToplevel
{
GdkWaylandSurface parent_instance;
GdkWaylandToplevel *transient_for;
};
typedef struct
{
GdkWaylandSurfaceClass parent_class;
} GdkWaylandToplevelClass;
static void gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface);
GType gdk_wayland_toplevel_get_type (void) G_GNUC_CONST;
#define GDK_IS_WAYLAND_TOPLEVEL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_TOPLEVEL))
#define GDK_WAYLAND_TOPLEVEL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_TOPLEVEL, GdkWaylandToplevel))
#define GDK_TYPE_WAYLAND_TOPLEVEL (gdk_wayland_toplevel_get_type ())
G_DEFINE_TYPE_WITH_CODE (GdkWaylandToplevel, gdk_wayland_toplevel, GDK_TYPE_WAYLAND_SURFACE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_TOPLEVEL,
gdk_wayland_toplevel_iface_init))
typedef struct
{
GdkWaylandSurface parent_instance;
} GdkWaylandPopup;
typedef struct
{
GdkWaylandSurfaceClass parent_class;
} GdkWaylandPopupClass;
static void gdk_wayland_popup_iface_init (GdkPopupInterface *iface);
GType gdk_wayland_popup_get_type (void) G_GNUC_CONST;
#define GDK_IS_WAYLAND_POPUP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_POPUP))
#define GDK_WAYLAND_POPUP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_POPUP, GdkWaylandPopup))
#define GDK_TYPE_WAYLAND_POPUP (gdk_wayland_popup_get_type ())
G_DEFINE_TYPE_WITH_CODE (GdkWaylandPopup, gdk_wayland_popup, GDK_TYPE_WAYLAND_SURFACE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_POPUP,
gdk_wayland_popup_iface_init))
typedef struct
{
GdkWaylandSurface parent_instance;
} GdkWaylandDragSurface;
typedef struct
{
GdkWaylandSurfaceClass parent_class;
} GdkWaylandDragSurfaceClass;
static void gdk_wayland_drag_surface_iface_init (GdkDragSurfaceInterface *iface);
GType gdk_wayland_drag_surface_get_type (void) G_GNUC_CONST;
#define GDK_IS_WAYLAND_DRAG_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DRAG_SURFACE))
#define GDK_TYPE_WAYLAND_DRAG_SURFACE (gdk_wayland_drag_surface_get_type ())
G_DEFINE_TYPE_WITH_CODE (GdkWaylandDragSurface, gdk_wayland_drag_surface, GDK_TYPE_WAYLAND_SURFACE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_DRAG_SURFACE,
gdk_wayland_drag_surface_iface_init))
static void gdk_wayland_surface_maybe_resize (GdkSurface *surface,
int width,
int height,
@@ -299,6 +221,16 @@ static void update_popup_layout_state (GdkSurface *surface,
static gboolean gdk_wayland_surface_is_exported (GdkSurface *surface);
G_DEFINE_TYPE (GdkWaylandSurface, gdk_wayland_surface, GDK_TYPE_SURFACE)
GType gdk_wayland_toplevel_get_type (void) G_GNUC_CONST;
GType gdk_wayland_popup_get_type (void) G_GNUC_CONST;
GType gdk_wayland_drag_surface_get_type (void) G_GNUC_CONST;
#define GDK_TYPE_WAYLAND_TOPLEVEL (gdk_wayland_toplevel_get_type ())
#define GDK_TYPE_WAYLAND_POPUP (gdk_wayland_popup_get_type ())
#define GDK_TYPE_WAYLAND_DRAG_SURFACE (gdk_wayland_drag_surface_get_type ())
static void
gdk_wayland_surface_init (GdkWaylandSurface *impl)
{
@@ -506,7 +438,6 @@ frame_callback (void *data,
switch (impl->popup_state)
{
case POPUP_STATE_IDLE:
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
case POPUP_STATE_WAITING_FOR_CONFIGURE:
break;
case POPUP_STATE_WAITING_FOR_FRAME:
@@ -701,9 +632,6 @@ _gdk_wayland_display_create_surface (GdkDisplay *display,
"display", display,
"frame-clock", frame_clock,
NULL);
display_wayland->toplevels = g_list_prepend (display_wayland->toplevels,
surface);
g_warn_if_fail (!parent);
break;
case GDK_SURFACE_POPUP:
surface = g_object_new (GDK_TYPE_WAYLAND_POPUP,
@@ -750,6 +678,10 @@ _gdk_wayland_display_create_surface (GdkDisplay *display,
gdk_wayland_surface_set_title (surface, get_default_title ());
if (parent == NULL)
display_wayland->toplevels = g_list_prepend (display_wayland->toplevels, surface);
impl->transient_for = parent;
gdk_wayland_surface_create_surface (surface);
@@ -840,6 +772,8 @@ gdk_wayland_surface_dispose (GObject *object)
impl = GDK_WAYLAND_SURFACE (surface);
g_clear_object (&impl->popup_parent);
if (impl->event_queue)
{
GdkWaylandDisplay *display_wayland =
@@ -891,7 +825,7 @@ gdk_wayland_surface_resize (GdkSurface *surface,
GdkDisplay *display;
GdkEvent *event;
event = gdk_configure_event_new (surface, width, height);
event = gdk_event_configure_new (surface, width, height);
gdk_wayland_surface_update_size (surface, width, height, scale);
_gdk_surface_update_size (surface);
@@ -969,7 +903,6 @@ gdk_wayland_surface_sync_parent (GdkSurface *surface,
GdkSurface *parent)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkWaylandToplevel *toplevel = GDK_WAYLAND_TOPLEVEL (impl);
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
GdkWaylandSurface *impl_parent = NULL;
@@ -980,8 +913,8 @@ gdk_wayland_surface_sync_parent (GdkSurface *surface,
if (!is_realized_toplevel (surface))
return;
if (toplevel->transient_for)
impl_parent = GDK_WAYLAND_SURFACE (toplevel->transient_for);
if (impl->transient_for)
impl_parent = GDK_WAYLAND_SURFACE (impl->transient_for);
else if (parent)
impl_parent = GDK_WAYLAND_SURFACE (parent);
@@ -1201,8 +1134,6 @@ surface_enter (void *data,
{
GdkSurface *surface = GDK_SURFACE (data);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
g_message ("surface enter, surface %p output %p", surface, output));
@@ -1210,9 +1141,6 @@ surface_enter (void *data,
impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output);
gdk_wayland_surface_update_scale (surface);
monitor = gdk_wayland_display_get_monitor_for_output (display, output);
gdk_surface_enter_monitor (surface, monitor);
}
static void
@@ -1222,8 +1150,6 @@ surface_leave (void *data,
{
GdkSurface *surface = GDK_SURFACE (data);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
g_message ("surface leave, surface %p output %p", surface, output));
@@ -1232,9 +1158,6 @@ surface_leave (void *data,
if (impl->display_server.outputs)
gdk_wayland_surface_update_scale (surface);
monitor = gdk_wayland_display_get_monitor_for_output (display, output);
gdk_surface_leave_monitor (surface, monitor);
}
static const struct wl_surface_listener surface_listener = {
@@ -1359,17 +1282,8 @@ gdk_wayland_surface_configure_popup (GdkSurface *surface)
impl->pending.serial);
}
if (impl->pending.popup.has_repositioned_token)
impl->received_reposition_token = impl->pending.popup.repositioned_token;
switch (impl->popup_state)
{
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
if (impl->received_reposition_token != impl->reposition_token)
return;
else
gdk_surface_thaw_updates (surface);
G_GNUC_FALLTHROUGH;
case POPUP_STATE_WAITING_FOR_CONFIGURE:
impl->popup_state = POPUP_STATE_WAITING_FOR_FRAME;
break;
@@ -1392,10 +1306,6 @@ gdk_wayland_surface_configure_popup (GdkSurface *surface)
width, height,
impl->popup.layout);
if (!impl->pending.popup.has_repositioned_token &&
!impl->pending.is_initial_configure)
g_signal_emit_by_name (surface, "popup-layout-changed");
gdk_surface_invalidate_rect (surface, NULL);
}
@@ -1408,7 +1318,6 @@ gdk_wayland_surface_configure (GdkSurface *surface)
{
gdk_surface_thaw_updates (surface);
impl->initial_configure_received = TRUE;
impl->pending.is_initial_configure = TRUE;
}
if (is_realized_popup (surface))
@@ -1418,8 +1327,6 @@ gdk_wayland_surface_configure (GdkSurface *surface)
else
g_warn_if_reached ();
impl->last_configure_serial = impl->pending.serial;
memset (&impl->pending, 0, sizeof (impl->pending));
}
@@ -1461,7 +1368,7 @@ gdk_wayland_surface_handle_close (GdkSurface *surface)
GDK_DISPLAY_NOTE (display, EVENTS, g_message ("close %p", surface));
event = gdk_delete_event_new (surface);
event = gdk_event_delete_new (surface);
_gdk_wayland_display_deliver_event (display, event);
}
@@ -1756,31 +1663,9 @@ xdg_popup_done (void *data,
gdk_surface_hide (surface);
}
static void
xdg_popup_repositioned (void *data,
struct xdg_popup *xdg_popup,
uint32_t token)
{
GdkSurface *surface = GDK_SURFACE (data);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
g_message ("repositioned %p", surface));
if (impl->popup_state != POPUP_STATE_WAITING_FOR_REPOSITIONED)
{
g_warning ("Unexpected xdg_popup.repositioned event, probably buggy compositor");
return;
}
impl->pending.popup.repositioned_token = token;
impl->pending.popup.has_repositioned_token = TRUE;
}
static const struct xdg_popup_listener xdg_popup_listener = {
xdg_popup_configure,
xdg_popup_done,
xdg_popup_repositioned,
};
static void
@@ -2167,8 +2052,7 @@ static gpointer
create_dynamic_positioner (GdkSurface *surface,
int width,
int height,
GdkPopupLayout *layout,
gboolean ack_parent_configure)
GdkPopupLayout *layout)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkSurface *parent = surface->parent;
@@ -2245,30 +2129,6 @@ create_dynamic_positioner (GdkSurface *surface,
xdg_positioner_set_constraint_adjustment (positioner,
constraint_adjustment);
if (xdg_positioner_get_version (positioner) >=
XDG_POSITIONER_SET_REACTIVE_SINCE_VERSION)
xdg_positioner_set_reactive (positioner);
if (ack_parent_configure &&
xdg_positioner_get_version (positioner) >=
XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION)
{
GdkWaylandSurface *parent_impl = GDK_WAYLAND_SURFACE (parent);
int parent_width;
int parent_height;
parent_width = parent->width - (parent_impl->margin_left +
parent_impl->margin_right);
parent_height = parent->height - (parent_impl->margin_top +
parent_impl->margin_bottom);
xdg_positioner_set_parent_size (positioner,
parent_width,
parent_height);
xdg_positioner_set_parent_configure (positioner,
parent_impl->last_configure_serial);
}
return positioner;
}
case GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6:
@@ -2334,7 +2194,7 @@ can_map_grabbing_popup (GdkSurface *surface,
return top_most_popup == parent;
}
static gboolean
static void
gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
GdkSurface *parent,
GdkWaylandSeat *grab_input_seat,
@@ -2348,32 +2208,32 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
gpointer positioner;
if (!impl->display_server.wl_surface)
return FALSE;
return;
if (!is_realized_shell_surface (parent))
return FALSE;
return;
if (is_realized_toplevel (surface))
{
g_warning ("Can't map popup, already mapped as toplevel");
return FALSE;
return;
}
if (is_realized_popup (surface))
{
g_warning ("Can't map popup, already mapped");
return FALSE;
return;
}
if (grab_input_seat &&
!can_map_grabbing_popup (surface, parent))
{
g_warning ("Tried to map a grabbing popup with a non-top most parent");
return FALSE;
return;
}
gdk_surface_freeze_updates (surface);
positioner = create_dynamic_positioner (surface, width, height, layout, FALSE);
positioner = create_dynamic_positioner (surface, width, height, layout);
switch (display->shell_variant)
{
@@ -2447,14 +2307,13 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
freeze_popup_toplevel_state (surface);
}
g_set_object (&impl->popup_parent, parent);
display->current_popups = g_list_append (display->current_popups, surface);
if (grab_input_seat)
{
display->current_grabbing_popups =
g_list_prepend (display->current_grabbing_popups, surface);
}
return TRUE;
}
static GdkWaylandSeat *
@@ -2537,8 +2396,9 @@ unmap_popups_for_surface (GdkSurface *surface)
for (l = display_wayland->current_popups; l; l = l->next)
{
GdkSurface *popup = l->data;
GdkWaylandSurface *popup_impl = GDK_WAYLAND_SURFACE (popup);
if (popup->parent == surface)
if (popup_impl->popup_parent == surface)
{
g_warning ("Tried to unmap the parent of a popup");
gdk_surface_hide (popup);
@@ -2641,9 +2501,6 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
{
switch (impl->popup_state)
{
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
gdk_surface_thaw_updates (surface);
G_GNUC_FALLTHROUGH;
case POPUP_STATE_WAITING_FOR_CONFIGURE:
case POPUP_STATE_WAITING_FOR_FRAME:
thaw_popup_toplevel_state (surface);
@@ -2745,7 +2602,6 @@ do_queue_relayout (GdkSurface *surface,
GdkPopupLayout *layout)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
struct xdg_positioner *positioner;
g_assert (is_realized_popup (surface));
g_assert (impl->popup_state == POPUP_STATE_IDLE ||
@@ -2756,41 +2612,7 @@ do_queue_relayout (GdkSurface *surface,
impl->popup.unconstrained_width = width;
impl->popup.unconstrained_height = height;
if (!impl->display_server.xdg_popup ||
xdg_popup_get_version (impl->display_server.xdg_popup) <
XDG_POPUP_REPOSITION_SINCE_VERSION)
{
g_warning_once ("Compositor doesn't support moving popups, "
"relying on remapping");
queue_relayout_fallback (surface, layout);
return;
}
positioner = create_dynamic_positioner (surface,
width, height, layout,
TRUE);
xdg_popup_reposition (impl->display_server.xdg_popup,
positioner,
++impl->reposition_token);
xdg_positioner_destroy (positioner);
gdk_surface_freeze_updates (surface);
switch (impl->popup_state)
{
case POPUP_STATE_IDLE:
freeze_popup_toplevel_state (surface);
break;
case POPUP_STATE_WAITING_FOR_FRAME:
break;
case POPUP_STATE_WAITING_FOR_CONFIGURE:
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
default:
g_assert_not_reached ();
}
impl->popup_state = POPUP_STATE_WAITING_FOR_REPOSITIONED;
queue_relayout_fallback (surface, layout);
}
static gboolean
@@ -2801,9 +2623,6 @@ is_relayout_finished (GdkSurface *surface)
if (!impl->initial_configure_received)
return FALSE;
if (impl->reposition_token != impl->received_reposition_token)
return FALSE;
return TRUE;
}
@@ -2829,13 +2648,11 @@ gdk_wayland_surface_map_popup (GdkSurface *surface,
grab_input_seat = find_grab_input_seat (surface, parent);
else
grab_input_seat = NULL;
if (!gdk_wayland_surface_create_xdg_popup (surface,
parent,
grab_input_seat,
width, height,
layout))
return;
gdk_wayland_surface_create_xdg_popup (surface,
parent,
grab_input_seat,
width, height,
layout);
impl->popup.layout = gdk_popup_layout_copy (layout);
impl->popup.unconstrained_width = width;
@@ -2890,7 +2707,6 @@ reposition_popup (GdkSurface *surface,
case POPUP_STATE_WAITING_FOR_FRAME:
do_queue_relayout (surface, width, height, layout);
break;
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
case POPUP_STATE_WAITING_FOR_CONFIGURE:
g_warn_if_reached ();
break;
@@ -3356,46 +3172,44 @@ gdk_wayland_surface_set_startup_id (GdkSurface *surface,
}
static gboolean
check_transient_for_loop (GdkWaylandToplevel *toplevel,
GdkWaylandToplevel *parent)
check_transient_for_loop (GdkSurface *surface,
GdkSurface *parent)
{
while (parent)
{
if (parent->transient_for == toplevel)
GdkWaylandSurface *impl;
if (!GDK_IS_WAYLAND_SURFACE (parent))
return FALSE;
impl = GDK_WAYLAND_SURFACE (parent);
if (impl->transient_for == surface)
return TRUE;
parent = parent->transient_for;
parent = impl->transient_for;
}
return FALSE;
}
static void
gdk_wayland_toplevel_set_transient_for (GdkWaylandToplevel *toplevel,
GdkSurface *parent)
gdk_wayland_surface_set_transient_for (GdkSurface *surface,
GdkSurface *parent)
{
g_return_if_fail (!parent || GDK_IS_WAYLAND_TOPLEVEL (parent));
g_return_if_fail (!parent ||
gdk_surface_get_display (GDK_SURFACE (toplevel)) == gdk_surface_get_display (parent));
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
if (parent)
g_assert (parent == NULL ||
gdk_surface_get_display (surface) == gdk_surface_get_display (parent));
if (check_transient_for_loop (surface, parent))
{
GdkWaylandToplevel *parent_toplevel = GDK_WAYLAND_TOPLEVEL (parent);
if (check_transient_for_loop (toplevel, parent_toplevel))
{
g_warning ("Setting %p transient for %p would create a loop",
toplevel, parent);
return;
}
g_warning ("Setting %p transient for %p would create a loop", surface, parent);
return;
}
unset_transient_for_exported (GDK_SURFACE (toplevel));
unset_transient_for_exported (surface);
if (parent)
toplevel->transient_for = GDK_WAYLAND_TOPLEVEL (parent);
else
toplevel->transient_for = NULL;
impl->transient_for = parent;
gdk_wayland_surface_sync_parent (GDK_SURFACE (toplevel), NULL);
gdk_wayland_surface_sync_parent (surface, NULL);
}
static void
@@ -3821,8 +3635,7 @@ gdk_wayland_surface_show_window_menu (GdkSurface *surface,
double x, y;
uint32_t serial;
GdkEventType event_type = gdk_event_get_event_type (event);
switch ((guint) event_type)
switch ((guint) event->any.type)
{
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
@@ -4284,7 +4097,7 @@ gdk_wayland_surface_set_transient_for_exported (GdkSurface *surface,
return FALSE;
}
gdk_wayland_toplevel_set_transient_for (GDK_WAYLAND_TOPLEVEL (impl), NULL);
gdk_wayland_surface_set_transient_for (surface, NULL);
impl->imported_transient_for =
zxdg_importer_v1_import (display_wayland->xdg_importer, parent_handle_str);
@@ -4356,6 +4169,22 @@ create_dnd_surface (GdkDisplay *display)
#define LAST_PROP 1
typedef struct
{
GdkWaylandSurface parent_instance;
} GdkWaylandPopup;
typedef struct
{
GdkWaylandSurfaceClass parent_class;
} GdkWaylandPopupClass;
static void gdk_wayland_popup_iface_init (GdkPopupInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GdkWaylandPopup, gdk_wayland_popup, GDK_TYPE_WAYLAND_SURFACE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_POPUP,
gdk_wayland_popup_iface_init))
static void
gdk_wayland_popup_init (GdkWaylandPopup *popup)
{
@@ -4465,6 +4294,22 @@ gdk_wayland_popup_iface_init (GdkPopupInterface *iface)
iface->get_position_y = gdk_wayland_popup_get_position_y;
}
typedef struct
{
GdkWaylandSurface parent_instance;
} GdkWaylandToplevel;
typedef struct
{
GdkWaylandSurfaceClass parent_class;
} GdkWaylandToplevelClass;
static void gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GdkWaylandToplevel, gdk_wayland_toplevel, GDK_TYPE_WAYLAND_SURFACE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_TOPLEVEL,
gdk_wayland_toplevel_iface_init))
static void
gdk_wayland_toplevel_init (GdkWaylandToplevel *toplevel)
{
@@ -4477,7 +4322,6 @@ gdk_wayland_toplevel_set_property (GObject *object,
GParamSpec *pspec)
{
GdkSurface *surface = GDK_SURFACE (object);
GdkWaylandToplevel *toplevel = GDK_WAYLAND_TOPLEVEL (surface);
switch (prop_id)
{
@@ -4492,8 +4336,7 @@ gdk_wayland_toplevel_set_property (GObject *object,
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_TRANSIENT_FOR:
gdk_wayland_toplevel_set_transient_for (toplevel,
g_value_get_object (value));
gdk_wayland_surface_set_transient_for (surface, g_value_get_object (value));
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
break;
@@ -4533,7 +4376,6 @@ gdk_wayland_toplevel_get_property (GObject *object,
{
GdkSurface *surface = GDK_SURFACE (object);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkWaylandToplevel *toplevel = GDK_WAYLAND_TOPLEVEL (surface);
switch (prop_id)
{
@@ -4550,7 +4392,7 @@ gdk_wayland_toplevel_get_property (GObject *object,
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_TRANSIENT_FOR:
g_value_set_object (value, toplevel->transient_for);
g_value_set_object (value, impl->transient_for);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_MODAL:
@@ -4775,6 +4617,22 @@ gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface)
iface->restore_system_shortcuts = gdk_wayland_toplevel_restore_system_shortcuts;
}
typedef struct
{
GdkWaylandSurface parent_instance;
} GdkWaylandDragSurface;
typedef struct
{
GdkWaylandSurfaceClass parent_class;
} GdkWaylandDragSurfaceClass;
static void gdk_wayland_drag_surface_iface_init (GdkDragSurfaceInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GdkWaylandDragSurface, gdk_wayland_drag_surface, GDK_TYPE_WAYLAND_SURFACE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_DRAG_SURFACE,
gdk_wayland_drag_surface_iface_init))
static void
gdk_wayland_drag_surface_init (GdkWaylandDragSurface *surface)
{
+7 -3
View File
@@ -37,6 +37,10 @@ gdk_wayland_deps = [
wlegldep,
]
# wayland protocols
proto_dir = dependency('wayland-protocols').get_pkgconfig_variable('pkgdatadir')
assert(proto_dir != '', 'Could not get pkgdatadir from wayland-protocols.pc')
wayland_scanner = find_program('wayland-scanner')
# Format:
@@ -64,14 +68,14 @@ foreach p: proto_sources
if proto_stability == 'stable'
output_base = proto_name
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
elif proto_stability == 'private'
output_base = proto_name
input = files('protocol/@0@.xml'.format(proto_name))
input = 'protocol/@0@.xml'.format(proto_name)
else
proto_version = p.get(2)
output_base = '@0@-@1@-@2@'.format(proto_name, proto_stability, proto_version)
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
endif
gdk_wayland_gen_headers += custom_target('@0@ client header'.format(output_base),
+6 -8
View File
@@ -1063,7 +1063,7 @@ gdk_input_other_event (GdkDisplay *display,
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK));
event = gdk_button_event_new (event_type,
event = gdk_event_button_new (event_type,
window,
device_manager->core_pointer,
GDK_DEVICE (source_device),
@@ -1077,11 +1077,10 @@ gdk_input_other_event (GdkDisplay *display,
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("WINTAB button %s:%d %g,%g\n",
(event->event_type == GDK_BUTTON_PRESS ?
(event->any.type == GDK_BUTTON_PRESS ?
"press" : "release"),
((GdkButtonEvent *) event)->button,
((GdkButtonEvent *) event)->x,
((GdkButtonEvent *) event)->y));
event->button.button,
event->button.x, event->button.y));
}
else
{
@@ -1098,7 +1097,7 @@ gdk_input_other_event (GdkDisplay *display,
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK));
event = gdk_motion_event_new (window,
event = gdk_event_motion_new (window,
device_manager->core_pointer,
GDK_DEVICE (source_device),
NULL,
@@ -1109,8 +1108,7 @@ gdk_input_other_event (GdkDisplay *display,
axes);
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("WINTAB motion: %g,%g\n",
((GdkMotionEvent *) event)->x,
((GdkMotionEvent *) event)->y));
event->motion.x, event->motion.y));
}
return event;
+1 -2
View File
@@ -2515,8 +2515,7 @@ gdk_win32_drag_handle_event (GdkDrag *drag,
if (!drag_win32->handle_events)
{
/* FIXME: remove this functionality once gtk no longer calls DnD after drag_done() */
g_warning ("Got an event %d for drag context %p, even though it's done!",
event->event_type, drag);
g_warning ("Got an event %d for drag context %p, even though it's done!", event->any.type, drag);
return FALSE;
}
+38 -45
View File
@@ -72,8 +72,6 @@
#include <imm.h>
#define GDK_MOD2_MASK (1 << 4)
#ifndef XBUTTON1
#define XBUTTON1 1
#define XBUTTON2 2
@@ -207,7 +205,7 @@ generate_focus_event (GdkDeviceManagerWin32 *device_manager,
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, source_device, in);
event = gdk_event_focus_new (window, device, source_device, in);
_gdk_win32_append_event (event);
}
@@ -233,7 +231,7 @@ generate_grab_broken_event (GdkDeviceManagerWin32 *device_manager,
source_device = device_manager->system_pointer;
}
event = gdk_grab_broken_event_new (window,
event = gdk_event_grab_broken_new (window,
device,
source_device,
grab_window,
@@ -744,7 +742,6 @@ print_event_state (guint state)
CASE (LOCK);
CASE (CONTROL);
CASE (ALT);
CASE (MOD2);
CASE (BUTTON1);
CASE (BUTTON2);
CASE (BUTTON3);
@@ -809,7 +806,7 @@ _gdk_win32_print_event (GdkEvent *event)
kvname = gdk_keyval_name (gdk_key_event_get_keyval (event));
g_print ("%#.02x group:%d %s",
gdk_key_event_get_keycode (event),
gdk_key_event_get_layout (event),
gdk_key_event_get_group (event),
(kvname ? kvname : "??"));
print_event_state (gdk_event_get_modifier_state (event));
break;
@@ -885,8 +882,12 @@ decode_key_lparam (LPARAM lParam)
static void
fixup_event (GdkEvent *event)
{
if (event->surface)
g_object_ref (event->surface);
if (event->any.surface)
g_object_ref (event->any.surface);
if (((event->any.type == GDK_ENTER_NOTIFY) ||
(event->any.type == GDK_LEAVE_NOTIFY)) &&
(event->crossing.child_surface != NULL))
g_object_ref (event->crossing.child_surface);
}
void
@@ -1076,7 +1077,7 @@ send_crossing_event (GdkDisplay *display,
pt = *screen_pt;
ScreenToClient (GDK_SURFACE_HWND (window), &pt);
event = gdk_crossing_event_new (type,
event = gdk_event_crossing_new (type,
window,
device_manager->core_pointer,
device_manager->system_pointer,
@@ -1585,7 +1586,7 @@ generate_button_event (GdkEventType type,
current_x = (gint16) GET_X_LPARAM (msg->lParam) / impl->surface_scale;
current_y = (gint16) GET_Y_LPARAM (msg->lParam) / impl->surface_scale;
event = gdk_button_event_new (type,
event = gdk_event_button_new (type,
window,
device_manager->core_pointer,
device_manager->system_pointer,
@@ -2046,12 +2047,12 @@ gdk_event_translate (MSG *msg,
GdkModifierType state;
guint keyval;
guint16 keycode;
guint16 scancode;
guint8 group;
gboolean is_modifier;
double delta_x, delta_y;
GdkScrollDirection direction;
GdkTranslatedKey translated;
display = gdk_display_get_default ();
win32_display = GDK_WIN32_DISPLAY (display);
@@ -2125,20 +2126,17 @@ gdk_event_translate (MSG *msg,
gdk_display_setting_changed (display, "gtk-im-module");
/* Generate a dummy key event to "nudge" IMContext */
translated.keyval = GDK_KEY_VoidSymbol;
translated.consumed = 0;
translated.layout = 0;
translated.level = 0;
event = gdk_key_event_new (GDK_KEY_PRESS,
event = gdk_event_key_new (GDK_KEY_PRESS,
window,
device_manager_win32->core_keyboard,
device_manager_win32->system_keyboard,
_gdk_win32_get_next_tick (msg->time),
0,
GDK_KEY_VoidSymbol,
0,
FALSE,
&translated,
&translated);
0,
0,
FALSE);
_gdk_win32_append_event (event);
break;
@@ -2224,6 +2222,7 @@ gdk_event_translate (MSG *msg,
keyval = GDK_KEY_VoidSymbol;
keycode = msg->wParam;
scancode = msg->lParam >> 16;
if (HIWORD (msg->lParam) & KF_EXTENDED)
{
@@ -2327,12 +2326,7 @@ gdk_event_translate (MSG *msg,
if (msg->wParam == VK_MENU)
state &= ~GDK_ALT_MASK;
/* FIXME do proper translation */
translated.keyval = keyval;
translated.consumed = 0;
translated.layout = group;
translated.level = 0;
event = gdk_key_event_new ((msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN)
event = gdk_event_key_new ((msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN)
? GDK_KEY_PRESS
: GDK_KEY_RELEASE,
window,
@@ -2340,10 +2334,11 @@ gdk_event_translate (MSG *msg,
device_manager_win32->system_keyboard,
_gdk_win32_get_next_tick (msg->time),
state,
keyval,
keycode,
is_modifier,
&translated,
&translated);
scancode,
group,
is_modifier);
_gdk_win32_append_event (event);
@@ -2405,34 +2400,32 @@ gdk_event_translate (MSG *msg,
for (i = 0; i < ccount; i++)
{
/* Build a key press event */
translated.keyval = gdk_unicode_to_keyval (wbuf[i]);
translated.consumed = 0;
translated.layout = get_active_group ();
translated.level = 0;
event = gdk_key_event_new (GDK_KEY_PRESS,
event = gdk_event_key_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),
gdk_unicode_to_keyval (wbuf[i]),
0,
FALSE,
&translated,
&translated);
0,
get_active_group (),
FALSE);
_gdk_win32_append_event (event);
/* Build a key release event. */
event = gdk_key_event_new (GDK_KEY_RELEASE,
event = gdk_event_key_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),
gdk_unicode_to_keyval (wbuf[i]),
0,
FALSE,
&translated,
&translated);
0,
get_active_group (),
FALSE);
_gdk_win32_append_event (event);
}
@@ -2637,7 +2630,7 @@ gdk_event_translate (MSG *msg,
current_x = (gint16) GET_X_LPARAM (msg->lParam) / impl->surface_scale;
current_y = (gint16) GET_Y_LPARAM (msg->lParam) / impl->surface_scale;
event = gdk_motion_event_new (window,
event = gdk_event_motion_new (window,
device_manager_win32->core_pointer,
device_manager_win32->system_pointer,
NULL,
@@ -2763,7 +2756,7 @@ gdk_event_translate (MSG *msg,
*/
delta_y *= -1.0;
event = gdk_scroll_event_new (window,
event = gdk_event_scroll_new (window,
device_manager_win32->core_pointer,
device_manager_win32->system_pointer,
NULL,
@@ -2786,7 +2779,7 @@ gdk_event_translate (MSG *msg,
? GDK_SCROLL_RIGHT
: GDK_SCROLL_LEFT;
event = gdk_scroll_event_new_discrete (window,
event = gdk_event_discrete_scroll_new (window,
device_manager_win32->core_pointer,
device_manager_win32->system_pointer,
NULL,
@@ -3421,7 +3414,7 @@ gdk_event_translate (MSG *msg,
if (GDK_SURFACE_DESTROYED (window))
break;
event = gdk_delete_event_new (window);
event = gdk_event_delete_new (window);
_gdk_win32_append_event (event);
@@ -3455,7 +3448,7 @@ gdk_event_translate (MSG *msg,
if (window == NULL || GDK_SURFACE_DESTROYED (window))
break;
event = gdk_delete_event_new (window);
event = gdk_event_delete_new (window);
_gdk_win32_append_event (event);
+16 -2
View File
@@ -38,8 +38,6 @@
#include "gdkkeysprivate.h"
#include "gdkwin32keys.h"
#define GDK_MOD2_MASK (1 << 4)
enum _GdkWin32KeyLevelState
{
GDK_WIN32_LEVEL_NONE = 0,
@@ -1673,6 +1671,20 @@ gdk_win32_keymap_translate_keyboard_state (GdkKeymap *gdk_keymap,
return tmp_keyval != GDK_KEY_VoidSymbol;
}
static void
gdk_win32_keymap_add_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
}
static gboolean
gdk_win32_keymap_map_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
/* FIXME: Is this the right thing to do? */
return TRUE;
}
static void
gdk_win32_keymap_class_init (GdkWin32KeymapClass *klass)
{
@@ -1690,4 +1702,6 @@ gdk_win32_keymap_class_init (GdkWin32KeymapClass *klass)
keymap_class->get_entries_for_keycode = gdk_win32_keymap_get_entries_for_keycode;
keymap_class->lookup_key = gdk_win32_keymap_lookup_key;
keymap_class->translate_keyboard_state = gdk_win32_keymap_translate_keyboard_state;
keymap_class->add_virtual_modifiers = gdk_win32_keymap_add_virtual_modifiers;
keymap_class->map_virtual_modifiers = gdk_win32_keymap_map_virtual_modifiers;
}
+2 -2
View File
@@ -288,10 +288,10 @@ extern UINT _gdk_input_codepage;
extern guint _gdk_keymap_serial;
/* The singleton clipdrop object pointer */
extern GdkWin32Clipdrop *_win32_clipdrop;
GdkWin32Clipdrop *_win32_clipdrop;
/* Used to identify the main thread */
extern GThread *_win32_main_thread;
GThread *_win32_main_thread;
void _gdk_win32_dnd_do_dragdrop (void);
+1 -1
View File
@@ -4462,7 +4462,7 @@ gdk_win32_surface_show_window_menu (GdkSurface *window,
gint x, y;
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
switch ((int) event->event_type)
switch (event->any.type)
{
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
-1
View File
@@ -30,7 +30,6 @@
#include "gdk/win32/gdkwin32surface.h"
#include "gdk/gdksurfaceprivate.h"
#include "gdk/gdkcursor.h"
#include "gdk/gdkinternals.h"
#include <windows.h>
+1
View File
@@ -31,6 +31,7 @@
#include <gdk/win32/gdkwin32display.h>
#include <gdk/win32/gdkwin32displaymanager.h>
#include <gdk/win32/gdkwin32dnd.h>
#include <gdk/win32/gdkwin32keys.h>
#include <gdk/win32/gdkwin32screen.h>
#include <gdk/win32/gdkwin32surface.h>
#include <gdk/win32/gdkwin32misc.h>
+2 -1
View File
@@ -23,7 +23,6 @@
#endif
#include <gdk/gdk.h>
#include "gdkkeysprivate.h"
G_BEGIN_DECLS
@@ -59,8 +58,10 @@ typedef struct _GdkWin32KeymapClass GdkWin32KeymapClass;
#define GDK_IS_WIN32_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WIN32_KEYMAP))
#define GDK_WIN32_KEYMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WIN32_KEYMAP, GdkWin32KeymapClass))
GDK_AVAILABLE_IN_ALL
GType gdk_win32_keymap_get_type (void);
GDK_AVAILABLE_IN_ALL
GdkWin32KeymapMatch gdk_win32_keymap_check_compose (GdkWin32Keymap *keymap,
guint16 *compose_buffer,
gsize compose_buffer_len,
+15 -43
View File
@@ -24,7 +24,6 @@
#include "gdkdevicetoolprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkeventtranslator.h"
#include "gdkkeys-x11.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
#include "gdkintl.h"
@@ -1448,7 +1447,7 @@ _gdk_device_manager_xi2_handle_focus (GdkSurface *surface,
{
GdkEvent *event;
event = gdk_focus_event_new (surface, device, source_device, focus_in);
event = gdk_event_focus_new (surface, device, source_device, focus_in);
gdk_display_put_event (gdk_surface_get_display (surface), event);
gdk_event_unref (event);
}
@@ -1522,10 +1521,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
GdkKeymap *keymap = gdk_display_get_keymap (display);
GdkModifierType consumed, state, orig_state;
int layout, level;
guint keyval;
GdkTranslatedKey translated;
GdkTranslatedKey no_lock;
GDK_DISPLAY_NOTE (display, EVENTS,
g_message ("key %s:\twindow %ld\n"
@@ -1553,49 +1549,25 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
state,
xev->group.effective,
&keyval,
&layout, &level, &consumed);
NULL, NULL, &consumed);
orig_state = state;
state &= ~consumed;
_gdk_x11_keymap_add_virt_mods (keymap, &state);
state |= orig_state;
translated.keyval = keyval;
translated.consumed = consumed;
translated.layout = layout;
translated.level = level;
if (orig_state & GDK_LOCK_MASK)
{
orig_state &= ~GDK_LOCK_MASK;
gdk_keymap_translate_keyboard_state (keymap,
xev->detail,
orig_state,
xev->group.effective,
&keyval,
&layout, &level, &consumed);
no_lock.keyval = keyval;
no_lock.consumed = consumed;
no_lock.layout = layout;
no_lock.level = level;
}
else
{
no_lock = translated;
}
event = gdk_key_event_new (xev->evtype == XI_KeyPress
event = gdk_event_key_new (xev->evtype == XI_KeyPress
? GDK_KEY_PRESS
: GDK_KEY_RELEASE,
surface,
device,
source_device,
xev->time,
xev->detail,
state,
gdk_x11_keymap_key_is_modifier (keymap, xev->detail),
&translated,
&no_lock);
keyval,
xev->detail,
xev->detail,
xev->group.effective,
gdk_x11_keymap_key_is_modifier (keymap, xev->detail));
if (ev->evtype == XI_KeyPress)
set_user_time (event);
@@ -1654,7 +1626,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
source_device = g_hash_table_lookup (device_manager->id_table,
GUINT_TO_POINTER (xev->sourceid));
event = gdk_scroll_event_new_discrete (surface,
event = gdk_event_discrete_scroll_new (surface,
device,
source_device,
NULL,
@@ -1684,7 +1656,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale;
event = gdk_button_event_new (ev->evtype == XI_ButtonPress
event = gdk_event_button_new (ev->evtype == XI_ButtonPress
? GDK_BUTTON_PRESS
: GDK_BUTTON_RELEASE,
surface,
@@ -1739,7 +1711,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
xev->deviceid, xev->sourceid,
xev->event, delta_x, delta_y));
event = gdk_scroll_event_new (surface,
event = gdk_event_scroll_new (surface,
device,
source_device,
NULL,
@@ -1760,7 +1732,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale;
event = gdk_motion_event_new (surface,
event = gdk_event_motion_new (surface,
device,
source_device,
source_device->last_tool,
@@ -1808,7 +1780,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale;
event = gdk_touch_event_new (ev->evtype == XI_TouchBegin
event = gdk_event_touch_new (ev->evtype == XI_TouchBegin
? GDK_TOUCH_BEGIN
: GDK_TOUCH_END,
GUINT_TO_POINTER (xev->detail),
@@ -1858,7 +1830,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale;
event = gdk_touch_event_new (GDK_TOUCH_UPDATE,
event = gdk_event_touch_new (GDK_TOUCH_UPDATE,
GUINT_TO_POINTER (xev->detail),
surface,
device,
@@ -1911,7 +1883,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
}
}
event = gdk_crossing_event_new (ev->evtype == XI_Enter
event = gdk_event_crossing_new (ev->evtype == XI_Enter
? GDK_ENTER_NOTIFY
: GDK_LEAVE_NOTIFY,
surface,

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