Skip to content

Commit 779e2d5

Browse files
committed
Fix Kivy's on_touch_down() - send modifiers for holding mouse button.
Add |modifiers| arg in API docs in Browser.SendMouse* methods.
1 parent 7b8d7e9 commit 779e2d5

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

api/Browser.md

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ for a description of the available keys.
566566
| mouseButtonType | int |
567567
| mouseUp | bool |
568568
| clickCount | int |
569+
| modifiers | int |
569570
| __Return__ | void |
570571

571572
Send a mouse click event to the browser. The |x| and |y| coordinates are relative to the upper-left corner of the view.
@@ -576,28 +577,21 @@ cefpython.`MOUSEBUTTON_LEFT`
576577
cefpython.`MOUSEBUTTON_MIDDLE`
577578
cefpython.`MOUSEBUTTON_RIGHT`
578579

579-
TODO: allow to pass modifiers which represents bit flags
580-
describing any pressed modifier keys. Modifiers can also
581-
be passed to SendMouseMoveEvent(), SendMouseWheelEvent().
582-
See cef_event_flags_t enum for modifiers values:
583-
584-
```
585-
enum cef_event_flags_t {
586-
EVENTFLAG_NONE = 0,
587-
EVENTFLAG_CAPS_LOCK_ON = 1 << 0,
588-
EVENTFLAG_SHIFT_DOWN = 1 << 1,
589-
EVENTFLAG_CONTROL_DOWN = 1 << 2,
590-
EVENTFLAG_ALT_DOWN = 1 << 3,
591-
EVENTFLAG_LEFT_MOUSE_BUTTON = 1 << 4,
592-
EVENTFLAG_MIDDLE_MOUSE_BUTTON = 1 << 5,
593-
EVENTFLAG_RIGHT_MOUSE_BUTTON = 1 << 6,
594-
// Mac OS-X command key.
595-
EVENTFLAG_COMMAND_DOWN = 1 << 7,
596-
EVENTFLAG_NUM_LOCK_ON = 1 << 8,
597-
EVENTFLAG_IS_KEY_PAD = 1 << 9,
598-
EVENTFLAG_IS_LEFT = 1 << 10,
599-
EVENTFLAG_IS_RIGHT = 1 << 11,
600-
```
580+
`modifiers` flags:
581+
582+
* EVENTFLAG_NONE
583+
* EVENTFLAG_CAPS_LOCK_ON
584+
* EVENTFLAG_SHIFT_DOWN
585+
* EVENTFLAG_CONTROL_DOWN
586+
* EVENTFLAG_ALT_DOWN
587+
* EVENTFLAG_LEFT_MOUSE_BUTTON
588+
* EVENTFLAG_MIDDLE_MOUSE_BUTTON
589+
* EVENTFLAG_RIGHT_MOUSE_BUTTON
590+
* EVENTFLAG_COMMAND_DOWN (Mac)
591+
* EVENTFLAG_NUM_LOCK_ON (Mac)
592+
* EVENTFLAG_IS_KEY_PAD (Mac)
593+
* EVENTFLAG_IS_LEFT (Mac)
594+
* EVENTFLAG_IS_RIGHT (Mac)
601595

602596

603597
### SendMouseMoveEvent
@@ -607,9 +601,12 @@ enum cef_event_flags_t {
607601
| x | int |
608602
| y | int |
609603
| mouseLeave | bool |
604+
| modifiers | int |
610605
| __Return__ | void |
611606

612-
Send a mouse move event to the browser. The |x| and |y| coordinates are relative to the upper-left corner of the view.
607+
Send a mouse move event to the browser. The |x| and |y| coordinates are
608+
relative to the upper-left corner of the view. For a list of modifiers
609+
flags see SendMouseClickEvent().
613610

614611

615612
### SendMouseWheelEvent
@@ -620,9 +617,10 @@ Send a mouse move event to the browser. The |x| and |y| coordinates are relative
620617
| y | int |
621618
| deltaX | int |
622619
| deltaY | int |
620+
| modifiers | int |
623621
| __Return__ | void |
624622

625-
Send a mouse wheel event to the browser. The |x| and |y| coordinates are relative to the upper-left corner of the view. The |deltaX| and |deltaY| values represent the movement delta in the X and Y directions respectively. In order to scroll inside select popups with window rendering disabled [RenderHandler](RenderHandler.md).GetScreenPoint() should be implemented properly.
623+
Send a mouse wheel event to the browser. The |x| and |y| coordinates are relative to the upper-left corner of the view. The |deltaX| and |deltaY| values represent the movement delta in the X and Y directions respectively. In order to scroll inside select popups with window rendering disabled [RenderHandler](RenderHandler.md).GetScreenPoint() should be implemented properly. For a list of modifiers flags see SendMouseClickEvent().
626624

627625

628626
### SendFocusEvent

src/linux/binaries_64bit/kivy_.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,9 @@ def on_touch_move(self, touch, *kwargs):
561561
return
562562

563563
y = self.height-touch.pos[1]
564-
self.browser.SendMouseMoveEvent(touch.x, y, mouseLeave=False)
564+
modifiers = cefpython.EVENTFLAG_LEFT_MOUSE_BUTTON
565+
self.browser.SendMouseMoveEvent(touch.x, y, mouseLeave=False,
566+
modifiers=modifiers)
565567

566568

567569
def on_touch_up(self, touch, *kwargs):

0 commit comments

Comments
 (0)