Skip to content

Commit c52a173

Browse files
committed
Use symbolic constants in the modules for WM events
1 parent e520ce3 commit c52a173

File tree

5 files changed

+29
-27
lines changed

5 files changed

+29
-27
lines changed

common/xrdp_constants.h

+2
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@
257257
#define WM_PAINT 3
258258
#define WM_KEYDOWN 15
259259
#define WM_KEYUP 16
260+
#define WM_KEYBRD_SYNC 17
260261
#define WM_MOUSEMOVE 100
261262
#define WM_LBUTTONUP 101
262263
#define WM_LBUTTONDOWN 102
@@ -281,6 +282,7 @@
281282
#define WM_TOUCH_HSCROLL 141
282283

283284
#define WM_INVALIDATE 200
285+
#define WM_CHANNEL_DATA 201
284286

285287
#define CB_ITEMCHANGE 300
286288

neutrinordp/xrdp-neutrinordp.c

+20-20
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
315315

316316
switch (msg)
317317
{
318-
case 15: /* key down */
318+
case WM_KEYDOWN:
319319

320320
/* Before we handle the first character we synchronize
321321
capslock and numlock. */
@@ -331,11 +331,11 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
331331
mod->inst->input->KeyboardEvent(mod->inst->input, param4, param3);
332332
break;
333333

334-
case 16: /* key up */
334+
case WM_KEYUP:
335335
mod->inst->input->KeyboardEvent(mod->inst->input, param4, param3);
336336
break;
337337

338-
case 17: /* Synchronize */
338+
case WM_KEYBRD_SYNC:
339339
LOG_DEVEL(LOG_LEVEL_DEBUG, "Synchronized event handled : %ld", param1);
340340
/* In some situations the Synchronize event come to early.
341341
Therefore we store this information and use it when we
@@ -351,111 +351,111 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
351351

352352
break;
353353

354-
case 100: /* mouse move */
354+
case WM_MOUSEMOVE: /* mouse move */
355355
LOG_DEVEL(LOG_LEVEL_DEBUG, "mouse move %ld %ld", param1, param2);
356356
x = param1;
357357
y = param2;
358358
flags = PTR_FLAGS_MOVE;
359359
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
360360
break;
361361

362-
case 101: /* left button up */
362+
case WM_LBUTTONUP:
363363
LOG_DEVEL(LOG_LEVEL_DEBUG, "left button up %ld %ld", param1, param2);
364364
x = param1;
365365
y = param2;
366366
flags = PTR_FLAGS_BUTTON1;
367367
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
368368
break;
369369

370-
case 102: /* left button down */
370+
case WM_LBUTTONDOWN:
371371
LOG_DEVEL(LOG_LEVEL_DEBUG, "left button down %ld %ld", param1, param2);
372372
x = param1;
373373
y = param2;
374374
flags = PTR_FLAGS_BUTTON1 | PTR_FLAGS_DOWN;
375375
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
376376
break;
377377

378-
case 103: /* right button up */
378+
case WM_RBUTTONUP:
379379
LOG_DEVEL(LOG_LEVEL_DEBUG, "right button up %ld %ld", param1, param2);
380380
x = param1;
381381
y = param2;
382382
flags = PTR_FLAGS_BUTTON2;
383383
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
384384
break;
385385

386-
case 104: /* right button down */
386+
case WM_RBUTTONDOWN:
387387
LOG_DEVEL(LOG_LEVEL_DEBUG, "right button down %ld %ld", param1, param2);
388388
x = param1;
389389
y = param2;
390390
flags = PTR_FLAGS_BUTTON2 | PTR_FLAGS_DOWN;
391391
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
392392
break;
393393

394-
case 105: /* middle button up */
394+
case WM_BUTTON3UP: /* middle button up */
395395
LOG_DEVEL(LOG_LEVEL_DEBUG, "middle button up %ld %ld", param1, param2);
396396
x = param1;
397397
y = param2;
398398
flags = PTR_FLAGS_BUTTON3;
399399
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
400400
break;
401401

402-
case 106: /* middle button down */
402+
case WM_BUTTON3DOWN: /* middle button down */
403403
LOG_DEVEL(LOG_LEVEL_DEBUG, "middle button down %ld %ld", param1, param2);
404404
x = param1;
405405
y = param2;
406406
flags = PTR_FLAGS_BUTTON3 | PTR_FLAGS_DOWN;
407407
mod->inst->input->MouseEvent(mod->inst->input, flags, x, y);
408408
break;
409409

410-
case 107: /* wheel up */
410+
case WM_BUTTON4UP: /* wheel up */
411411
flags = PTR_FLAGS_WHEEL | 0x0078;
412412
mod->inst->input->MouseEvent(mod->inst->input, flags, 0, 0);
413413
break;
414414

415-
case 108:
415+
case WM_BUTTON4DOWN:
416416
break;
417417

418-
case 109: /* wheel down */
418+
case WM_BUTTON5UP: /* wheel down */
419419
flags = PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x0088;
420420
mod->inst->input->MouseEvent(mod->inst->input, flags, 0, 0);
421421
break;
422422

423-
case 110:
423+
case WM_BUTTON5DOWN:
424424
break;
425425

426-
case 115: /* extended mouse button8 up */
426+
case WM_BUTTON8UP:
427427
LOG_DEVEL(LOG_LEVEL_DEBUG, "extended mouse button8 up %ld %ld", param1, param2);
428428
x = param1;
429429
y = param2;
430430
flags = PTR_XFLAGS_BUTTON1;
431431
mod->inst->input->ExtendedMouseEvent(mod->inst->input, flags, x, y);
432432
break;
433433

434-
case 116: /* extended mouse button8 down */
434+
case WM_BUTTON8DOWN:
435435
LOG_DEVEL(LOG_LEVEL_DEBUG, "extended mouse button8 down %ld %ld", param1, param2);
436436
x = param1;
437437
y = param2;
438438
flags = PTR_XFLAGS_BUTTON1 | PTR_XFLAGS_DOWN;
439439
mod->inst->input->ExtendedMouseEvent(mod->inst->input, flags, x, y);
440440
break;
441441

442-
case 117: /* extended mouse button9 up */
442+
case WM_BUTTON9UP:
443443
LOG_DEVEL(LOG_LEVEL_DEBUG, "extended mouse button9 up %ld %ld", param1, param2);
444444
x = param1;
445445
y = param2;
446446
flags = PTR_XFLAGS_BUTTON2;
447447
mod->inst->input->ExtendedMouseEvent(mod->inst->input, flags, x, y);
448448
break;
449449

450-
case 118: /* extended mouse button9 down */
450+
case WM_BUTTON9DOWN:
451451
LOG_DEVEL(LOG_LEVEL_DEBUG, "extended mouse button9 down %ld %ld", param1, param2);
452452
x = param1;
453453
y = param2;
454454
flags = PTR_XFLAGS_BUTTON2 | PTR_XFLAGS_DOWN;
455455
mod->inst->input->ExtendedMouseEvent(mod->inst->input, flags, x, y);
456456
break;
457457

458-
case 200:
458+
case WM_INVALIDATE:
459459
LOG_DEVEL(LOG_LEVEL_DEBUG, "Invalidate request sent from client");
460460
x = (param1 >> 16) & 0xffff;
461461
y = (param1 >> 0) & 0xffff;
@@ -464,7 +464,7 @@ lxrdp_event(struct mod *mod, int msg, long param1, long param2,
464464
mod->inst->SendInvalidate(mod->inst, -1, x, y, cx, cy);
465465
break;
466466

467-
case 0x5555:
467+
case WM_CHANNEL_DATA:
468468
chanid = LOWORD(param1);
469469
flags = HIWORD(param1);
470470
size = (int)param2;

vnc/vnc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ lib_mod_event(struct vnc *v, int msg, long param1, long param2,
486486
error = 0;
487487
make_stream(s);
488488

489-
if (msg == 0x5555) /* channel data */
489+
if (msg == WM_CHANNEL_DATA)
490490
{
491491
chanid = LOWORD(param1);
492492
flags = HIWORD(param1);

xrdp/xrdp_mm.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@ xrdp_mm_setup_mod2(struct xrdp_mm *self)
557557
{
558558
if (self->mod->mod_event != 0)
559559
{
560-
self->mod->mod_event(self->mod, 17, key_flags, device_flags,
561-
key_flags, device_flags);
560+
self->mod->mod_event(self->mod, WM_KEYBRD_SYNC, key_flags,
561+
device_flags, key_flags, device_flags);
562562
}
563563
}
564564
}

xrdp/xrdp_wm.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1636,8 +1636,8 @@ xrdp_wm_key_sync(struct xrdp_wm *self, int device_flags, int key_flags)
16361636
{
16371637
if (self->mm->mod->mod_event != 0)
16381638
{
1639-
self->mm->mod->mod_event(self->mm->mod, 17, key_flags, device_flags,
1640-
key_flags, device_flags);
1639+
self->mm->mod->mod_event(self->mm->mod, WM_KEYBRD_SYNC, key_flags,
1640+
device_flags, key_flags, device_flags);
16411641
}
16421642
}
16431643

@@ -1946,8 +1946,8 @@ xrdp_wm_process_channel_data(struct xrdp_wm *self,
19461946
{
19471947
if (self->mm->mod->mod_event != 0)
19481948
{
1949-
rv = self->mm->mod->mod_event(self->mm->mod, 0x5555, param1, param2,
1950-
param3, param4);
1949+
rv = self->mm->mod->mod_event(self->mm->mod, WM_CHANNEL_DATA,
1950+
param1, param2, param3, param4);
19511951
}
19521952
}
19531953
}

0 commit comments

Comments
 (0)