1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
--- dfb.c 2002-05-25 04:12:15.000000000 -0400
+++ ../../dfb.c 2002-07-06 10:20:21.000000000 -0400
@@ -18,7 +18,6 @@
*/
#include "directvnc.h"
-#include "keysymdef.h"
#include <math.h>
/* DirectFB interfaces needed */
@@ -61,14 +60,13 @@
/* FIXME */
dsc.pixelformat = DSPF_RGB16;
- dfb->CreateSurface(dfb, &dsc, &primary );
+ DFBCHECK(dfb->CreateSurface(dfb, &dsc, &primary ));
primary->GetSize (primary, &opt.client.width, &opt.client.height);
DFBCHECK(dfb->GetInputDevice( dfb, DIDID_KEYBOARD, &keyboard ));
DFBCHECK(dfb->GetInputDevice( dfb, DIDID_MOUSE, &mouse ));
DFBCHECK(keyboard->CreateEventBuffer(keyboard, &input_buffer));
DFBCHECK(mouse->AttachEventBuffer(mouse, input_buffer));
-
}
@@ -156,36 +154,23 @@
* screen gets blanked for every unsuccessful connect (wrong password)
* which is not pretty either. I think I prefer checking here for the time
* being. */
-
if (!dfb)
return 0;
-
while(input_buffer->GetEvent(input_buffer, DFB_EVENT(&evt)) == DFB_OK)
{
switch (evt.type)
{
case DIET_KEYPRESS:
- /* quit on ctrl-q */
- if (evt.key_ascii && evt.key_ascii == 113
- && evt.modifiers & DIMK_CTRL)
+ /* quit on ctrl-q FIXME make this configurable*/
+ if (evt.key_id == DIKI_Q && evt.modifiers & DIMM_CONTROL)
{
dfb_deinit();
exit(1);
}
- /* ascii 13 is CR. We want XK_Return, so dont send the ascii but
- * translate into keysym */
- if (evt.key_ascii && evt.key_ascii != 13)
- {
- rfb_send_key_event(evt.key_ascii, 1);
- }
- else
- rfb_send_key_event(dfb_get_keysym_from_keycode(evt.keycode, evt.modifiers), 1);
+ rfb_send_key_event(evt.key_symbol, 1);
break;
case DIET_KEYRELEASE:
- if (evt.key_ascii && evt.key_ascii != 13)
- rfb_send_key_event(evt.key_ascii, 0);
- else
- rfb_send_key_event(dfb_get_keysym_from_keycode(evt.keycode, evt.modifiers), 0);
+ rfb_send_key_event(evt.key_symbol, 0);
break;
case DIET_AXISMOTION:
if (evt.flags & DIEF_AXISREL)
@@ -250,75 +235,6 @@
}
int
-dfb_get_keysym_from_keycode(int keycode, int modifiers)
-{
-
- switch (keycode)
- {
- case DIKC_BACKSPACE: return XK_BackSpace;
- case DIKC_ENTER: return XK_Return;
- case DIKC_PAUSE: return XK_Pause;
- case DIKC_SCRLOCK: return XK_Scroll_Lock;
- case DIKC_CAPSLOCK: return XK_Caps_Lock;
- case DIKC_NUMLOCK: return XK_Num_Lock;
-
-
- case DIKC_ALT: return XK_Alt_L;
- case DIKC_ALTGR: return XK_Super_R;
- case DIKC_SHIFT: return XK_Shift_R;
- case DIKC_CTRL: return XK_Control_R;
- case DIKC_INSERT: return XK_Insert;
- case DIKC_DELETE: return XK_Delete;
-
- case DIKC_HOME: return XK_Home;
- case DIKC_LEFT: return XK_Left;
- case DIKC_RIGHT: return XK_Right;
- case DIKC_UP: return XK_Up;
- case DIKC_DOWN: return XK_Down;
- case DIKC_PAGEUP: return XK_Page_Up;
- case DIKC_PAGEDOWN: return XK_Page_Down;
- case DIKC_END: return XK_End;
-
- /* Keypad Keys */
- case DIKC_KP_PLUS: return XK_KP_Add;
- case DIKC_KP_MULT: return XK_KP_Multiply;
- case DIKC_KP_MINUS: return XK_KP_Subtract;
- case DIKC_KP_DIV: return XK_KP_Divide;
- case DIKC_KP_ENTER: return XK_KP_Enter;
- case DIKC_KP_SPACE: return XK_KP_Space;
- case DIKC_KP_TAB: return XK_KP_Tab;
-
- case DIKC_KP_0: return XK_KP_0;
- case DIKC_KP_1: return XK_KP_1;
- case DIKC_KP_2: return XK_KP_2;
- case DIKC_KP_3: return XK_KP_3;
- case DIKC_KP_4: return XK_KP_4;
- case DIKC_KP_5: return XK_KP_5;
- case DIKC_KP_6: return XK_KP_6;
- case DIKC_KP_7: return XK_KP_7;
- case DIKC_KP_8: return XK_KP_8;
- case DIKC_KP_9: return XK_KP_9;
-
- case DIKC_KP_DELETE: return XK_KP_Delete;
- case DIKC_KP_INSERT: return XK_KP_Insert;
- case DIKC_KP_END: return XK_KP_End;
- case DIKC_KP_DOWN: return XK_KP_Down;
- case DIKC_KP_PAGE_DOWN: return XK_KP_Page_Down;
- case DIKC_KP_LEFT: return XK_KP_Left;
- case DIKC_KP_BEGIN: return XK_KP_Begin;
- case DIKC_KP_RIGHT: return XK_KP_Right;
- case DIKC_KP_HOME: return XK_KP_Home;
- case DIKC_KP_UP: return XK_KP_Up;
- case DIKC_KP_PAGE_UP: return XK_KP_Page_Up;
-
- case DIKC_UNKNOWN:
- fprintf(stderr, "Unknown key pressed\n");
- }
-
- return -1;
-}
-
-int
dfb_draw_rect_with_rgb(int x, int y, int w, int h, int r, int g, int b)
{
primary->SetColor(primary, r,g,b,0xFF);
|