Initial support for Wayland 1.3.
[profile/ivi/layer-management.git] / LayerManagerPlugins / Renderers / Graphic / src / WindowSystems / WaylandEvdevInputEvent.cpp
index 33f1547..fac99e5 100644 (file)
@@ -960,15 +960,24 @@ WaylandEvdevInputEvent::notifyKeyboardFocusIn(struct wl_array *keys,
     {
         return;
     }
-    if (!wlSeat->keyboard)
-    {
-        return;
-    }
+    /**
+     * @todo Port to Wayland 1.3.
+     */
+    // if (!wlSeat->keyboard)
+    // {
+    //     return;
+    // }
     serial = wl_display_next_serial(m_inputDevice->display());
-    wl_array_init(&wlSeat->keyboard->keys);
-    wl_array_copy(&wlSeat->keyboard->keys, keys);
-
-    struct wl_array *array = &wlSeat->keyboard->keys;
+    /**
+     * @todo Port to Wayland 1.3.
+     */
+    // wl_array_init(&wlSeat->keyboard->keys);
+    // wl_array_copy(&wlSeat->keyboard->keys, keys);
+
+    /**
+     * @todo Port to Wayland 1.3.
+     */
+    struct wl_array *array = NULL; // &wlSeat->keyboard->keys;
     for (k = (uint32_t*)array->data;
         (const char*)k < (const char*)array->data + array->size;
         ++k)
@@ -1150,9 +1159,12 @@ WaylandEvdevInputEvent::flushMotion(struct evdev_input_device *device,
         if (wlSeat)
         {
             // notify_motion
-            notifyMotion(device, time,
-                        wlSeat->pointer->x + device->rel.dx,
-                        wlSeat->pointer->y + device->rel.dy);
+            /**
+             * @todo Port to Wayland 1.3.
+             */
+            // notifyMotion(device, time,
+            //             wlSeat->pointer->x + device->rel.dx,
+            //             wlSeat->pointer->y + device->rel.dy);
         }
         device->pending_events &= ~EVDEV_RELATIVE_MOTION;
         device->rel.dx = 0;
@@ -1531,35 +1543,38 @@ WaylandEvdevInputEvent::notifyButton(struct evdev_input_device *device,
     wlSeat = inputEvent->inputDevice().seat();
     serial = wl_display_next_serial(inputEvent->inputDevice().display());
 
-    if (state == WL_POINTER_BUTTON_STATE_PRESSED)
-    {
-        if (wlSeat->pointer->button_count == 0)
-        {
-            wlSeat->pointer->grab_button = button;
-            wlSeat->pointer->grab_time = time;
-            wlSeat->pointer->grab_x = wlSeat->pointer->x;
-            wlSeat->pointer->grab_y = wlSeat->pointer->y;
-        }
-        ++wlSeat->pointer->button_count;
-    }
-    else
-    {
-        --wlSeat->pointer->button_count;
-    }
-    wlEvent.x = wl_fixed_to_int(wlSeat->pointer->x);
-    wlEvent.y = wl_fixed_to_int(wlSeat->pointer->y);
-    wlEvent.buttonState = state;
-    wlEvent.serial = serial;
-
-    inputEvent->windowSystem().manageWLInputEvent(INPUT_DEVICE_POINTER,
-        state == WL_POINTER_BUTTON_STATE_PRESSED ? INPUT_STATE_PRESSED :
-        INPUT_STATE_RELEASED, &wlEvent);
-
-    if (wlSeat->pointer->button_count == 1)
-    {
-        wlSeat->pointer->grab_serial =
-            wl_display_get_serial(inputEvent->inputDevice().display());
-    }
+    /**
+     * @todo Port to Wayland 1.3.
+     */
+    // if (state == WL_POINTER_BUTTON_STATE_PRESSED)
+    // {
+    //     if (wlSeat->pointer->button_count == 0)
+    //     {
+    //         wlSeat->pointer->grab_button = button;
+    //         wlSeat->pointer->grab_time = time;
+    //         wlSeat->pointer->grab_x = wlSeat->pointer->x;
+    //         wlSeat->pointer->grab_y = wlSeat->pointer->y;
+    //     }
+    //     ++wlSeat->pointer->button_count;
+    // }
+    // else
+    // {
+    //     --wlSeat->pointer->button_count;
+    // }
+    // wlEvent.x = wl_fixed_to_int(wlSeat->pointer->x);
+    // wlEvent.y = wl_fixed_to_int(wlSeat->pointer->y);
+    // wlEvent.buttonState = state;
+    // wlEvent.serial = serial;
+
+    // inputEvent->windowSystem().manageWLInputEvent(INPUT_DEVICE_POINTER,
+    //     state == WL_POINTER_BUTTON_STATE_PRESSED ? INPUT_STATE_PRESSED :
+    //     INPUT_STATE_RELEASED, &wlEvent);
+
+    // if (wlSeat->pointer->button_count == 1)
+    // {
+    //     wlSeat->pointer->grab_serial =
+    //         wl_display_get_serial(inputEvent->inputDevice().display());
+    // }
 }
 
 void
@@ -1594,8 +1609,11 @@ WaylandEvdevInputEvent::notifyMotion(struct evdev_input_device *device,
     if (y < 0) y = 0;
     if (y > h) y = h;
 
-    wlSeat->pointer->x = wl_fixed_from_int(x);
-    wlSeat->pointer->y = wl_fixed_from_int(y);
+    /**
+     * @todo Port to Wayland 1.3.
+     */
+    // wlSeat->pointer->x = wl_fixed_from_int(x);
+    // wlSeat->pointer->y = wl_fixed_from_int(y);
 
     wlEvent.x = x;
     wlEvent.y = y;
@@ -1624,27 +1642,33 @@ WaylandEvdevInputEvent::notifyKey(struct evdev_input_device *device,
     wlSeat = inputEvent->inputDevice().seat();
     if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
     {
-        wlSeat->keyboard->grab_key = key;
-        wlSeat->keyboard->grab_time = time;
-    }
-
-    end = (uint32_t*)(((unsigned char*)wlSeat->keyboard->keys.data) + wlSeat->keyboard->keys.size);
-    for (k = (uint32_t*)wlSeat->keyboard->keys.data; k < end; ++k)
-    {
-        if (*k == key)
-        {
-            // Ignore server-generated repeats
-            if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
-                return;
-            *k = *--end;
-        }
-    }
-    wlSeat->keyboard->keys.size = end - (uint32_t*)wlSeat->keyboard->keys.data;
-    if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
-    {
-        k = (uint32_t*)wl_array_add(&wlSeat->keyboard->keys, sizeof(*k));
-        *k = key;
-    }
+        /**
+         * @todo Port to Wayland 1.3.
+         */
+        // wlSeat->keyboard->grab_key = key;
+        // wlSeat->keyboard->grab_time = time;
+    }
+
+    /**
+     * @todo Port to Wayland 1.3.
+     */
+    // end = (uint32_t*)(((unsigned char*)wlSeat->keyboard->keys.data) + wlSeat->keyboard->keys.size);
+    // for (k = (uint32_t*)wlSeat->keyboard->keys.data; k < end; ++k)
+    // {
+    //     if (*k == key)
+    //     {
+    //         // Ignore server-generated repeats
+    //         if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
+    //             return;
+    //         *k = *--end;
+    //     }
+    // }
+    // wlSeat->keyboard->keys.size = end - (uint32_t*)wlSeat->keyboard->keys.data;
+    // if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
+    // {
+    //     k = (uint32_t*)wl_array_add(&wlSeat->keyboard->keys, sizeof(*k));
+    //     *k = key;
+    // }
 
     wlEvent.keyCode = key;
     wlEvent.keyState = state;
@@ -1711,18 +1735,21 @@ WaylandEvdevInputEvent::notifyModifiers(struct wl_seat *wlSeat, uint32_t serial)
     mods_locked = xkb_state_serialize_mods(m_xkbState.state, (xkb_state_component)XKB_STATE_LOCKED);
     group = xkb_state_serialize_mods(m_xkbState.state, (xkb_state_component)XKB_STATE_EFFECTIVE);
 
-    if (mods_depressed != wlSeat->keyboard->modifiers.mods_depressed ||
-        mods_latched != wlSeat->keyboard->modifiers.mods_latched ||
-        mods_locked != wlSeat->keyboard->modifiers.mods_locked ||
-        group != wlSeat->keyboard->modifiers.group)
-    {
-        changed = 1;
-    }
-
-    wlSeat->keyboard->modifiers.mods_depressed = mods_depressed;
-    wlSeat->keyboard->modifiers.mods_latched = mods_latched;
-    wlSeat->keyboard->modifiers.mods_locked = mods_locked;
-    wlSeat->keyboard->modifiers.group = group;
+    /**
+     * @todo Port to Wayland 1.3.
+     */
+    // if (mods_depressed != wlSeat->keyboard->modifiers.mods_depressed ||
+    //     mods_latched != wlSeat->keyboard->modifiers.mods_latched ||
+    //     mods_locked != wlSeat->keyboard->modifiers.mods_locked ||
+    //     group != wlSeat->keyboard->modifiers.group)
+    // {
+    //     changed = 1;
+    // }
+
+    // wlSeat->keyboard->modifiers.mods_depressed = mods_depressed;
+    // wlSeat->keyboard->modifiers.mods_latched = mods_latched;
+    // wlSeat->keyboard->modifiers.mods_locked = mods_locked;
+    // wlSeat->keyboard->modifiers.group = group;
 
     // And update the modifier_state for bindings
     mods_lookup = mods_depressed | mods_latched;