author | Radek Brich <radek.brich@devl.cz> |
Wed, 30 Jan 2013 19:44:01 +0100 | |
changeset 72 | 6e0656600754 |
parent 71 | cfd3445107b4 |
child 73 | 85a282b5e4fc |
permissions | -rw-r--r-- |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
1 |
# distutils: language = c++ |
69
4e7be77bafff
Add sdlterm to setup.py. Simplify color description, allow missing bg.
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
2 |
# distutils: sources = sdlterm/src/sdlterm.cc |
4e7be77bafff
Add sdlterm to setup.py. Simplify color description, allow missing bg.
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
3 |
# distutils: include_dirs = /usr/include/SDL sdlterm/src |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
4 |
# distutils: libraries = SDL SDL_ttf |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
5 |
# distutils: define_macros = _GNU_SOURCE=1 _REENTRANT |
49
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
6 |
# distutils: extra_compile_args = --std=c++11 |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
7 |
# cython: language_level=3 |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
8 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
9 |
from libcpp cimport bool |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
10 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
11 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
12 |
cdef extern from "sdlterm.h": |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
13 |
cdef struct Event_key: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
14 |
char *keyname |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
15 |
Py_UNICODE unicode |
67
71f60bf6ebb7
DriverSDL: add support for key modifiers.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
16 |
int mod |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
17 |
|
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
18 |
cdef struct Event_mouse: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
19 |
int x, y |
71
cfd3445107b4
Report mousemove relative position change. Window: when in AnchorLayout, aligned right/bottom - fix resizing by mouse to behave as expected.
Radek Brich <radek.brich@devl.cz>
parents:
69
diff
changeset
|
20 |
int relx, rely |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
21 |
int button |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
22 |
|
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
23 |
cdef struct Event: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
24 |
# enum |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
25 |
int QUIT |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
26 |
int RESIZE |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
27 |
int KEYPRESS |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
28 |
int MOUSEDOWN |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
29 |
int MOUSEUP |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
30 |
int MOUSEMOVE |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
31 |
int MOUSEWHEEL |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
32 |
|
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
33 |
int type |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
34 |
Event_key key |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
35 |
Event_mouse mouse |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
36 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
37 |
cdef cppclass Terminal: |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
38 |
Terminal() except + |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
39 |
|
49
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
40 |
void select_font(char *fname_regular, char *fname_bold, int ptsize) except + |
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
41 |
void resize(int pxwidth, int pxheight) except + |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
42 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
43 |
void erase() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
44 |
void putch(int x, int y, Py_UNICODE ch) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
45 |
void commit() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
46 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
47 |
int prepare_attr(int fg, int bg, int style) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
48 |
void set_attr(int value) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
49 |
|
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
50 |
void show_cursor(int x, int y) |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
51 |
void hide_cursor() |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
52 |
|
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
53 |
bool wait_event(Event event, int timeout) except + |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
54 |
|
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
55 |
int get_width() |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
56 |
int get_height() |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
57 |
|
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
58 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
59 |
cdef class SDLTerminal: |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
60 |
cdef Terminal *thisptr # hold a C++ instance which we're wrapping |
49
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
61 |
cdef Event event |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
62 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
63 |
def __cinit__(self): |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
64 |
self.thisptr = new Terminal() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
65 |
def __dealloc__(self): |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
66 |
del self.thisptr |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
67 |
|
54
86b84535726e
DriverSDL: system font lookup.
Radek Brich <radek.brich@devl.cz>
parents:
53
diff
changeset
|
68 |
def select_font(self, bytes fname_regular, bytes fname_bold, int ptsize): |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
69 |
self.thisptr.select_font(fname_regular, fname_bold, ptsize) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
70 |
def resize(self, width, height): |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
71 |
self.thisptr.resize(width, height) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
72 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
73 |
def erase(self): |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
74 |
self.thisptr.erase() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
75 |
def putch(self, x, y, ch): |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
76 |
self.thisptr.putch(x, y, ch) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
77 |
def commit(self): |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
78 |
self.thisptr.commit() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
79 |
|
50
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
80 |
def prepare_attr(self, fg, bg, style): |
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
81 |
return self.thisptr.prepare_attr(fg, bg, style) |
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
82 |
def set_attr(self, value): |
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
83 |
self.thisptr.set_attr(value) |
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
84 |
|
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
85 |
def show_cursor(self, x, y): |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
86 |
self.thisptr.show_cursor(x, y) |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
87 |
def hide_cursor(self): |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
88 |
self.thisptr.hide_cursor() |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
89 |
|
69
4e7be77bafff
Add sdlterm to setup.py. Simplify color description, allow missing bg.
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
90 |
def wait_event(self, timeout=None): |
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
91 |
if not self.thisptr.wait_event(self.event, timeout or 0): |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
92 |
# timeout |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
93 |
return None |
49
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
94 |
event = self.event |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
95 |
if event.type == event.MOUSEMOVE: |
71
cfd3445107b4
Report mousemove relative position change. Window: when in AnchorLayout, aligned right/bottom - fix resizing by mouse to behave as expected.
Radek Brich <radek.brich@devl.cz>
parents:
69
diff
changeset
|
96 |
return ('mousemove', 0, event.mouse.x, event.mouse.y, event.mouse.relx, event.mouse.rely) |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
97 |
if event.type == event.MOUSEDOWN: |
71
cfd3445107b4
Report mousemove relative position change. Window: when in AnchorLayout, aligned right/bottom - fix resizing by mouse to behave as expected.
Radek Brich <radek.brich@devl.cz>
parents:
69
diff
changeset
|
98 |
return ('mousedown', event.mouse.button, event.mouse.x, event.mouse.y) |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
99 |
if event.type == event.MOUSEUP: |
71
cfd3445107b4
Report mousemove relative position change. Window: when in AnchorLayout, aligned right/bottom - fix resizing by mouse to behave as expected.
Radek Brich <radek.brich@devl.cz>
parents:
69
diff
changeset
|
100 |
return ('mouseup', event.mouse.button, event.mouse.x, event.mouse.y) |
55
1ab0edd5d784
DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
54
diff
changeset
|
101 |
if event.type == event.MOUSEWHEEL: |
71
cfd3445107b4
Report mousemove relative position change. Window: when in AnchorLayout, aligned right/bottom - fix resizing by mouse to behave as expected.
Radek Brich <radek.brich@devl.cz>
parents:
69
diff
changeset
|
102 |
return ('mousewheel', event.mouse.button, event.mouse.x, event.mouse.y) |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
103 |
if event.type == event.KEYPRESS: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
104 |
keyname = event.key.keyname |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
105 |
if keyname: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
106 |
keyname = keyname.decode() |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
107 |
else: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
108 |
keyname = None |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
109 |
char = event.key.unicode |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
110 |
if char == '\x00': |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
111 |
char = None |
67
71f60bf6ebb7
DriverSDL: add support for key modifiers.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
112 |
mod = event.key.mod |
71f60bf6ebb7
DriverSDL: add support for key modifiers.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
113 |
return ('keypress', keyname, char, mod) |
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
114 |
if event.type == event.RESIZE: |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
115 |
return ('resize',) |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
116 |
if event.type == event.QUIT: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
117 |
return ('quit',) |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
118 |
return ('unknown',) |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
119 |
|
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
120 |
property width: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
121 |
def __get__(self): return self.thisptr.get_width() |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
122 |
property height: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
123 |
def __get__(self): return self.thisptr.get_height() |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
124 |