[five-or-more/arnaudb/wip/gtk4: 78/80] Fix keyboard.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [five-or-more/arnaudb/wip/gtk4: 78/80] Fix keyboard.
- Date: Sun, 25 Oct 2020 18:51:47 +0000 (UTC)
commit ed242cc5bd8ac7f8bf4639144685506fe8a52922
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Aug 5 18:43:19 2020 +0200
Fix keyboard.
data/ui/five-or-more.ui | 5 -----
src/view.vala | 9 +++++----
2 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/data/ui/five-or-more.ui b/data/ui/five-or-more.ui
index 01bf5d9..e2c32d2 100644
--- a/data/ui/five-or-more.ui
+++ b/data/ui/five-or-more.ui
@@ -105,7 +105,6 @@
</section>
</menu>
<template class="GameWindow" parent="GtkApplicationWindow">
- <property name="can_focus">False</property>
<property name="default_width">320</property>
<property name="default_height">400</property>
<property name="icon_name">five-or-more</property>
@@ -114,17 +113,14 @@
<property name="title" translatable="yes">Five or More</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="headerbar">
- <property name="can_focus">False</property>
<property name="show_title_buttons">True</property>
<child type="start">
<object class="GtkBox" id="preview_hbox">
- <property name="can_focus">False</property>
<!-- <property name="border_width">12</property> FIXME -->
<property name="orientation">horizontal</property>
<child>
<object class="GtkLabel" id="labelNext">
<property name="ellipsize">PANGO_ELLIPSIZE_END</property>
- <property name="can_focus">False</property>
<!-- Translators: label displayed in the headerbar, introducing the next balls to be added
to the board -->
<property name="label" translatable="yes">Next:</property>
<attributes>
@@ -136,7 +132,6 @@
</child>
<child type="end">
<object class="GtkMenuButton">
- <property name="can_focus">True</property>
<property name="menu_model">primary-menu</property>
<property name="icon_name">open-menu-symbolic</property>
<!-- <accelerator key="F10" signal="activate"/> FIXME -->
diff --git a/src/view.vala b/src/view.vala
index 2a24642..e714fa7 100644
--- a/src/view.vala
+++ b/src/view.vala
@@ -75,6 +75,8 @@ private class View : DrawingArea
this.game = game;
this.theme = theme;
+ focusable = true;
+
init_keyboard ();
init_mouse ();
set_draw_func (draw);
@@ -99,7 +101,6 @@ private class View : DrawingArea
game.board.grid_changed.connect (queue_draw);
- set_can_focus (true);
grab_focus ();
game.current_path_cell_pos_changed.connect (queue_draw);
@@ -159,12 +160,12 @@ private class View : DrawingArea
private void init_keyboard ()
{
- key_controller = new Gtk.EventControllerKey ();
+ key_controller = new EventControllerKey ();
key_controller.key_pressed.connect (on_key_pressed);
add_controller (key_controller);
}
- private inline bool on_key_pressed (Gtk.EventControllerKey _key_controller, uint keyval, uint keycode,
Gdk.ModifierType state)
+ private inline bool on_key_pressed (EventControllerKey _key_controller, uint keyval, uint keycode,
Gdk.ModifierType state)
{
switch (keyval)
{
@@ -413,7 +414,7 @@ private class View : DrawingArea
}
}
- private inline void draw (Gtk.DrawingArea _this, Cairo.Context cr, int new_width, int new_height)
+ private inline void draw (DrawingArea _this, Cairo.Context cr, int new_width, int new_height)
{
if (theme == null)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]