@@ 397-410 (lines=14) @@ | ||
394 | input_str += '<{0},{1}>'.format(col, row) |
|
395 | self._bridge.input(input_str) |
|
396 | ||
397 | def _gtk_scroll(self, widget, event, *args): |
|
398 | if not self._mouse_enabled: |
|
399 | return |
|
400 | col = int(math.floor(event.x / self._cell_pixel_width)) |
|
401 | row = int(math.floor(event.y / self._cell_pixel_height)) |
|
402 | if event.direction == Gdk.ScrollDirection.UP: |
|
403 | key = 'ScrollWheelUp' |
|
404 | elif event.direction == Gdk.ScrollDirection.DOWN: |
|
405 | key = 'ScrollWheelDown' |
|
406 | else: |
|
407 | return |
|
408 | input_str = _stringify_key(key, event.state) |
|
409 | input_str += '<{0},{1}>'.format(col, row) |
|
410 | self._bridge.input(input_str) |
|
411 | ||
412 | def _gtk_focus_in(self, *a): |
|
413 | self._im_context.focus_in() |
|
@@ 370-383 (lines=14) @@ | ||
367 | def _gtk_key_release(self, widget, event, *args): |
|
368 | self._im_context.filter_keypress(event) |
|
369 | ||
370 | def _gtk_button_press(self, widget, event, *args): |
|
371 | if not self._mouse_enabled or event.type != Gdk.EventType.BUTTON_PRESS: |
|
372 | return |
|
373 | button = 'Left' |
|
374 | if event.button == 2: |
|
375 | button = 'Middle' |
|
376 | elif event.button == 3: |
|
377 | button = 'Right' |
|
378 | col = int(math.floor(event.x / self._cell_pixel_width)) |
|
379 | row = int(math.floor(event.y / self._cell_pixel_height)) |
|
380 | input_str = _stringify_key(button + 'Mouse', event.state) |
|
381 | input_str += '<{0},{1}>'.format(col, row) |
|
382 | self._bridge.input(input_str) |
|
383 | self._pressed = button |
|
384 | ||
385 | def _gtk_button_release(self, widget, event, *args): |
|
386 | self._pressed = None |