GithubHelp home page GithubHelp logo

Comments (5)

Consolatis avatar Consolatis commented on June 28, 2024 2

I like the general approach by @tokyo4j above as it basically just interprets the touch down event on the window the same as a mouse click by calling the same binding. This still leaves the user in control of the config (I think by default it is Focus and Raise). Some potential issues with the approach are a) the Frame context and b) closing open menus (root / window menu). Maybe we could either re-use some currently internal function from src/input/cursor.c here or add a public abstraction there which allows for such use. Then we would have the code in a central place.

An alternative approach could be to synthesize a usual cursor click but somehow prevent it from being forwarded to the actual surface. That might also have some issues though (like seat_set_pressed() tracking and the whole cursor_update_common() logic).

from labwc.

tokyo4j avatar tokyo4j commented on June 28, 2024 1

Something like this, in addition to #1550 ?

diff --git a/src/input/touch.c b/src/input/touch.c
index 1650059..048aaf2 100644
--- a/src/input/touch.c
+++ b/src/input/touch.c
@@ -7,6 +7,9 @@
 #include "idle.h"
 #include "input/touch.h"
 #include "labwc.h"
+#include "config/mousebind.h"
+#include "action.h"
+#include "view.h"
 
 /* Holds layout -> surface offsets to report motion events in relative coords */
 struct touch_point {
@@ -109,6 +112,16 @@ touch_down(struct wl_listener *listener, void *data)
 		double sx = lx - x_offset;
 		double sy = ly - y_offset;
 
+		struct view *view = view_from_wlr_surface(touch_point->surface);
+		struct mousebind *mousebind;
+		wl_list_for_each(mousebind, &rc.mousebinds, link) {
+			if (mousebind->mouse_event == MOUSE_ACTION_PRESS
+					&& mousebind->button == BTN_LEFT
+					&& mousebind->context == LAB_SSD_CLIENT) {
+				actions_run(view, seat->server, &mousebind->actions, 0);
+			}
+		}
+
 		wlr_seat_touch_notify_down(seat->seat, touch_point->surface,
 			event->time_msec, event->touch_id, sx, sy);
 	} else {

from labwc.

jp7677 avatar jp7677 commented on June 28, 2024

There is also view_move_to_front (https://github.com/labwc/labwc/blob/master/src/view.c#L1926), which might be an alternative, like:

struct view *view = view_from_wlr_surface(touch_point->surface);
if (view) {
    view_move_to_front(view);
}

That said, I'm not sure if that snippet is sufficient for focus management and guarding. There is also desktop_focus_view (https://github.com/labwc/labwc/blob/master/src/desktop.c#L41), but that on the other hand might be a bit overkill for every touch-down.

from labwc.

spl237 avatar spl237 commented on June 28, 2024

For the time being, I've added @tokyo4j 's suggestion to the existing PR to make headerbar touches work - I've tried it here and it seems to work for me; if it turns out not to be the best solution, we've at least got all the touch stuff on the same PR for now!

#1550

from labwc.

Consolatis avatar Consolatis commented on June 28, 2024

Thanks! Should be fixed by

from labwc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.