Subversion Repositories Kolibri OS

Rev

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

Rev 276 Rev 281
Line 268... Line 268...
268
           jz .fail
268
           jz .fail
269
 
269
 
Line 270... Line 270...
270
           xor ebx, ebx
270
           xor ebx, ebx
271
           mov [eax+CURSOR.magic], 'CURS'
271
           mov [eax+CURSOR.magic], 'CURS'
272
           mov [eax+CURSOR.size],  CURSOR_SIZE
272
;           mov [eax+CURSOR.destructor],  CURSOR_SIZE
273
           mov [eax+CURSOR.pid], ebx
273
           mov [eax+CURSOR.pid], ebx
274
           mov [eax+CURSOR.hot_x], ebx
274
           mov [eax+CURSOR.hot_x], ebx
275
           mov [eax+CURSOR.hot_y], ebx
275
           mov [eax+CURSOR.hot_y], ebx
276
.fail:
276
.fail:
277
           ret
277
           ret
Line 278... Line -...
278
 
-
 
279
if 0
-
 
280
 
-
 
281
align 4
-
 
282
proc alloc_cursor
-
 
283
 
-
 
284
           pushfd
-
 
285
           cli
-
 
286
           mov ebx, [cursor_start]
-
 
287
           mov ecx, [cursor_end]
-
 
288
.l1:
-
 
289
           bsf eax,[ebx];
-
 
290
           jnz .found
-
 
291
           add ebx,4
-
 
292
           cmp ebx, ecx
-
 
293
           jb .l1
-
 
294
           popfd
-
 
295
           xor eax,eax
-
 
296
           ret
-
 
297
.found:
-
 
298
           btr [ebx], eax
-
 
299
           popfd
-
 
300
 
-
 
301
           mov [cursor_start],ebx
-
 
302
           sub ebx, cursor_map
-
 
303
           lea eax,[eax+ebx*8]
-
 
304
           shl eax,3
-
 
305
           lea eax,[cursors+eax+eax*2]
-
 
306
 
-
 
307
           xor ebx, ebx
-
 
308
           mov [eax+CURSOR.magic], 'CURS'
-
 
309
           mov [eax+CURSOR.size],  CURSOR_SIZE
-
 
310
           mov [eax+CURSOR.pid], ebx
-
 
311
           mov [eax+CURSOR.hot_x], ebx
-
 
312
           mov [eax+CURSOR.hot_y], ebx
-
 
313
           ret
-
 
314
endp
-
 
315
 
-
 
316
 
-
 
317
align 4
-
 
318
proc free_cursor
-
 
319
           pushfd
-
 
320
           cli
-
 
321
           xor edx, edx
-
 
322
           mov ecx, CURSOR_SIZE
-
 
323
           sub eax, cursors
-
 
324
           div ecx
-
 
325
           test edx, edx
-
 
326
           jnz .exit
-
 
327
 
-
 
328
           mov ebx, cursor_map
-
 
329
           bts [ebx], eax
-
 
330
           shr eax, 3
-
 
331
           and eax, not 3
-
 
332
           add eax, ebx
-
 
333
           cmp [cursor_start], eax
-
 
334
           ja @f
-
 
335
.exit:
-
 
336
           popfd
-
 
337
           ret
-
 
338
@@:
-
 
339
           mov [cursor_start], eax
-
 
340
           popfd
-
 
341
           ret
-
 
342
endp
-
 
343
 
-
 
344
end if
-
 
345
 
278
 
346
align 4
279
align 4
347
proc set_cursor stdcall, hcursor:dword
280
proc set_cursor stdcall, hcursor:dword
348
           mov eax, [hcursor]
281
           mov eax, [hcursor]
349
           cmp [eax+CURSOR.magic], 'CURS'
282
           cmp [eax+CURSOR.magic], 'CURS'
350
           jne .fail
283
           jne .fail
351
           cmp [eax+CURSOR.size], CURSOR_SIZE
284
;           cmp [eax+CURSOR.size], CURSOR_SIZE
352
           jne .fail
285
;           jne .fail
353
           mov ebx, [CURRENT_TASK]
286
           mov ebx, [CURRENT_TASK]
354
           shl ebx, 8
287
           shl ebx, 8
355
           xchg eax, [ebx+PROC_BASE+APPDATA.cursor]
288
           xchg eax, [ebx+PROC_BASE+APPDATA.cursor]
356
           ret
289
           ret
Line 361... Line 294...
361
           xchg eax, [ebx+PROC_BASE+APPDATA.cursor]
294
           xchg eax, [ebx+PROC_BASE+APPDATA.cursor]
362
           ret
295
           ret
363
endp
296
endp
364
 
297
 
Line -... Line 298...
-
 
298
; param
-
 
299
;  eax= pid
-
 
300
;  ebx= src
-
 
301
;  ecx= flags
-
 
302
 
-
 
303
vesa_cursor:
-
 
304
.src     equ esp
-
 
305
.flags   equ esp+4
-
 
306
.hcursor equ esp+8
-
 
307
 
-
 
308
           sub esp, 4          ;space for .hcursor
-
 
309
           push ecx
-
 
310
           push ebx
-
 
311
 
-
 
312
           mov ebx, eax
-
 
313
           mov eax, CURSOR_SIZE
-
 
314
           call create_kernel_object
-
 
315
           test eax, eax
-
 
316
           jz .fail
-
 
317
 
-
 
318
           mov [.hcursor],eax
-
 
319
 
-
 
320
           xor ebx, ebx
-
 
321
           mov [eax+CURSOR.magic], 'CURS'
365
proc vesa_cursor stdcall, hcursor:dword, src:dword, flags:dword
322
           mov [eax+CURSOR.destroy], destroy_cursor
-
 
323
           mov [eax+CURSOR.hot_x], ebx
-
 
324
           mov [eax+CURSOR.hot_y], ebx
Line 366... Line 325...
366
 
325
 
367
           stdcall kernel_alloc, 0x1000
326
           stdcall kernel_alloc, 0x1000
368
           test eax, eax
327
           test eax, eax
Line 369... Line 328...
369
           jz .fail
328
           jz .fail
370
 
329
 
Line 371... Line 330...
371
           mov edi, [hcursor]
330
           mov edi, [.hcursor]
372
           mov [edi+CURSOR.base], eax
331
           mov [edi+CURSOR.base], eax
373
 
332
 
374
           mov esi, [src]
333
           mov esi, [.src]
Line 375... Line 334...
375
           mov ebx, [flags]
334
           mov ebx, [.flags]
376
           cmp bx, LOAD_INDIRECT
335
           cmp bx, LOAD_INDIRECT
377
           je .indirect
336
           je .indirect
378
 
337
 
Line 379... Line 338...
379
           movzx ecx, word [esi+10]
338
           movzx ecx, word [esi+10]
380
           movzx edx, word [esi+12]
339
           movzx edx, word [esi+12]
381
           mov [edi+CURSOR.hot_x], ecx
340
           mov [edi+CURSOR.hot_x], ecx
-
 
341
           mov [edi+CURSOR.hot_y], edx
382
           mov [edi+CURSOR.hot_y], edx
342
 
383
 
343
           stdcall vesa_init_cursor, eax, esi
384
           stdcall vesa_init_cursor, eax, esi
344
           mov eax, [.hcursor]
385
           mov eax, [hcursor]
345
.fail:
386
.fail:
346
           add esp, 12
Line 395... Line 355...
395
           xchg edi, eax
355
           xchg edi, eax
396
           mov ecx, 1024
356
           mov ecx, 1024
397
           cld
357
           cld
398
           rep movsd
358
           rep movsd
-
 
359
           add esp, 12
399
           ret
360
           ret
400
endp
-
 
Line 401... Line 361...
401
 
361
 
402
align 4
362
align 4
403
proc load_cursor stdcall, src:dword, flags:dword
363
proc load_cursor stdcall, src:dword, flags:dword
404
           locals
364
           locals
Line 414... Line 374...
414
           test eax, eax
374
           test eax, eax
415
           jz .exit
375
           jz .exit
416
           mov [src], eax
376
           mov [src], eax
417
@@:
377
@@:
418
           call alloc_cursor
378
           mov eax, [CURRENT_TASK]
419
           test eax, eax
379
           shl eax, 5
420
           jz .fail
380
           mov eax, [0x3000+eax+4]
421
 
-
 
422
           mov ebx, [CURRENT_TASK]
-
 
423
           shl ebx, 5
381
           mov ebx, [src]
424
           mov ebx, [0x3000+ebx+4]
382
           mov ecx, [flags]
425
           mov [eax+CURSOR.pid], ebx
383
           call [create_cursor]    ;eax, ebx, ecx
426
 
-
 
427
           stdcall [create_cursor], eax, [src], [flags]
-
 
428
           mov [handle], eax
384
           mov [handle], eax
429
.fail:
385
.fail:
430
           cmp word [flags], LOAD_FROM_FILE
386
           cmp word [flags], LOAD_FROM_FILE
431
           jne .exit
387
           jne .exit
432
           stdcall kernel_free, [src]
388
           stdcall kernel_free, [src]
433
.exit:
389
.exit:
Line 448... Line 404...
448
 
404
 
Line 449... Line 405...
449
           mov esi, [hcursor]
405
           mov esi, [hcursor]
450
           cmp [esi+CURSOR.magic], 'CURS'
406
           cmp [esi+CURSOR.magic], 'CURS'
451
           jne .fail
407
           jne .fail
452
           cmp [esi+CURSOR.size], CURSOR_SIZE
408
;           cmp [esi+CURSOR.size], CURSOR_SIZE
453
           jne .fail
409
;           jne .fail
Line 454... Line 410...
454
 
410
 
455
           mov ebx, [CURRENT_TASK]
411
           mov ebx, [CURRENT_TASK]
456
           shl ebx, 5
412
           shl ebx, 5
457
           mov ebx, [0x3000+ebx+4]
413
           mov ebx, [0x3000+ebx+4]
Line 464... Line 420...
464
           jne @F
420
           jne @F
465
           mov eax, [def_cursor]
421
           mov eax, [def_cursor]
466
           mov [ebx+PROC_BASE+APPDATA.cursor], eax
422
           mov [ebx+PROC_BASE+APPDATA.cursor], eax
467
@@:
423
@@:
468
           mov eax, [hw_cursor]
424
           mov eax, [hcursor]
469
           test eax, eax
-
 
470
           jz @F
-
 
471
 
-
 
472
           xor ebx, ebx
-
 
473
           mov ecx, [esi+CURSOR.base]
-
 
474
           mov [hsrv], eax
-
 
475
           mov [io_code], VIDEO_FREE
-
 
476
           mov [input], ecx
-
 
477
           mov [inp_size], 4
-
 
478
           mov [output], ebx
-
 
479
           mov [out_size], ebx
-
 
480
 
-
 
481
           lea eax, [hsrv]
-
 
482
           stdcall srv_handler, eax
-
 
483
           jmp .exit
-
 
484
@@:
-
 
485
           stdcall kernel_free, [esi+CURSOR.base]
-
 
486
.exit:
-
 
487
           mov eax, [hcursor]
-
 
488
           call free
425
           call [eax+APPOBJ.destroy]
489
.fail:
426
.fail:
490
           ret
427
           ret
491
endp
428
 
-
 
429
;@@:
-
 
430
;           mov eax, [hw_cursor]
-
 
431
;           test eax, eax
-
 
432
;           jz @F
-
 
433
 
-
 
434
;           xor ebx, ebx
-
 
435
;           mov ecx, [esi+CURSOR.base]
-
 
436
;           mov [hsrv], eax
-
 
437
;           mov [io_code], VIDEO_FREE
-
 
438
;           mov [input], ecx
-
 
439
;           mov [inp_size], 4
-
 
440
;           mov [output], ebx
-
 
441
;           mov [out_size], ebx
-
 
442
 
-
 
443
;           lea eax, [hsrv]
-
 
444
;           stdcall srv_handler, eax
-
 
445
;           jmp .exit
-
 
446
;@@:
-
 
447
;           stdcall kernel_free, [esi+CURSOR.base]
-
 
448
;.exit:
-
 
449
;           mov eax, [hcursor]
-
 
450
;           call destroy_kernel_object
-
 
451
;.fail:
-
 
452
;           ret
-
 
453
endp
492
 
454
 
-
 
455
; param
-
 
456
;  eax= cursor
-
 
457
 
-
 
458
align 4
-
 
459
destroy_cursor:
-
 
460
 
-
 
461
           push eax
-
 
462
           stdcall kernel_free, [eax+CURSOR.base]
-
 
463
           pop eax
-
 
464
 
-
 
465
 
-
 
466
           call destroy_kernel_object
-
 
467
           ret
-
 
468
 
Line 493... Line 469...
493
align 4
469
align 4
494
proc init_cursors
470
proc init_cursors
495
           cmp [0xfe0c],word 0x13
471
           cmp [0xfe0c],word 0x13
496
           jbe .fail
472
           jbe .fail
Line 507... Line 483...
507
           sub ebx, 96
483
           sub ebx, 96
508
.init:
484
.init:
509
           mov [cur_def_interl], ebx
485
           mov [cur_def_interl], ebx
510
 
486
 
Line 511... Line -...
511
if 0
-
 
512
           xor eax, eax
-
 
513
           mov edi, cursors
-
 
514
           mov ecx, CURSOR_SIZE*16
-
 
515
           cld
-
 
516
           rep stosd
-
 
517
 
-
 
518
           not eax
-
 
519
           mov [cursor_map], eax
-
 
520
           mov [cursor_map+4], eax
-
 
521
           mov edx, cursor_map
-
 
522
           mov [cursor_start], edx
-
 
523
           add edx, 8
-
 
524
           mov [cursor_end], edx
-
 
525
end if
-
 
526
           stdcall load_driver, drv_hw_mouse
487
           stdcall load_driver, drv_hw_mouse
527
           mov [hw_cursor], eax
488
           mov [hw_cursor], eax
528
           test eax, eax
489
           test eax, eax
529
           jz .sw_mouse
490
           jz .sw_mouse