]> Pileus Git - ~andy/gtk/blobdiff - gdk/wayland/gdkdevice-wayland.c
Change FSF Address
[~andy/gtk] / gdk / wayland / gdkdevice-wayland.c
index 1e0080fa469ddb7f44cdafab95c73396c42e4996..7381d217b920b9b5702d37780c1b28058038bc5b 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #define _GNU_SOURCE
@@ -378,6 +376,19 @@ input_handle_button(void *data, struct wl_input_device *input_device,
   GdkDisplayWayland *display = GDK_DISPLAY_WAYLAND (device->display);
   GdkEvent *event;
   uint32_t modifier;
+  int gdk_button;
+
+  switch (button) {
+  case 273:
+    gdk_button = 3;
+    break;
+  case 274:
+    gdk_button = 2;
+    break;
+  default:
+    gdk_button = button - 271;
+    break;
+  }
 
   device->time = time;
   event = gdk_event_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE);
@@ -390,10 +401,10 @@ input_handle_button(void *data, struct wl_input_device *input_device,
   event->button.y_root = (gdouble) device->y;
   event->button.axes = NULL;
   event->button.state = device->modifiers;
-  event->button.button = button - 271;
+  event->button.button = gdk_button;
   gdk_event_set_screen (event, display->screen);
 
-  modifier = 1 << (8 + button - 272);
+  modifier = 1 << (8 + gdk_button - 1);
   if (state)
     device->modifiers |= modifier;
   else
@@ -675,6 +686,7 @@ input_handle_keyboard_focus(void *data,
   device->time = time;
   if (device->keyboard_focus)
     {
+      _gdk_wayland_window_remove_focus (device->keyboard_focus);
       event = gdk_event_new (GDK_FOCUS_CHANGE);
       event->focus_change.window = g_object_ref (device->keyboard_focus);
       event->focus_change.send_event = FALSE;
@@ -709,6 +721,8 @@ input_handle_keyboard_focus(void *data,
                           device, device->keyboard_focus));
 
       _gdk_wayland_display_deliver_event (device->display, event);
+
+      _gdk_wayland_window_add_focus (device->keyboard_focus);
     }
 }
 
@@ -1016,7 +1030,7 @@ gdk_wayland_device_get_selection_type_atoms (GdkDevice  *gdk_device,
 
   device = GDK_DEVICE_CORE (gdk_device)->device;
 
-  if (device->selection_offer->types->len == 0)
+  if (!device->selection_offer || device->selection_offer->types->len == 0)
     {
       *atoms_out = NULL;
       return 0;