Subversion Repositories Kolibri OS

Rev

Rev 3622 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3622 Rev 4224
Line 38... Line 38...
38
asm ("int $0x40"::"a"(65));
38
asm ("int $0x40"::"a"(65));
39
asm("popa");
39
asm("popa");
40
}
40
}
Line -... Line 41...
-
 
41
 
-
 
42
 
-
 
43
unsigned kol_mouse_posw()
-
 
44
{
-
 
45
unsigned error;
-
 
46
asm volatile ("int $0x40":"=a"(error):"a"(37), "b"(1));
-
 
47
return error;
-
 
48
}
-
 
49
 
-
 
50
 
-
 
51
unsigned kol_mouse_btn()
-
 
52
{
-
 
53
unsigned error;
-
 
54
asm volatile ("int $0x40":"=a"(error):"a"(37), "b"(2));
-
 
55
return error;
-
 
56
}
-
 
57
 
-
 
58
unsigned kol_scancodes()
-
 
59
{
-
 
60
unsigned error;
-
 
61
asm volatile ("int $0x40":"=a"(error):"a"(66), "b"(1), "c"(1));
-
 
62
return error;
-
 
63
}
41
 
64
 
Line 42... Line 65...
42
 
65
 
Line 43... Line 66...
43
void kolibri_redraw(nsfb_t *nsfb){
66
void kolibri_redraw(nsfb_t *nsfb){
Line -... Line 67...
-
 
67
	
-
 
68
 
-
 
69
 f65(0,0, nsfb->width, nsfb->height, pixels);
-
 
70
 
-
 
71
}
-
 
72
 
-
 
73
 
-
 
74
unsigned kol_skin_h()
-
 
75
{
-
 
76
unsigned error;
-
 
77
asm volatile ("int $0x40":"=a"(error):"a"(48), "b"(4));
-
 
78
return error;
-
 
79
}
-
 
80
 
-
 
81
unsigned kol_area(char *data)
-
 
82
{
44
	
83
unsigned error;
Line 45... Line 84...
45
 
84
asm volatile ("int $0x40":"=a"(error):"a"(9), "b"(data), "c"(0xffffffff));
46
 f65(0,0, nsfb->width, nsfb->height, pixels);
85
return error;
47
 
86
}
48
}
87
 
Line 49... Line 88...
49
 
88
 
50
void kolibri_window_redraw(nsfb_t *nsfb){
89
void kolibri_window_redraw(nsfb_t *nsfb){
51
	
90
	
-
 
91
 __menuet__window_redraw(1);
-
 
92
 __menuet__define_window(100,100,nsfb->width+9,nsfb->height+kol_skin_h(),0x34000080,0x800000FF,"Netsurf");
-
 
93
 //__menuet__write_text(3,3,0xFFFFFF,"Netsurf",7);
52
 __menuet__window_redraw(1);
94
//__menuet__debug_out("f65 is mighty!\n");
Line 53... Line 95...
53
 __menuet__define_window(100,100,nsfb->width,nsfb->height,0x43000080,0x800000FF,0x000080);
95
 
Line 82... Line 124...
82
    tx = dstbox->x0;
124
    tx = dstbox->x0;
83
    ty = dstbox->y0;
125
    ty = dstbox->y0;
84
    tw = dstbox->x1 - dstbox->x0;
126
    tw = dstbox->x1 - dstbox->x0;
85
    th = dstbox->y1 - dstbox->y0;
127
    th = dstbox->y1 - dstbox->y0;
Line 86... Line 128...
86
    
128
    
87
    char pst[255];
129
   // char pst[255];
88
    sprintf (pst, "Src %d,%d %dx%d Dst %d,%d %dx%d \n", x,y,w,h,tx,ty,tw,th);
130
  //  sprintf (pst, "Src %d,%d %dx%d Dst %d,%d %dx%d \n", x,y,w,h,tx,ty,tw,th);
Line 89... Line 131...
89
    __menuet__debug_out(pst);
131
   // __menuet__debug_out(pst);
Line 133... Line 175...
133
 
175
 
134
static int kolibri_initialise(nsfb_t *nsfb)
176
static int kolibri_initialise(nsfb_t *nsfb)
135
{
177
{
Line -... Line 178...
-
 
178
    enum nsfb_format_e fmt;
-
 
179
 
136
    enum nsfb_format_e fmt;
180
	kol_scancodes(); 
137
 
181
 
Line 138... Line 182...
138
pz=0;
182
pz=0;
Line 185... Line 229...
185
    __menuet__sys_exit();
229
    __menuet__sys_exit();
186
    return 0;
230
    return 0;
187
}
231
}
Line 188... Line -...
188
 
-
 
189
 
232
 
190
unsigned kol_mouse_posw()
233
 
191
{
-
 
192
unsigned error;
234
 
193
asm volatile ("int $0x40":"=a"(error):"a"(37), "b"(1));
235
int isup(int scan){
Line -... Line 236...
-
 
236
	return (scan&0x80)>>7;
-
 
237
}
-
 
238
 
-
 
239
int scan2key(int scan){
-
 
240
	int keycode=(scan&0x0FF7F);
-
 
241
	/* MAIN KB - NUMS */
-
 
242
	if (keycode == 0x02) return NSFB_KEY_1;
-
 
243
	if (keycode == 0x03) return NSFB_KEY_2;
-
 
244
	if (keycode == 0x04) return NSFB_KEY_3;
-
 
245
	if (keycode == 0x05) return NSFB_KEY_4;
-
 
246
	if (keycode == 0x06) return NSFB_KEY_5;
-
 
247
	if (keycode == 0x07) return NSFB_KEY_6;
-
 
248
	if (keycode == 0x08) return NSFB_KEY_7;
-
 
249
	if (keycode == 0x09) return NSFB_KEY_8;
-
 
250
	if (keycode == 0x0A) return NSFB_KEY_9;
-
 
251
	if (keycode == 0x0B) return NSFB_KEY_0;
-
 
252
	
-
 
253
	if (keycode == 0x10) return NSFB_KEY_q;
-
 
254
	if (keycode == 0x11) return NSFB_KEY_w;
-
 
255
	if (keycode == 0x12) return NSFB_KEY_e;
-
 
256
	if (keycode == 0x13) return NSFB_KEY_r;
-
 
257
	if (keycode == 0x14) return NSFB_KEY_t;
-
 
258
	if (keycode == 0x15) return NSFB_KEY_y;
-
 
259
	if (keycode == 0x16) return NSFB_KEY_u;
-
 
260
	if (keycode == 0x17) return NSFB_KEY_i;
-
 
261
	if (keycode == 0x18) return NSFB_KEY_o;
-
 
262
	if (keycode == 0x19) return NSFB_KEY_p;
-
 
263
	if (keycode == 0x1A) return NSFB_KEY_LEFTBRACKET;
-
 
264
	if (keycode == 0x1B) return NSFB_KEY_RIGHTBRACKET;
-
 
265
	
-
 
266
	if (keycode == 0x1E) return NSFB_KEY_a;
-
 
267
	if (keycode == 0x1F) return NSFB_KEY_s;
-
 
268
	if (keycode == 0x20) return NSFB_KEY_d;
-
 
269
	if (keycode == 0x21) return NSFB_KEY_f;
-
 
270
	if (keycode == 0x22) return NSFB_KEY_g;
-
 
271
	if (keycode == 0x23) return NSFB_KEY_h;
-
 
272
	if (keycode == 0x24) return NSFB_KEY_j;
-
 
273
	if (keycode == 0x25) return NSFB_KEY_k;
-
 
274
	if (keycode == 0x26) return NSFB_KEY_l;
-
 
275
	
-
 
276
	if (keycode == 0x2C) return NSFB_KEY_z;
-
 
277
	if (keycode == 0x2D) return NSFB_KEY_x;
-
 
278
	if (keycode == 0x2E) return NSFB_KEY_c;
-
 
279
	if (keycode == 0x2F) return NSFB_KEY_v;
-
 
280
	if (keycode == 0x30) return NSFB_KEY_b;
-
 
281
	if (keycode == 0x31) return NSFB_KEY_n;
-
 
282
	if (keycode == 0x32) return NSFB_KEY_m;
-
 
283
	
-
 
284
	if (keycode == 0x27) return NSFB_KEY_SEMICOLON;
-
 
285
	if (keycode == 0x28) return NSFB_KEY_QUOTEDBL;
-
 
286
	if (keycode == 0x2B) return NSFB_KEY_BACKSLASH;
-
 
287
	if (keycode == 0x33) return NSFB_KEY_COMMA;
-
 
288
	if (keycode == 0x34) return NSFB_KEY_PERIOD;
-
 
289
	if (keycode == 0x35) return NSFB_KEY_SLASH;
-
 
290
	if (keycode == 0x0C) return NSFB_KEY_MINUS;
-
 
291
	if (keycode == 0x0D) return NSFB_KEY_EQUALS;
-
 
292
	
-
 
293
	if (keycode == 0x0E) return NSFB_KEY_BACKSPACE;
-
 
294
	if (keycode == 0xE053) return NSFB_KEY_DELETE;
-
 
295
	if (keycode == 0x2A) return NSFB_KEY_LSHIFT;
-
 
296
	if (keycode == 0x36) return NSFB_KEY_RSHIFT;
-
 
297
	
-
 
298
	if (keycode == 0x1C) return NSFB_KEY_RETURN;
-
 
299
	
-
 
300
	if (keycode == 0xE04B) return NSFB_KEY_LEFT;
-
 
301
	if (keycode == 0xE04D) return NSFB_KEY_RIGHT;
-
 
302
	if (keycode == 0xE048) return NSFB_KEY_UP;
-
 
303
	if (keycode == 0xE050) return NSFB_KEY_DOWN;
-
 
304
	
-
 
305
	if (keycode == 0x3F) return NSFB_KEY_F5;
-
 
306
	
-
 
307
	if (keycode == 0x39) return NSFB_KEY_SPACE;
-
 
308
	if (keycode == 0x01) return NSFB_KEY_ESCAPE;
-
 
309
	
-
 
310
	if (keycode == 0x38) return NSFB_KEY_LALT;
-
 
311
	if (keycode == 0x1D) return NSFB_KEY_LCTRL;
-
 
312
	if (keycode == 0xE038) return NSFB_KEY_RALT;
-
 
313
	if (keycode == 0xE01D) return NSFB_KEY_RCTRL;
-
 
314
	
-
 
315
	
-
 
316
	if (keycode == 0xE047) return NSFB_KEY_HOME;
-
 
317
	if (keycode == 0xE04F) return NSFB_KEY_END;
-
 
318
	if (keycode == 0xE049) return NSFB_KEY_PAGEUP;
Line 194... Line -...
194
return error;
-
 
195
}
-
 
196
 
-
 
197
 
-
 
198
unsigned kol_mouse_btn()
-
 
199
{
319
	if (keycode == 0xE051) return NSFB_KEY_PAGEDOWN;
Line -... Line 320...
-
 
320
	
-
 
321
	return NSFB_KEY_UNKNOWN;
-
 
322
	
Line 200... Line 323...
200
unsigned error;
323
}
201
asm volatile ("int $0x40":"=a"(error):"a"(37), "b"(2));
324
 
202
return error;
325
int ispowerkey(int scan){
203
}
-
 
-
 
326
	return (scan&0xE000)>>15;
Line 204... Line 327...
204
 
327
}
Line -... Line 328...
-
 
328
 
205
 
329
 
Line 206... Line 330...
206
 
330
static bool kolibri_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout)
207
static bool kolibri_input(nsfb_t *nsfb, nsfb_event_t *event, int timeout)
331
{
208
{
332
    int got_event;
Line 223... Line 347...
223
    kolibri_window_redraw(nsfb);
347
    kolibri_window_redraw(nsfb);
Line 224... Line 348...
224
	
348
	
Line 225... Line 349...
225
	}
349
	}
-
 
350
 
-
 
351
    if (got_event==2) { //key pressed
-
 
352
    int scanz = __menuet__getkey();
-
 
353
    
-
 
354
    //char dbs[64];
-
 
355
    
-
 
356
    //__menuet__debug_out("KEY PRESSED\n");
-
 
357
    
-
 
358
   // sprintf (dbs, "FULLKEY BEFORE: F:%x\n", scanfull);
-
 
359
	//__menuet__debug_out(dbs);
-
 
360
	
-
 
361
	if (scanz==0xE0) {
-
 
362
		scanfull=0xE000;
-
 
363
		return true;
-
 
364
	} else {
-
 
365
		scanfull=scanfull+scanz;
-
 
366
	}
-
 
367
	
-
 
368
    //sprintf (dbs, "FULLKEY AFTER: F:%x\n", scanfull);
-
 
369
	//__menuet__debug_out(dbs);
-
 
370
    
-
 
371
    
226
 
372
	if (isup(scanfull)==1) {
-
 
373
	event->type = NSFB_EVENT_KEY_UP;} else {
227
    if (got_event==2) { //key pressed
374
	event->type = NSFB_EVENT_KEY_DOWN;}
-
 
375
		
-
 
376
	event->value.keycode = scan2key(scanfull);
-
 
377
	
-
 
378
	//sprintf (dbs, "KEY: %x F:%x %d %d\n", scanz, scanfull, isup(scanz), scan2key(scanz));
-
 
379
	//__menuet__debug_out(dbs);
-
 
380
	
228
    event->type = NSFB_EVENT_KEY_UP;
381
	scanfull=0;
-
 
382
	
229
	event->value.keycode = __menuet__getkey();
383
	return true;
Line 230... Line 384...
230
	return true;
384
 
231
	}
385
	}
232
	
386