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