diff -Nru nx-libs-3.5.99.20/ChangeLog nx-libs-3.5.99.22/ChangeLog --- nx-libs-3.5.99.20/ChangeLog 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/ChangeLog 2019-12-16 06:31:54.000000000 +0000 @@ -1,6 +1,899 @@ -2019-04-17 11:04:51 +0200 Mike Gabriel (f1f744a41) +2019-08-27 15:46:37 +0200 Mike Gabriel (885116a4b) - * release 3.5.99.20 (HEAD -> 3.6.x, tag: 3.5.99.20) + * release 3.5.99.22 (HEAD -> 3.6.x, tag: 3.5.99.22) + +2019-08-27 15:15:47 +0200 Mike Gabriel (7d07442d7) + + * debian/copyright: Update copyright attributions. + +2019-08-27 15:14:49 +0200 Mike Gabriel (e428e39de) + + * debian/{nxagent,nxdialog}.install: Move nxdialog files from + nxagent.install to nxdialog.install. + +2019-08-27 15:14:25 +0200 Mike Gabriel (1b967c701) + + * debian/control: Split-out nxdialog bin:pkg. + +2019-08-27 14:11:53 +0200 Mike Gabriel (6bca289af) + + * Merge branch 'uli42-gh-sunweaver/pr/autograb-without-inputlock' + into 3.6.x + +2019-08-14 20:59:49 +0200 Ulrich Sibiller (6181aa911) + + * Events.c: introduce separate debug level for autograb debugging + only + +2019-06-27 23:43:44 +0200 Ulrich Sibiller (063813d35) + + * Make AutoGrab work in more situations + +2017-07-24 14:48:29 +0200 Mike Gabriel (14d8e0a2a) + + * Dialog.c: Add NXTransDialog() call for autograb toggling. + +2017-05-25 23:20:50 +0200 Ulrich Sibiller (03aa5d743) + + * Events.c: Autograb only for windowed modes + +2017-05-18 15:09:29 +0200 Ulrich Sibiller (a4d7a04c4) + + * Events.c: do not ungrab keyboard on LeaveNotify when in autograb + mode + +2017-05-18 15:08:29 +0200 Ulrich Sibiller (6dcdc578f) + + * Events.c: improve debugging output for FocusIn/Out + +2017-04-20 14:19:27 +0200 Ulrich Sibiller (ebfd8742c) + + * Args.c: make autograb available via options file, too. + +2017-03-16 13:12:01 +0100 Ulrich Sibiller (4eaedd002) + + * Args.c: Add command line option -autograb. + +2017-03-16 13:00:48 +0100 Ulrich Sibiller (8bf3429bc) + + * nxagent: Make autograb an nxagentOption. + +2017-03-05 23:51:24 +0100 Ulrich Sibiller (58183b7ce) + + * nxagent: Add autograb mode. + +2019-08-27 08:33:22 +0200 Mike Gabriel (daa50fd80) + + * Merge branch 'uli42-pr/fix_double_free' into 3.6.x + +2019-08-12 23:11:34 +0200 Ulrich Sibiller (a7abd45a8) + + * Screen.c: initialize RandR only on startup... + +2019-08-27 08:27:42 +0200 Mike Gabriel (6f80a06fb) + + * Merge branch 'uli42-pr/safe_free' into 3.6.x + +2019-08-16 13:11:38 +0200 Ulrich Sibiller (f39b81d31) + + * NXdispatch.c: move nxagentWMtimeout into the function + +2019-08-16 13:08:42 +0200 Ulrich Sibiller (4202d5094) + + * NXdispatch.c: drop currentDispatch variable + +2019-08-16 13:02:01 +0200 Ulrich Sibiller (60a3c9b0a) + + * nxagent: move nxagentWMPassed to Splash.c + +2019-08-16 12:55:28 +0200 Ulrich Sibiller (db4c220b2) + + * nxagent: add NXAGENT_ONSTART where missing + +2019-08-16 12:54:10 +0200 Ulrich Sibiller (0f5e873dc) + + * nxagent: drop NXAGENT_SPLASH + +2019-08-16 12:46:21 +0200 Ulrich Sibiller (784846317) + + * nxagent: rename nxagentWMStart to nxagentReadyAtom + +2019-08-16 12:38:53 +0200 Ulrich Sibiller (bd002ffc5) + + * Splash.c: move some variables to Splash.c + +2019-08-15 22:33:35 +0200 Ulrich Sibiller (5bb5adc8a) + + * Splash.c: make Splash logo work with white background (-wr) mode, + too + +2019-08-15 22:10:45 +0200 Ulrich Sibiller (41bfed975) + + * Splash.c: remove global variables for colors + +2019-08-15 22:06:14 +0200 Ulrich Sibiller (e12983a67) + + * nxagent: drop nxagentRootTileWindow + +2019-08-15 22:04:07 +0200 Ulrich Sibiller (bfb4e9ac9) + + * Splash.c: nxagentRemoveSplashWindow: drop unused parameter + +2019-08-11 01:59:42 +0200 Ulrich Sibiller (48c43c837) + + * Splash.c: code cleanup + +2019-08-11 01:51:37 +0200 Ulrich Sibiller (208e58fb7) + + * Splash.c: drop return code of nxagentShowSplashWindow + +2019-08-11 01:47:16 +0200 Ulrich Sibiller (9cd602b27) + + * Splash.c: do not wait in nxagent mode + +2019-08-11 00:21:44 +0200 Ulrich Sibiller (8eeaa40b1) + + * dix: add whiteroot flag + +2019-08-10 23:56:22 +0200 Ulrich Sibiller (817c3c6fc) + + * NXwindow.c: simplify window background code + +2019-08-10 23:42:45 +0200 Ulrich Sibiller (d3869aa53) + + * nxagent: fix main window being garbled without inner windows + +2018-05-05 18:56:35 +0200 Ulrich Sibiller (17495dd6a) + + * nxagent: simplify nxagentWaitEvents() + +2019-06-28 22:10:23 +0200 Ulrich Sibiller (1d32e5368) + + * Keystroke.c: fix wrong return code + +2019-06-28 22:09:23 +0200 Ulrich Sibiller (bcbf25510) + + * Events.c: add more comments and TEST output + +2019-06-28 22:07:00 +0200 Ulrich Sibiller (e7451477e) + + * Events.c: refactor nxagentHandleKeypress + +2019-08-27 08:14:23 +0200 Mike Gabriel (8b15d574b) + + * Merge branch 'uli42-pr/fix_background' into 3.6.x + +2019-08-16 13:11:38 +0200 Ulrich Sibiller (3563959c0) + + * NXdispatch.c: move nxagentWMtimeout into the function + +2019-08-16 13:08:42 +0200 Ulrich Sibiller (c34d1b201) + + * NXdispatch.c: drop currentDispatch variable + +2019-08-16 13:02:01 +0200 Ulrich Sibiller (ab8015237) + + * nxagent: move nxagentWMPassed to Splash.c + +2019-08-16 12:55:28 +0200 Ulrich Sibiller (b04b58bad) + + * nxagent: add NXAGENT_ONSTART where missing + +2019-08-16 12:54:10 +0200 Ulrich Sibiller (2228513a6) + + * nxagent: drop NXAGENT_SPLASH + +2019-08-16 12:46:21 +0200 Ulrich Sibiller (24f392c4a) + + * nxagent: rename nxagentWMStart to nxagentReadyAtom + +2019-08-16 12:38:53 +0200 Ulrich Sibiller (798a053b4) + + * Splash.c: move some variables to Splash.c + +2019-08-15 22:33:35 +0200 Ulrich Sibiller (074821a84) + + * Splash.c: make Splash logo work with white background (-wr) mode, + too + +2019-08-15 22:10:45 +0200 Ulrich Sibiller (afebb8211) + + * Splash.c: remove global variables for colors + +2019-08-15 22:06:14 +0200 Ulrich Sibiller (8fcaafab4) + + * nxagent: drop nxagentRootTileWindow + +2019-08-15 22:04:07 +0200 Ulrich Sibiller (be508a447) + + * Splash.c: nxagentRemoveSplashWindow: drop unused parameter + +2019-08-11 01:59:42 +0200 Ulrich Sibiller (612cbcc43) + + * Splash.c: code cleanup + +2019-08-11 01:51:37 +0200 Ulrich Sibiller (3c92d8897) + + * Splash.c: drop return code of nxagentShowSplashWindow + +2019-08-11 01:47:16 +0200 Ulrich Sibiller (470e0bd4d) + + * Splash.c: do not wait in nxagent mode + +2019-08-11 00:21:44 +0200 Ulrich Sibiller (a539aaa6a) + + * dix: add whiteroot flag + +2019-08-10 23:56:22 +0200 Ulrich Sibiller (c610d706b) + + * NXwindow.c: simplify window background code + +2019-08-10 23:42:45 +0200 Ulrich Sibiller (d7d205c0d) + + * nxagent: fix main window being garbled without inner windows + +2019-08-16 11:52:35 +0200 Mike Gabriel (f24767b3c) + + * Merge branch 'uli42-pr/improve_wait_events' into 3.6.x + +2018-05-05 18:56:35 +0200 Ulrich Sibiller (62573abf0) + + * nxagent: simplify nxagentWaitEvents() + +2019-08-16 11:50:10 +0200 Mike Gabriel (7f4b50deb) + + * Merge branch 'uli42-pr/no_keystroke_passthrough' into 3.6.x + +2019-06-28 22:10:23 +0200 Ulrich Sibiller (ceeb53f0c) + + * Keystroke.c: fix wrong return code + +2019-06-28 22:09:23 +0200 Ulrich Sibiller (b3d41485d) + + * Events.c: add more comments and TEST output + +2019-06-28 22:07:00 +0200 Ulrich Sibiller (c260ae425) + + * Events.c: refactor nxagentHandleKeypress + +2019-07-23 20:12:31 +0200 Ulrich Sibiller (504b1400e) + + * Clipboard.c: use SAFE_free + +2019-07-23 20:10:43 +0200 Ulrich Sibiller (4421f787d) + + * Atoms.c: use SAFE_XFree and SAFE_free macros + +2019-07-22 22:26:46 +0200 Ulrich Sibiller (7d25771da) + + * Keystroke.c: use SAFE_free + +2019-07-22 22:25:40 +0200 Ulrich Sibiller (8080ad26a) + + * GCOps.c: use SAFE_free + +2019-07-22 22:24:37 +0200 Ulrich Sibiller (6378d5ade) + + * GC.c: use SAFE_free + +2019-07-22 22:22:31 +0200 Ulrich Sibiller (a9819436d) + + * Drawable.c: use SAFE_free + +2019-07-22 22:20:47 +0200 Ulrich Sibiller (43e300ecd) + + * Colormap.c: use SAFE_free + +2019-07-22 22:19:15 +0200 Ulrich Sibiller (633d04097) + + * Args.c: use SAFE_free + +2019-07-22 22:17:25 +0200 Ulrich Sibiller (122fbd3e1) + + * Error.c: use SAFE_free + +2019-07-22 21:53:20 +0200 Ulrich Sibiller (dde4e7636) + + * Image.c: use SAFE_free + +2019-07-22 21:50:19 +0200 Ulrich Sibiller (458538010) + + * Render.c: use SAFE_free + +2019-07-22 21:45:25 +0200 Ulrich Sibiller (8b74ff1c1) + + * Pixmap.c: use SAFE_free + +2019-07-22 21:44:25 +0200 Ulrich Sibiller (34bd0942b) + + * Reconnect.c: use SAFE_free + +2019-07-22 21:34:42 +0200 Ulrich Sibiller (fd4fa4e96) + + * Keyboard.c: use SAFE_XFree and SAFE_free + +2019-07-22 21:33:54 +0200 Ulrich Sibiller (156533439) + + * Cursor.c: use SAFE_XFree + +2019-07-22 21:32:58 +0200 Ulrich Sibiller (d0a6c98cb) + + * Window.c: use SAFE_free and SAFE_XFree + +2019-07-22 21:29:31 +0200 Ulrich Sibiller (4a826d30f) + + * Rootless.c: use SAFE_free and SAFE_XFree + +2019-07-22 21:27:10 +0200 Ulrich Sibiller (a4700c9d0) + + * Font.c: use SAFE_XFree and SAFE_free + +2019-07-22 18:11:59 +0200 Ulrich Sibiller (d8012d2a8) + + * Screen.c: safe some lines by calling SAFE_XFree + +2019-07-22 18:10:12 +0200 Ulrich Sibiller (ebc2ea79f) + + * Events.c: safe some lines by calling SAFE_XFree + +2019-07-22 18:16:20 +0200 Ulrich Sibiller (b8411180e) + + * Display.c: safe some lines by calling SAFE_XFree and SAFE_free + +2019-07-23 20:08:16 +0200 Ulrich Sibiller (1330167fa) + + * Utils.h: add SAFE_free macro + +2019-08-05 18:32:16 +0200 Mike Gabriel (360cb5dd9) + + * release 3.5.99.21 (tag: 3.5.99.21) + +2019-06-27 22:48:09 +0200 Mike Gabriel (c2ca013fb) + + * Merge branch 'uli42-pr/drop_ipaq' into 3.6.x + +2019-06-27 21:50:53 +0200 Ulrich Sibiller (738686685) + + * drop onscreen keyboard support + +2019-06-27 21:44:31 +0200 Ulrich Sibiller (6bdf9c2fa) + + * Drop Ipaq support + +2019-06-27 21:03:03 +0200 Mike Gabriel (1ebf78519) + + * Merge branch 'uli42-pr/fix_fullscreen' into 3.6.x + +2019-06-27 20:38:10 +0200 Ulrich Sibiller (032ed3511) + + * Screen.c: use XlibWindow so silence the compiler + +2019-06-27 20:15:15 +0200 Ulrich Sibiller (d487d5879) + + * Consistently use None instead of 0 for nxagentIconWindow everywhere + +2019-06-27 19:51:03 +0200 Ulrich Sibiller (ea571387b) + + * Screen.c: simplify nxagentMinimizeFromFullscreen + +2019-06-26 19:04:41 +0200 Ulrich Sibiller (6657b8cc8) + + * nxagentMaximizeToFullScreen: only reparent if necessary + +2019-06-26 18:50:44 +0200 Ulrich Sibiller (d32706888) + + * Screen.c: add nxagentIsParentOf helper + +2019-06-26 18:49:36 +0200 Ulrich Sibiller (c190fd187) + + * Window.c: rearrange code regarding window decorations sizes + +2019-06-26 18:49:13 +0200 Ulrich Sibiller (ca54fabed) + + * Window.c: add some comments about fullscreen handling + +2019-06-23 22:21:24 +0200 Mike Gabriel (5858ebc6d) + + * Merge branch 'mjtrangoni-add-gcc-9' into 3.6.x + +2019-06-22 18:44:25 +0200 Mario Trangoni (1ffe92a6f) + + * TravisCI: Print compiler version currently used + +2019-06-22 18:26:14 +0200 Mario Trangoni (fba18967f) + + * TravisCI: move from gcc 8.x to gcc 9.x + +2019-06-23 21:39:51 +0200 Mike Gabriel (4a440feaf) + + * Merge branch 'uli42-pr/fix_xkb_privates' into 3.6.x + +2019-06-22 16:03:06 +0200 Ulrich Sibiller (3aabc92cf) + + * rework xkb device private handling + +2019-06-22 11:32:42 +0200 Mike Gabriel (abf374136) + + * Merge branch 'uli42-pr/various' into 3.6.x + +2019-06-20 12:51:23 +0200 Ulrich Sibiller (c8a5e33fc) + + * Suppress false positives in static analysis + +2019-06-21 12:04:23 +0200 Ulrich Sibiller (b91b3d807) + + * record/set.c: silence cpp finding + +2019-06-21 11:39:03 +0200 Ulrich Sibiller (364035c00) + + * Keyboard.c: use existing define instead of hardcoced value + +2019-06-21 11:38:39 +0200 Ulrich Sibiller (2bb498a4c) + + * Keyboard.c: fix another cppcheck finding + +2019-06-21 11:22:28 +0200 Ulrich Sibiller (5be6d271b) + + * xkb: fix what looks to be a copy-paste error with first vs firstMM + +2019-06-21 11:13:46 +0200 Ulrich Sibiller (31c3d27ea) + + * xkmread.c: fix compiler warning + +2019-06-21 11:01:59 +0200 Ulrich Sibiller (813acdd2d) + + * xkb: Silence some compiler warnings + +2019-06-21 10:57:09 +0200 Ulrich Sibiller (054e906f6) + + * xkb: Use snprintf to measure string lengths instead of manual + strlen math + +2019-06-21 10:45:57 +0200 Ulrich Sibiller (2070891cb) + + * xkbEvents.c: Fix "warning: unused variable `s'". + +2019-06-21 10:41:36 +0200 Ulrich Sibiller (4962c5a8d) + + * XKB: Remove a bunch of mad ifdefs + +2019-06-21 10:10:21 +0200 Ulrich Sibiller (56dcc8a4b) + + * xkb: remove oldState from XkbHandleActions. + +2019-06-20 23:14:09 +0200 Ulrich Sibiller (c8520ac0a) + + * mi/miexpose.c: add missing free() + +2019-06-20 19:54:44 +0200 Ulrich Sibiller (956caeb8a) + + * compext/Png.c: Nullify after free + +2019-06-20 19:53:39 +0200 Ulrich Sibiller (e440e722d) + + * compext/Png.c: simplify srcBuf allocation + +2019-06-20 19:51:00 +0200 Ulrich Sibiller (d48824195) + + * compext/Png.c: late image_index allocation + +2019-06-20 19:14:10 +0200 Ulrich Sibiller (b4d3dc5bf) + + * NXdixfonts.c: fix index out of bounds + +2019-06-20 18:52:31 +0200 Ulrich Sibiller (fd7e1f989) + + * Keyboard.c: rearrange code to make cppcheck happy + +2019-06-20 01:35:22 +0200 Ulrich Sibiller (3c0469971) + + * os/access.c: add missing } + +2019-06-20 01:31:17 +0200 Ulrich Sibiller (528e1e4ef) + + * NXpicture.c: code simplification + +2019-06-20 01:29:21 +0200 Ulrich Sibiller (bb08043a6) + + * Screen.c: fix two more memleaks of visuals + +2019-06-20 01:21:44 +0200 Ulrich Sibiller (213e63eed) + + * Screen.c: fix two memleaks + +2019-06-20 00:59:16 +0200 Ulrich Sibiller (e63d9de45) + + * NXrender: fix another memleak + +2019-06-20 00:51:32 +0200 Ulrich Sibiller (78eff73e4) + + * render: Propagate allocation failure from createSourcePicture() + +2019-06-20 00:42:01 +0200 Ulrich Sibiller (9f9b790f8) + + * fb: fix memory leak in fbOverlayFinishScreenInit + +2019-06-20 00:26:47 +0200 Ulrich Sibiller (f55402572) + + * dix/dispatch: fix a small memory leak + +2019-06-20 00:13:25 +0200 Ulrich Sibiller (6f954bb7d) + + * Quarks.c: add missing ) + +2019-06-19 23:44:40 +0200 Ulrich Sibiller (6da106610) + + * Keyboard.c: fix three memory leaks + +2019-06-19 23:10:40 +0200 Ulrich Sibiller (234be0245) + + * glyph.c: fix a read beyond end of heap buffer + +2019-06-19 01:12:26 +0200 Ulrich Sibiller (8205db425) + + * Font.c: code simplifications + +2019-05-25 19:38:14 +0200 Ulrich Sibiller (cb508b263) + + * various scope improvements + +2019-06-18 23:36:45 +0200 Ulrich Sibiller (bffdacc48) + + * glxext.c: fix another memory leak + +2019-06-18 19:10:38 +0200 Ulrich Sibiller (b5eb7c76e) + + * Screen.c: more debug output + +2019-06-18 19:04:12 +0200 Ulrich Sibiller (7e12c9ba5) + + * Extension.c: code simplifications + +2019-06-17 21:57:45 +0200 Ulrich Sibiller (17d5e62ba) + + * Events.c: use designated initializer in + nxagentDeactivatePointerGrab + +2019-06-18 18:57:17 +0200 Ulrich Sibiller (5cb497146) + + * mi/miinitext.c: fix memleaks: remove (double) glx initialization + +2019-06-17 23:37:51 +0200 Ulrich Sibiller (756442226) + + * Screen.c: fix another memory leak + +2019-06-17 20:25:09 +0200 Ulrich Sibiller (4dd1f3cbd) + + * Fix memleaks: Free devPrivates of devices on shutdown + +2019-06-17 18:15:05 +0200 Ulrich Sibiller (ca741177e) + + * CloseDevice: call XkbRemoveResourceClient before freeing key class + struct + +2019-06-17 17:31:32 +0200 Ulrich Sibiller (340de78e2) + + * Keyboard.c: nullify freed pointers + +2019-06-17 16:06:02 +0200 Ulrich Sibiller (3b06ad51d) + + * Screen.c: Fix: make sure RRCloseScreen is being called + +2019-06-14 00:14:17 +0200 Ulrich Sibiller (0f8dbbab2) + + * Screen.c: correctly free stuff in nxagentCloseScreen + +2019-06-13 22:56:45 +0200 Ulrich Sibiller (308824ba9) + + * xkb: initialize tsyms + +2019-06-12 19:25:57 +0200 Ulrich Sibiller (6d00a387f) + + * Rootless.c: improve TEST/WARN/DEBUG outout + +2019-06-12 00:16:48 +0200 Ulrich Sibiller (2b25eb3d2) + + * Pixmap.c: fix comment phrasing/spelling + +2019-05-30 11:38:10 +0200 Ulrich Sibiller (1bfafc127) + + * Window.c: add missing comment about nxagentConfiguredWindowList + +2019-05-30 00:30:46 +0200 Ulrich Sibiller (1a8de6352) + + * dix/window.c: fix compiler warning + +2019-05-01 10:40:47 +0200 Ulrich Sibiller (3900ba3f8) + + * NXshm.c: remove left-overs from patch + +2019-05-01 02:06:30 +0200 Ulrich Sibiller (b961e190b) + + * miwindow.c: add hint to Red Hat Bugzilla + fix + +2019-05-04 01:44:36 +0200 Ulrich Sibiller (28e42b3bd) + + * mi: Hush an almost certainly bogus warning + +2019-05-30 00:10:43 +0200 Ulrich Sibiller (9f5ddede9) + + * Window.c: Drop defines CWParent and CWStackingOrder + +2019-05-29 23:52:44 +0200 Ulrich Sibiller (a3e0376f9) + + * Window.c: remove leftover (commented) code + +2019-05-30 23:50:53 +0200 Ulrich Sibiller (d8f5e647c) + + * NXwindow.c: fix compiler warning + +2019-06-01 00:52:06 +0200 Ulrich Sibiller (a765857aa) + + * Remove the Must_have_memory hack. + +2019-06-11 12:24:44 +0200 Mike Gabriel (c0754a357) + + * Merge branch 'uli42-pr/use_selection_callback' into 3.6.x + +2019-06-10 14:25:53 +0200 Ulrich Sibiller (848dee5c4) + + * NXdispatch.c: use upstream version of ProcSetSelectionOwner + +2019-06-10 14:21:43 +0200 Ulrich Sibiller (09ba97b2d) + + * NXdispatch.c: Use Callback instead of a modified function + +2019-06-10 14:20:47 +0200 Ulrich Sibiller (2972f6af1) + + * Add nxagentSetSelectionCallback + +2019-06-10 14:18:06 +0200 Ulrich Sibiller (3fd7e5f93) + + * Add nxagentExternalClipboardEventTrap + +2019-06-11 12:10:25 +0200 Mike Gabriel (58cd35745) + + * Merge branch 'uli42-pr/drop_nxmiexpose' into 3.6.x + +2019-05-30 16:04:43 +0200 Ulrich Sibiller (073c6c17e) + + * NXmiexpose.c: drop file altogether + +2019-05-30 16:02:53 +0200 Ulrich Sibiller (6ce9fb5f2) + + * Window.c/NXmiexpose.c: remove hack for certain WM theme + +2019-05-25 17:29:17 +0200 Ulrich Sibiller (af1c4b9b7) + + * NXmiexpose.c: mark NX changes + +2019-05-01 01:22:39 +0200 Ulrich Sibiller (9e051eab0) + + * NXmiexpose.c: use upstream version of miPaintWindows() + +2019-05-04 01:47:50 +0200 Ulrich Sibiller (39ff69c72) + + * NXmiexpose.c: use upstream miHandleExposures() + +2019-06-11 12:05:42 +0200 Mike Gabriel (a25232734) + + * Merge branch 'uli42-pr/various_small_things' into 3.6.x + +2019-05-30 11:36:18 +0200 Ulrich Sibiller (2da476a67) + + * Window.c: comment on the purpose of some functions + +2019-06-10 15:32:38 +0200 Ulrich Sibiller (d38fb8137) + + * Events.c: add debug output + +2019-06-10 15:27:02 +0200 Ulrich Sibiller (9cb29cce2) + + * Clipboard.c: more debugging output + +2019-06-10 15:23:55 +0200 Ulrich Sibiller (9739c7009) + + * Clipboard.c: Scope improvements + +2019-06-10 15:21:45 +0200 Ulrich Sibiller (4b19c4975) + + * Clipboard.c: fix wrong variable being printed + +2019-06-10 12:09:16 +0200 Ulrich Sibiller (d9b1272fb) + + * Screen.c: more TEST output + +2019-06-10 12:06:31 +0200 Ulrich Sibiller (0e496e5d1) + + * Screen.c: use consistent spacing on pointer references + +2019-06-10 12:05:24 +0200 Ulrich Sibiller (8365ce463) + + * Screen.c: whitespace/formatting fixes + +2019-06-10 12:04:20 +0200 Ulrich Sibiller (d98eeec02) + + * Screen.c: report both created windows (and with the right name) + +2019-06-10 12:01:05 +0200 Ulrich Sibiller (61255ac1a) + + * Window.c: fix: report correct window on icon window creation + +2019-06-11 12:00:48 +0200 Mike Gabriel (92f41213e) + + * Merge branch 'uli42-pr/fix_broken_cursor_handling' into 3.6.x + +2019-05-27 15:42:11 +0200 Ulrich Sibiller (a736122f5) + + * os: fix BigReq ignoring when another request is pending + +2019-05-23 00:17:21 +0200 Ulrich Sibiller (49adb1e5c) + + * render/glyph.c: add missing usage_hint + +2019-05-22 22:22:36 +0200 Ulrich Sibiller (fd8427002) + + * Fix NXevents.c: Reactivate errornously commented function + +2019-06-11 11:31:05 +0200 Mike Gabriel (126cbe1ff) + + * Merge branch 'uli42-pr/remove_requestlog' into 3.6.x + +2019-05-27 20:35:25 +0200 Ulrich Sibiller (0eab060d1) + + * dix: remove unused requestLogIndex + +2019-05-21 10:57:22 +0200 Mike Gabriel (789d3a37e) + + * Merge branch 'uli42-pr/fix_xkb_crash' into 3.6.x + +2019-05-15 19:54:24 +0200 Ulrich Sibiller (20353e96a) + + * libNX_X11: add additional checks for dpy and xkb + +2019-05-15 19:42:29 +0200 Ulrich Sibiller (4df77fe73) + + * xkbUtils.c: Catch division by zero + +2019-05-17 15:51:36 +0200 Mike Gabriel (6981e9bb0) + + * Merge branch 'andschwa-xtestext1h' into 3.6.x + +2019-05-13 21:32:07 +0000 Andrew Schwartzmeyer (6a938063b) + + * Remove Debian build references to `xtestext1.h` + +2019-05-11 09:41:15 +0200 Mike Gabriel (226493690) + + * Merge branch 'uli42-pr/small_fixes' into 3.6.x + +2019-05-08 23:23:54 +0200 Ulrich Sibiller (fac36b24f) + + * nxagent: make nxagentX2go a Boolean + +2019-05-08 22:25:02 +0200 Ulrich Sibiller (1b9d735b0) + + * README.keystrokes: mention nxdialog + +2019-05-08 21:49:50 +0200 Ulrich Sibiller (79a2b7b24) + + * Remove useless "ignore" keystroke for Ctrl-Alt-Backspace + +2019-05-08 21:57:01 +0200 Ulrich Sibiller (a31d28014) + + * README.keystrokes: refine description + +2019-05-04 01:04:06 +0200 Ulrich Sibiller (0db8b0353) + + * NXdispatch.c: indent code to match environment + +2019-05-04 00:40:49 +0200 Ulrich Sibiller (f6845fbd9) + + * NXdispatch.c: add missing fixes + +2019-05-04 00:30:21 +0200 Ulrich Sibiller (3d254765c) + + * NXdispatch.c: add missing change + +2019-05-01 20:11:14 +0200 Ulrich Sibiller (0312a8cfe) + + * Rename libdamage to (correct) libdamageext + +2019-05-01 15:04:26 +0200 Ulrich Sibiller (f0ba303d4) + + * NXdamage.c: add missing upstream fixes + +2019-05-01 14:38:31 +0200 Ulrich Sibiller (249be6680) + + * NXwindow.c: add missing change + +2019-04-30 21:00:31 +0200 Ulrich Sibiller (34e9c6b0b) + + * Keyboard.c: clean/unify formatting + +2018-11-02 20:56:55 +0100 Ulrich Sibiller (0a211b6b6) + + * Keyboard.c: improve TEST and DEBUG output + +2019-04-29 15:37:10 +0200 Ulrich Sibiller (bee0f13ce) + + * nxagent: Remove own GetTimeInMillis() implementation + +2018-11-07 21:29:19 +0100 Ulrich Sibiller (b32a984f8) + + * Die XTESTEXT1, die! + +2019-04-29 22:02:47 +0200 Ulrich Sibiller (dece08252) + + * Reconnect.c: initialize stateFile path + +2019-04-29 22:02:24 +0200 Ulrich Sibiller (ff5740e03) + + * spelling fixes + +2019-05-10 16:37:20 +0200 Mike Gabriel (f6177d2ad) + + * Merge branch 'uli42-pr/short_font_code' into 3.6.x + +2019-04-23 20:09:25 +0200 Ulrich Sibiller (453edbd21) + + * Font.c: use __func__ in TEST prints + +2019-04-23 20:08:57 +0200 Ulrich Sibiller (0086b8c24) + + * Font.c: Avoid duplicate font paths + +2019-04-23 18:22:45 +0200 Ulrich Sibiller (78a16245a) + + * auto-determine system font path and add to list of font paths + +2019-04-23 19:34:57 +0200 Ulrich Sibiller (898f04e42) + + * Font.c: Loop over font paths + +2019-04-23 19:21:41 +0200 Ulrich Sibiller (dfb5602a6) + + * Font.c: Let dix check if a font path exists + +2019-04-23 19:19:04 +0200 Ulrich Sibiller (8029141e7) + + * Font.c: build the font paths at runtime + +2019-04-23 18:34:04 +0200 Ulrich Sibiller (bcb5c7962) + + * Drop Speedo font support + +2019-04-03 22:33:33 +0200 Ulrich Sibiller (dff2e0a01) + + * Font.c: factor out font checks + +2019-05-10 16:10:46 +0200 Mike Gabriel (d94e9ba24) + + * Merge branch 'uli42-pr/fix_flavour_change' into 3.6.x + +2019-05-08 23:21:30 +0200 Ulrich Sibiller (3c9ee1ff7) + + * nxagent: Determine nxagentProgName only once + +2019-04-23 08:42:43 +0200 Mike Gabriel (4ce890758) + + * Merge branch 'mjtrangoni-update-clang-8' into 3.6.x + +2019-04-22 17:26:33 +0200 Mario Trangoni (ee82317b5) + + * travis.yml: Update clang 7.0 => 8.0 + +2019-04-17 11:12:29 +0200 Mike Gabriel (c9cac948f) + + * roll-tarballs.sh: Fix script removal from nx-libs-lite tarballs. + +2019-04-17 11:07:36 +0200 Mike Gabriel (3dc2c9aac) + + * roll-tarballs.sh: Remove nxdialog/* in nx-libs-lite tarballs. + +2019-04-17 11:04:51 +0200 Mike Gabriel (e2b73ab90) + + * release 3.5.99.20 (tag: 3.5.99.20) 2019-04-17 10:52:00 +0200 Mike Gabriel (2a10438f7) diff -Nru nx-libs-3.5.99.20/debian/changelog nx-libs-3.5.99.22/debian/changelog --- nx-libs-3.5.99.20/debian/changelog 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/debian/changelog 2019-12-16 06:31:54.000000000 +0000 @@ -1,14 +1,22 @@ -nx-libs (2:3.5.99.20-0~201904250526~ubuntu16.04.1) xenial; urgency=low +nx-libs (2:3.5.99.22-0~201908271346~ubuntu16.04.1) xenial; urgency=low * Auto build. - -- X2Go Thu, 25 Apr 2019 10:48:24 +0000 + -- X2Go Mon, 16 Dec 2019 06:31:54 +0000 -nx-libs (2:3.5.99.20-0.0x2go1) unstable; urgency=medium +nx-libs (2:3.5.99.22-0) unstable; urgency=medium - * Bump revision up. + * Upstream-provided Debian package for nx-libs. + See upstream ChangeLog for recent changes. - -- X2Go Release Manager Thu, 25 Apr 2019 07:25:44 +0200 + -- Mike Gabriel Tue, 27 Aug 2019 15:44:17 +0200 + +nx-libs (2:3.5.99.21-0) unstable; urgency=medium + + * Upstream-provided Debian package for nx-libs. + See upstream ChangeLog for recent changes. + + -- Mike Gabriel Mon, 05 Aug 2019 18:25:33 +0200 nx-libs (2:3.5.99.20-0) unstable; urgency=medium diff -Nru nx-libs-3.5.99.20/debian/control nx-libs-3.5.99.22/debian/control --- nx-libs-3.5.99.20/debian/control 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/debian/control 2019-12-16 06:31:54.000000000 +0000 @@ -330,9 +330,6 @@ libnx-x11-6 (= ${binary:Version}), libxcomp3 (= ${binary:Version}), libxcompshad3 (= ${binary:Version}), - python3, - python3-gi, - gir1.2-gtk-3.0, x11-xkb-utils, ${misc:Depends}, ${shlibs:Depends}, @@ -378,6 +375,28 @@ helpful backtraces. You can safely remove it if you do not intend to debug NX packages on this system. +Package: nxdialog +Architecture: all +Depends: + python3, + python3-gi, + gir1.2-gtk-3.0, + x11-xkb-utils, + ${misc:Depends}, +Recommends: + nxagent, +Breaks: + nxagent (<< 2:3.5.99.22-0~), +Replaces: + nxagent (<< 2:3.5.99.22-0~), +Description: Dialogs for NX Agent + NX is a software suite which implements very efficient + compression of the X11 protocol. This increases performance when + using X applications over a network, especially a slow one. + . + nxdialog adds dialog windows/menus to nxagent. They get triggered by + certain actions within the NX Agent Xserver. + Package: nxproxy Architecture: any Multi-Arch: foreign diff -Nru nx-libs-3.5.99.20/debian/copyright nx-libs-3.5.99.22/debian/copyright --- nx-libs-3.5.99.20/debian/copyright 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/debian/copyright 2019-12-16 06:31:54.000000000 +0000 @@ -1674,8 +1674,7 @@ 1991-2004, Silicon Graphics, Inc License: SGI-1.1 -Files: nx-X11/programs/Xserver/Xext/xtest1dd.h - nx-X11/programs/Xserver/Xi/allowev.h +Files: nx-X11/programs/Xserver/Xi/allowev.h nx-X11/programs/Xserver/Xi/chgdctl.h nx-X11/programs/Xserver/Xi/chgfctl.h nx-X11/programs/Xserver/Xi/chgkbd.h @@ -1790,7 +1789,6 @@ nx-X11/programs/Xserver/hw/nxagent/Pointer.h nx-X11/programs/Xserver/hw/nxagent/Screen.c nx-X11/programs/Xserver/hw/nxagent/Screen.h - nx-X11/programs/Xserver/hw/nxagent/TestExt.c nx-X11/programs/Xserver/hw/nxagent/Visual.c nx-X11/programs/Xserver/hw/nxagent/Visual.h Copyright: 1993, Davor Matic @@ -1922,7 +1920,6 @@ nx-X11/programs/Xserver/hw/nxagent/NXevents.c nx-X11/programs/Xserver/hw/nxagent/NXextension.c nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c - nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c nx-X11/programs/Xserver/hw/nxagent/NXproperty.c nx-X11/programs/Xserver/hw/nxagent/NXresource.c nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -2246,35 +2243,6 @@ 1996, 1998, The Open Group License: MIT~OpenGroup -Files: nx-X11/include/extensions/xtestext1.h - nx-X11/programs/Xserver/Xext/xtest1dd.c - nx-X11/programs/Xserver/Xext/xtest1di.c -Copyright: 1986-1988, 1998, The Open Group - 1986-1988, Hewlett-Packard Corporation -License: MIT~OpenGroup -Comment: - Contributions by Hewlett-Packard Corporation have been licensed - under the following license: - . - Permission to use, copy, modify, and distribute this - software and its documentation for any purpose and without - fee is hereby granted, provided that the above copyright - notice appear in all copies and that both that copyright - notice and this permission notice appear in supporting - documentation, and that the name of Hewlett-Packard not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - . - Hewlett-Packard makes no representations about the - suitability of this software for any purpose. It is provided - "as is" without express or implied warranty. - . - As additional note, we find: - . - This software is not subject to any license of the American - Telephone and Telegraph Company or of the Regents of the - University of California. - Files: nx-X11/programs/Xserver/hw/nxagent/NXdamage.c nx-X11/programs/Xserver/randr/rrmode.c nx-X11/programs/Xserver/randr/rrscreen.c @@ -3001,6 +2969,7 @@ nxproxy/man/Makefile.am nxproxy/src/Makefile.am run-static-analysis.sh + static-analysis-suppressions Copyright: 2001, 2011, NoMachine (http://www.nomachine.com) 2008-2014, Oleksandr Shneyder 2011-2016, Mike Gabriel */ @@ -3078,7 +3047,8 @@ 2014, 2015, Google Inc.; contributed by Alexey Sokolov 2015, Paul Norman 2015, Moritz Klammler - 2016, Krzesimir Nowak + 2016, 2018, Krzesimir Nowak + 2019, Enji Cooper License: permissive Comment: Make lintian happy by listing all symlinks. @@ -3099,13 +3069,32 @@ Files: m4/ax_pthread.m4 nxcomp/m4/ax_pthread.m4 - nxproxy/m4/ax_pthread.m4 Copyright: 2008, Steven G. Johnson 2011, Daniel Richard G. License: GPL-3+ Comment: Make lintian happy by listing all symlinks. +Files: nxdialog/Makefile.am + nxdialog/README.md + nxdialog/VERSION + nxdialog/bin/Makefile.am + nxdialog/configure.ac + nxdialog/man/Makefile.am + nxdialog/man/nxdialog.1 + nxdialog/m4/.keep +Copyright: 2019, Mike Gabriel +License: GPL-2+ +Comment: + Using license as found in nxdialog/bin/nxdialog. + . + Using copyright holder as found in VCS information. + +Files: nxdialog/bin/nxdialog +Copyright: 2008, Google Inc. + 2019, Ulrich Sibiller +License: GPL-2+ + Files: debian/* Copyright: 2011-2016, Mike Gabriel 2011-2013, Reinhard Tartler diff -Nru nx-libs-3.5.99.20/debian/copyright.in nx-libs-3.5.99.22/debian/copyright.in --- nx-libs-3.5.99.20/debian/copyright.in 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/debian/copyright.in 2019-12-16 06:31:54.000000000 +0000 @@ -2122,15 +2122,6 @@ License: MIT/X11 (BSD like) FIXME -Files: nx-X11/include/extensions/xtestext1.h - nx-X11/programs/Xserver/Xext/xtest1dd.c - nx-X11/programs/Xserver/Xext/xtest1di.c - nx-X11/programs/Xserver/mi/mibstore.c -Copyright: 1986-1988, 1998, The Open Group - 1987, 1998, The Open Group -License: NTP - FIXME - Files: nx-X11/programs/Xserver/miext/cw/cw.c nx-X11/programs/Xserver/miext/cw/cw.h nx-X11/programs/Xserver/miext/cw/cw_ops.c diff -Nru nx-libs-3.5.99.20/debian/git-build-recipe.manifest nx-libs-3.5.99.22/debian/git-build-recipe.manifest --- nx-libs-3.5.99.20/debian/git-build-recipe.manifest 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/debian/git-build-recipe.manifest 2019-12-16 06:31:54.000000000 +0000 @@ -1,2 +1,2 @@ -# git-build-recipe format 0.4 deb-version 2:{debupstream}-0~201904250526 -lp:~x2go/x2go/+git/nx-libs git-commit:f7242597d939369fb3d537bb11d0443480f45c7b +# git-build-recipe format 0.4 deb-version 2:{debupstream}-0~201908271346 +lp:~x2go/x2go/+git/nx-libs git-commit:57d3a42c22f7213e782f89429c1a072833f90785 diff -Nru nx-libs-3.5.99.20/debian/nxagent.install nx-libs-3.5.99.22/debian/nxagent.install --- nx-libs-3.5.99.20/debian/nxagent.install 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/debian/nxagent.install 2019-12-16 06:31:54.000000000 +0000 @@ -1,9 +1,7 @@ etc/nxagent/keystrokes.cfg usr/bin/nxagent -usr/bin/nxdialog usr/lib/*/nx/X11/ usr/share/man/man1/nxagent.1* -usr/share/man/man1/nxdialog.1* usr/share/nx/VERSION.nxagent usr/share/pixmaps/nxagent.xpm # FIXME: compatibility symlink, drop for 3.6.0 release diff -Nru nx-libs-3.5.99.20/debian/nxdialog.install nx-libs-3.5.99.22/debian/nxdialog.install --- nx-libs-3.5.99.20/debian/nxdialog.install 1970-01-01 00:00:00.000000000 +0000 +++ nx-libs-3.5.99.22/debian/nxdialog.install 2019-12-16 06:31:54.000000000 +0000 @@ -0,0 +1,2 @@ +usr/bin/nxdialog +usr/share/man/man1/nxdialog.1* diff -Nru nx-libs-3.5.99.20/debian/nx-x11proto-xext-dev.install nx-libs-3.5.99.22/debian/nx-x11proto-xext-dev.install --- nx-libs-3.5.99.20/debian/nx-x11proto-xext-dev.install 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/debian/nx-x11proto-xext-dev.install 2019-12-16 06:31:54.000000000 +0000 @@ -12,5 +12,4 @@ usr/include/*/nx-X11/extensions/xf86bigfont.h usr/include/*/nx-X11/extensions/xf86bigfproto.h usr/include/*/nx-X11/extensions/xtestconst.h -usr/include/*/nx-X11/extensions/xtestext1.h usr/include/*/nx-X11/extensions/xteststr.h diff -Nru nx-libs-3.5.99.20/doc/nxagent/README.keystrokes nx-libs-3.5.99.22/doc/nxagent/README.keystrokes --- nx-libs-3.5.99.20/doc/nxagent/README.keystrokes 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/doc/nxagent/README.keystrokes 2019-12-16 06:31:54.000000000 +0000 @@ -58,21 +58,35 @@ '0', 'false' and an unspecified attribute are false, anything else is considered true. -Everything in this file is case-sensitive. Unknown lines are ignored. -Keybindings are evaluated from top to bottom, so if a keybinding -matches, other keybindings further down will be ignored. The contents -of the file replaces the default keybindings, and only one file is -read, no merging between different configuration files is done. This -also means that an empty or invalid configuration file deactivates all +Everything in this file is case-sensitive. Unknown lines are ignored +(accompanied by a warning in the session log). Keybindings are +evaluated from top to bottom, so if a keybinding matches, other +keybindings further down will be ignored. The contents of the file +replaces the default keybindings, and only one file is read, no +merging between different configuration files is done. This also means +that an empty or invalid configuration file deactivates all keybindings. If an attribute occurs more than once in a line the last one wins. +Some of the actions can open a dialog window. Depending on the user's +answer the selected action will be taken. Some actions will only show +a dialog informing the user about the taken action. All these dialogs +will only work if the nxagent/x2goagent process has a properly +configured NX_CLIENT environment variable pointing to an executable +(like nxdialog) that is responsible for showing the dialogs and taking +the action(s). If that executable cannot be run no dialog will show up +and no action will be taken. + List of possible 'action' attributes: ------------------------------------- close_session - This terminates the session. + This terminates the session. If a proper dialog helper is available + ask the user if he wants to disconnect + or terminate the session and then perform the selected + action. Without proper helper it will do nothing (except writing an + error the session log) fullscreen Switches the client window into or out of fullscreen mode, using @@ -98,16 +112,23 @@ (maximum step size is 200px). defer - Activates/deactivates deferred screen updates. + Activates/deactivates deferred screen updates. With a proper + dialog helper (see above) it will open a dialog informing the user + about the action taken. ignore Ignores the following keystroke, nothing will happen when this - keystroke is pressed. + keystroke is pressed. The keystroke will NOT be passed to the + clients. If you want the clients to see the keystroke you need to + eliminate the line from the config file instead of using 'ignore'. reread_keystrokes Forces nxagent to re-read the keystroke configuration. Useful to add/change keystrokes to a running session. +autograb + Toggles autograb mode + force_synchronization Forces immediate drawing of elements to be synchronized which can fix some visual bugs. diff -Nru nx-libs-3.5.99.20/etc/keystrokes.cfg nx-libs-3.5.99.22/etc/keystrokes.cfg --- nx-libs-3.5.99.20/etc/keystrokes.cfg 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/etc/keystrokes.cfg 2019-12-16 06:31:54.000000000 +0000 @@ -5,7 +5,6 @@ - @@ -25,4 +24,5 @@ + diff -Nru nx-libs-3.5.99.20/Makefile nx-libs-3.5.99.22/Makefile --- nx-libs-3.5.99.20/Makefile 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/Makefile 2019-12-16 06:31:54.000000000 +0000 @@ -30,6 +30,9 @@ ifneq ($(shell pkg-config --exists xkbcomp && echo yes), yes) $(warning xkbcomp devel package missing, using imake default values) endif +ifneq ($(shell pkg-config --exists fontutil && echo yes), yes) + $(warning fontutil devel package missing, using imake default values) +endif IMAKE_DEFINES ?= @@ -112,6 +115,8 @@ (pkg-config --exists xkbcomp && echo "#define SystemXkbConfigDir `pkg-config xkbcomp --variable=xkbconfigdir`"; :) >>nx-X11/config/cf/nxconfig.def (pkg-config --exists xkbcomp && echo "#define SystemXkbBinDir `pkg-config xkbcomp --variable=prefix`/bin"; :) >>nx-X11/config/cf/nxconfig.def + (pkg-config --exists fontutil && echo "#define SystemFontRootDir `pkg-config fontutil --variable=fontrootdir`"; :) >>nx-X11/config/cf/nxconfig.def + # let's create the nx-X11 Makefiles now, once everything has been defined $(MAKE) -j1 -C nx-X11 Makefiles IMAKE_DEFINES="$(IMAKE_DEFINES)" diff -Nru nx-libs-3.5.99.20/nxcomp/src/Loop.cpp nx-libs-3.5.99.22/nxcomp/src/Loop.cpp --- nx-libs-3.5.99.20/nxcomp/src/Loop.cpp 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nxcomp/src/Loop.cpp 2019-12-16 06:31:54.000000000 +0000 @@ -1565,6 +1565,10 @@ return (control != NULL); } +// +// FIXME: why timeval? Passing milliseconds would be more convenient, +// the timeval struct/T_timestamp could be built on demand. +// int NXTransContinue(struct timeval *selectTs) { if (control != NULL) diff -Nru nx-libs-3.5.99.20/nxcomp/VERSION nx-libs-3.5.99.22/nxcomp/VERSION --- nx-libs-3.5.99.20/nxcomp/VERSION 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nxcomp/VERSION 2019-12-16 06:31:54.000000000 +0000 @@ -1 +1 @@ -3.5.99.20 +3.5.99.22 diff -Nru nx-libs-3.5.99.20/nxcompshad/VERSION nx-libs-3.5.99.22/nxcompshad/VERSION --- nx-libs-3.5.99.20/nxcompshad/VERSION 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nxcompshad/VERSION 2019-12-16 06:31:54.000000000 +0000 @@ -1 +1 @@ -3.5.99.20 +3.5.99.22 diff -Nru nx-libs-3.5.99.20/nxdialog/bin/nxdialog nx-libs-3.5.99.22/nxdialog/bin/nxdialog --- nx-libs-3.5.99.20/nxdialog/bin/nxdialog 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nxdialog/bin/nxdialog 2019-12-16 06:31:54.000000000 +0000 @@ -180,7 +180,7 @@ @param title: Message box title @type text: str @param text: Message box text - @return: Choosen action + @return: Chosen action """ dlg = Gtk.MessageDialog(type=Gtk.MessageType.QUESTION, @@ -207,7 +207,7 @@ @param title: Message box title @type text: str @param text: Message box text - @return: Choosen action + @return: Chosen action """ dlg = Gtk.MessageDialog(type=Gtk.MessageType.QUESTION, @@ -227,12 +227,12 @@ def handle_session_action(agentpid, action): - """ Execute session action choosen by user. + """ Execute session action chosen by user. @type agentpid: int @param agentpid: Nxagent process id as passed by command line @type action: int or None - @param action: Choosen action + @param action: Chosen action """ @@ -298,7 +298,7 @@ parser = argparse.ArgumentParser(description="Helper for nxagent to display dialogs") - # nxagent 3.5.99.20 only uses yesno, ok, pulldown and yesnosuspend + # nxagent 3.5.99.22 only uses yesno, ok, pulldown and yesnosuspend # yesno dialogs will always kill the session if "yes" is selected parser.add_argument("--dialog", dest="dialog_type", help='type of dialog to show, one of "yesno", \ @@ -316,7 +316,7 @@ parser.add_argument("--window", dest="window", help="id of window where to embed the \ pulldown dialog type") - # -class, -local, -allowmultiple are unused in nxlibs 3.5.99.20 + # -class, -local, -allowmultiple are unused in nxlibs 3.5.99.22 parser.add_argument("--class", dest="dlgclass", default="info", help="class of the message (info, warning, error) \ default: info) [currently unimplemented]") diff -Nru nx-libs-3.5.99.20/nxdialog/man/nxdialog.1 nx-libs-3.5.99.22/nxdialog/man/nxdialog.1 --- nx-libs-3.5.99.20/nxdialog/man/nxdialog.1 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nxdialog/man/nxdialog.1 2019-12-16 06:31:54.000000000 +0000 @@ -5,7 +5,7 @@ \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac -.TH nxdialog 1 "Apr 2019" "Version 3.5.99.20" "NX Dialog" +.TH nxdialog 1 "Aug 2019" "Version 3.5.99.22" "NX Dialog" .SH NAME nxdialog \- NX Dialog Helper .SH SYNOPSIS diff -Nru nx-libs-3.5.99.20/nxdialog/VERSION nx-libs-3.5.99.22/nxdialog/VERSION --- nx-libs-3.5.99.20/nxdialog/VERSION 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nxdialog/VERSION 2019-12-16 06:31:54.000000000 +0000 @@ -1 +1 @@ -3.5.99.20 +3.5.99.22 diff -Nru nx-libs-3.5.99.20/nx-libs.spec nx-libs-3.5.99.22/nx-libs.spec --- nx-libs-3.5.99.20/nx-libs.spec 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-libs.spec 2019-12-16 06:31:54.000000000 +0000 @@ -10,7 +10,7 @@ %endif Name: nx-libs -Version: 3.5.99.20 +Version: 3.5.99.22 Release: 0.0build1%{?dist} Summary: NX X11 protocol compression libraries @@ -598,7 +598,6 @@ %{_includedir}/nx-X11/extensions/xfixesproto.h %{_includedir}/nx-X11/extensions/xfixeswire.h %{_includedir}/nx-X11/extensions/xtestconst.h -%{_includedir}/nx-X11/extensions/xtestext1.h %{_includedir}/nx-X11/extensions/xteststr.h %files -n nxagent @@ -628,5 +627,5 @@ %changelog -* Thu Jan 29 2015 Mike Gabriel 3.5.99.1 +* Thu Aug 27 2019 Mike Gabriel 3.5.99.22 - See upstream ChangeLog and debian/changelog for details. diff -Nru nx-libs-3.5.99.20/nxproxy/man/nxproxy.1 nx-libs-3.5.99.22/nxproxy/man/nxproxy.1 --- nx-libs-3.5.99.20/nxproxy/man/nxproxy.1 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nxproxy/man/nxproxy.1 2019-12-16 06:31:54.000000000 +0000 @@ -5,7 +5,7 @@ \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac -.TH nxproxy 1 "Apr 2019" "Version 3.5.99.20" "NX Proxy" +.TH nxproxy 1 "Aug 2019" "Version 3.5.99.22" "NX Proxy" .SH NAME nxproxy \- NX Proxy Tool .SH SYNOPSIS diff -Nru nx-libs-3.5.99.20/nxproxy/VERSION nx-libs-3.5.99.22/nxproxy/VERSION --- nx-libs-3.5.99.20/nxproxy/VERSION 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nxproxy/VERSION 2019-12-16 06:31:54.000000000 +0000 @@ -1 +1 @@ -3.5.99.20 +3.5.99.22 diff -Nru nx-libs-3.5.99.20/nx-X11/config/cf/gnu.cf nx-libs-3.5.99.22/nx-X11/config/cf/gnu.cf --- nx-libs-3.5.99.20/nx-X11/config/cf/gnu.cf 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/config/cf/gnu.cf 2019-12-16 06:31:54.000000000 +0000 @@ -127,7 +127,7 @@ XCOMM i386Architecture #define OptimizedCDebugFlags DefaultGcc2i386Opt #define GNUMachineDefines -D__i386__ -#define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +#define ServerOSDefines XFree86ServerOSDefines #define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #define HasPlugin YES #define VendorHasX11R6_3libXext YES diff -Nru nx-libs-3.5.99.20/nx-X11/config/cf/host.def nx-libs-3.5.99.22/nx-X11/config/cf/host.def --- nx-libs-3.5.99.20/nx-X11/config/cf/host.def 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/config/cf/host.def 2019-12-16 06:31:54.000000000 +0000 @@ -156,15 +156,15 @@ * this by default as NX intaller carries only misc and TTF in the * basic set of fonts installed under Windows. * -#define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/Speedo/,$(FONTDIR)/Type1/,$(FONTDIR)/75dpi/,$(FONTDIR)/100dpi/ +#define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/Type1/,$(FONTDIR)/75dpi/,$(FONTDIR)/100dpi/ */ #if defined(LinuxArchitecture) || defined(SunArchitecture) || defined(FreeBSDArchitecture) -#define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/Speedo/,$(FONTDIR)/Type1/,$(FONTDIR)/75dpi/,$(FONTDIR)/100dpi/,$(FONTDIR)/TTF/ +#define DefaultFontPath $(FONTDIR)/misc/,$(FONTDIR)/Type1/,$(FONTDIR)/75dpi/,$(FONTDIR)/100dpi/,$(FONTDIR)/TTF/ #endif /* #if defined(LinuxArchitecture) || defined(SunArchitecture) */ #if defined(cygwinArchitecture) -#define DefaultFontPath /mnt/NX/fonts/base/,/mnt/NX/fonts/misc/,/mnt/NX/fonts/Speedo/,/mnt/NX/fonts/Type1/,/mnt/NX/fonts/75dpi/,/mnt/NX/fonts/100dpi/,/mnt/NX/fonts/TTF/ +#define DefaultFontPath /mnt/NX/fonts/base/,/mnt/NX/fonts/misc/,/mnt/NX/fonts/Type1/,/mnt/NX/fonts/75dpi/,/mnt/NX/fonts/100dpi/,/mnt/NX/fonts/TTF/ #endif /* #if defined(cygwinArchitecture) */ /* diff -Nru nx-libs-3.5.99.20/nx-X11/config/cf/Imake.tmpl nx-libs-3.5.99.22/nx-X11/config/cf/Imake.tmpl --- nx-libs-3.5.99.20/nx-X11/config/cf/Imake.tmpl 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/config/cf/Imake.tmpl 2019-12-16 06:31:54.000000000 +0000 @@ -791,6 +791,10 @@ #define SystemXkbBinDir /usr/bin #endif +#ifndef SystemFontDir +#define SystemFontDir /usr/share/fonts/X11 +#endif + #ifndef ShLibDir #define ShLibDir UsrLibDir #endif @@ -1668,6 +1672,7 @@ SYSTEMUSRINCDIR = SystemUsrIncDir /* system's "/usr/include" */ SYSTEMXKBCONFDIR = SystemXkbConfigDir /* system's "/usr/share/xkb" */ SYSTEMXKBBINDIR = SystemXkbBinDir /* system's "/usr/bin" */ + SYSTEMFONTDIR = SystemFontDir /* system's "/usr/share/fonts/X11" */ SHLIBDIR = ShLibDir /* shared libraries */ LINTLIBDIR = LintlibDir /* lint libraries */ MANPATH = ManPath /* top of manual page tree */ diff -Nru nx-libs-3.5.99.20/nx-X11/config/cf/linux.cf nx-libs-3.5.99.22/nx-X11/config/cf/linux.cf --- nx-libs-3.5.99.20/nx-X11/config/cf/linux.cf 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/config/cf/linux.cf 2019-12-16 06:31:54.000000000 +0000 @@ -683,7 +683,7 @@ # define OptimizedCDebugFlags DefaultGcc2AxpOpt # endif # define LinuxMachineDefines -D__alpha__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 -DJENSEN_SUPPORT # ifdef UseCompaqMathLibrary # define MathLibrary -lcpml -lm @@ -693,7 +693,7 @@ #ifdef HPArchitecture # define OptimizedCDebugFlags -O2 GccAliasingArgs # define LinuxMachineDefines -D__hppa__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* HPArchitecture */ @@ -702,7 +702,7 @@ # define OptimizedCDebugFlags -O3 # endif # define LinuxMachineDefines -D__arm__ -D__arm32__ -U__arm -Uarm -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* Arm32Achitecture */ @@ -711,7 +711,7 @@ # define OptimizedCDebugFlags -O3 # endif # define LinuxMachineDefines -D__aarch64__ -U__arm -Uarm -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* Arm64Achitecture */ @@ -720,7 +720,7 @@ # define OptimizedCDebugFlags DefaultGcc2i386Opt # endif # define LinuxMachineDefines -D__i386__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* i386Architecture */ @@ -729,7 +729,7 @@ # define OptimizedCDebugFlags -O2 GccAliasingArgs # endif # define LinuxMachineDefines -D__ia64__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* ia64Architecture */ @@ -738,7 +738,7 @@ # define OptimizedCDebugFlags -O2 GccAliasingArgs # endif # define LinuxMachineDefines -D__mc68000__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* Mc68020Architecture */ @@ -747,7 +747,7 @@ # define OptimizedCDebugFlags DefaultGcc2MipsOpt # endif # define LinuxMachineDefines -D__mips__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif @@ -756,7 +756,7 @@ # define OptimizedCDebugFlags DefaultGcc2MipsOpt # endif # define LinuxMachineDefines -D__MIPSEL__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # ifdef Mips64elArchitecture # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 # else @@ -770,7 +770,7 @@ # define OptimizedCDebugFlags DefaultGcc2Ppc64Opt # endif # define LinuxMachineDefines -D__powerpc64__ -D__powerpc__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME -DPART_NET +# define ServerOSDefines XFree86ServerOSDefines -DPART_NET # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* Ppc64Architecture */ @@ -779,7 +779,7 @@ # define OptimizedCDebugFlags DefaultGcc2PpcOpt # endif # define LinuxMachineDefines -D__powerpc__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* PpcArchitecture */ @@ -788,7 +788,7 @@ # define OptimizedCDebugFlags -O2 -fomit-frame-pointer GccAliasingArgs # endif # define LinuxMachineDefines -D__s390__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* s390Architecture */ @@ -796,7 +796,7 @@ /*#define DefaultCCOptions -fsigned-char */ #define OptimizedCDebugFlags -O3 -fomit-frame-pointer #define LinuxMachineDefines -D__s390x__ -#define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +#define ServerOSDefines XFree86ServerOSDefines #define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* s390xArchitecture */ @@ -805,7 +805,7 @@ # define OptimizedCDebugFlags -O2 GccAliasingArgs # endif # define LinuxMachineDefines -D__sparc__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define AsVISOption -Av9a # ifdef Sparc64Architecture # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 @@ -835,7 +835,7 @@ # define OptimizedCDebugFlags -O2 SuperHArchOptFlags SuperHEndianFlags GccAliasingArgs # endif # define LinuxMachineDefines -D__sh__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif @@ -844,7 +844,7 @@ # define OptimizedCDebugFlags DefaultGcc2AMD64Opt # endif # define LinuxMachineDefines -D__amd64__ -# define ServerOSDefines XFree86ServerOSDefines -DDDXTIME +# define ServerOSDefines XFree86ServerOSDefines # define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 #endif /* AMD64Architecture */ Binary files /tmp/tmpRKF4Q9/XjMlEYonZr/nx-libs-3.5.99.20/nx-X11/extras/Mesa/progs/images/bw.rgb and /tmp/tmpRKF4Q9/0ffVwXLdCy/nx-libs-3.5.99.22/nx-X11/extras/Mesa/progs/images/bw.rgb differ Binary files /tmp/tmpRKF4Q9/XjMlEYonZr/nx-libs-3.5.99.20/nx-X11/extras/Mesa_6.4.2/progs/images/bw.rgb and /tmp/tmpRKF4Q9/0ffVwXLdCy/nx-libs-3.5.99.22/nx-X11/extras/Mesa_6.4.2/progs/images/bw.rgb differ diff -Nru nx-libs-3.5.99.20/nx-X11/include/extensions/Imakefile nx-libs-3.5.99.22/nx-X11/include/extensions/Imakefile --- nx-libs-3.5.99.20/nx-X11/include/extensions/Imakefile 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/include/extensions/Imakefile 2019-12-16 06:31:54.000000000 +0000 @@ -54,7 +54,7 @@ xcmiscstr.h \ bigreqstr.h \ XI.h XIproto.h \ - xtestconst.h xtestext1.h xteststr.h \ + xtestconst.h xteststr.h \ XKB.h XKBgeom.h XKBproto.h XKBstr.h XKBsrv.h \ Xdbeproto.h \ $(EXTRAHEADERS) \ diff -Nru nx-libs-3.5.99.20/nx-X11/include/extensions/xtestext1.h nx-libs-3.5.99.22/nx-X11/include/extensions/xtestext1.h --- nx-libs-3.5.99.20/nx-X11/include/extensions/xtestext1.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/include/extensions/xtestext1.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,325 +0,0 @@ -/* - * xtestext1.h - * - * X11 Input Synthesis Extension include file - */ - -/* - - -Copyright 1986, 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Hewlett-Packard not be used in -advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Hewlett-Packard makes no representations about the -suitability of this software for any purpose. It is provided -"as is" without express or implied warranty. - -This software is not subject to any license of the American -Telephone and Telegraph Company or of the Regents of the -University of California. - -*/ - -/* - * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h - */ - -/* - * used in the XTestPressButton and XTestPressKey functions - */ -#define XTestPRESS 1 << 0 -#define XTestRELEASE 1 << 1 -#define XTestSTROKE 1 << 2 - -/* - * When doing a key or button stroke, the number of milliseconds - * to delay between the press and the release of a key or button - * in the XTestPressButton and XTestPressKey functions. - */ - -#define XTestSTROKE_DELAY_TIME 10 - -/* - * used in the XTestGetInput function - */ -#define XTestEXCLUSIVE 1 << 0 -#define XTestPACKED_ACTIONS 1 << 1 -#define XTestPACKED_MOTION 1 << 2 - -/* - * used in the XTestFakeInput function - */ -#define XTestFAKE_ACK_NOT_NEEDED 0 -#define XTestFAKE_ACK_REQUEST 1 - -/* - * used in the XTest extension initialization routine - */ -#define XTestEXTENSION_NAME "XTestExtension1" -#define XTestEVENT_COUNT 2 - -/* - * XTest request type values - * - * used in the XTest extension protocol requests - */ -#define X_TestFakeInput 1 -#define X_TestGetInput 2 -#define X_TestStopInput 3 -#define X_TestReset 4 -#define X_TestQueryInputSize 5 - -/* - * This defines the maximum size of a list of input actions - * to be sent to the server. It should always be a multiple of - * 4 so that the entire xTestFakeInputReq structure size is a - * multiple of 4. - */ -#define XTestMAX_ACTION_LIST_SIZE 64 - -typedef struct { - CARD8 reqType; /* always XTestReqCode */ - CARD8 XTestReqType; /* always X_TestFakeInput */ - CARD16 length B16; /* 2 + XTestMAX_ACTION_LIST_SIZE/4 */ - CARD32 ack B32; - CARD8 action_list[XTestMAX_ACTION_LIST_SIZE]; -} xTestFakeInputReq; -#define sz_xTestFakeInputReq (XTestMAX_ACTION_LIST_SIZE + 8) - -typedef struct { - CARD8 reqType; /* always XTestReqCode */ - CARD8 XTestReqType; /* always X_TestGetInput */ - CARD16 length B16; /* 2 */ - CARD32 mode B32; -} xTestGetInputReq; -#define sz_xTestGetInputReq 8 - -typedef struct { - CARD8 reqType; /* always XTestReqCode */ - CARD8 XTestReqType; /* always X_TestStopInput */ - CARD16 length B32; /* 1 */ -} xTestStopInputReq; -#define sz_xTestStopInputReq 4 - -typedef struct { - CARD8 reqType; /* always XTestReqCode */ - CARD8 XTestReqType; /* always X_TestReset */ - CARD16 length B16; /* 1 */ -} xTestResetReq; -#define sz_xTestResetReq 4 - -typedef struct { - CARD8 reqType; /* always XTestReqCode */ - CARD8 XTestReqType; /* always X_TestQueryInputSize */ - CARD16 length B16; /* 1 */ -} xTestQueryInputSizeReq; -#define sz_xTestQueryInputSizeReq 4 - -/* - * This is the definition of the reply for the xTestQueryInputSize - * request. It should remain the same minimum size as other replies - * (32 bytes). - */ -typedef struct { - CARD8 type; /* always X_Reply */ - CARD8 pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* always 0 */ - CARD32 size_return B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xTestQueryInputSizeReply; - -/* - * This is the definition for the input action wire event structure. - * This event is sent to the client when the server has one or - * more user input actions to report to the client. It must - * remain the same size as all other wire events (32 bytes). - */ -#define XTestACTIONS_SIZE 28 - -typedef struct { - CARD8 type; /* always XTestInputActionType */ - CARD8 pad00; - CARD16 sequenceNumber B16; - CARD8 actions[XTestACTIONS_SIZE]; -} xTestInputActionEvent; - -/* - * This is the definition for the xTestFakeAck wire event structure. - * This event is sent to the client when the server has completely - * processed its input action buffer, and is ready for more. - * It must remain the same size as all other wire events (32 bytes). - */ -typedef struct { - CARD8 type; /* always XTestFakeAckType */ - CARD8 pad00; - CARD16 sequenceNumber B16; - CARD32 pad02 B32; - CARD32 pad03 B32; - CARD32 pad04 B32; - CARD32 pad05 B32; - CARD32 pad06 B32; - CARD32 pad07 B32; - CARD32 pad08 B32; -} xTestFakeAckEvent; - -/* - * The server side of this extension does not (and should not) have - * definitions for Display and Window. The ifndef allows the server - * side of the extension to ignore the following typedefs. - */ -#ifndef XTestSERVER_SIDE -/* - * This is the definition for the input action host format event structure. - * This is the form that a client using this extension will see when - * it receives an input action event. - */ -typedef struct { - int type; /* always XTestInputActionType */ - Display *display; - Window window; - CARD8 actions[XTestACTIONS_SIZE]; -} XTestInputActionEvent; - -/* - * This is the definition for the xTestFakeAck host format event structure. - * This is the form that a client using this extension will see when - * it receives an XTestFakeAck event. - */ -typedef struct { - int type; /* always XTestFakeAckType */ - Display *display; - Window window; -} XTestFakeAckEvent; -#endif - -/* - * This is the definition for the format of the header byte - * in the input action structures. - */ -#define XTestACTION_TYPE_MASK 0x03 /* bits 0 and 1 */ -#define XTestKEY_STATE_MASK 0x04 /* bit 2 (key action) */ -#define XTestX_SIGN_BIT_MASK 0x04 /* bit 2 (motion action) */ -#define XTestY_SIGN_BIT_MASK 0x08 /* bit 3 (motion action) */ -#define XTestDEVICE_ID_MASK 0xf0 /* bits 4 through 7 */ - -#define XTestMAX_DEVICE_ID 0x0f -#define XTestPackDeviceID(x) (((x) & XTestMAX_DEVICE_ID) << 4) -#define XTestUnpackDeviceID(x) (((x) & XTestDEVICE_ID_MASK) >> 4) - -/* - * These are the possible action types. - */ -#define XTestDELAY_ACTION 0 -#define XTestKEY_ACTION 1 -#define XTestMOTION_ACTION 2 -#define XTestJUMP_ACTION 3 - -/* - * These are the definitions for key/button motion input actions. - */ -#define XTestKEY_UP 0x04 -#define XTestKEY_DOWN 0x00 - -typedef struct { - CARD8 header; /* which device, key up/down */ - CARD8 keycode; /* which key/button to move */ - CARD16 delay_time B16; /* how long to delay (in ms) */ -} XTestKeyInfo; - -/* - * This is the definition for pointer jump input actions. - */ -typedef struct { - CARD8 header; /* which pointer */ - CARD8 pad1; /* unused padding byte */ - CARD16 jumpx B16; /* x coord to jump to */ - CARD16 jumpy B16; /* y coord to jump to */ - CARD16 delay_time B16; /* how long to delay (in ms) */ -} XTestJumpInfo; - -/* - * These are the definitions for pointer relative motion input - * actions. - * - * The sign bits for the x and y relative motions are contained - * in the header byte. The x and y relative motions are packed - * into one byte to make things fit in 32 bits. If the relative - * motion range is larger than +/-15, use the pointer jump action. - */ -#define XTestMOTION_MAX 15 -#define XTestMOTION_MIN -15 - -#define XTestX_NEGATIVE 0x04 -#define XTestY_NEGATIVE 0x08 - -#define XTestX_MOTION_MASK 0x0f -#define XTestY_MOTION_MASK 0xf0 - -#define XTestPackXMotionValue(x) ((x) & XTestX_MOTION_MASK) -#define XTestPackYMotionValue(x) (((x) << 4) & XTestY_MOTION_MASK) - -#define XTestUnpackXMotionValue(x) ((x) & XTestX_MOTION_MASK) -#define XTestUnpackYMotionValue(x) (((x) & XTestY_MOTION_MASK) >> 4) - -typedef struct { - CARD8 header; /* which pointer */ - CARD8 motion_data; /* x,y relative motion */ - CARD16 delay_time B16; /* how long to delay (in ms) */ -} XTestMotionInfo; - -/* - * These are the definitions for a long delay input action. It is - * used when more than XTestSHORT_DELAY_TIME milliseconds of delay - * (approximately one minute) is needed. - * - * The device ID for a delay is always set to XTestDELAY_DEVICE_ID. - * This guarantees that a header byte with a value of 0 is not - * a valid header, so it can be used as a flag to indicate that - * there are no more input actions in an XTestInputAction event. - */ - -#define XTestSHORT_DELAY_TIME 0xffff -#define XTestDELAY_DEVICE_ID 0x0f - -typedef struct { - CARD8 header; /* always XTestDELAY_DEVICE_ID */ - CARD8 pad1; /* unused padding byte */ - CARD16 pad2 B16; /* unused padding word */ - CARD32 delay_time B32; /* how long to delay (in ms) */ -} XTestDelayInfo; diff -Nru nx-libs-3.5.99.20/nx-X11/lib/src/Quarks.c nx-libs-3.5.99.22/nx-X11/lib/src/Quarks.c --- nx-libs-3.5.99.20/nx-X11/lib/src/Quarks.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/lib/src/Quarks.c 2019-12-16 06:31:54.000000000 +0000 @@ -88,7 +88,7 @@ #define STRQUANTSIZE (sizeof(XrmString) * (QUANTUMMASK + 1)) #ifdef PERMQ #define QUANTSIZE (STRQUANTSIZE + \ - (sizeof(Bits) * ((QUANTUMMASK + 1) >> 3)) + (sizeof(Bits) * ((QUANTUMMASK + 1) >> 3))) #else #define QUANTSIZE STRQUANTSIZE #endif diff -Nru nx-libs-3.5.99.20/nx-X11/lib/src/xkb/XKBBind.c nx-libs-3.5.99.22/nx-X11/lib/src/xkb/XKBBind.c --- nx-libs-3.5.99.20/nx-X11/lib/src/xkb/XKBBind.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/lib/src/xkb/XKBBind.c 2019-12-16 06:31:54.000000000 +0000 @@ -108,7 +108,21 @@ _XkbCheckPendingRefresh(dpy, dpy->xkb_info); +#ifdef NX_TRANS_SOCKET + /* + check again, we have seen cases where the connection broke + during CheckPendingEvents(), followed by a crash when accessing + dpy. See https://github.com/ArcticaProject/nx-libs/issues/801 + */ + if (_XkbUnavailable(dpy)) + return _XKeycodeToKeysym(dpy, kc, col); +#endif + xkb = dpy->xkb_info->desc; +#ifdef NX_TRANS_SOCKET + if (xkb == NULL) + return _XKeycodeToKeysym(dpy, kc, col); +#endif if ((kc < xkb->min_key_code) || (kc > xkb->max_key_code)) return NoSymbol; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/damageext/Imakefile nx-libs-3.5.99.22/nx-X11/programs/Xserver/damageext/Imakefile --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/damageext/Imakefile 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/damageext/Imakefile 2019-12-16 06:31:54.000000000 +0000 @@ -20,9 +20,9 @@ $(NX_DEFINES) \ $(NULL) -NormalLibraryTarget(damage,$(OBJS)) +NormalLibraryTarget(damageext,$(OBJS)) NormalLibraryObjectRule() -LintLibraryTarget(damage,$(SRCS)) +LintLibraryTarget(damageext,$(SRCS)) NormalLintTarget($(SRCS)) DependTarget() diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/dix/devices.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/dix/devices.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/dix/devices.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/dix/devices.c 2019-12-16 06:31:54.000000000 +0000 @@ -73,6 +73,8 @@ #include "swaprep.h" #include "dixevents.h" +extern void XkbFreePrivates(DeviceIntPtr device); + DeviceIntPtr AddInputDevice(DeviceProc deviceProc, Bool autoStart) { @@ -203,7 +205,15 @@ if (dev->inited) (void)(*dev->deviceProc)(dev, DEVICE_CLOSE); + +#ifdef XKB + while (dev->xkb_interest) { + XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource); + } +#endif + free(dev->name); + if (dev->key) { #ifdef XKB @@ -267,11 +277,13 @@ #endif free(l); } + #ifdef XKB - while (dev->xkb_interest) { - XkbRemoveResourceClient((DevicePtr)dev,dev->xkb_interest->resource); - } + XkbFreePrivates(dev); #endif + + free(dev->devPrivates); + free(dev->sync.event); free(dev); } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/dix/dispatch.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/dix/dispatch.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/dix/dispatch.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/dix/dispatch.c 2019-12-16 06:31:54.000000000 +0000 @@ -416,12 +416,6 @@ } client->sequence++; -#ifdef DEBUG - if (client->requestLogIndex == MAX_REQUEST_LOG) - client->requestLogIndex = 0; - client->requestLog[client->requestLogIndex] = MAJOROP; - client->requestLogIndex++; -#endif if (result > (maxBigRequestSize << 2)) result = BadLength; else @@ -925,7 +919,6 @@ } } -#ifndef NXAGENT_SERVER int ProcSetSelectionOwner(register ClientPtr client) { @@ -1020,7 +1013,6 @@ return (BadAtom); } } -#endif /* NXAGENT_SERVER */ int ProcGetSelectionOwner(register ClientPtr client) @@ -3622,9 +3614,6 @@ client->numSaved = 0; client->saveSet = (SaveSetElt *)NULL; client->noClientException = Success; -#ifdef DEBUG - client->requestLogIndex = 0; -#endif client->requestVector = InitialVector; client->osPrivate = ospriv; client->swapped = FALSE; @@ -4161,7 +4150,10 @@ pScreen->devPrivates = (DevUnion *)calloc(sizeof(DevUnion), screenPrivateCount); if (!pScreen->devPrivates && screenPrivateCount) + { + free(pScreen); return -1; + } ret = init_screen(pScreen, i); if (ret != 0) { diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/dix/events.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/dix/events.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/dix/events.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/dix/events.c 2019-12-16 06:31:54.000000000 +0000 @@ -245,6 +245,8 @@ int y ); +static Bool CheckMotion(xEvent *xE); + extern int lastEvent; static Mask lastEventMask; @@ -1936,10 +1938,8 @@ if (spriteTraceGood >= spriteTraceSize) { spriteTraceSize += 10; - Must_have_memory = TRUE; /* XXX */ - spriteTrace = (WindowPtr *)realloc( + spriteTrace = realloc( spriteTrace, spriteTraceSize*sizeof(WindowPtr)); - Must_have_memory = FALSE; /* XXX */ } spriteTrace[spriteTraceGood++] = pWin; pWin = pWin->firstChild; @@ -1951,6 +1951,7 @@ } #endif /* NXAGENT_SERVER */ +#ifndef NXAGENT_SERVER static Bool CheckMotion(xEvent *xE) { @@ -2015,6 +2016,7 @@ } return TRUE; } +#endif /* NXAGENT_SERVER */ void WindowsRestructured() @@ -2451,11 +2453,9 @@ { if (device->sync.evcount < count) { - Must_have_memory = TRUE; /* XXX */ - device->sync.event = (xEvent *)realloc(device->sync.event, - count* - sizeof(xEvent)); - Must_have_memory = FALSE; /* XXX */ + device->sync.event = realloc(device->sync.event, + count* + sizeof(xEvent)); } device->sync.evcount = count; for (dxE = device->sync.event; --count >= 0; dxE++, xE++) @@ -2623,10 +2623,8 @@ FreezeThaw(thisDev, TRUE); if (thisDev->sync.evcount < count) { - Must_have_memory = TRUE; /* XXX */ - thisDev->sync.event = (xEvent *)realloc(thisDev->sync.event, - count*sizeof(xEvent)); - Must_have_memory = FALSE; /* XXX */ + thisDev->sync.event = realloc(thisDev->sync.event, + count*sizeof(xEvent)); } thisDev->sync.evcount = count; for (dxE = thisDev->sync.event; --count >= 0; dxE++, xE++) @@ -3501,11 +3499,8 @@ if (depth > focus->traceSize) { focus->traceSize = depth+1; - Must_have_memory = TRUE; /* XXX */ - focus->trace = (WindowPtr *)realloc(focus->trace, - focus->traceSize * - sizeof(WindowPtr)); - Must_have_memory = FALSE; /* XXX */ + focus->trace = realloc(focus->trace, + focus->traceSize * sizeof(WindowPtr)); } focus->traceGood = depth; for (pWin = focusWin, depth--; pWin; pWin = pWin->parent, depth--) diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/dix/window.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/dix/window.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/dix/window.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/dix/window.c 2019-12-16 06:31:54.000000000 +0000 @@ -305,7 +305,6 @@ #endif } -#ifndef NXAGENT_SERVER static void MakeRootTile(WindowPtr pWin) { @@ -348,7 +347,6 @@ FreeScratchGC(pGC); } -#endif /* NXAGENT_SERVER */ WindowPtr AllocateWindow(ScreenPtr pScreen) diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/fb/fboverlay.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/fb/fboverlay.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/fb/fboverlay.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/fb/fboverlay.c 2019-12-16 06:31:54.000000000 +0000 @@ -410,16 +410,20 @@ if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &depth1, &defaultVisual, ((unsigned long)1<<(bpp1-1)) | - ((unsigned long)1<<(bpp2-1)), 8)) + ((unsigned long)1<<(bpp2-1)), 8)) { + free(pScrPriv); return FALSE; + } if (! miScreenInit(pScreen, 0, xsize, ysize, dpix, dpiy, 0, depth1, ndepths, depths, defaultVisual, nvisuals, visuals #ifdef FB_OLD_MISCREENINIT , (miBSFuncPtr) 0 #endif - )) + )) { + free(pScrPriv); return FALSE; + } /* MI thinks there's no frame buffer */ #ifdef MITSHM ShmRegisterFbFuncs(pScreen); diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/GL/glx/glxext.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/GL/glx/glxext.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/GL/glx/glxext.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/GL/glx/glxext.c 2019-12-16 06:31:54.000000000 +0000 @@ -64,6 +64,7 @@ if (cl->returnBuf) free(cl->returnBuf); if (cl->largeCmdBuf) free(cl->largeCmdBuf); if (cl->currentContexts) free(cl->currentContexts); + if (cl->GLClientextensions) free(cl->GLClientextensions); memset(cl, 0, sizeof(__GLXclientState)); /* ** By default, assume that the client supports @@ -71,9 +72,6 @@ */ cl->GLClientmajorVersion = 1; cl->GLClientminorVersion = 0; - if (cl->GLClientextensions) - free(cl->GLClientextensions); - } /* diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Args.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Args.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Args.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Args.c 2019-12-16 06:31:54.000000000 +0000 @@ -126,7 +126,7 @@ extern char dispatchExceptionAtReset; -char *nxagentProgName; +const char *nxagentProgName = NULL; char nxagentDisplayName[NXAGENTDISPLAYNAMELENGTH]; Bool nxagentSynchronize = False; @@ -153,7 +153,6 @@ Bool nxagentReportPrivateWindowIds = False; Bool nxagentDoDirectColormaps = False; Window nxagentParentWindow = 0; -Bool nxagentIpaq = False; int nxagentLockDeferLevel = 0; @@ -186,17 +185,31 @@ int ddxProcessArgument(int argc, char *argv[], int i) { /* - * Ensure that the options are set to their defaults. + * The flavour can never change, so only set it once. + * + * FIXME: ddxProcessArgument() is called once for every command line + * argument, with argv[0] being the argument and not the program + * name! We should move this check somewhere else. */ + if (nxagentProgName == NULL) + { + char *basec = strdup(argv[0]); + nxagentProgName = strdup(basename(basec)); + SAFE_free(basec); + + /* + * Check if we are running as X2Go Agent + */ + checkX2goAgent(); + } - char *basec = strdup(argv[0]); - nxagentProgName = strdup(basename(basec)); - free(basec); + #ifdef TEST + fprintf(stderr, "%s: argv[0] [%s] nxagentProgName [%s]\n", __func__, argv[0], nxagentProgName); + #endif /* - * Check if we running as X2Go Agent + * Ensure that the options are set to their defaults. */ - checkX2goAgent(); static Bool resetOptions = True; @@ -257,7 +270,7 @@ { nxagentParseOptionString(envOptions); - free(envOptions); + SAFE_free(envOptions); } for (j = 0; j < argc; j++) @@ -365,8 +378,7 @@ { if (++i < argc) { - free(nxagentOptionsFilenameOrString); - nxagentOptionsFilenameOrString = NULL; + SAFE_free(nxagentOptionsFilenameOrString); if (-1 == asprintf(&nxagentOptionsFilenameOrString, "%s", argv[i])) { @@ -604,14 +616,6 @@ nxagentChangeOption(AllScreens, True); } - else if (!strcmp(argv[i],"ipaq")) - { - nxagentChangeOption(Fullscreen, True); - - nxagentChangeOption(AllScreens, True); - - nxagentIpaq = True; - } else { if (nxagentUserGeometry.flag == 0) @@ -711,8 +715,7 @@ { if (++i < argc) { - free(nxagentKeyboard); - nxagentKeyboard = NULL; + SAFE_free(nxagentKeyboard); nxagentKeyboard = strdup(argv[i]); if (nxagentKeyboard == NULL) @@ -1036,6 +1039,14 @@ return 0; } + if (!strcmp(argv[i], "-autograb")) + { + nxagentChangeOption(AutoGrab, True); + + return 1; + } + + /* * Disable Xinerama (i.e. fake it in Screen.c) if somehow Xinerama support * has been disabled on the cmdline. @@ -1536,6 +1547,19 @@ return; } + else if (!strcmp(name, "autograb")) + { + if (!strcmp(value, "0")) + { + nxagentChangeOption(AutoGrab, False); + } + else + { + nxagentChangeOption(AutoGrab, True); + } + + return; + } else { #ifdef DEBUG @@ -1569,7 +1593,7 @@ ddxProcessArgument(argc, argv, 0); - free(argv[0]); + SAFE_free(argv[0]); } static void nxagentParseOptionString(char *string) @@ -1756,7 +1780,7 @@ nxagentProcessOptionsFileExit: - free(data); + SAFE_free(data); if (file) { @@ -2192,6 +2216,7 @@ ErrorF("-noignore don't ignore pointer and keyboard configuration changes mandated by clients\n"); ErrorF("-nokbreset don't reset keyboard device if the session is resumed\n"); ErrorF("-noxkblock always allow applications to change layout through XKEYBOARD\n"); + ErrorF("-autograb enable autograb\n"); ErrorF("-tile WxH size of image tiles (minimum allowed: 32x32)\n"); ErrorF("-keystrokefile file file with keyboard shortcut definitions\n"); ErrorF("-verbose print more warning and error messages\n"); diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Args.h nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Args.h --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Args.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Args.h 2019-12-16 06:31:54.000000000 +0000 @@ -82,7 +82,6 @@ extern Window nxagentParentWindow; extern int nxagentMaxAllowedReset; extern Bool nxagentResizeDesktopAtStartup; -extern Bool nxagentIpaq; extern int nxagentLockDeferLevel; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Atoms.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Atoms.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Atoms.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Atoms.c 2019-12-16 06:31:54.000000000 +0000 @@ -43,6 +43,7 @@ #include "Screen.h" #include "Options.h" #include "Agent.h" +#include "Utils.h" /* * Set here the required log level. @@ -53,11 +54,6 @@ #undef TEST #undef DEBUG -#ifdef DEBUG -/* for validateString() */ -#include "Utils.h" -#endif - /* * These values should be moved in * the option repository. @@ -482,8 +478,8 @@ fprintf(stderr, "nxagentInitAtomMap: WARNING! XInternAtoms request failed.\n"); #endif - free(atom_list); - free(name_list); + SAFE_free(atom_list); + SAFE_free(name_list); return 0; } @@ -523,8 +519,8 @@ } } - free(atom_list); - free(name_list); + SAFE_free(atom_list); + SAFE_free(name_list); nxagentPrintAtomMapInfo("nxagentInitAtomMap: Exiting"); @@ -794,7 +790,7 @@ #ifdef TEST fprintf(stderr, "%s: remote [%d (%s)] -> local [%d]\n", __func__, remote, string, local); #endif - XFree(string); + SAFE_XFree(string); return local; } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Client.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Client.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Client.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Client.c 2019-12-16 06:31:54.000000000 +0000 @@ -400,7 +400,7 @@ fprintf(stderr, "++++++nxagentWaitWakeupBySplit: Yielding control to the NX transport.\n"); #endif - nxagentWaitEvents(nxagentDisplay, NULL); + nxagentWaitEvents(nxagentDisplay, 0); } } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c 2019-12-16 06:31:54.000000000 +0000 @@ -305,7 +305,7 @@ fprintf(stderr, " lastClientSelection (Atom) [% 4d][%s]\n", lastClientSelection, NameForAtom(lastClientSelection)); fprintf(stderr, " lastClientTarget (Atom) [% 4d][%s]\n", lastClientTarget, NameForAtom(lastClientTarget)); fprintf(stderr, " lastClientTime (Time) [%u]\n", lastServerTime); - fprintf(stderr, " lastClientReqTime (Time) [%u]\n", lastServerTime); + fprintf(stderr, " lastClientReqTime (Time) [%u]\n", lastServerReqTime); fprintf(stderr, " lastClientPropertySize (unsigned long) [%lu]\n", lastClientPropertySize); fprintf(stderr, " lastClientStage (ClientSelectionStage) [%d][%s]\n", lastClientStage, GetClientSelectionStageString(lastClientStage)); @@ -392,8 +392,6 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow) { - int i; - #ifdef DEBUG fprintf(stderr, "%s: Called with client [%p] window [%p].\n", __func__, (void *) pClient, (void *) pWindow); @@ -405,7 +403,7 @@ * Only for PRIMARY and CLIPBOARD selections. */ - for (i = 0; i < nxagentMaxSelections; i++) + for (int i = 0; i < nxagentMaxSelections; i++) { if ((pClient != NULL && lastSelectionOwner[i].client == pClient) || (pWindow != NULL && lastSelectionOwner[i].windowPtr == pWindow)) @@ -1241,7 +1239,9 @@ { XSetSelectionOwner(nxagentDisplay, lastSelectionOwner[i].selection, serverWindow, CurrentTime); + #ifdef DEBUG fprintf(stderr, "%s: Reset clipboard state.\n", __func__); + #endif lastSelectionOwner[i].client = NULL; lastSelectionOwner[i].window = None; @@ -1257,9 +1257,77 @@ return; } +#ifdef NXAGENT_CLIPBOARD +void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data, + void *args) +{ + /* + * Only act if the Trap is unset. The trap indicates that we are + * triggered by a clipboard event originating from the real X + * server. In that case we do not want to propagate back changes to + * the real X server, because it already knows about them and we + * would end up in an infinite loop of events. If there was a better + * way to identify that situation during Callback processing we + * could get rid of the Trap... + */ + if (nxagentExternalClipboardEventTrap != 0) + { + #ifdef DEBUG + fprintf(stderr, "%s: Trap is set, doing nothing\n", __func__); + #endif + return; + } + + SelectionInfoRec *info = (SelectionInfoRec *)args; + + Selection * pCurSel = (Selection *)info->selection; + + #ifdef DEBUG + fprintf(stderr, "%s: pCurSel->lastTimeChanged [%d]\n", __func__, pCurSel->lastTimeChanged.milliseconds); + #endif + + if (info->kind == SelectionSetOwner) + { + #ifdef DEBUG + fprintf(stderr, "%s: called with SelectionCallbackKind SelectionSetOwner\n", __func__); + fprintf(stderr, "%s: pCurSel->pWin [0x%x]\n", __func__, pCurSel->pWin ? pCurSel->pWin->drawable.id : NULL); + fprintf(stderr, "%s: pCurSel->selection [%s]\n", __func__, NameForAtom(pCurSel->selection)); + #endif + + if ((pCurSel->pWin != NULL) && + (nxagentOption(Clipboard) != ClipboardNone) && + ((pCurSel->selection == XA_PRIMARY) || + (pCurSel->selection == MakeAtom("CLIPBOARD", 9, 0)))) + { + #ifdef DEBUG + fprintf(stderr, "%s: calling nxagentSetSelectionOwner\n", __func__); + #endif + nxagentSetSelectionOwner(pCurSel); + } + } + else if (info->kind == SelectionWindowDestroy) + { + #ifdef DEBUG + fprintf(stderr, "%s: called with SelectionCallbackKind SelectionWindowDestroy\n", __func__); + #endif + } + else if (info->kind == SelectionClientClose) + { + #ifdef DEBUG + fprintf(stderr, "%s: called with SelectionCallbackKind SelectionClientClose\n", __func__); + #endif + } + else + { + #ifdef DEBUG + fprintf(stderr, "%s: called with unknown SelectionCallbackKind\n", __func__); + #endif + } +} +#endif + void nxagentSetSelectionOwner(Selection *pSelection) { - int i; #ifdef DEBUG fprintf(stderr, "%s: Got called.\n", __func__); #endif @@ -1270,7 +1338,7 @@ } #ifdef DEBUG - fprintf(stderr, "%s: Setting selection owner to window [0x%x].\n", __func__, + fprintf(stderr, "%s: Setting selection owner to serverwindow ([0x%x]).\n", __func__, serverWindow); #endif @@ -1286,10 +1354,24 @@ * Only for PRIMARY and CLIPBOARD selections. */ - for (i = 0; i < nxagentMaxSelections; i++) + for (int i = 0; i < nxagentMaxSelections; i++) { if (pSelection->selection == CurrentSelections[i].selection) { + #ifdef DEBUG + fprintf(stderr, "%s: lastSelectionOwner.client [0x%x] -> [0x%x]\n", __func__, lastSelectionOwner[i].client, pSelection->client); + fprintf(stderr, "%s: lastSelectionOwner.window [0x%x] -> [0x%x]\n", __func__, lastSelectionOwner[i].window, pSelection->window); + fprintf(stderr, "%s: lastSelectionOwner.windowPtr [0x%x] -> [0x%x] [0x%x] (serverWindow: [0x%x])\n", __func__, lastSelectionOwner[i].windowPtr, pSelection->pWin, nxagentWindow(pSelection->pWin), serverWindow); + fprintf(stderr, "%s: lastSelectionOwner.lastTimeChanged [%d]\n", __func__, lastSelectionOwner[i].lastTimeChanged); + #endif + + /* + * inform the real X server that our serverWindow is the + * clipboard owner. The real owner window (inside nxagent) is + * stored in lastSelectionOwner.window. + * lastSelectionOwner.windowPtr points to the struct that + * contains all information about the owner window + */ XSetSelectionOwner(nxagentDisplay, lastSelectionOwner[i].selection, serverWindow, CurrentTime); lastSelectionOwner[i].client = pSelection->client; @@ -1701,8 +1783,7 @@ fprintf(stderr, "%s: Got called.\n", __func__); #endif - free(lastSelectionOwner); - lastSelectionOwner = NULL; + SAFE_free(lastSelectionOwner); lastSelectionOwner = (SelectionOwner *) malloc(nxagentMaxSelections * sizeof(SelectionOwner)); diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Colormap.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Colormap.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Colormap.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Colormap.c 2019-12-16 06:31:54.000000000 +0000 @@ -54,6 +54,7 @@ #include "Visual.h" #include "Windows.h" #include "Args.h" +#include "Utils.h" #define PANIC #define WARNING @@ -120,7 +121,7 @@ pCmap->red[i].co.local.green = colors[i].red; pCmap->red[i].co.local.blue = colors[i].red; } - free(colors); + SAFE_free(colors); break; case StaticColor: /* read only */ @@ -133,7 +134,7 @@ pCmap->red[i].co.local.green = colors[i].green; pCmap->red[i].co.local.blue = colors[i].blue; } - free(colors); + SAFE_free(colors); break; case TrueColor: /* read only */ @@ -157,7 +158,7 @@ pCmap->green[i].co.local.green = colors[i].green; pCmap->blue[i].co.local.blue = colors[i].blue; } - free(colors); + SAFE_free(colors); break; case GrayScale: /* read and write */ @@ -176,7 +177,7 @@ void nxagentDestroyColormap(ColormapPtr pCmap) { XFreeColormap(nxagentDisplay, nxagentColormap(pCmap)); - free(pCmap->devPriv); + SAFE_free(pCmap->devPriv); } #define SEARCH_PREDICATE \ @@ -254,10 +255,10 @@ numWindows = 0; } - free(icws.cmapIDs); + SAFE_free(icws.cmapIDs); if (!nxagentSameInstalledColormapWindows(icws.windows, icws.numWindows)) { - free(nxagentOldInstalledColormapWindows); + SAFE_free(nxagentOldInstalledColormapWindows); #ifdef _XSERVER64 { @@ -268,7 +269,7 @@ windows[i] = icws.windows[i]; XSetWMColormapWindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], windows, numWindows); - free(windows); + SAFE_free(windows); } #else XSetWMColormapWindows(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], @@ -317,12 +318,12 @@ #endif /* DUMB_WINDOW_MANAGERS */ } else - free(icws.windows); + SAFE_free(icws.windows); } void nxagentSetScreenSaverColormapWindow(ScreenPtr pScreen) { - free(nxagentOldInstalledColormapWindows); + SAFE_free(nxagentOldInstalledColormapWindows); #ifdef _XSERVER64 { @@ -454,7 +455,7 @@ pColors64[i].flags = pColors[i].flags; } XStoreColors(nxagentDisplay, nxagentColormap(pCmap), pColors64, nColors); - free(pColors64); + SAFE_free(pColors64); } #else XStoreColors(nxagentDisplay, nxagentColormap(pCmap), diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/compext/Png.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/compext/Png.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/compext/Png.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/compext/Png.c 2019-12-16 06:31:54.000000000 +0000 @@ -253,17 +253,6 @@ NXColorTable color_table[NB_COLOR_MAX]; CARD8 *image_index; - image_index = (CARD8 *) malloc((image -> height) * (image -> width) * sizeof(CARD8)); - - /* - * TODO: Be sure the padded bytes are cleaned. - * It would be better to set to zero the bytes - * that are not aligned to the word boundary - * at the end of the procedure. - */ - - memset(image_index, 0, (image -> height) * (image -> width) * sizeof(CARD8)); - *compressed_size = 0; pngDataLen = 0; @@ -283,7 +272,6 @@ bitsPerPixel); #endif - free(image_index); return NULL; } @@ -316,7 +304,6 @@ fprintf(stderr, "******PngCompressData: PANIC! Failed creating the png_create_write_struct.\n"); #endif - free(image_index); return NULL; } @@ -329,7 +316,6 @@ #endif png_destroy_write_struct(&png_ptr, NULL); - free(image_index); return NULL; } @@ -341,7 +327,6 @@ #endif png_destroy_write_struct(&png_ptr, &info_ptr); - free(image_index); return NULL; } @@ -364,8 +349,6 @@ PNG_DEST_SIZE(w, h)); #endif - free(image_index); - return NULL; } @@ -383,6 +366,24 @@ return NULL; } + image_index = (CARD8 *) calloc(1, (image -> height) * (image -> width) * sizeof(CARD8)); + if (image_index == NULL) + { + #ifdef PANIC + fprintf(stderr, "******PngCompressData: PANIC! Could not alloc image_index.\n"); + #endif + + free(pngCompBuf); + return NULL; + } + + /* + * TODO: Be sure the padded bytes are cleaned. + * It would be better to set to zero the bytes + * that are not aligned to the word boundary + * at the end of the procedure. + */ + png_set_compression_level(png_ptr, PNG_Z_LEVEL); if (bitsPerPixel == 16) @@ -480,47 +481,23 @@ return NULL; } + int count; if (color_type == PNG_COLOR_TYPE_PALETTE) { - srcBuf = (CARD8 *) malloc(w * sizeof(CARD8)); - - if (srcBuf == NULL) - { - #ifdef PANIC - fprintf(stderr, "******PngCompressData: PANIC! Cannot allocate [%d] bytes.\n", - (int) (w * sizeof(CARD8))); - #endif - - free(image_index); - - return NULL; - } - - /* - * TODO: Be sure the padded bytes are cleaned. - * It would be better to set to zero the bytes - * that are not aligned to the word boundary - * at the end of the procedure. - */ - - memset(srcBuf, 0, w * sizeof(CARD8)); + count = w; } else { - srcBuf = (CARD8 *) malloc(w * 3 * sizeof(CARD8)); - - /* - * TODO: See above. - */ - - memset(srcBuf, 0, w * 3 * sizeof(CARD8)); + count = 3 * w; } + srcBuf = (CARD8 *) calloc(count, sizeof(CARD8)); + if (srcBuf == NULL) { #ifdef PANIC fprintf(stderr, "******PngCompressData: PANIC! Cannot allocate [%d] bytes.\n", - w * 3); + (int) (count * sizeof(CARD8))); #endif free(pngCompBuf); @@ -529,6 +506,13 @@ return NULL; } + /* + * TODO: Be sure the padded bytes are cleaned. + * It would be better to set to zero the bytes + * that are not aligned to the word boundary + * at the end of the procedure. + */ + for (dy = 0; dy < h; dy++) { if (color_type == PNG_COLOR_TYPE_RGB) @@ -548,8 +532,8 @@ dy, h); #endif - free(srcBuf); - free(image_index); + free(srcBuf); srcBuf = NULL; + free(image_index); image_index = NULL; if (setjmp(png_jmpbuf(png_ptr))) { diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Cursor.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Cursor.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Cursor.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Cursor.c 2019-12-16 06:31:54.000000000 +0000 @@ -61,6 +61,7 @@ #include "Events.h" #include "Render.h" #include "Client.h" +#include "Utils.h" #include "windowstr.h" #include "resource.h" @@ -211,7 +212,7 @@ XPutImage(nxagentDisplay, source, nxagentBitmapGC, image, 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height); - XFree(image); + SAFE_XFree(image); image = XCreateImage(nxagentDisplay, nxagentDefaultVisual(pScreen), @@ -229,7 +230,7 @@ XPutImage(nxagentDisplay, mask, nxagentBitmapGC, image, 0, 0, 0, 0, pCursor->bits->width, pCursor->bits->height); - XFree(image); + SAFE_XFree(image); fg_color.red = pCursor->foreRed; fg_color.green = pCursor->foreGreen; @@ -264,14 +265,12 @@ if (nxagentCursorUsesRender(pCursor, pScreen)) { PicturePtr pPicture = nxagentCursorPicture(pCursor, pScreen); - FreePicture(pPicture, pPicture -> id); } if (nxagentCursor(pCursor, pScreen) != None) { XFreeCursor(nxagentDisplay, nxagentCursor(pCursor, pScreen)); - nxagentCursor(pCursor, pScreen) = None; } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Dialog.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Dialog.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Dialog.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Dialog.c 2019-12-16 06:31:54.000000000 +0000 @@ -63,6 +63,8 @@ int nxagentDisableRandRModeDialogPid = 0; int nxagentEnableDeferModePid = 0; int nxagentDisableDeferModePid = 0; +int nxagentEnableAutograbModePid = 0; +int nxagentDisableAutograbModePid = 0; static int nxagentFailedReconnectionDialogPid = 0; @@ -158,6 +160,24 @@ nxagentDisableDeferModePid = 0; } + else if (pid == nxagentEnableAutograbModePid) + { + #ifdef TEST + fprintf(stderr, "nxagentResetDialog: Resetting enable autograb mode dialog pid [%d].\n", + nxagentEnableAutograbModePid); + #endif + + nxagentEnableAutograbModePid = 0; + } + else if (pid == nxagentDisableAutograbModePid) + { + #ifdef TEST + fprintf(stderr, "nxagentResetDialog: Resetting disable autograb mode dialog pid [%d].\n", + nxagentDisableAutograbModePid); + #endif + + nxagentDisableAutograbModePid = 0; + } } void nxagentLaunchDialog(DialogType dialogType) @@ -263,6 +283,24 @@ break; } + case DIALOG_ENABLE_AUTOGRAB_MODE: + { + message = DIALOG_ENABLE_AUTOGRAB_MODE_MESSAGE; + type = DIALOG_ENABLE_AUTOGRAB_MODE_TYPE; + local = DIALOG_ENABLE_AUTOGRAB_MODE_LOCAL; + pid = &nxagentEnableAutograbModePid; + + break; + } + case DIALOG_DISABLE_AUTOGRAB_MODE: + { + message = DIALOG_DISABLE_AUTOGRAB_MODE_MESSAGE; + type = DIALOG_DISABLE_AUTOGRAB_MODE_TYPE; + local = DIALOG_DISABLE_AUTOGRAB_MODE_LOCAL; + pid = &nxagentDisableAutograbModePid; + + break; + } default: { #ifdef WARNING @@ -496,6 +534,18 @@ break; } + case DIALOG_ENABLE_AUTOGRAB_MODE: + { + pid = nxagentEnableAutograbModePid; + + break; + } + case DIALOG_DISABLE_AUTOGRAB_MODE: + { + pid = nxagentDisableAutograbModePid; + + break; + } default: { #ifdef WARNING diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Dialog.h nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Dialog.h --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Dialog.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Dialog.h 2019-12-16 06:31:54.000000000 +0000 @@ -41,6 +41,8 @@ DIALOG_FAILED_RECONNECTION, DIALOG_ENABLE_DEFER_MODE, DIALOG_DISABLE_DEFER_MODE, + DIALOG_ENABLE_AUTOGRAB_MODE, + DIALOG_DISABLE_AUTOGRAB_MODE, DIALOG_LAST_TAG } DialogType; @@ -54,6 +56,8 @@ extern int nxagentDisableRandRModeDialogPid; extern int nxagentEnableDeferModePid; extern int nxagentDisableDeferModePid; +extern int nxagentEnableAutograbModePid; +extern int nxagentDisableAutograbModePid; #define NXAGENTFAILEDRECONNECTIONMESSAGELENGTH 256 extern char nxagentFailedReconnectionMessage[NXAGENTFAILEDRECONNECTIONMESSAGELENGTH]; @@ -87,6 +91,8 @@ (type) == DIALOG_FAILED_RECONNECTION ? "DIALOG_FAILED_RECONNECTION" : \ (type) == DIALOG_ENABLE_DEFER_MODE ? "DIALOG_ENABLE_DEFER_MODE" : \ (type) == DIALOG_DISABLE_DEFER_MODE ? "DIALOG_DISABLE_DEFER_MODE" : \ + (type) == DIALOG_ENABLE_AUTOGRAB_MODE ? "DIALOG_ENABLE_AUTGRAB_MODE" : \ + (type) == DIALOG_DISABLE_AUTOGRAB_MODE ? "DIALOG_DISABLE_AUTOGRAB_MODE" : \ "UNKNOWN_DIALOG") /* @@ -214,5 +220,29 @@ #define DIALOG_DISABLE_DEFER_MODE_LOCAL 0 + +#define DIALOG_ENABLE_AUTOGRAB_MODE_MESSAGE \ +\ +"\ +Keyboard auto-grabbing mode is now enabled. You can press\n\ +Ctrl+Alt+G again to disable auto-grabbing.\ +" + +#define DIALOG_ENABLE_AUTOGRAB_MODE_TYPE "ok" + +#define DIALOG_ENABLE_AUTOGRAB_MODE_LOCAL 0 + + +#define DIALOG_DISABLE_AUTOGRAB_MODE_MESSAGE \ +\ +"\ +Keyboard auto-grabbing mode is now disabled. You can press\n\ +Ctrl+Alt+G again to re-enable auto-grabbing.\ +" + +#define DIALOG_DISABLE_AUTOGRAB_MODE_TYPE "ok" + +#define DIALOG_DISABLE_AUTOGRAB_MODE_LOCAL 0 + #endif /* __Dialog_H__ */ diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Display.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Display.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Display.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Display.c 2019-12-16 06:31:54.000000000 +0000 @@ -71,6 +71,7 @@ #include "Init.h" #include "Args.h" #include "Image.h" +#include "Utils.h" #define Pixmap XlibPixmap #include "Icons.h" @@ -1386,15 +1387,6 @@ nxagentChangeOption(BorderWidth, 1); } - nxagentLogoDepth = DefaultDepth(nxagentDisplay, - DefaultScreen(nxagentDisplay) - ); - - nxagentLogoBlack = 0x000000; - nxagentLogoRed = 0xff0000; - nxagentLogoWhite = 0xffffff; - nxagentLogoGray = 0x222222; - #ifdef WATCH fprintf(stderr, "nxagentOpenDisplay: Watchpoint 5.1.\n"); @@ -1543,7 +1535,7 @@ nxagentNumVisuals * sizeof(XVisualInfo)); } - XFree(viList); + SAFE_XFree(viList); if (nxagentNumVisuals == 0 || nxagentVisuals == NULL) { @@ -1765,20 +1757,11 @@ * traffic */ - free(nxagentDefaultColormaps); - nxagentDefaultColormaps = NULL; - - XFree(nxagentVisuals); - nxagentVisuals = NULL; - - free(nxagentDepths); - nxagentDepths = NULL; - - XFree(nxagentPixmapFormats); - nxagentPixmapFormats = NULL; - - XFree(nxagentRemotePixmapFormats); - nxagentRemotePixmapFormats = NULL; + SAFE_free(nxagentDefaultColormaps); + SAFE_free(nxagentDepths); + SAFE_XFree(nxagentVisuals); + SAFE_XFree(nxagentPixmapFormats); + SAFE_XFree(nxagentRemotePixmapFormats); nxagentFreeFontCache(); /* @@ -2017,11 +2000,7 @@ nxagentNumDefaultColormapsRecBackup = nxagentNumDefaultColormaps; nxagentVisualsRecBackup = nxagentVisuals; nxagentNumVisualsRecBackup = nxagentNumVisuals; - if (nxagentVisualHasBeenIgnored) - { - free(nxagentVisualHasBeenIgnored); - nxagentVisualHasBeenIgnored = NULL; - } + SAFE_free(nxagentVisualHasBeenIgnored); nxagentVisualHasBeenIgnored = malloc(nxagentNumVisuals * sizeof(Bool)); nxagentDefaultDepthRecBackup = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)); nxagentDisplayWidthRecBackup = DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay)); @@ -2033,20 +2012,11 @@ void nxagentCleanupBackupDisplayInfo(void) { - free(nxagentDepthsRecBackup); - nxagentNumDepthsRecBackup = 0; + SAFE_free(nxagentDepthsRecBackup); + SAFE_free(nxagentVisualsRecBackup); + SAFE_free(nxagentVisualHasBeenIgnored); nxagentNumDefaultColormapsRecBackup = 0; - - free(nxagentVisualsRecBackup); - nxagentNumVisualsRecBackup = 0; - - if (nxagentVisualHasBeenIgnored) - { - free(nxagentVisualHasBeenIgnored); - nxagentVisualHasBeenIgnored = NULL; - } - nxagentDefaultDepthRecBackup = 0; nxagentDisplayWidthRecBackup = 0; nxagentDisplayHeightRecBackup = 0; @@ -2054,7 +2024,6 @@ if (nxagentDisplayBackup) { XCloseDisplay(nxagentDisplayBackup); - nxagentDisplayBackup = NULL; } @@ -2066,7 +2035,7 @@ } else { - free(nxagentBitmapGCBackup); + SAFE_free(nxagentBitmapGCBackup); } nxagentBitmapGCBackup = NULL; @@ -2569,7 +2538,7 @@ } } - XFree(viList); + SAFE_XFree(viList); if (compatible) { @@ -2585,7 +2554,7 @@ fprintf(stderr, "nxagentInitAndCheckVisuals: New visuals don't match with old visuals.\n"); #endif - free(newVisuals); + SAFE_free(newVisuals); } return compatible; @@ -2766,19 +2735,8 @@ * will be reallocated in nxagentInitPixmapFormats(). */ - if (nxagentPixmapFormats != NULL) - { - XFree(nxagentPixmapFormats); - - nxagentPixmapFormats = NULL; - } - - if (nxagentRemotePixmapFormats != NULL) - { - XFree(nxagentRemotePixmapFormats); - - nxagentRemotePixmapFormats = NULL; - } + SAFE_XFree(nxagentPixmapFormats); + SAFE_XFree(nxagentRemotePixmapFormats); /* * Check if all the required pixmap @@ -2860,13 +2818,6 @@ nxagentConfineWindow); #endif - nxagentLogoDepth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)); - - nxagentLogoBlack = 0x000000; - nxagentLogoRed = 0xff0000; - nxagentLogoWhite = 0xffffff; - nxagentLogoGray = 0x222222; - useXpmIcon = nxagentMakeIcon(nxagentDisplay, &nxagentIconPixmap, &nxagentIconShape); /* diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Drawable.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Drawable.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Drawable.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Drawable.c 2019-12-16 06:31:54.000000000 +0000 @@ -42,6 +42,7 @@ #include "Pixels.h" #include "Reconnect.h" #include "GCOps.h" +#include "Utils.h" #include "compext/Compext.h" @@ -365,7 +366,7 @@ success = nxagentSynchronizeRegion(pDrawable, NullRegion, breakMask, owner); nxagentSynchronizeDrawableDataEnd: - free(data); + SAFE_free(data); return success; } @@ -861,7 +862,7 @@ #endif } - free(cmpData); + SAFE_free(cmpData); } } else @@ -1058,7 +1059,7 @@ nxagentFreeRegion(pDrawable, clipRegion); } - free(data); + SAFE_free(data); RegionUninit(&exposeRegion); @@ -2158,7 +2159,7 @@ fprintf(stderr, "nxagentGetColor: WARNING! Failed to create the XImage.\n"); #endif - free(data); + SAFE_free(data); return -1; } @@ -2384,7 +2385,7 @@ XFillRectangles(nxagentDisplay, nxagentDrawable(pDrawable), nxagentGC(pGC), pRects, nrects); - free(pRects); + SAFE_free(pRects); } } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Error.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Error.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Error.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Error.c 2019-12-16 06:31:54.000000000 +0000 @@ -42,6 +42,7 @@ #include "Error.h" #include "Args.h" +#include "Utils.h" /* * Set here the required log level. @@ -425,7 +426,7 @@ "home directory '%s'.\n", homeEnv); #endif - free(homeEnv); + SAFE_free(homeEnv); return NULL; } @@ -436,7 +437,7 @@ snprintf(nxagentRootDir, DEFAULT_STRING_LENGTH, "%s/.nx", homeEnv); - free(homeEnv); + SAFE_free(homeEnv); /* * Create the NX root directory. @@ -534,14 +535,14 @@ nxagentSessionDir); #endif - free(rootPath); + SAFE_free(rootPath); return NULL; } snprintf(nxagentSessionDir, DEFAULT_STRING_LENGTH, "%s/C-%s", rootPath, nxagentSessionId); - free(rootPath); + SAFE_free(rootPath); if ((stat(nxagentSessionDir, &dirStat) == -1) && (errno == ENOENT)) { @@ -595,14 +596,14 @@ fprintf(stderr, "nxagentGetClientsPath: PANIC! Invalid value for the NX clients Log File Path ''.\n"); #endif - free(sessionPath); + SAFE_free(sessionPath); return; } snprintf(nxagentClientsLogName, NXAGENTCLIENTSLOGNAMELENGTH, "%s/clients", sessionPath); - free(sessionPath); + SAFE_free(sessionPath); } return; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Events.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Events.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Events.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Events.c 2019-12-16 06:31:54.000000000 +0000 @@ -115,6 +115,15 @@ #undef TEST #undef DEBUG +/* debug individual subsystems */ +#undef DEBUG_AUTOGRAB + +/* aktivate subsystems if generic DEBUG is activated */ +#ifdef DEBUG +#ifndef DEBUG_AUTOGRAB +#define DEBUG_AUTOGRAB +#endif +#endif /* * Log begin and end of the important handlers. */ @@ -124,7 +133,6 @@ extern Bool nxagentOnce; extern WindowPtr nxagentRootTileWindow; -extern int nxagentSplashCount; extern int nxagentLastClipboardClient; @@ -293,6 +301,36 @@ mieqProcessInputEvents(); } +#ifdef DEBUG +char * nxagentGetNotifyMode(int mode) +{ + switch (mode) + { + case NotifyNormal: + { + return "NotifyNormal"; + break; + } + case NotifyGrab: + { + return "NotifyGrab"; + break; + } + case NotifyUngrab: + { + return "NotifyUngrab"; + break; + } + case NotifyWhileGrabbed: + { + return "NotifyWhileGrabbed"; + break; + } + } + return "Unknown"; +} +#endif + #ifdef DEBUG_TREE /* @@ -329,7 +367,7 @@ else if (winName) { fprintf(stderr, " \"%s\" ", winName); - XFree(winName); + SAFE_XFree(winName); } #else @@ -477,10 +515,7 @@ nxagentRemoteWindowsTree(childList[i], level + 1); } - if (childList) - { - XFree((char *) childList); - } + SAFE_XFree((char *) childList); } #endif @@ -678,6 +713,40 @@ } } +static void nxagentEnableAutoGrab(void) +{ + #ifdef DEBUG_AUTOGRAB + fprintf(stderr, "enabling autograb\n"); + #endif + + nxagentGrabPointerAndKeyboard(NULL); + nxagentChangeOption(AutoGrab, True); + nxagentLaunchDialog(DIALOG_ENABLE_AUTOGRAB_MODE); +} + +static void nxagentDisableAutoGrab(void) +{ + #ifdef DEBUG_AUTOGRAB + fprintf(stderr, "disabling autograb\n"); + #endif + + nxagentUngrabPointerAndKeyboard(NULL); + nxagentChangeOption(AutoGrab, False); + nxagentLaunchDialog(DIALOG_DISABLE_AUTOGRAB_MODE); +} + +static void nxagentToggleAutoGrab(void) +{ + /* autograb only works in windowed mode */ + if (nxagentOption(Rootless) || nxagentOption(Fullscreen)) + return; + + if (!nxagentOption(AutoGrab)) + nxagentEnableAutoGrab(); + else + nxagentDisableAutoGrab(); +} + static Bool nxagentExposurePredicate(Display *display, XEvent *event, XPointer window) { /* @@ -804,7 +873,6 @@ ScreenPtr pScreen = NULL; Bool minimize = False; - Bool startKbd = False; Bool closeSession = False; Bool switchFullscreen = False; Bool switchAllScreens = False; @@ -941,7 +1009,7 @@ viewportLastKeyPressResult = result; } - if (result != doNothing && result != doStartKbd) + if (result != doNothing) { pScreen = nxagentScreen(X.xkey.window); } @@ -980,12 +1048,6 @@ break; } - case doStartKbd: - { - startKbd = TRUE; - - break; - } case doSwitchFullscreen: { switchFullscreen = TRUE; @@ -1071,6 +1133,12 @@ break; } + case doAutoGrab: + { + nxagentToggleAutoGrab(); + + break; + } default: { FatalError("nxagentDispatchEvent: handleKeyPress returned unknown value\n"); @@ -1120,8 +1188,8 @@ /* FIXME: Don't enqueue the KeyRelease event if the key was not already pressed. This workaround avoids a fake - KeyPress is enqueued by the XKEYBOARD extension. - Another solution would be to let the events are + KeyPress being enqueued by the XKEYBOARD extension. + Another solution would be to let the events enqueued and to remove the KeyPress afterwards. */ if (BitIsOn(inputInfo.keyboard -> key -> down, @@ -1160,6 +1228,9 @@ nxagentXkbNumTrap = 0; } + /* Calculate the time elapsed between this and the last event we + received. Add this delta to time we recorded for the last + KeyPress event we passed on to our clients. */ memset(&x, 0, sizeof(xEvent)); x.u.u.type = KeyRelease; x.u.u.detail = nxagentConvertKeycode(X.xkey.keycode); @@ -1175,8 +1246,14 @@ x.u.keyButtonPointer.time = nxagentLastEventTime; } - if (!(nxagentCheckSpecialKeystroke(&X.xkey, &result)) && sendKey == 1) + /* do not send a KeyRelease for a special keystroke since we + also did not send a KeyPress event in that case */ + if (!(nxagentCheckSpecialKeystroke(&X.xkey, &result)) && (sendKey == 1)) { + #ifdef TEST + fprintf(stderr, "%s: passing KeyRelease event to clients\n", __func__); + #endif + mieqEnqueue(&x); CriticalOutputPending = 1; @@ -1188,6 +1265,12 @@ NXShadowEvent(nxagentDisplay, X); } } + else + { + #ifdef TEST + fprintf(stderr, "%s: NOT passing KeyRelease event to clients\n", __func__); + #endif + } break; } @@ -1214,11 +1297,6 @@ } } - if (nxagentIpaq && nxagentClients <= 0) - { - closeSession = TRUE; - } - if (nxagentOption(DesktopResize) == False && (X.xbutton.state & (ControlMask | Mod1Mask)) == (ControlMask | Mod1Mask)) { @@ -1493,8 +1571,18 @@ { WindowPtr pWin; - #ifdef TEST - fprintf(stderr, "nxagentDispatchEvents: Going to handle new FocusIn event.\n"); + #ifdef DEBUG + fprintf(stderr, "%s: Going to handle new FocusIn event [0x%x] mode: [%s]\n", __func__, X.xfocus.window, nxagentGetNotifyMode(X.xfocus.mode)); + { + XlibWindow w; + int revert_to; + XGetInputFocus(nxagentDisplay, &w, &revert_to); + fprintf(stderr, "%s: (FocusIn): Event win [0x%x] Focus owner [0x%x] nxagentDefaultWindows[0] [0x%x]\n", __func__, X.xfocus.window, w, nxagentDefaultWindows[0]); + } + #else + #ifdef TEST + fprintf(stderr, "%s: Going to handle new FocusIn event\n", __func__); + #endif #endif /* @@ -1520,12 +1608,34 @@ } } + if (nxagentOption(AutoGrab) && !(nxagentOption(AllScreens) || nxagentOption(Fullscreen) || nxagentOption(Rootless))) + { + if (X.xfocus.window == nxagentDefaultWindows[0] && X.xfocus.mode == NotifyNormal) + { + #if defined(DEBUG) || defined(DEBUG_AUTOGRAB) + fprintf(stderr, "%s: (FocusIn): grabbing\n", __func__); + #endif + nxagentGrabPointerAndKeyboard(NULL); + } + /* else + { + #if defined(DEBUG) || defined(DEBUG_AUTOGRAB) + fprintf(stderr, "%s: (FocusIn): ungrabbing\n", __func__); + #endif + nxagentUngrabPointerAndKeyboard(NULL); + } + */ + } break; } case FocusOut: { - #ifdef TEST - fprintf(stderr, "nxagentDispatchEvents: Going to handle new FocusOut event.\n"); + #ifdef DEBUG + fprintf(stderr, "%s: Going to handle new FocusOut event [0x%x] mode: [%s]\n", __func__, X.xfocus.window, nxagentGetNotifyMode(X.xfocus.mode)); + #else + #ifdef TEST + fprintf(stderr, "%s: Going to handle new FocusOut event.\n", __func__); + #endif #endif if (X.xfocus.detail != NotifyInferior) @@ -1598,6 +1708,19 @@ #endif /* NXAGENT_FIXKEYS */ + if (nxagentOption(AutoGrab) && !nxagentFullscreenWindow) + { + XlibWindow w; + int revert_to; + XGetInputFocus(nxagentDisplay, &w, &revert_to); + if (w != nxagentDefaultWindows[0] && X.xfocus.mode == NotifyWhileGrabbed) + { + #if defined(DEBUG) || defined(DEBUG_AUTOGRAB) + fprintf(stderr, "%s: (FocusOut): ungrabbing\n", __func__); + #endif + nxagentUngrabPointerAndKeyboard(NULL); + } + } break; } case KeymapNotify: @@ -1733,11 +1856,14 @@ nxagentLastEnteredWindow = NULL; } - if (X.xcrossing.window == nxagentDefaultWindows[0] && - X.xcrossing.detail != NotifyInferior && - X.xcrossing.mode == NotifyNormal) + if (!nxagentOption(AutoGrab)) { - nxagentUngrabPointerAndKeyboard(&X); + if (X.xcrossing.window == nxagentDefaultWindows[0] && + X.xcrossing.detail != NotifyInferior && + X.xcrossing.mode == NotifyNormal) + { + nxagentUngrabPointerAndKeyboard(&X); + } } if (X.xcrossing.detail != NotifyInferior) @@ -1964,14 +2090,14 @@ } case UnmapNotify: { - WindowPtr pWin; - #ifdef TEST fprintf(stderr, "nxagentDispatchEvents: Going to handle new UnmapNotify event.\n"); #endif if (nxagentOption(Rootless) == 1) { + WindowPtr pWin; + if ((pWin = nxagentRootlessTopLevelWindow(X.xunmap.window)) != NULL || ((pWin = nxagentWindowPtr(X.xunmap.window)) != NULL && nxagentWindowTopLevel(pWin) == 1)) @@ -1995,22 +2121,19 @@ } case MapNotify: { - WindowPtr pWin; - ClientPtr pClient; - #ifdef TEST fprintf(stderr, "nxagentDispatchEvents: Going to handle new MapNotify event.\n"); #endif if (nxagentOption(Rootless) == 1) { - Bool value = 1; + WindowPtr pWin; if ((pWin = nxagentRootlessTopLevelWindow(X.xmap.window)) != NULL || ((pWin = nxagentWindowPtr(X.xmap.window)) != NULL && nxagentWindowTopLevel(pWin) == 1)) { - pClient = wClient(pWin); + ClientPtr pClient = wClient(pWin); nxagentScreenTrap = 1; @@ -2021,6 +2144,8 @@ if (pWin != NULL) { + Bool value = 1; + TraverseTree(pWin, nxagentChangeMapPrivate, &value); } } @@ -2177,72 +2302,6 @@ } } - if (startKbd) - { - if (xkbdRunning) - { - #ifdef NXAGENT_XKBD_DEBUG - fprintf(stderr, "Events: nxkbd now is NOT running: %d, %d\n", - X.xkey.keycode, escapecode); - #endif - - xkbdRunning = False; - - kill(pidkbd, 9); - } - else - { - char kbddisplay[6]; - char *kbdargs[6]; - - strcpy(kbddisplay,":"); - /* FIXME: why limit to 4? */ - strncat(kbddisplay, display, 4); - - kbdargs[0] = "nxkbd"; - kbdargs[1] = "-geometry"; - kbdargs[2] = "240x70+0+250"; - kbdargs[3] = "-display"; - kbdargs[4] = kbddisplay; - kbdargs[5] = NULL; - - switch (pidkbd = fork()) - { - case 0: - { - execvp(kbdargs[0], kbdargs); - - #ifdef NXAGENT_XKBD_DEBUG - fprintf(stderr, "Events: The execvp of nxkbd process failed.\n"); - #endif - - exit(1); - - break; - } - case -1: - { - #ifdef NXAGENT_XKBD_DEBUG - fprintf(stderr, "Events: Can't fork to run the nxkbd process.\n"); - #endif - - break; - } - default: - { - break; - } - } - - #ifdef NXAGENT_XKBD_DEBUG - fprintf(stderr, "Events: The nxkbd process now running with [%d][%d].\n", - X.xkey.keycode, escapecode); - #endif - - xkbdRunning = True; - } - } - #ifdef BLOCKS fprintf(stderr, "[End read]\n"); #endif @@ -2304,8 +2363,6 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result) { - xEvent x; - if (nxagentXkbState.Initialized == 0) { if (X -> xkey.keycode == nxagentCapsLockKeycode) @@ -2325,6 +2382,9 @@ if (nxagentCheckSpecialKeystroke(&X -> xkey, result)) { + #ifdef TEST + fprintf(stderr, "%s: NOT passing KeyPress event to clients\n", __func__); + #endif return 1; } @@ -2337,14 +2397,18 @@ nxagentXkbState.Num = (~nxagentXkbState.Num & 1); } + nxagentLastServerTime = X -> xkey.time; + nxagentLastEventTime = nxagentLastKeyPressTime = GetTimeInMillis(); - - memset(&x, 0, sizeof(xEvent)); + + xEvent x = {0}; x.u.u.type = KeyPress; x.u.u.detail = nxagentConvertKeycode(X -> xkey.keycode); x.u.keyButtonPointer.time = nxagentLastKeyPressTime; - nxagentLastServerTime = X -> xkey.time; + #ifdef TEST + fprintf(stderr, "%s: passing KeyPress event to clients\n", __func__); + #endif mieqEnqueue(&x); @@ -2355,8 +2419,6 @@ int nxagentHandlePropertyNotify(XEvent *X) { - int resource; - if (nxagentOption(Rootless) && !nxagentNotifyMatchChangeProperty((XPropertyEvent *) X)) { #ifdef TEST @@ -2366,7 +2428,7 @@ if (nxagentWindowPtr(X -> xproperty.window) != NULL) { - resource = NXGetCollectPropertyResource(nxagentDisplay); + int resource = NXGetCollectPropertyResource(nxagentDisplay); if (resource == -1) { @@ -2514,20 +2576,6 @@ } } - if (nxagentRootTileWindow != NULL) - { - if (nxagentWindowPriv(nxagentRootTileWindow) -> window == nxagentWindowPriv(pWin) -> window && - nxagentSplashCount == 1 && X -> xexpose.count == 0) - { - #ifdef DEBUG - fprintf(stderr, "nxagentHandleExposeEvent: Clearing root tile window id [%u].\n", - nxagentWindowPriv(nxagentRootTileWindow) -> window); - #endif - - XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow) -> window); - } - } - RegionUninit(&sum); } @@ -2643,8 +2691,6 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) { - WindowPtr pWin; - *result = doNothing; #ifdef TEST @@ -2680,7 +2726,7 @@ return 0; } - pWin = nxagentWindowPtr(X -> xclient.window); + WindowPtr pWin = nxagentWindowPtr(X -> xclient.window); if (pWin == NULL) { @@ -2886,7 +2932,6 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X) { - int i; Atom local; XFixesSelectionEvent *xfixesEvent = (XFixesSelectionEvent *) X; @@ -2915,7 +2960,7 @@ if (SelectionCallback) { - i = 0; + int i = 0; while ((i < NumCurrentSelections) && CurrentSelections[i].selection != local) @@ -2940,6 +2985,13 @@ #endif #ifdef DEBUG + fprintf(stderr, "%s: CurrentSelections[i].lastTimeChanged [%d]\n", __func__, CurrentSelections[i].lastTimeChanged.milliseconds); + fprintf(stderr, "%s: Event timestamp [%ld]\n", __func__, xfixesEvent->xfixesselection.timestamp); + fprintf(stderr, "%s: Event selection timestamp [%ld]\n", __func__, xfixesEvent->xfixesselection.selection_timestamp); + fprintf(stderr, "%s: Event selection window [0x%x]\n", __func__, xfixesEvent->xfixesselection.window); + fprintf(stderr, "%s: Event selection owner [0x%x]\n", __func__, xfixesEvent->xfixesselection.owner); + fprintf(stderr, "%s: Event selection [%s]\n", __func__, NameForAtom(nxagentRemoteToLocalAtom(xfixesEvent->xfixesselection.selection))); + fprintf(stderr, "nxagentHandleXFixesSelectionNotify: Subtype "); switch (xfixesEvent -> xfixesselection.subtype) @@ -2961,7 +3013,19 @@ info.selection = &CurrentSelections[i]; info.kind = xfixesEvent->xfixesselection.subtype; + + /* + * The trap indicates that we are triggered by a clipboard event + * originating from the real X server. In that case we do not + * want to propagate back changes to the real X server, because + * it already knows about them and we would end up in an + * infinite loop of events. If there was a better way to + * identify that situation during Callback processing we could + * get rid of the Trap... + */ + nxagentExternalClipboardEventTrap = 1; CallCallbacks(&SelectionCallback, &info); + nxagentExternalClipboardEventTrap = 0; } } return 1; @@ -3193,10 +3257,7 @@ #endif } - if (children_return) - { - XFree(children_return); - } + SAFE_XFree(children_return); #if 0 fprintf(stderr, "nxagentCheckWindowConfiguration: Trees match: %s\n", @@ -3354,7 +3415,6 @@ ScreenPtr pScreen = nxagentScreen(X -> xconfigure.window); Bool doRandR = False; - struct timeval timeout; if (X -> xconfigure.window == nxagentDefaultWindows[pScreen -> myNum]) { @@ -3390,10 +3450,7 @@ { newEvents = False; - timeout.tv_sec = 0; - timeout.tv_usec = 500 * 1000; - - nxagentWaitEvents(nxagentDisplay, &timeout); + nxagentWaitEvents(nxagentDisplay, 500); /* * This should also flush the NX link for us. @@ -3578,11 +3635,7 @@ result = XQueryTree(nxagentDisplay, w, &root_return, &parent_return, &children_return, &nchildren_return); - if (children_return) - { - XFree(children_return); - children_return = NULL; - } + SAFE_XFree(children_return); if (!result) { @@ -3620,11 +3673,7 @@ #endif } - if (children_return) - { - XFree(children_return); - children_return = NULL; - } + SAFE_XFree(children_return); } else { @@ -3688,11 +3737,7 @@ result = XQueryTree(nxagentDisplay, w, &rootReturn, &parentReturn, &childrenReturn, &nchildrenReturn); - if (childrenReturn) - { - XFree(childrenReturn); - childrenReturn = NULL; - } + SAFE_XFree(childrenReturn); if (parentReturn == rootReturn || parentReturn == 0 || result == 0) { @@ -3872,7 +3917,7 @@ while ((resource = (*pGetResource)(nxagentDisplay)) == -1) { - if (nxagentWaitEvents(nxagentDisplay, NULL) == -1) + if (nxagentWaitEvents(nxagentDisplay, 0) == -1) { return -1; } @@ -3909,13 +3954,26 @@ fprintf(stderr, "nxagentGrabPointerAndKeyboard: Going to grab the keyboard in context [B1].\n"); #endif - result = XGrabKeyboard(nxagentDisplay, nxagentFullscreenWindow, - True, GrabModeAsync, GrabModeAsync, now); + if (nxagentFullscreenWindow) + result = XGrabKeyboard(nxagentDisplay, nxagentFullscreenWindow, + True, GrabModeAsync, GrabModeAsync, now); + else + result = XGrabKeyboard(nxagentDisplay, RootWindow(nxagentDisplay, DefaultScreen(nxagentDisplay)), + True, GrabModeAsync, GrabModeAsync, now); if (result != GrabSuccess) { + #ifdef DEBUG + fprintf(stderr, "%s: keyboard grab failed.\n", __func__); + #endif return; } + #ifdef DEBUG + else + { + fprintf(stderr, "%s: keyboard grab successful.\n", __func__); + } + #endif /* * The smart scheduler could be stopped while @@ -3933,7 +3991,8 @@ resource = nxagentWaitForResource(NXGetCollectGrabPointerResource, nxagentCollectGrabPointerPredicate); - NXCollectGrabPointer(nxagentDisplay, resource, + if (nxagentFullscreenWindow) + NXCollectGrabPointer(nxagentDisplay, resource, nxagentFullscreenWindow, True, NXAGENT_POINTER_EVENT_MASK, GrabModeAsync, GrabModeAsync, None, None, now); @@ -3992,21 +4051,23 @@ if (grab) { - XButtonEvent X; - memset(&X, 0, sizeof(XButtonEvent)); - - X.type = ButtonRelease; - X.serial = 0; - X.send_event = FALSE; - X.time = currentTime.milliseconds; - X.display = nxagentDisplay; - X.window = nxagentWindow(grab -> window); - X.root = RootWindow(nxagentDisplay, 0); - X.subwindow = 0; - X.x = X.y = X.x_root = X.y_root = 0; - X.state = 0x100; - X.button = 1; - X.same_screen = TRUE; + XButtonEvent X = { + .type = ButtonRelease, + .serial = 0, + .send_event = FALSE, + .time = currentTime.milliseconds, + .display = nxagentDisplay, + .window = nxagentWindow(grab -> window), + .root = RootWindow(nxagentDisplay, 0), + .subwindow = 0, + .x = 0, + .y = 0, + .x_root = 0, + .y_root = 0, + .state = 0x100, + .button = 1, + .same_screen = TRUE, + }; XPutBackEvent(nxagentDisplay, (XEvent*)&X); } @@ -4087,10 +4148,7 @@ #endif } - if (pszReturnData != NULL) - { - XFree(pszReturnData); - } + SAFE_XFree(pszReturnData); return; } @@ -4554,14 +4612,11 @@ } /* - * Blocks until an event becomes - * available. + * Blocks until an event becomes available. */ -int nxagentWaitEvents(Display *dpy, struct timeval *tm) +int nxagentWaitEvents(Display *dpy, useconds_t msec) { - XEvent ev; - #ifdef DEBUG fprintf(stderr, "nxagentWaitEvents called.\n"); #endif @@ -4569,33 +4624,41 @@ NXFlushDisplay(dpy, NXFlushLink); /* - * If the transport is not running we - * have to rely on Xlib to wait for an - * event. In this case the timeout is - * ignored. + * If the transport is not running we have to rely on Xlib to wait + * for an event. In this case the timeout is ignored. */ if (NXTransRunning(NX_FD_ANY) == 1) { - NXTransContinue(tm); + if (msec > 0) + { + struct timeval tm = { + .tv_sec = 0, + .tv_usec = msec * 1000 + }; + NXTransContinue(&tm); + } + else + { + NXTransContinue(NULL); + } } else { + XEvent ev; XPeekEvent(dpy, &ev); } /* - * Check if we encountered a display - * error. If we did, wait for the + * Check if we encountered a display error. If we did, wait for the * time requested by the caller. */ if (NXDisplayError(dpy) == 1) { - if (tm != NULL) + if (msec > 0) { - usleep(tm -> tv_sec * 1000 * 1000 + - tm -> tv_usec); + usleep(msec * 1000); } return -1; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Events.h nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Events.h --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Events.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Events.h 2019-12-16 06:31:54.000000000 +0000 @@ -39,7 +39,6 @@ doMinimize, doDebugTree, doCloseSession, - doStartKbd, doSwitchFullscreen, doSwitchAllScreens, doViewportMoveUp, @@ -51,7 +50,8 @@ doViewportRight, doViewportDown, doSwitchResizeMode, - doSwitchDeferMode + doSwitchDeferMode, + doAutoGrab, }; extern CARD32 nxagentLastEventTime; @@ -233,6 +233,6 @@ #define nxagentCheckEvents(display, event, predicate, argument) \ XCheckIfEventNoFlush((display), (event), (predicate), (argument)) -int nxagentWaitEvents(Display *, struct timeval *); +int nxagentWaitEvents(Display *, useconds_t msec); #endif /* __Events_H__ */ diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Extensions.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Extensions.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Extensions.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Extensions.c 2019-12-16 06:31:54.000000000 +0000 @@ -98,13 +98,12 @@ int *numVisuals, int *numDepths, int *rootDepth, VisualID *defaultVisual) { - miInitVisualsProcPtr initVisuals; /* * Initialize the visuals to use the GLX extension. */ - initVisuals = NULL; + miInitVisualsProcPtr initVisuals = NULL; GlxWrapInitVisuals(&initVisuals); @@ -372,15 +371,13 @@ int nxagentRandRSetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { - int r; - UpdateCurrentTime(); /* * Whatever size is OK for us. */ - r = nxagentResizeScreen(pScreen, pSize -> width, pSize -> height, + int r = nxagentResizeScreen(pScreen, pSize -> width, pSize -> height, pSize -> mmWidth, pSize -> mmHeight); nxagentMoveViewport(pScreen, 0, 0); @@ -430,8 +427,6 @@ int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight) { - int result; - UpdateCurrentTime(); if (nxagentOption(DesktopResize) == 1 && @@ -453,7 +448,7 @@ nxagentChangeOption(Height, height); } - result = nxagentResizeScreen(pScreen, width, height, mmWidth, mmHeight); + int result = nxagentResizeScreen(pScreen, width, height, mmWidth, mmHeight); if (result == 1 && nxagentOption(DesktopResize) == 1 && nxagentOption(Fullscreen) == 0 && nxagentOption(AllScreens) == 0) diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Font.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Font.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Font.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Font.c 2019-12-16 06:31:54.000000000 +0000 @@ -71,30 +71,22 @@ #undef TEST #undef DEBUG -#define NXAGENT_DEFAULT_FONT_DIR "/usr/share/nx/fonts" -#define NXAGENT_ALTERNATE_FONT_DIR "/usr/share/X11/fonts" -#define NXAGENT_ALTERNATE_FONT_DIR_2 "/usr/share/fonts/X11" -#define NXAGENT_ALTERNATE_FONT_DIR_3 "/usr/X11R6/lib/X11/fonts" - -#define NXAGENT_DEFAULT_FONT_PATH \ -"/usr/share/nx/fonts/misc/,/usr/share/nx/fonts/Speedo/,\ -/usr/share/nx/fonts/Type1/,/usr/share/nx/fonts/75dpi/,\ -/usr/share/nx/fonts/100dpi/,/usr/share/nx/fonts/TTF/" - -#define NXAGENT_ALTERNATE_FONT_PATH \ -"/usr/share/X11/fonts/misc/,/usr/share/X11/fonts/Speedo/,\ -/usr/share/X11/fonts/Type1/,/usr/share/X11/fonts/75dpi/,\ -/usr/share/X11/fonts/100dpi/,/usr/share/X11/fonts/TTF/" - -#define NXAGENT_ALTERNATE_FONT_PATH_2 \ -"/usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Speedo/,\ -/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,\ -/usr/share/fonts/X11/100dpi/,/usr/share/fonts/X11/TTF/" - -#define NXAGENT_ALTERNATE_FONT_PATH_3 \ -"/usr/X11R6/lib/X11/fonts/misc/,/usr/X11R6/lib/X11/fonts/Speedo/,\ -/usr/X11R6/lib/X11/fonts/Type1/,/usr/X11R6/lib/X11/fonts/75dpi/,\ -/usr/X11R6/lib/X11/fonts/100dpi/,/usr/X11R6/lib/X11/fonts/TTF/" +const char * nxagentFontDirs[] = { + SYSTEMFONTDIR, + "/usr/share/nx/fonts", + "/usr/share/X11/fonts", + "/usr/share/fonts/X11", + "/usr/X11R6/lib/X11/fonts", + NULL +}; + +const char * nxagentFontSubdirs[] = { + "Type1", + "75dpi", + "100dpi", + "TTF", + NULL +}; #undef NXAGENT_FONTCACHE_DEBUG #undef NXAGENT_RECONNECT_FONT_DEBUG @@ -173,8 +165,6 @@ void nxagentFreeFontCache(void) { - int i; - #ifdef NXAGENT_FONTCACHE_DEBUG fprintf(stderr, "Font: Freeing nxagent font cache\n"); #endif @@ -186,7 +176,7 @@ fprintf(stderr, "Font: Freeing nxagent font cache, there are [%d] entries.\n", CACHE_INDEX); #endif - for (i = 0; i < CACHE_INDEX; i++) + for (int i = 0; i < CACHE_INDEX; i++) { #ifdef NXAGENT_FONTCACHE_DEBUG fprintf(stderr, "Font: Freeing nxagent font cache entry [%d] entry pointer is [%p], name [%s]\n", @@ -198,11 +188,11 @@ nxagentFreeFont(CACHE_FSTRUCT(i)); } - free(CACHE_NAME(i)); - free(CACHE_ENTRY(i)); + SAFE_free(CACHE_NAME(i)); + SAFE_free(CACHE_ENTRY(i)); } - free(CACHE_ENTRY_PTR); + SAFE_free(CACHE_ENTRY_PTR); CACHE_ENTRY_PTR = NULL; CACHE_INDEX = 0; CACHE_SIZE = 0; @@ -216,8 +206,6 @@ void nxagentListRemoteFonts(const char *searchPattern, const int maxNames) { - int i, q, p; - char **xList; int xLen = 0; @@ -249,7 +237,7 @@ * other one will select the 'real' fonts. */ - for (p = 0; p < patternsQt; p++) + for (int p = 0; p < patternsQt; p++) { xList = XListFonts(nxagentDisplay, patterns[p], maxNames, &xLen); @@ -264,11 +252,9 @@ nxagentListRemoteAddName(searchPattern, maxNames); - for (i = 0; i < xLen; i++) + for (int i = 0; i < xLen; i++) { - q = 1; - - nxagentListRemoteAddName(xList[i], q); + nxagentListRemoteAddName(xList[i], 1); } XFreeFontNames(xList); @@ -278,7 +264,7 @@ fprintf(stderr, "nxagentListRemoteFonts: Printing remote font list.\n"); - for (i = 0; i < nxagentRemoteFontList.length; i++) + for (int i = 0; i < nxagentRemoteFontList.length; i++) { fprintf(stderr, "Font# %d, \"%s\"\n", i, nxagentRemoteFontList.list[i]->name); } @@ -338,8 +324,7 @@ if (nxagentRemoteFontList.list[pos]->name == NULL) { fprintf(stderr, "Font: remote list name memory allocation failed!.\n"); - free(nxagentRemoteFontList.list[pos]); - nxagentRemoteFontList.list[pos] = NULL; + SAFE_free(nxagentRemoteFontList.list[pos]); return; } } @@ -361,42 +346,34 @@ static void nxagentFreeRemoteFontList(nxagentFontList *listRec) { - int l; - - for (l = 0; l < listRec -> length; l++) + for (int l = 0; l < listRec -> length; l++) { if (listRec -> list[l]) { - free(listRec -> list[l] -> name); - listRec -> list[l] -> name = NULL; - - free(listRec -> list[l]); - listRec -> list[l] = NULL; + SAFE_free(listRec -> list[l] -> name); + SAFE_free(listRec -> list[l]); } } listRec -> length = listRec -> listSize = 0; - free(listRec -> list); - listRec -> list = NULL; + SAFE_free(listRec -> list); return; } Bool nxagentFontFind(const char *name, int *pos) { - int low,high,res,iter,lpos; - if (!nxagentRemoteFontList.length) { *pos=0; return False; } - low = 0; - high = nxagentRemoteFontList.length - 1; - iter = 0; - res = 1; - lpos = nxagentRemoteFontList.length; + int low = 0; + int high = nxagentRemoteFontList.length - 1; + int iter = 0; + int res = 1; + int lpos = nxagentRemoteFontList.length; while (low <= high) { *pos = (high + low)/2; @@ -432,18 +409,15 @@ Bool nxagentFontLookUp(const char *name) { int i; - int result; - - char *scalable; if (name != NULL && strlen(name) == 0) { return 0; } - result = nxagentFontFind(name, &i); + int result = nxagentFontFind(name, &i); - scalable = NULL; + char *scalable = NULL; /* * Let's try with the scalable font description. @@ -451,13 +425,11 @@ if (result == 0) { - scalable = nxagentMakeScalableFontName(name, 0); - - if (scalable != NULL) + if ((scalable = nxagentMakeScalableFontName(name, 0)) != NULL) { result = nxagentFontFind(scalable, &i); - free(scalable); + SAFE_free(scalable); } } @@ -467,13 +439,11 @@ if (result == 0) { - scalable = nxagentMakeScalableFontName(name, 1); - - if (scalable != NULL) + if ((scalable = nxagentMakeScalableFontName(name, 1)) != NULL) { result = nxagentFontFind(scalable, &i); - free(scalable); + SAFE_free(scalable); } } @@ -711,7 +681,7 @@ int nxagentDestroyNewFontResourceType(void * p, XID id) { #ifdef TEST - fprintf(stderr, "nxagentDestroyNewFontResourceType: Destroying mirror id [%ld] for font at [%p].\n", + fprintf(stderr, "%s: Destroying mirror id [%ld] for font at [%p].\n", __func__, nxagentFontPriv((FontPtr) p) -> mirrorID, (void *) p); #endif @@ -838,7 +808,7 @@ for (j = 0; j < numSearchFields; j++) { - free(searchFields[j]); + SAFE_free(searchFields[j]); } } } @@ -855,7 +825,7 @@ for (j = 0; j < numFontFields; j++) { - free(fontNameFields[j]); + SAFE_free(fontNameFields[j]); } return fontStruct; @@ -865,7 +835,6 @@ { nxagentPrivFont *privFont; Bool *pBool = (Bool*)param2; - int i; if (pFont == NULL || !*pBool) return; @@ -877,7 +846,7 @@ (void *) pFont, privFont -> font_struct ? nxagentFont(pFont) : 0); #endif - for (i = 0; i < CACHE_INDEX; i++) + for (int i = 0; i < CACHE_INDEX; i++) { if (strcasecmp(CACHE_NAME(i), privFont -> fontName) == 0) { @@ -905,7 +874,6 @@ static void nxagentCollectFailedFont(FontPtr fpt, XID id) { - if (nxagentFailedToReconnectFonts.font == NULL) { nxagentFailedToReconnectFonts.size = 8; @@ -917,10 +885,8 @@ if (nxagentFailedToReconnectFonts.font == NULL || nxagentFailedToReconnectFonts.id == NULL) { - free(nxagentFailedToReconnectFonts.font); - nxagentFailedToReconnectFonts.font = NULL; - free(nxagentFailedToReconnectFonts.id); - nxagentFailedToReconnectFonts.id = NULL; + SAFE_free(nxagentFailedToReconnectFonts.font); + SAFE_free(nxagentFailedToReconnectFonts.id); FatalError("Font: font not reconnected memory allocation failed!.\n"); } @@ -1051,13 +1017,11 @@ static void nxagentFreeCacheBeforeReconnect(void) { - int i; - #ifdef NXAGENT_RECONNECT_FONT_DEBUG printFontCacheDump("nxagentFreeCacheBeforeReconnect"); #endif - for (i = 0; i < CACHE_INDEX; i++) + for (int i = 0; i < CACHE_INDEX; i++) { if (CACHE_FSTRUCT(i)) { @@ -1069,25 +1033,26 @@ static void nxagentCleanCacheAfterReconnect(void) { - int i, j; int real_size = CACHE_INDEX; - nxCacheFontEntryRecPtr swapEntryPtr; #ifdef NXAGENT_RECONNECT_FONT_DEBUG printFontCacheDump("nxagentCleanCacheAfterReconnect"); #endif - for (i = 0; i < CACHE_INDEX; i++) + for (int i = 0; i < CACHE_INDEX; i++) { if(CACHE_FSTRUCT(i) == NULL) { - XFree(CACHE_NAME(i)); + SAFE_XFree(CACHE_NAME(i)); real_size--; } } - for (i = 0; i < real_size; i++) + for (int i = 0; i < real_size; i++) { + int j; + nxCacheFontEntryRecPtr swapEntryPtr; + /* Find - first bad occurrence if exist. */ while ((i < real_size) && CACHE_FSTRUCT(i)) i++; @@ -1116,11 +1081,9 @@ #ifdef NXAGENT_RECONNECT_FONT_DEBUG static void printFontCacheDump(char* msg) { - int i; - fprintf(stderr, "%s - begin -\n", msg); - for (i = 0; i < CACHE_INDEX; i++) + for (int i = 0; i < CACHE_INDEX; i++) { if (CACHE_FSTRUCT(i)) { @@ -1137,7 +1100,6 @@ Bool nxagentReconnectAllFonts(void *p0) { - int cid; Bool fontSuccess = True; reconnectFlexibility = *((int *) p0); @@ -1155,7 +1117,7 @@ FindClientResourcesByType(clients[serverClient -> index], RT_NX_FONT, (FindResType) nxagentFontReconnect, &fontSuccess); - for (cid = 0; cid < MAXCLIENTS; cid++) + for (int cid = 0; cid < MAXCLIENTS; cid++) { if (clients[cid]) { @@ -1254,11 +1216,8 @@ static void nxagentFreeFailedToReconnectFonts(void) { - free(nxagentFailedToReconnectFonts.font); - nxagentFailedToReconnectFonts.font = NULL; - - free(nxagentFailedToReconnectFonts.id); - nxagentFailedToReconnectFonts.id = NULL; + SAFE_free(nxagentFailedToReconnectFonts.font); + SAFE_free(nxagentFailedToReconnectFonts.id); nxagentFailedToReconnectFonts.size = 0; nxagentFailedToReconnectFonts.index = 0; @@ -1266,7 +1225,6 @@ Bool nxagentReconnectFailedFonts(void *p0) { - int i; int attempt = 1; const int maxAttempt = 5; @@ -1320,7 +1278,7 @@ nxagentFreeRemoteFontList(&nxagentRemoteFontList); nxagentListRemoteFonts("*", nxagentMaxFontNames); - for(i = 0; i < nxagentFailedToReconnectFonts.index; i++) + for(int i = 0; i < nxagentFailedToReconnectFonts.index; i++) { fontSuccess = True; @@ -1353,7 +1311,7 @@ nxagentListRemoteFonts("*", nxagentMaxFontNames); XFreeFontPath(fontPaths); - free(newFontPaths); + SAFE_free(newFontPaths); return False; } @@ -1364,7 +1322,7 @@ XSetFontPath(nxagentDisplay, fontPaths, nPaths); XFreeFontPath(fontPaths); - free(newFontPaths); + SAFE_free(newFontPaths); nxagentCleanCacheAfterReconnect(); @@ -1373,7 +1331,6 @@ Bool nxagentDisconnectAllFonts(void) { - int cid; Bool fontSuccess = True; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_FONT_DEBUG) @@ -1392,7 +1349,7 @@ FindClientResourcesByType(clients[serverClient -> index], RT_NX_FONT, (FindResType) nxagentFontDisconnect, &fontSuccess); - for(cid = 0; cid < MAXCLIENTS; cid++) + for(int cid = 0; cid < MAXCLIENTS; cid++) { if( clients[cid] && fontSuccess ) { @@ -1418,14 +1375,14 @@ snprintf(fontServerPath, min(size, len + 1), "%s", path + 1); #ifdef TEST - fprintf(stderr, "nxagentGetFontServerPath: Got path [%s].\n", + fprintf(stderr, "%s: Got path [%s].\n", __func__, fontServerPath); #endif } else { #ifdef TEST - fprintf(stderr, "nxagentGetFontServerPath: WARNING! Font server tunneling not enabled.\n"); + fprintf(stderr, "%s: WARNING! Font server tunneling not enabled.\n", __func__); #endif return False; @@ -1434,7 +1391,7 @@ else { #ifdef TEST - fprintf(stderr, "nxagentGetFontServerPath: WARNING! Failed to get path for font server tunneling.\n"); + fprintf(stderr, "%s: WARNING! Failed to get path for font server tunneling.\n", __func__); #endif return False; @@ -1443,144 +1400,118 @@ return True; } -void nxagentVerifyDefaultFontPath(void) +void nxagentVerifySingleFontPath(char **dest, const char *fontDir) { - struct stat dirStat; - static char *fontPath; + if (!dest || !*dest) + return; #ifdef TEST - fprintf(stderr, "nxagentVerifyDefaultFontPath: Going to search for one or more valid font paths.\n"); + fprintf(stderr, "%s: Assuming fonts in directory [%s].\n", __func__, + validateString(fontDir)); #endif - /* - * Set the default font path as the first choice. - */ - - if ((fontPath = strdup(defaultFontPath)) == NULL) + for (int i = 0; ; i++) { - #ifdef WARNING - fprintf(stderr, "nxagentVerifyDefaultFontPath: WARNING! Unable to allocate memory for a new font path. " - "Using the default font path [%s].\n", validateString(defaultFontPath)); - #endif + char *tmppath = NULL; + int rc; - return; - } + const char *subdir = nxagentFontSubdirs[i]; - if (stat(NXAGENT_DEFAULT_FONT_DIR, &dirStat) == 0 && - S_ISDIR(dirStat.st_mode) != 0) - { - /* - * Let's use the old "/usr/share/nx/fonts" style. - */ - - #ifdef TEST - fprintf(stderr, "nxagentVerifyDefaultFontPath: Assuming fonts in directory [%s].\n", - validateString(NXAGENT_DEFAULT_FONT_DIR)); - #endif + if (subdir == NULL) + return; - if (*fontPath != '\0') + if (**dest != '\0') { - fontPath = realloc(fontPath, strlen(fontPath) + strlen(NXAGENT_DEFAULT_FONT_PATH) + 2); - strcat(fontPath, ","); + rc = asprintf(&tmppath, "%s,%s/%s", *dest, fontDir, subdir); } else { - fontPath = realloc(fontPath, strlen(fontPath) + strlen(NXAGENT_DEFAULT_FONT_PATH) + 1); + rc = asprintf(&tmppath, "%s/%s", fontDir, subdir); } - strcat(fontPath, NXAGENT_DEFAULT_FONT_PATH); - } + if (rc == -1) + return; - if (stat(NXAGENT_ALTERNATE_FONT_DIR, &dirStat) == 0 && - S_ISDIR(dirStat.st_mode) != 0) - { - /* - * Let's use the new "/usr/share/X11/fonts" path. - */ + SAFE_free(*dest); + *dest = tmppath; + tmppath = NULL; + } +} - #ifdef TEST - fprintf(stderr, "nxagentVerifyDefaultFontPath: Assuming fonts in directory [%s].\n", - validateString(NXAGENT_ALTERNATE_FONT_DIR)); - #endif +void nxagentVerifyDefaultFontPath(void) +{ + static char *fontPath; - if (*fontPath != '\0') - { - fontPath = realloc(fontPath, strlen(fontPath) + strlen(NXAGENT_ALTERNATE_FONT_PATH) + 2); - strcat(fontPath, ","); - } - else - { - fontPath = realloc(fontPath, strlen(fontPath) + strlen(NXAGENT_ALTERNATE_FONT_PATH) + 1); - } + #ifdef TEST + fprintf(stderr, "%s: Going to search for one or more valid font paths.\n", __func__); + #endif - strcat(fontPath, NXAGENT_ALTERNATE_FONT_PATH); - } + /* + * Set the default font path as the first choice. + */ - if (stat(NXAGENT_ALTERNATE_FONT_DIR_2, &dirStat) == 0 && - S_ISDIR(dirStat.st_mode) != 0) + if ((fontPath = strdup(defaultFontPath)) == NULL) { - /* - * Let's use the "/usr/share/fonts/X11" path. - */ - - #ifdef TEST - fprintf(stderr, "nxagentVerifyDefaultFontPath: Assuming fonts in directory [%s].\n", - validateString(NXAGENT_ALTERNATE_FONT_DIR_2)); + #ifdef WARNING + fprintf(stderr, "%s: WARNING! Unable to allocate memory for a new font path. " + "Using the default font path [%s].\n", __func__, + validateString(defaultFontPath)); #endif - if (*fontPath != '\0') - { - fontPath = realloc(fontPath, strlen(fontPath) + strlen(NXAGENT_ALTERNATE_FONT_PATH_2) + 2); - strcat(fontPath, ","); - } - else - { - fontPath = realloc(fontPath, strlen(fontPath) + strlen(NXAGENT_ALTERNATE_FONT_PATH_2) + 1); - } - - strcat(fontPath, NXAGENT_ALTERNATE_FONT_PATH_2); + return; } - if (stat(NXAGENT_ALTERNATE_FONT_DIR_3, &dirStat) == 0 && - S_ISDIR(dirStat.st_mode) != 0) + for (int i = 0; ; i++) { - /* - * Let's use the "/usr/X11R6/lib/X11/fonts" path. - */ - - #ifdef TEST - fprintf(stderr, "nxagentVerifyDefaultFontPath: Assuming fonts in directory [%s].\n", - validateString(NXAGENT_ALTERNATE_FONT_DIR_3)); - #endif + int j; + const char *dir = nxagentFontDirs[i]; - if (*fontPath != '\0') + if (dir == NULL) { - fontPath = realloc(fontPath, strlen(fontPath) + strlen(NXAGENT_ALTERNATE_FONT_PATH_3) + 2); - strcat(fontPath, ","); + break; } else { - fontPath = realloc(fontPath, strlen(fontPath) + strlen(NXAGENT_ALTERNATE_FONT_PATH_3) + 1); - } + for (j = 0; j <= i; j++) + { + //if (strcmp(nxagentFontDirs[j], dir) == 0) + if (nxagentFontDirs[j] == dir) + { + break; + } + } - strcat(fontPath, NXAGENT_ALTERNATE_FONT_PATH_3); + if (j == i) + { + nxagentVerifySingleFontPath(&fontPath, dir); + } +#ifdef TEST + else + { + fprintf(stderr, "%s: Skipping duplicate font dir [%s].\n", __func__, + validateString(dir)); + } +#endif + } } - if (*fontPath == '\0') + + if (*fontPath == '\0') { #ifdef WARNING - fprintf(stderr, "nxagentVerifyDefaultFontPath: WARNING! Can't find a valid font directory.\n"); - - fprintf(stderr, "nxagentVerifyDefaultFontPath: WARNING! Using font path [%s].\n", - validateString(defaultFontPath)); + fprintf(stderr, "%s: WARNING! Can't find a valid font directory.\n", __func__); + fprintf(stderr, "%s: WARNING! Using font path [%s].\n", __func__, + validateString(defaultFontPath)); #endif } else { + /* do _not_ free defaultFontPath here - it's either set at compile time or + part of argv */ defaultFontPath = fontPath; - + #ifdef TEST - fprintf(stderr, "nxagentVerifyDefaultFontPath: Using font path [%s].\n", - validateString(defaultFontPath)); + fprintf(stderr, "%s: Using font path [%s].\n", __func__, + validateString(defaultFontPath)); #endif } @@ -1613,7 +1544,7 @@ fprintf(stderr, "nxagentLoadQueryFont: WARNING! Font not found '%s'.\n", name); #endif - free(fs); + SAFE_free(fs); return (XFontStruct *) NULL; } @@ -1647,7 +1578,7 @@ fprintf(stderr, "nxagentLoadQueryFont: WARNING! Failed allocation of XFontProp."); #endif - free((char *) fs); + SAFE_free(fs); return (XFontStruct *) NULL; } @@ -1681,19 +1612,17 @@ int nxagentFreeFont(XFontStruct *fs) { - - if (fs -> per_char) + if (fs->per_char) { #ifdef USE_XF86BIGFONT _XF86BigfontFreeFontMetrics(fs); #else - free ((char *) fs->per_char); + SAFE_free(fs->per_char); #endif } - free (fs->properties); - - XFree(fs); + SAFE_free(fs->properties); + SAFE_XFree(fs); return 1; } @@ -1829,7 +1758,7 @@ MakeScalableFontNameError: - free(scalableFontName); + SAFE_free(scalableFontName); #ifdef DEBUG fprintf(stderr, "nxagentMakeScalableFontName: Invalid font name.\n"); diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/GC.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/GC.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/GC.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/GC.c 2019-12-16 06:31:54.000000000 +0000 @@ -61,6 +61,7 @@ #include "Trap.h" #include "Screen.h" #include "Pixels.h" +#include "Utils.h" #include "../../fb/fb.h" @@ -694,7 +695,7 @@ XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC -> clipOrg.x, pGC -> clipOrg.y, pRects, nRects, Unsorted); - free((char *) pRects); + SAFE_free(pRects); } break; @@ -778,7 +779,7 @@ pGC->clientClip = (void *) RegionFromRects(nRects, (xRectangle *)pValue, type); - free(pValue); + SAFE_free(pValue); pValue = pGC->clientClip; @@ -912,9 +913,8 @@ (void *) t, (void *) t -> gc); #endif - free(t -> gc); - - free(t); + SAFE_free(t -> gc); + SAFE_free(t); } static void nxagentRestoreGCRec(struct nxagentGCRec *t) @@ -924,11 +924,11 @@ (void*)t, (void*)t -> gc); #endif - free(nxagentGC(t -> pGC)); + SAFE_free(nxagentGC(t -> pGC)); nxagentGC(t -> pGC) = t -> gc; - free(t); + SAFE_free(t); } static void nxagentAddGCToList(GCPtr pGC) @@ -1303,7 +1303,7 @@ XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC -> clipOrg.x, pGC -> clipOrg.y, pRects, nRects, Unsorted); - free((char *) pRects); + SAFE_free(pRects); } else { @@ -1374,7 +1374,7 @@ pGC->clientClip = (void *) RegionFromRects(nRects, (xRectangle *)pValue, type); - free(pValue); + SAFE_free(pValue); pValue = pGC->clientClip; type = CT_REGION; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/GCOps.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/GCOps.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/GCOps.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/GCOps.c 2019-12-16 06:31:54.000000000 +0000 @@ -57,6 +57,7 @@ #include "Holder.h" #include "Args.h" #include "Screen.h" +#include "Utils.h" #include "compext/Compext.h" @@ -787,7 +788,7 @@ srcx, srcy, width, height); #endif - free(data); + SAFE_free(data); /* * If the source is a shared memory pixmap, the @@ -1007,7 +1008,7 @@ srcx, srcy, width, height); #endif - free(data); + SAFE_free(data); /* * If the source is a shared memory pixmap, the @@ -1545,7 +1546,7 @@ RESET_GC_TRAP(); } - free(newPoints); + SAFE_free(newPoints); } void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Handlers.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Handlers.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Handlers.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Handlers.c 2019-12-16 06:31:54.000000000 +0000 @@ -1255,7 +1255,7 @@ while (nxagentTokens.pending == TOKENS_PENDING_LIMIT) { - if (nxagentWaitEvents(nxagentDisplay, NULL) == -1) + if (nxagentWaitEvents(nxagentDisplay, 0) == -1) { nxagentTokens.pending = 0; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Image.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Image.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Image.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Image.c 2019-12-16 06:31:54.000000000 +0000 @@ -455,7 +455,7 @@ if (nxagentUnpackAlpha[resource] != NULL) { - free(nxagentUnpackAlpha[resource] -> data); + SAFE_free(nxagentUnpackAlpha[resource] -> data); } else if ((nxagentUnpackAlpha[resource] = malloc(sizeof(UnpackAlphaRec))) == NULL) { @@ -463,7 +463,7 @@ fprintf(stderr, "nxagentSetUnpackAlpha: PANIC! Can't allocate data for the alpha structure.\n"); #endif - free(data); + SAFE_free(data); return; } @@ -483,7 +483,7 @@ resource, size); #endif - free(data); + SAFE_free(data); } } @@ -1567,20 +1567,20 @@ nxagentImageStatistics.totalEncoded, nxagentImageStatistics.totalAdded); #endif - free(packedChecksum); + SAFE_free(packedChecksum); if (packedImage != NULL) { if (packedImage -> data != NULL && packedImage -> data != plainImage -> data) { - free(packedImage -> data); + SAFE_free(packedImage -> data); } - free(packedImage); + SAFE_free(packedImage); } - free(plainImage); + SAFE_free(plainImage); } void nxagentGetImage(DrawablePtr pDrawable, int x, int y, int w, int h, @@ -1634,11 +1634,8 @@ { if (nxagentUnpackAlpha[i]) { - free(nxagentUnpackAlpha[i] -> data); - - free(nxagentUnpackAlpha[i]); - - nxagentUnpackAlpha[i] = NULL; + SAFE_free(nxagentUnpackAlpha[i] -> data); + SAFE_free(nxagentUnpackAlpha[i]); } } } @@ -1716,7 +1713,7 @@ if (newImage -> data == NULL) { - free(newImage); + SAFE_free(newImage); #ifdef PANIC fprintf(stderr, "nxagentScaleImage: PANIC! Failed to create the target image data.\n"); @@ -1784,8 +1781,8 @@ } } - free((char *) image -> obdata); - free((char *) image); + SAFE_free(image -> obdata); + SAFE_free(image); *pImage = newImage; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Imakefile nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Imakefile --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Imakefile 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Imakefile 2019-12-16 06:31:54.000000000 +0000 @@ -20,7 +20,6 @@ NXshm.c \ NXglxext.c \ NXxvdisp.c \ - NXmiexpose.c \ NXresource.c \ NXdamage.c \ NXmitrap.c \ @@ -42,7 +41,6 @@ Keystroke.c \ Pointer.c \ Screen.c \ - TestExt.c \ Visual.c \ Drawable.c \ Window.c \ @@ -82,7 +80,6 @@ NXshm.o \ NXglxext.o \ NXxvdisp.o \ - NXmiexpose.o \ NXresource.o \ NXdamage.o \ NXmitrap.o \ @@ -104,7 +101,6 @@ Keystroke.o \ Pointer.o \ Screen.o \ - TestExt.o \ Visual.o \ Drawable.o \ Window.o \ @@ -244,7 +240,6 @@ -DNXAGENT_VISIBILITY \ -DNXAGENT_WAKEUP=1000 \ -DNXAGENT_ONSTART \ - -DNXAGENT_SPLASH \ -DNXAGENT_ARTSD \ -DNXAGENT_RANDR_MODE_PREFIX \ -UNX_DEBUG_INPUT \ @@ -255,6 +250,7 @@ -DRANDR_15_INTERFACE=1 \ -DPANORAMIX \ -UDEBUG_TREE \ + -DSYSTEMFONTDIR=\"$(SYSTEMFONTDIR)\" \ $(NULL) all:: $(OBJS) diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Init.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Init.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Init.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Init.c 2019-12-16 06:31:54.000000000 +0000 @@ -143,6 +143,11 @@ static void nxagentGrabServerCallback(CallbackListPtr *callbacks, void *data, void *args); +#ifdef NXAGENT_CLIPBOARD +extern void nxagentSetSelectionCallback(CallbackListPtr *callbacks, void *data, + void *args); +#endif + void ddxInitGlobals(void) { /* @@ -183,25 +188,30 @@ int nxagentDoFullGeneration = 1; /* - * 1 if agent running as X2goAgent - * 0 if NX Agent + * True if agent is running as X2goAgent + * False if agent is running as NXAgent */ -int nxagentX2go; +Bool nxagentX2go; /* - * Checking if agent is x2go agent + * Check if agent is x2go agent */ void checkX2goAgent(void) { - extern char *nxagentProgName; - if( strcasecmp(nxagentProgName,"x2goagent") == 0) + extern const char *nxagentProgName; + + #ifdef TEST + fprintf(stderr, "%s: nxagentProgName [%s]\n", __func__, nxagentProgName); + #endif + + if (strcasecmp(nxagentProgName,"x2goagent") == 0) { fprintf(stderr, "\nrunning as X2Go Agent\n"); - nxagentX2go=1; + nxagentX2go = True; } else - nxagentX2go=0; + nxagentX2go = False; } @@ -403,9 +413,14 @@ * background. */ - blackRoot = TRUE; + if (!whiteRoot) + blackRoot = TRUE; nxagentInitKeystrokes(False); + +#ifdef NXAGENT_CLIPBOARD + AddCallback(&SelectionCallback, nxagentSetSelectionCallback, NULL); +#endif } void diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c 2019-12-16 06:31:54.000000000 +0000 @@ -58,6 +58,7 @@ #include "Options.h" #include "Error.h" #include "Init.h" +#include "Utils.h" #include "compext/Compext.h" @@ -553,10 +554,11 @@ value_mask = KBLed | KBLedMode; - for (int i = 1; i <= 32; i++) + for (int i = 1; i <= XkbNumIndicators; i++) { + unsigned int mask = (unsigned int)1 << (i - 1); values.led = i; - values.led_mode = (ctrl->leds & (1 << (i - 1))) ? LedModeOn : LedModeOff; + values.led_mode = (ctrl->leds & mask) ? LedModeOn : LedModeOff; XChangeKeyboardControl(nxagentDisplay, value_mask, &values); } @@ -647,15 +649,16 @@ if (keymap64 == NULL) { XFreeModifiermap(modifier_keymap); - return -1; } len = (max_keycode - min_keycode + 1) * mapWidth; keymap = (KeySym *)malloc(len * sizeof(KeySym)); for(i = 0; i < len; ++i) + { keymap[i] = keymap64[i]; - XFree(keymap64); + } + SAFE_XFree(keymap64); } #else /* #ifdef _XSERVER64 */ @@ -668,7 +671,6 @@ if (keymap == NULL) { XFreeModifiermap(modifier_keymap); - return -1; } @@ -682,18 +684,24 @@ memset(modmap, 0, sizeof(modmap)); for (j = 0; j < 8; j++) - for(i = 0; i < modifier_keymap->max_keypermod; i++) { + { + for(i = 0; i < modifier_keymap->max_keypermod; i++) + { CARD8 keycode; if ((keycode = modifier_keymap-> modifiermap[j * modifier_keymap->max_keypermod + i])) + { modmap[keycode] |= 1< 0) { nxagentCheckModifierMasks(keycode, j); } } + } + XFreeModifiermap(modifier_keymap); modifier_keymap = NULL; @@ -747,18 +755,15 @@ #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: Using XKB extension.\n"); - #endif - - #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: nxagentKeyboard is [%s].\n", nxagentKeyboard ? nxagentKeyboard : "NULL"); #endif - if (nxagentX2go == 1 && nxagentKeyboard && (strcmp(nxagentKeyboard, "null/null") == 0)) + if (nxagentX2go && nxagentKeyboard && (strcmp(nxagentKeyboard, "null/null") == 0)) { #ifdef TEST fprintf(stderr, "%s: changing nxagentKeyboard from [null/null] to [clone].\n", __func__); #endif - free(nxagentKeyboard); + SAFE_free(nxagentKeyboard); nxagentKeyboard = strdup("clone"); } @@ -779,10 +784,9 @@ { for (i = 0; nxagentKeyboard[i] != '/' && nxagentKeyboard[i] != 0; i++); - if(nxagentKeyboard[i] == 0 || nxagentKeyboard[i + 1] == 0 || i == 0) + if (nxagentKeyboard[i] == 0 || nxagentKeyboard[i + 1] == 0 || i == 0) { ErrorF("Warning: Wrong keyboard type: %s.\n", nxagentKeyboard); - goto XkbError; } @@ -806,7 +810,7 @@ layout = strdup(strsep(&tmp, sep)); variant = strdup(strsep(&tmp, sep)); options = strdup(strsep(&tmp, sep)); - free(rmlvo); + SAFE_free(rmlvo); } else { @@ -842,7 +846,7 @@ { #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: Using default keyboard: model [%s] layout [%s].\n", - model, layout); + model?model:"(default)", layout?layout:"(default)"); #endif } @@ -861,19 +865,21 @@ /* Only setup keycode conversion if we are NOT in clone mode */ if (nxagentKeyboard && (strcmp(nxagentKeyboard, "clone") == 0)) { - free(rules); rules = strdup(nxagentRemoteRules); - free(model); model = strdup(nxagentRemoteModel); - free(layout); layout = strdup(nxagentRemoteLayout); - free(variant); variant = strdup(nxagentRemoteVariant); - free(options); options = strdup(nxagentRemoteOptions); + SAFE_free(rules); rules = strdup(nxagentRemoteRules); + SAFE_free(model); model = strdup(nxagentRemoteModel); + SAFE_free(layout); layout = strdup(nxagentRemoteLayout); + SAFE_free(variant); variant = strdup(nxagentRemoteVariant); + SAFE_free(options); options = strdup(nxagentRemoteOptions); /* * when cloning we do not want X2Go to set the keyboard * via a keyboard file generated by nxagent. The defined * method for switching that off is the creation of a dir * instead of a file. */ - if (nxagentX2go == 1) + if (nxagentX2go) + { nxagentWriteKeyboardDir(); + } } else { @@ -890,8 +896,10 @@ * know about that yet. Once x2go starts using clone * we can drop this here. */ - if (nxagentX2go == 1) + if (nxagentX2go) + { nxagentWriteKeyboardFile(nxagentRemoteRules, nxagentRemoteModel, nxagentRemoteLayout, nxagentRemoteVariant, nxagentRemoteOptions); + } } } #ifdef DEBUG @@ -905,19 +913,20 @@ if (xkb && xkb->geom) { - XkbGetControls(nxagentDisplay, XkbAllControlsMask, xkb); + XkbGetControls(nxagentDisplay, XkbAllControlsMask, xkb); } #ifdef TEST else { - fprintf(stderr, "nxagentKeyboardProc: No current keyboard.\n"); + fprintf(stderr, "nxagentKeyboardProc: No current keyboard.\n"); } #endif #ifdef DEBUG fprintf(stderr, "nxagentKeyboardProc: Going to set rules and init device: " "[rules='%s',model='%s',layout='%s',variant='%s',options='%s'].\n", - rules, model, layout, variant, options); + rules?rules:"(default)", model?model:"(default)", layout?layout:"(default)", + variant?variant:"(default)", options?options:"(default)"); #endif XkbSetRulesDflts(rules, model, layout, variant, options); @@ -931,23 +940,27 @@ if (xkb && xkb->geom) { - XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls); + XkbDDXChangeControls(pDev, xkb->ctrls, xkb->ctrls); } if (nxagentOption(Shadow) == 1 && pDev && pDev->key) { NXShadowInitKeymap(&(pDev->key->curKeySyms)); } + + SAFE_free(rules); + SAFE_free(variant); + SAFE_free(options); } if (xkb) { - XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); - xkb = NULL; + XkbFreeKeyboard(xkb, XkbAllComponentsMask, True); + xkb = NULL; } - free(model); - free(layout); + SAFE_free(model); + SAFE_free(layout); #endif #ifdef WATCH @@ -968,9 +981,9 @@ #endif #ifdef _XSERVER64 - free(keymap); + SAFE_free(keymap); #else - XFree(keymap); + SAFE_XFree(keymap); #endif break; case DEVICE_ON: @@ -1018,7 +1031,6 @@ break; case DEVICE_CLOSE: - #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: Called for [DEVICE_CLOSE].\n"); #endif @@ -1171,7 +1183,7 @@ nxagentFreeKeyboardDeviceData(devBackup); - free(devBackup); + SAFE_free(devBackup); return 1; } @@ -1285,8 +1297,6 @@ static int nxagentFreeKeyboardDeviceData(DeviceIntPtr dev) { - KbdFeedbackPtr k, knext; - if (!dev) { #ifdef PANIC @@ -1306,28 +1316,29 @@ } #endif - free(dev->key->curKeySyms.map); - free(dev->key->modifierKeyMap); - free(dev->key); - - dev->key = NULL; + SAFE_free(dev->key->curKeySyms.map); + SAFE_free(dev->key->modifierKeyMap); + SAFE_free(dev->key); } if (dev->focus) { - free(dev->focus->trace); - free(dev->focus); - dev->focus = NULL; + SAFE_free(dev->focus->trace); + SAFE_free(dev->focus); } - for (k = dev->kbdfeed; k; k = knext) + if (dev->kbdfeed) { - knext = k->next; - #ifdef XKB - if (k->xkb_sli) - XkbFreeSrvLedInfo(k->xkb_sli); - #endif - free(k); + for (KbdFeedbackPtr k = dev->kbdfeed, knext; k; k = knext) + { + knext = k->next; + #ifdef XKB + if (k->xkb_sli) + XkbFreeSrvLedInfo(k->xkb_sli); + #endif + SAFE_free(k); + } + dev->kbdfeed = NULL; } #ifdef DEBUG @@ -1558,11 +1569,11 @@ void nxagentXkbClearNames(void) { - free(nxagentRemoteRules); nxagentRemoteRules = NULL; - free(nxagentRemoteModel); nxagentRemoteModel = NULL; - free(nxagentRemoteLayout); nxagentRemoteLayout = NULL; - free(nxagentRemoteVariant); nxagentRemoteVariant = NULL; - free(nxagentRemoteOptions); nxagentRemoteOptions = NULL; + SAFE_free(nxagentRemoteRules); + SAFE_free(nxagentRemoteModel); + SAFE_free(nxagentRemoteLayout); + SAFE_free(nxagentRemoteVariant); + SAFE_free(nxagentRemoteOptions); } static void nxagentXkbGetNames(void) @@ -1605,7 +1616,7 @@ { if (data) { - XFree(data); + SAFE_XFree(data); return; } } @@ -1642,7 +1653,7 @@ name += strlen(name) + 1; } - XFree(data); + SAFE_XFree(data); return; } @@ -1673,10 +1684,13 @@ { if ((asprintf(&keyboard_file_path, "%s/keyboard", sessionpath) == -1)) { - free(sessionpath); + SAFE_free(sessionpath); FatalError("malloc for keyboard file path failed."); } - free(sessionpath); + else + { + SAFE_free(sessionpath); + } } else { @@ -1704,7 +1718,7 @@ { fprintf(stderr, "Info: keyboard blocking directory created: '%s'\n", keyboard_file_path); } - free(keyboard_file_path); + SAFE_free(keyboard_file_path); } } @@ -1732,7 +1746,7 @@ int save_err = errno; fprintf(stderr, "Error: keyboard file not created: %s\n", strerror(save_err)); } - free(keyboard_file_path); + SAFE_free(keyboard_file_path); } } } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c 2019-12-16 06:31:54.000000000 +0000 @@ -44,7 +44,6 @@ #include extern Bool nxagentWMIsRunning; -extern Bool nxagentIpaq; extern char *nxagentKeystrokeFile; #ifdef NX_DEBUG_INPUT @@ -100,6 +99,9 @@ "viewport_scroll_down", "reread_keystrokes", + + "autograb", + NULL, }; @@ -113,8 +115,6 @@ {KEYSTROKE_FULLSCREEN, ControlMask | ShiftMask, True, XK_f}, {KEYSTROKE_MINIMIZE, ControlMask, True, XK_m}, {KEYSTROKE_DEFER, ControlMask, True, XK_e}, - {KEYSTROKE_IGNORE, ControlMask, True, XK_BackSpace}, - {KEYSTROKE_IGNORE, 0, False, XK_Terminate_Server}, {KEYSTROKE_FORCE_SYNCHRONIZATION, ControlMask, True, XK_j}, #ifdef DUMP {KEYSTROKE_REGIONS_ON_SCREEN, ControlMask, True, XK_a}, @@ -141,6 +141,7 @@ {KEYSTROKE_VIEWPORT_SCROLL_DOWN, ControlMask, True, XK_Down}, {KEYSTROKE_VIEWPORT_SCROLL_DOWN, ControlMask, True, XK_KP_Down}, {KEYSTROKE_REREAD_KEYSTROKES, ControlMask, True, XK_k}, + {KEYSTROKE_AUTOGRAB, ControlMask, True, XK_g}, {KEYSTROKE_END_MARKER, 0, False, NoSymbol}, }; struct nxagentSpecialKeystrokeMap *map = default_map; @@ -297,7 +298,7 @@ if (force) { if (map != default_map) { - free(map); + SAFE_free(map); map = default_map; } fprintf(stderr, "Info: re-reading keystrokes configuration\n"); @@ -417,7 +418,7 @@ #endif filename = NULL; } - free(homepath); + SAFE_free(homepath); if (map == default_map) { @@ -470,7 +471,7 @@ #endif for (struct nxagentSpecialKeystrokeMap *cur = map; cur->stroke != KEYSTROKE_END_MARKER; cur++) { #ifdef DEBUG - fprintf(stderr, "%s: checking keysym '%c' (%d)\n", __func__, cur->keysym, cur->keysym); + fprintf(stderr,"%s: keysym %d stroke %d, type %d\n", __func__, cur->keysym, cur->stroke, X->type); #endif if (cur->keysym == keysym && modifier_matches(cur->modifierMask, cur->modifierAltMeta, X->state)) { #ifdef DEBUG @@ -483,6 +484,9 @@ return ret; } +/* + * returns True if a special keystroke has been pressed. *result will contain the action. + */ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result) { enum nxagentSpecialKeystroke stroke = find_keystroke(X); @@ -509,13 +513,6 @@ * here. */ - if (X -> keycode == 130 && nxagentIpaq) - { - *result = doStartKbd; - - return True; - } - switch (stroke) { #ifdef DEBUG_TREE case KEYSTROKE_DEBUG_TREE: @@ -634,10 +631,13 @@ if (X->type == KeyRelease) nxagentInitKeystrokes(True); break; + case KEYSTROKE_AUTOGRAB: + *result = doAutoGrab; + break; case KEYSTROKE_NOTHING: /* do nothing. difference to KEYSTROKE_IGNORE is the return value */ case KEYSTROKE_END_MARKER: /* just to make gcc STFU */ case KEYSTROKE_MAX: break; } - return (*result == doNothing); + return (*result != doNothing); } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Keystroke.h 2019-12-16 06:31:54.000000000 +0000 @@ -73,6 +73,8 @@ KEYSTROKE_REREAD_KEYSTROKES, + KEYSTROKE_AUTOGRAB, + KEYSTROKE_NOTHING, /* insert more here and in the string translation */ diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 2019-12-16 06:31:54.000000000 +0000 @@ -23,7 +23,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .ds q \N'34' -.TH nxagent 1 "Apr 2019" "Version 3.5.99.20" "NX Agent (Xserver)" +.TH nxagent 1 "Aug 2019" "Version 3.5.99.22" "NX Agent (Xserver)" .SH NAME nxagent \- nested Xserver optimized for remote computing .SH SYNOPSIS @@ -142,8 +142,10 @@ disables backing store support on all screens. .TP 8 .B \-br -sets the default root window to solid black instead of the standard root weave -pattern. +sets the default root window to solid black (default). +.TP 8 +.B \-wr +sets the default root window to solid white. .TP 8 .B \-c turns off key-click. @@ -455,6 +457,9 @@ .B \-forcenx force use of NX protocol messages assuming communication through \fBnxproxy\fR .TP 8 +.B \-autograb +enable autograb mode on \fBnxagent\fR startup. The autograb feature can be toggled via nxagent keystrokes +.TP 8 .B \-nxrealwindowprop set property NX_REAL_WINDOW for each X11 client inside \fBnxagent\fR, providing the window XID of the corresponding window object on the X @@ -751,6 +756,10 @@ means that all of these checks are essentially deactivated. This is a very bad idea. .RE +.TP 8 +.B autograb= +enable or disable autograb (default: disabled) +.RE If you want to use \fBnxagent\fR as a replacement for Xnest or Xephyr you can pass options like this: diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Millis.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Millis.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Millis.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Millis.c 2019-12-16 06:31:54.000000000 +0000 @@ -29,19 +29,6 @@ #include "Xos.h" #include "Millis.h" -#ifdef DDXTIME - -CARD32 GetTimeInMillis() -{ - struct timeval ts; - - X_GETTIMEOFDAY(&ts); - - return(ts.tv_sec * 1000) + (ts.tv_usec / 1000); -} - -#endif - const char *GetTimeAsString() { char *value; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Millis.h nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Millis.h --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Millis.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Millis.h 2019-12-16 06:31:54.000000000 +0000 @@ -28,8 +28,6 @@ #include "Xmd.h" -CARD32 GetTimeInMillis(void); - const char *GetTimeInMillisAsString(void); const char *GetTimeAsString(void); diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c 2019-12-16 06:31:54.000000000 +0000 @@ -154,10 +154,10 @@ DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (checkGCDamage (pDrawable, pGC)) - damageText (pDrawable, pGC, x, y, (unsigned long) count, chars, + x = damageText (pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit, TT_POLY8); - - x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars); + else + x = (*pGC->ops->PolyText8)(pDrawable, pGC, x, y, count, chars); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); return x; @@ -174,11 +174,11 @@ DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); if (checkGCDamage (pDrawable, pGC)) - damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, + x = damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, TT_POLY16); - - x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars); + else + x = (*pGC->ops->PolyText16)(pDrawable, pGC, x, y, count, chars); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); return x; @@ -197,8 +197,8 @@ if (checkGCDamage (pDrawable, pGC)) damageText (pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit, TT_IMAGE8); - - (*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars); + else + (*pGC->ops->ImageText8)(pDrawable, pGC, x, y, count, chars); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -217,8 +217,8 @@ damageText (pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, TT_IMAGE16); - - (*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars); + else + (*pGC->ops->ImageText16)(pDrawable, pGC, x, y, count, chars); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c 2019-12-16 06:31:54.000000000 +0000 @@ -141,9 +141,6 @@ void nxagentListRemoteFonts(const char *, int); -unsigned int nxagentWMtimeout = 0; -Bool nxagentWMPassed = False; - /* * Timeouts based on screen saver time. */ @@ -243,8 +240,6 @@ register HWEventQueuePtr* icheck = checkForInput; long start_tick; - unsigned long currentDispatch = 0; - nextFreeClientID = 1; InitSelections(); nClients = 0; @@ -265,12 +260,11 @@ #ifdef NXAGENT_ONSTART /* - * Set NX_WM property (used by NX client to identify - * the agent's window) three seconds since the first - * client connects. + * Set NX_WM property (used by NX client to identify the agent's + * window) three seconds since the first client connects. */ - nxagentWMtimeout = GetTimeInMillis() + 3000; + unsigned int nxagentWMtimeout = GetTimeInMillis() + 3000; #endif @@ -278,9 +272,9 @@ if (!clientReady) return; - #ifdef WATCH + #ifdef WATCH - fprintf(stderr, "Dispatch: Watchpoint 12.\n"); + fprintf(stderr, "Dispatch: Watchpoint 12.\n"); /* Reply Total Cached Bits In Bits Out Bits/Reply Ratio @@ -294,22 +288,22 @@ #98 1 256 bits (0 KB) -> 34 bits (0 KB) -> 256/1 -> 34/1 = 7.529:1 */ - sleep(30); + sleep(30); - #endif + #endif - #ifdef TEST - fprintf(stderr, "Dispatch: Value of dispatchException is [%x].\n", - dispatchException); + #ifdef TEST + fprintf(stderr, "Dispatch: Value of dispatchException is [%x].\n", + dispatchException); - fprintf(stderr, "Dispatch: Value of dispatchExceptionAtReset is [%x].\n", - dispatchExceptionAtReset); - #endif + fprintf(stderr, "Dispatch: Value of dispatchExceptionAtReset is [%x].\n", + dispatchExceptionAtReset); + #endif - if (!(dispatchException & DE_TERMINATE)) - dispatchException = 0; + if (!(dispatchException & DE_TERMINATE)) + dispatchException = 0; - while (!dispatchException) + while (!dispatchException) { if (*icheck[0] != *icheck[1]) { @@ -370,18 +364,15 @@ #ifdef NXAGENT_ONSTART - currentDispatch = GetTimeInMillis(); - - /* - * If the timeout is expired set the - * selection informing the NX client - * that the agent is ready. - */ + /* + * If the timeout is expired set the selection informing the + * NX client that the agent is ready. + */ - if (!nxagentWMPassed && (nxagentWMtimeout < currentDispatch)) - { - nxagentRemoveSplashWindow(NULL); - } + if (nxagentWMtimeout < GetTimeInMillis()) + { + nxagentRemoveSplashWindow(); + } nxagentClients = nClients; @@ -468,12 +459,6 @@ #endif client->sequence++; -#ifdef DEBUG - if ((client->requestLogIndex >= MAX_REQUEST_LOG) || (client->requestLogIndex <= 0)) - client->requestLogIndex = 0; - client->requestLog[client->requestLogIndex] = MAJOROP; - client->requestLogIndex++; -#endif if (result > (maxBigRequestSize << 2)) result = BadLength; else @@ -594,10 +579,7 @@ if (!pWin) return(BadWindow); - if (!nxagentWMPassed) - { - nxagentRemoveSplashWindow(pWin); - } + nxagentRemoveSplashWindow(); pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, DixWriteAccess); @@ -626,7 +608,7 @@ int ProcQueryTree(register ClientPtr client) { - xQueryTreeReply reply; + xQueryTreeReply reply = {0}; int numChildren = 0; register WindowPtr pChild, pWin, pHead; Window *childIDs = (Window *)NULL; @@ -637,7 +619,6 @@ DixReadAccess); if (!pWin) return(BadWindow); - memset(&reply, 0, sizeof(xQueryTreeReply)); reply.type = X_Reply; reply.root = pWin->drawable.pScreen->root->drawable.id; reply.sequenceNumber = client->sequence; @@ -685,113 +666,6 @@ int -ProcSetSelectionOwner(register ClientPtr client) -{ - WindowPtr pWin; - TimeStamp time; - REQUEST(xSetSelectionOwnerReq); - - REQUEST_SIZE_MATCH(xSetSelectionOwnerReq); - UpdateCurrentTime(); - time = ClientTimeToServerTime(stuff->time); - - /* If the client's time stamp is in the future relative to the server's - time stamp, do not set the selection, just return success. */ - if (CompareTimeStamps(time, currentTime) == LATER) - return Success; - if (stuff->window != None) - { - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return(BadWindow); - } - else - pWin = (WindowPtr)None; - if (ValidAtom(stuff->selection)) - { - int i = 0; - - /* - * First, see if the selection is already set... - */ - while ((i < NumCurrentSelections) && - CurrentSelections[i].selection != stuff->selection) - i++; - if (i < NumCurrentSelections) - { - xEvent event = {0}; - - /* If the timestamp in client's request is in the past relative - to the time stamp indicating the last time the owner of the - selection was set, do not set the selection, just return - success. */ - if (CompareTimeStamps(time, CurrentSelections[i].lastTimeChanged) - == EARLIER) - return Success; - if (CurrentSelections[i].client && - (!pWin || (CurrentSelections[i].client != client))) - { - event.u.u.type = SelectionClear; - event.u.selectionClear.time = time.milliseconds; - event.u.selectionClear.window = CurrentSelections[i].window; - event.u.selectionClear.atom = CurrentSelections[i].selection; - (void) TryClientEvents (CurrentSelections[i].client, &event, 1, - NoEventMask, NoEventMask /* CantBeFiltered */, - NullGrab); - } - } - else - { - /* - * It doesn't exist, so add it... - */ - Selection *newsels; - - if (i == 0) - newsels = (Selection *)malloc(sizeof(Selection)); - else - newsels = (Selection *)realloc(CurrentSelections, - (NumCurrentSelections + 1) * sizeof(Selection)); - if (!newsels) - return BadAlloc; - NumCurrentSelections++; - CurrentSelections = newsels; - CurrentSelections[i].selection = stuff->selection; - } - CurrentSelections[i].lastTimeChanged = time; - CurrentSelections[i].window = stuff->window; - CurrentSelections[i].pWin = pWin; - CurrentSelections[i].client = (pWin ? client : NullClient); - if (SelectionCallback) - { - SelectionInfoRec info; - - info.selection = &CurrentSelections[i]; - info.kind= SelectionSetOwner; - CallCallbacks(&SelectionCallback, &info); - } - -#ifdef NXAGENT_CLIPBOARD - if ((CurrentSelections[i].pWin != NULL) && - (nxagentOption(Clipboard) != ClipboardNone) && - ((CurrentSelections[i].selection == XA_PRIMARY) || - (CurrentSelections[i].selection == MakeAtom("CLIPBOARD", 9, 0)))) - { - nxagentSetSelectionOwner(&CurrentSelections[i]); - } -#endif - return (client->noClientException); - } - else - { - client->errorValue = stuff->selection; - return (BadAtom); - } -} - - -int ProcConvertSelection(register ClientPtr client) { Bool paramsOkay; @@ -1309,6 +1183,9 @@ CallCallbacks((&ClientStateCallback), (void *)&clientinfo); } FreeClientResources(client); + /* Disable client ID tracking. This must be done after + * ClientStateCallback. */ + ReleaseClientIds(client); if (client->index < nextFreeClientID) nextFreeClientID = client->index; clients[client->index] = NullClient; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c 2019-12-16 06:31:54.000000000 +0000 @@ -1216,7 +1216,7 @@ if (c->savedName) { memcpy(tmp,c->savedName,c->savedNameLen>255?255:c->savedNameLen); - tmp[c->savedNameLen>255?256:c->savedNameLen]=0; + tmp[c->savedNameLen>255?255:c->savedNameLen]=0; if (nxagentFontLookUp(tmp)) break; else tmp[0]=0; @@ -1225,7 +1225,7 @@ else { memcpy(tmp,name,namelen>255?255:namelen); - tmp[namelen>255?256:namelen]=0; + tmp[namelen>255?255:namelen]=0; if (nxagentFontLookUp(tmp)) break; else tmp[0]=0; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXevents.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXevents.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXevents.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXevents.c 2019-12-16 06:31:54.000000000 +0000 @@ -367,10 +367,8 @@ if (spriteTraceGood >= spriteTraceSize) { spriteTraceSize += 10; - Must_have_memory = TRUE; /* XXX */ - spriteTrace = (WindowPtr *)realloc( + spriteTrace = realloc( spriteTrace, spriteTraceSize*sizeof(WindowPtr)); - Must_have_memory = FALSE; /* XXX */ } spriteTrace[spriteTraceGood++] = pWin; pWin = pWin->firstChild; @@ -381,79 +379,88 @@ return spriteTrace[spriteTraceGood-1]; } -// static Bool -// CheckMotion(xEvent *xE) -// { -// WindowPtr prevSpriteWin = sprite.win; -// +static Bool +CheckMotion(xEvent *xE) +{ + WindowPtr prevSpriteWin = sprite.win; + #ifdef PANORAMIX -// if(!noPanoramiXExtension) -// return XineramaCheckMotion(xE); + if(!noPanoramiXExtension) + return XineramaCheckMotion(xE); #endif -// if (xE && !syncEvents.playingEvents) -// { -// if (sprite.hot.pScreen != sprite.hotPhys.pScreen) -// { -// sprite.hot.pScreen = sprite.hotPhys.pScreen; -// ROOT = sprite.hot.pScreen->root; -// } -// sprite.hot.x = XE_KBPTR.rootX; -// sprite.hot.y = XE_KBPTR.rootY; -// if (sprite.hot.x < sprite.physLimits.x1) -// sprite.hot.x = sprite.physLimits.x1; -// else if (sprite.hot.x >= sprite.physLimits.x2) -// sprite.hot.x = sprite.physLimits.x2 - 1; -// if (sprite.hot.y < sprite.physLimits.y1) -// sprite.hot.y = sprite.physLimits.y1; -// else if (sprite.hot.y >= sprite.physLimits.y2) -// sprite.hot.y = sprite.physLimits.y2 - 1; + if (xE && !syncEvents.playingEvents) + { + if (sprite.hot.pScreen != sprite.hotPhys.pScreen) + { + sprite.hot.pScreen = sprite.hotPhys.pScreen; + ROOT = sprite.hot.pScreen->root; + } + sprite.hot.x = XE_KBPTR.rootX; + sprite.hot.y = XE_KBPTR.rootY; + if (sprite.hot.x < sprite.physLimits.x1) + sprite.hot.x = sprite.physLimits.x1; + else if (sprite.hot.x >= sprite.physLimits.x2) + sprite.hot.x = sprite.physLimits.x2 - 1; + if (sprite.hot.y < sprite.physLimits.y1) + sprite.hot.y = sprite.physLimits.y1; + else if (sprite.hot.y >= sprite.physLimits.y2) + sprite.hot.y = sprite.physLimits.y2 - 1; #ifdef SHAPE -// if (sprite.hotShape) -// ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y); + if (sprite.hotShape) + ConfineToShape(sprite.hotShape, &sprite.hot.x, &sprite.hot.y); +#endif + sprite.hotPhys = sprite.hot; + +#ifdef NXAGENT_SERVER + /* + * This code force cursor position to be inside the + * root window of the agent. We can't view a reason + * to do this and it interacts in an undesirable way + * with toggling fullscreen. + * + * if ((sprite.hotPhys.x != XE_KBPTR.rootX) || + * (sprite.hotPhys.y != XE_KBPTR.rootY)) + * { + * (*sprite.hotPhys.pScreen->SetCursorPosition)( + * sprite.hotPhys.pScreen, + * sprite.hotPhys.x, sprite.hotPhys.y, FALSE); + * } + */ +#else + if ((sprite.hotPhys.x != XE_KBPTR.rootX) || + (sprite.hotPhys.y != XE_KBPTR.rootY)) + { + (*sprite.hotPhys.pScreen->SetCursorPosition)( + sprite.hotPhys.pScreen, + sprite.hotPhys.x, sprite.hotPhys.y, FALSE); + } #endif -// sprite.hotPhys = sprite.hot; -// -// /* -// * This code force cursor position to be inside the -// * root window of the agent. We can't view a reason -// * to do this and it interacts in an undesirable way -// * with toggling fullscreen. -// * -// * if ((sprite.hotPhys.x != XE_KBPTR.rootX) || -// * (sprite.hotPhys.y != XE_KBPTR.rootY)) -// * { -// * (*sprite.hotPhys.pScreen->SetCursorPosition)( -// * sprite.hotPhys.pScreen, -// * sprite.hotPhys.x, sprite.hotPhys.y, FALSE); -// * } -// */ -// -// XE_KBPTR.rootX = sprite.hot.x; -// XE_KBPTR.rootY = sprite.hot.y; -// } -// -// sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y); + XE_KBPTR.rootX = sprite.hot.x; + XE_KBPTR.rootY = sprite.hot.y; + } + + sprite.win = XYToWindow(sprite.hot.x, sprite.hot.y); #ifdef notyet -// if (!(sprite.win->deliverableEvents & -// Motion_Filter(inputInfo.pointer->button)) -// !syncEvents.playingEvents) -// { -// /* XXX Do PointerNonInterestBox here */ -// } + if (!(sprite.win->deliverableEvents & + Motion_Filter(inputInfo.pointer->button)) + !syncEvents.playingEvents) + { + /* XXX Do PointerNonInterestBox here */ + } #endif -// if (sprite.win != prevSpriteWin) -// { -// if (prevSpriteWin != NullWindow) { -// if (!xE) -// UpdateCurrentTimeIf(); -// DoEnterLeaveEvents(prevSpriteWin, sprite.win, NotifyNormal); -// } -// PostNewCursor(); -// return FALSE; -// } -// return TRUE; -// } + if (sprite.win != prevSpriteWin) + { + if (prevSpriteWin != NullWindow) { + if (!xE) + UpdateCurrentTimeIf(); + DoEnterLeaveEvents(prevSpriteWin, sprite.win, NotifyNormal); + } + PostNewCursor(); + return FALSE; + } + return TRUE; +} void DefineInitialRootWindow(register WindowPtr win) diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c 2019-12-16 06:31:54.000000000 +0000 @@ -59,6 +59,67 @@ #endif +GlyphRefPtr +FindGlyphRef (GlyphHashPtr hash, CARD32 signature, Bool match, GlyphPtr compare) +{ + CARD32 elt, step, s; + GlyphPtr glyph; + GlyphRefPtr table, gr, del; + CARD32 tableSize = hash->hashSet->size; + + table = hash->table; + elt = signature % tableSize; + step = 0; + del = 0; + for (;;) + { + gr = &table[elt]; + s = gr->signature; + glyph = gr->glyph; + if (!glyph) + { + if (del) + gr = del; + break; + } + if (glyph == DeletedGlyph) + { + if (!del) + del = gr; + else if (gr == del) + break; + } +#ifdef NXAGENT_SERVER + else if (s == signature && match && glyph->size != compare->size) + { + /* + * if the glyphsize is different there's no need to do a memcmp + * because it will surely report difference. And even worse: + * it will read beyond the end of glyph under some + * circumstances, which can be detected when compiling with + * -fsanitize=address. + */ + } +#endif + else if (s == signature && + (!match || + memcmp (&compare->info, &glyph->info, compare->size) == 0)) + { + break; + } + if (!step) + { + step = signature % hash->hashSet->rehash; + if (!step) + step = 1; + } + elt += step; + if (elt >= tableSize) + elt -= tableSize; + } + return gr; +} + void AddGlyph (GlyphSetPtr glyphSet, GlyphPtr glyph, Glyph id) { @@ -138,12 +199,6 @@ int oldSize; CARD32 s; - #ifdef NXAGENT_SERVER - - CARD32 c; - - #endif - tableEntries = hash->tableEntries + change; hashSet = FindGlyphHashSet (tableEntries); if (hashSet == hash->hashSet) @@ -164,7 +219,7 @@ #ifdef NXAGENT_SERVER - c = hash->table[i].corruptedGlyph; + CARD32 c = hash->table[i].corruptedGlyph; #endif diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,747 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXAGENT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ -/***************************************************************** - -Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Digital Equipment Corporation -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from Digital -Equipment Corporation. - -******************************************************************/ - - -#include "Windows.h" - -#include "../../mi/miexpose.c" - -/* miHandleExposures - generate a region for exposures for areas that were copied from obscured or -non-existent areas to non-obscured areas of the destination. Paint the -background for the region, if the destination is a window. - -NOTE: - this should generally be called, even if graphicsExposures is false, -because this is where bits get recovered from backing store. - -NOTE: - added argument 'plane' is used to indicate how exposures from backing -store should be accomplished. If plane is 0 (i.e. no bit plane), CopyArea -should be used, else a CopyPlane of the indicated plane will be used. The -exposing is done by the backing store's GraphicsExpose function, of course. - -*/ - -RegionPtr -miHandleExposures(pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, plane) - register DrawablePtr pSrcDrawable; - register DrawablePtr pDstDrawable; - GCPtr pGC; - int srcx, srcy; - int width, height; - int dstx, dsty; - unsigned long plane; -{ - register ScreenPtr pscr; - RegionPtr prgnSrcClip; /* drawable-relative source clip */ - RegionRec rgnSrcRec; - RegionPtr prgnDstClip; /* drawable-relative dest clip */ - RegionRec rgnDstRec; - BoxRec srcBox; /* unclipped source */ - RegionRec rgnExposed; /* exposed region, calculated source- - relative, made dst relative to - intersect with visible parts of - dest and send events to client, - and then screen relative to paint - the window background - */ - WindowPtr pSrcWin; - BoxRec expBox; - Bool extents; - - /* - * Set the elements reported by the compiler - * as uninitialized. - */ - - expBox.x1 = 0; - expBox.y1 = 0; - expBox.x2 = 0; - expBox.y2 = 0; - - /* This prevents warning about pscr not being used. */ - pGC->pScreen = pscr = pGC->pScreen; - - /* avoid work if we can */ - if (!pGC->graphicsExposures && - (pDstDrawable->type == DRAWABLE_PIXMAP) && - ((pSrcDrawable->type == DRAWABLE_PIXMAP) || - (((WindowPtr)pSrcDrawable)->backStorage == NULL))) - return NULL; - - srcBox.x1 = srcx; - srcBox.y1 = srcy; - srcBox.x2 = srcx+width; - srcBox.y2 = srcy+height; - - if (pSrcDrawable->type != DRAWABLE_PIXMAP) - { - BoxRec TsrcBox; - - TsrcBox.x1 = srcx + pSrcDrawable->x; - TsrcBox.y1 = srcy + pSrcDrawable->y; - TsrcBox.x2 = TsrcBox.x1 + width; - TsrcBox.y2 = TsrcBox.y1 + height; - pSrcWin = (WindowPtr) pSrcDrawable; - if (pGC->subWindowMode == IncludeInferiors) - { - prgnSrcClip = NotClippedByChildren (pSrcWin); - if ((RegionContainsRect(prgnSrcClip, &TsrcBox)) == rgnIN) - { - RegionDestroy(prgnSrcClip); - return NULL; - } - } - else - { - if ((RegionContainsRect(&pSrcWin->clipList, &TsrcBox)) == rgnIN) - return NULL; - prgnSrcClip = &rgnSrcRec; - RegionNull(prgnSrcClip); - RegionCopy(prgnSrcClip, &pSrcWin->clipList); - } - RegionTranslate(prgnSrcClip, - -pSrcDrawable->x, -pSrcDrawable->y); - } - else - { - BoxRec box; - - if ((srcBox.x1 >= 0) && (srcBox.y1 >= 0) && - (srcBox.x2 <= pSrcDrawable->width) && - (srcBox.y2 <= pSrcDrawable->height)) - return NULL; - - box.x1 = 0; - box.y1 = 0; - box.x2 = pSrcDrawable->width; - box.y2 = pSrcDrawable->height; - prgnSrcClip = &rgnSrcRec; - RegionInit(prgnSrcClip, &box, 1); - pSrcWin = (WindowPtr)NULL; - } - - if (pDstDrawable == pSrcDrawable) - { - prgnDstClip = prgnSrcClip; - } - else if (pDstDrawable->type != DRAWABLE_PIXMAP) - { - if (pGC->subWindowMode == IncludeInferiors) - { - prgnDstClip = NotClippedByChildren((WindowPtr)pDstDrawable); - } - else - { - prgnDstClip = &rgnDstRec; - RegionNull(prgnDstClip); - RegionCopy(prgnDstClip, - &((WindowPtr)pDstDrawable)->clipList); - } - RegionTranslate(prgnDstClip, - -pDstDrawable->x, -pDstDrawable->y); - } - else - { - BoxRec box; - - box.x1 = 0; - box.y1 = 0; - box.x2 = pDstDrawable->width; - box.y2 = pDstDrawable->height; - prgnDstClip = &rgnDstRec; - RegionInit(prgnDstClip, &box, 1); - } - - /* drawable-relative source region */ - RegionInit(&rgnExposed, &srcBox, 1); - - /* now get the hidden parts of the source box*/ - RegionSubtract(&rgnExposed, &rgnExposed, prgnSrcClip); - - if (pSrcWin && pSrcWin->backStorage) - { - /* - * Copy any areas from the source backing store. Modifies - * rgnExposed. - */ - (* pSrcWin->drawable.pScreen->ExposeCopy) ((WindowPtr)pSrcDrawable, - pDstDrawable, - pGC, - &rgnExposed, - srcx, srcy, - dstx, dsty, - plane); - } - - /* move them over the destination */ - RegionTranslate(&rgnExposed, dstx-srcx, dsty-srcy); - - /* intersect with visible areas of dest */ - RegionIntersect(&rgnExposed, &rgnExposed, prgnDstClip); - - /* - * If we have LOTS of rectangles, we decide to take the extents - * and force an exposure on that. This should require much less - * work overall, on both client and server. This is cheating, but - * isn't prohibited by the protocol ("spontaneous combustion" :-) - * for windows. - */ - extents = pGC->graphicsExposures && - (RegionNumRects(&rgnExposed) > RECTLIMIT) && - (pDstDrawable->type != DRAWABLE_PIXMAP); -#ifdef SHAPE - if (pSrcWin) - { - RegionPtr region; - if (!(region = wClipShape (pSrcWin))) - region = wBoundingShape (pSrcWin); - /* - * If you try to CopyArea the extents of a shaped window, compacting the - * exposed region will undo all our work! - */ - if (extents && pSrcWin && region && - (RegionContainsRect(region, &srcBox) != rgnIN)) - extents = FALSE; - } -#endif - if (extents) - { - WindowPtr pWin = (WindowPtr)pDstDrawable; - - expBox = *RegionExtents(&rgnExposed); - RegionReset(&rgnExposed, &expBox); - /* need to clear out new areas of backing store */ - if (pWin->backStorage) - (void) (* pWin->drawable.pScreen->ClearBackingStore)( - pWin, - expBox.x1, - expBox.y1, - expBox.x2 - expBox.x1, - expBox.y2 - expBox.y1, - FALSE); - } - if ((pDstDrawable->type != DRAWABLE_PIXMAP) && - (((WindowPtr)pDstDrawable)->backgroundState != None)) - { - WindowPtr pWin = (WindowPtr)pDstDrawable; - - /* make the exposed area screen-relative */ - RegionTranslate(&rgnExposed, - pDstDrawable->x, pDstDrawable->y); - - if (extents) - { - /* PaintWindowBackground doesn't clip, so we have to */ - RegionIntersect(&rgnExposed, &rgnExposed, &pWin->clipList); - } - (*pWin->drawable.pScreen->PaintWindowBackground)( - (WindowPtr)pDstDrawable, &rgnExposed, PW_BACKGROUND); - - if (extents) - { - RegionReset(&rgnExposed, &expBox); - } - else - RegionTranslate(&rgnExposed, - -pDstDrawable->x, -pDstDrawable->y); - } - if (prgnDstClip == &rgnDstRec) - { - RegionUninit(prgnDstClip); - } - else if (prgnDstClip != prgnSrcClip) - { - RegionDestroy(prgnDstClip); - } - - if (prgnSrcClip == &rgnSrcRec) - { - RegionUninit(prgnSrcClip); - } - else - { - RegionDestroy(prgnSrcClip); - } - - if (pGC->graphicsExposures) - { - /* don't look */ - RegionPtr exposed = RegionCreate(NullBox, 0); - *exposed = rgnExposed; - return exposed; - } - else - { - RegionUninit(&rgnExposed); - return NULL; - } -} - -void -miWindowExposures(pWin, prgn, other_exposed) - WindowPtr pWin; - register RegionPtr prgn, other_exposed; -{ - - int total; - - RegionPtr exposures = prgn; - if (pWin->backStorage && prgn) - /* - * in some cases, backing store will cause a different - * region to be exposed than needs to be repainted - * (like when a window is mapped). RestoreAreas is - * allowed to return a region other than prgn, - * in which case this routine will free the resultant - * region. If exposures is null, then no events will - * be sent to the client; if prgn is empty - * no areas will be repainted. - */ - exposures = (*pWin->drawable.pScreen->RestoreAreas)(pWin, prgn); - if ((prgn && !RegionNil(prgn)) || - (exposures && !RegionNil(exposures)) || other_exposed) - { - RegionRec expRec; - int clientInterested; - - /* - * Restore from backing-store FIRST. - */ - clientInterested = (pWin->eventMask|wOtherEventMasks(pWin)) & ExposureMask; - if (other_exposed) - { - if (exposures) - { - RegionUnion(other_exposed, - exposures, - other_exposed); - if (exposures != prgn) - RegionDestroy(exposures); - } - exposures = other_exposed; - } - - /* - * If the number of rectangles is greater - * than 4, let the function decide. - */ - - total = RegionNumRects(exposures); - - if (clientInterested && exposures && (total > RECTLIMIT || - (total > 4 && nxagentExtentsPredicate(total) == 1))) - { - /* - * If we have LOTS of rectangles, we decide to take the extents - * and force an exposure on that. This should require much less - * work overall, on both client and server. This is cheating, but - * isn't prohibited by the protocol ("spontaneous combustion" :-). - */ - BoxRec box; - - box = *RegionExtents(exposures); - if (exposures == prgn) { - exposures = &expRec; - RegionInit(exposures, &box, 1); - RegionReset(prgn, &box); - } else { - RegionReset(exposures, &box); - RegionUnion(prgn, prgn, exposures); - } - /* PaintWindowBackground doesn't clip, so we have to */ - RegionIntersect(prgn, prgn, &pWin->clipList); - /* need to clear out new areas of backing store, too */ - if (pWin->backStorage) - (void) (* pWin->drawable.pScreen->ClearBackingStore)( - pWin, - box.x1 - pWin->drawable.x, - box.y1 - pWin->drawable.y, - box.x2 - box.x1, - box.y2 - box.y1, - FALSE); - } - if (prgn && !RegionNil(prgn)) - (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, PW_BACKGROUND); - if (clientInterested && exposures && !RegionNil(exposures)) - miSendExposures(pWin, exposures, - pWin->drawable.x, pWin->drawable.y); - if (exposures == &expRec) - { - RegionUninit(exposures); - } - else if (exposures && exposures != prgn && exposures != other_exposed) - RegionDestroy(exposures); - if (prgn) - RegionEmpty(prgn); - } - else if (exposures && exposures != prgn) - RegionDestroy(exposures); -} - -void -miPaintWindow(pWin, prgn, what) -register WindowPtr pWin; -RegionPtr prgn; -int what; -{ - int status; - - Bool usingScratchGC = FALSE; - WindowPtr pRoot; - -#define FUNCTION 0 -#define FOREGROUND 1 -#define TILE 2 -#define FILLSTYLE 3 -#define ABSX 4 -#define ABSY 5 -#define CLIPMASK 6 -#define SUBWINDOW 7 -#define COUNT_BITS 8 - - ChangeGCVal gcval[7]; - ChangeGCVal newValues [COUNT_BITS] = {{ 0 }}; - - BITS32 gcmask, index, mask; - RegionRec prgnWin; - DDXPointRec oldCorner; - BoxRec box = {0}; - WindowPtr pBgWin; - GCPtr pGC; - register int i; - register BoxPtr pbox; - register ScreenPtr pScreen = pWin->drawable.pScreen; - register xRectangle *prect; - int numRects; - - /* - * Set the elements reported by the compiler - * as uninitialized. - */ - - prgnWin.extents.x1 = 0; - prgnWin.extents.y1 = 0; - prgnWin.extents.x2 = 0; - prgnWin.extents.y2 = 0; - - prgnWin.data = NULL; - - oldCorner.x = 0; - oldCorner.y = 0; - - gcmask = 0; - - if (what == PW_BACKGROUND) - { - switch (pWin->backgroundState) { - case None: - return; - case ParentRelative: - (*pWin->parent->drawable.pScreen->PaintWindowBackground)(pWin->parent, prgn, what); - return; - case BackgroundPixel: - newValues[FOREGROUND].val = pWin->background.pixel; - newValues[FILLSTYLE].val = FillSolid; - gcmask |= GCForeground | GCFillStyle; - break; - case BackgroundPixmap: - newValues[TILE].ptr = (void *)pWin->background.pixmap; - newValues[FILLSTYLE].val = FillTiled; - gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin; - break; - } - } - else - { - if (pWin->borderIsPixel) - { - newValues[FOREGROUND].val = pWin->border.pixel; - newValues[FILLSTYLE].val = FillSolid; - gcmask |= GCForeground | GCFillStyle; - } - else - { - newValues[TILE].ptr = (void *)pWin->border.pixmap; - newValues[FILLSTYLE].val = FillTiled; - gcmask |= GCTile | GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin; - } - } - - prect = (xRectangle *)calloc(RegionNumRects(prgn), sizeof(xRectangle)); - if (!prect) - return; - - newValues[FUNCTION].val = GXcopy; - gcmask |= GCFunction | GCClipMask; - - i = pScreen->myNum; - pRoot = screenInfo.screens[i]->root; - - pBgWin = pWin; - if (what == PW_BORDER) - { - while (pBgWin->backgroundState == ParentRelative) - pBgWin = pBgWin->parent; - } - - if ((pWin->drawable.depth != pRoot->drawable.depth) || - (pWin->drawable.bitsPerPixel != pRoot->drawable.bitsPerPixel)) - { - usingScratchGC = TRUE; - pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); - if (!pGC) - { - free(prect); - return; - } - /* - * mash the clip list so we can paint the border by - * mangling the window in place, pretending it - * spans the entire screen - */ - if (what == PW_BORDER) - { - prgnWin = pWin->clipList; - oldCorner.x = pWin->drawable.x; - oldCorner.y = pWin->drawable.y; - pWin->drawable.x = pWin->drawable.y = 0; - box.x1 = 0; - box.y1 = 0; - box.x2 = pScreen->width; - box.y2 = pScreen->height; - RegionInit(&pWin->clipList, &box, 1); - pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; - newValues[ABSX].val = pBgWin->drawable.x; - newValues[ABSY].val = pBgWin->drawable.y; - } - else - { - newValues[ABSX].val = 0; - newValues[ABSY].val = 0; - } - } else { - /* - * draw the background to the root window - */ - if (screenContext[i] == (GCPtr)NULL) - { - if (!ResType && !(ResType = CreateNewResourceType(tossGC))) - return; - screenContext[i] = CreateGC((DrawablePtr)pWin, (BITS32) 0, - (XID *)NULL, &status); - if (!screenContext[i]) { - free(prect); - return; - } - numGCs++; - if (!AddResource(FakeClientID(0), ResType, - (void *)screenContext[i])) - { - free(prect); - return; - } - } - pGC = screenContext[i]; - newValues[SUBWINDOW].val = IncludeInferiors; - newValues[ABSX].val = pBgWin->drawable.x; - newValues[ABSY].val = pBgWin->drawable.y; - gcmask |= GCSubwindowMode; - pWin = pRoot; - } - - if (pWin->backStorage) - (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack); - - mask = gcmask; - gcmask = 0; - i = 0; - while (mask) { - index = lowbit (mask); - mask &= ~index; - switch (index) { - case GCFunction: - if (pGC->alu != newValues[FUNCTION].val) { - gcmask |= index; - gcval[i++].val = newValues[FUNCTION].val; - } - break; - case GCTileStipXOrigin: - if ( pGC->patOrg.x != newValues[ABSX].val) { - gcmask |= index; - gcval[i++].val = newValues[ABSX].val; - } - break; - case GCTileStipYOrigin: - if ( pGC->patOrg.y != newValues[ABSY].val) { - gcmask |= index; - gcval[i++].val = newValues[ABSY].val; - } - break; - case GCClipMask: - if ( pGC->clientClipType != CT_NONE) { - gcmask |= index; - gcval[i++].val = CT_NONE; - } - break; - case GCSubwindowMode: - if ( pGC->subWindowMode != newValues[SUBWINDOW].val) { - gcmask |= index; - gcval[i++].val = newValues[SUBWINDOW].val; - } - break; - case GCTile: - if (pGC->tileIsPixel || pGC->tile.pixmap != newValues[TILE].ptr) - { - gcmask |= index; - gcval[i++].ptr = newValues[TILE].ptr; - } - break; - case GCFillStyle: - if ( pGC->fillStyle != newValues[FILLSTYLE].val) { - gcmask |= index; - gcval[i++].val = newValues[FILLSTYLE].val; - } - break; - case GCForeground: - if ( pGC->fgPixel != newValues[FOREGROUND].val) { - gcmask |= index; - gcval[i++].val = newValues[FOREGROUND].val; - } - break; - } - } - - if (gcmask) - dixChangeGC(NullClient, pGC, gcmask, NULL, gcval); - - if (pWin->drawable.serialNumber != pGC->serialNumber) - ValidateGC((DrawablePtr)pWin, pGC); - - numRects = RegionNumRects(prgn); - pbox = RegionRects(prgn); - for (i= numRects; --i >= 0; pbox++, prect++) - { - prect->x = pbox->x1 - pWin->drawable.x; - prect->y = pbox->y1 - pWin->drawable.y; - prect->width = pbox->x2 - pbox->x1; - prect->height = pbox->y2 - pbox->y1; - } - prect -= numRects; - (*pGC->ops->PolyFillRect)((DrawablePtr)pWin, pGC, numRects, prect); - free(prect); - - if (pWin->backStorage) - (*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeNothing); - - if (usingScratchGC) - { - if (what == PW_BORDER) - { - RegionUninit(&pWin->clipList); - pWin->clipList = prgnWin; - pWin->drawable.x = oldCorner.x; - pWin->drawable.y = oldCorner.y; - pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; - } - FreeScratchGC(pGC); - } -} diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c 2019-12-16 06:31:54.000000000 +0000 @@ -303,33 +303,25 @@ static PicturePtr createSourcePicture(void) { - PicturePtr pPicture; - extern int nxagentPicturePrivateIndex; - unsigned int totalPictureSize; - - DevUnion *ppriv; - - char *privPictureRecAddr; - - int i; - /* * Compute size of entire PictureRect, plus privates. */ - totalPictureSize = sizeof(PictureRec) + + unsigned int totalPictureSize = sizeof(PictureRec) + picturePrivateCount * sizeof(DevUnion) + sizeof(nxagentPrivPictureRec); - pPicture = (PicturePtr) calloc(1, totalPictureSize); + PicturePtr pPicture = (PicturePtr) calloc(1, totalPictureSize); + if (!pPicture) + return 0; if (pPicture != NULL) { - ppriv = (DevUnion *) (pPicture + 1); + DevUnion *ppriv = (DevUnion *) (pPicture + 1); - for (i = 0; i < picturePrivateCount; ++i) + for (int i = 0; i < picturePrivateCount; ++i) { /* * Other privates are inaccessible. @@ -338,7 +330,7 @@ ppriv[i].ptr = NULL; } - privPictureRecAddr = (char *) &ppriv[picturePrivateCount]; + char *privPictureRecAddr = (char *) &ppriv[picturePrivateCount]; ppriv[nxagentPicturePrivateIndex].ptr = (void *) privPictureRecAddr; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXrender.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXrender.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXrender.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXrender.c 2019-12-16 06:31:54.000000000 +0000 @@ -1004,7 +1004,11 @@ elementsBase = malloc(nlist * sizeof(XGlyphElt8)); if (!elementsBase) - return BadAlloc; + { + free(glyphsBase); + free(listsBase); + return BadAlloc; + } buffer = (CARD8 *) (stuff + 1); glyphs = glyphsBase; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXshm.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXshm.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXshm.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXshm.c 2019-12-16 06:31:54.000000000 +0000 @@ -387,8 +387,8 @@ ((stuff->format != ZPixmap) && (stuff->srcX < screenInfo.bitmapScanlinePad) && ((stuff->format == XYBitmap) || - - ((stuff->srcY == 0) && - - (stuff->srcHeight == stuff->totalHeight))))) && + ((stuff->srcY == 0) && + (stuff->srcHeight == stuff->totalHeight))))) && ((stuff->srcX + stuff->srcWidth) == stuff->totalWidth)) (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY, @@ -396,7 +396,7 @@ stuff->srcX, stuff->format, shmdesc->addr + stuff->offset + (stuff->srcY * length)); -- else + else #endif { #ifdef TEST diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c 2019-12-16 06:31:54.000000000 +0000 @@ -114,10 +114,6 @@ #include "Drawable.h" #include "Colormap.h" -/* prototypes (only MakeRootTile() required here) */ - -static void MakeRootTile(WindowPtr pWin); - #include "../../dix/window.c" extern Bool nxagentWMIsRunning; @@ -132,69 +128,8 @@ #undef TEST #undef DEBUG -WindowPtr nxagentRootTileWindow; - extern void nxagentSetVersionProperty(WindowPtr pWin); -void nxagentClearSplash(WindowPtr pW) -{ - ScreenPtr pScreen = pW->drawable.pScreen; - - if (pW->backgroundState == BackgroundPixmap) - { - (*pScreen->DestroyPixmap)(pW->background.pixmap); - } - - pW->backgroundState = BackgroundPixel; - pW->background.pixel = nxagentLogoBlack; - - (*pScreen->ChangeWindowAttributes)(pW, CWBackPixmap|CWBackPixel); -} - -static void -MakeRootTile(WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - GCPtr pGC; - unsigned char back[128]; - int len = BitmapBytePad(sizeof(long)); - register unsigned char *from, *to; - register int i, j; - - pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4, - pScreen->rootDepth, 0); - - pWin->backgroundState = BackgroundPixmap; - pGC = GetScratchGC(pScreen->rootDepth, pScreen); - if (!pWin->background.pixmap || !pGC) - FatalError("could not create root tile"); - - { - CARD32 attributes[2]; - - attributes[0] = pScreen->whitePixel; - attributes[1] = pScreen->blackPixel; - - (void)ChangeGC(pGC, GCForeground | GCBackground, attributes); - } - - ValidateGC((DrawablePtr)pWin->background.pixmap, pGC); - - from = (screenInfo.bitmapBitOrder == LSBFirst) ? _back_lsb : _back_msb; - to = back; - - for (i = 4; i > 0; i--, from++) - for (j = len; j > 0; j--) - *to++ = *from; - - (*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap, pGC, 1, - 0, 0, len, 4, 0, XYBitmap, (char *)back); - - FreeScratchGC(pGC); - - nxagentRootTileWindow = pWin; -} - void InitRootWindow(WindowPtr pWin) { @@ -249,28 +184,12 @@ pWin->optional->cursor = rootCursor; rootCursor->refcnt++; -#ifdef NXAGENT_SPLASH if (blackRoot) pWin->background.pixel = pScreen->blackPixel; else pWin->background.pixel = pScreen->whitePixel; backFlag |= CWBackPixel; - MakeRootTile(pWin); -#else - if (!blackRoot && !whiteRoot) { - MakeRootTile(pWin); - backFlag |= CWBackPixmap; - } - else { - if (blackRoot) - pWin->background.pixel = pScreen->blackPixel; - else - pWin->background.pixel = pScreen->whitePixel; - backFlag |= CWBackPixel; - } -#endif - pWin->backingStore = defaultBackingStore; pWin->forcedBS = (defaultBackingStore != NotUseful); @@ -296,7 +215,7 @@ #ifdef NXAGENT_ARTSD { char artsd_port[10]; - int nPort; + short int nPort; extern void nxagentPropagateArtsdProperties(ScreenPtr pScreen, char *port); nPort = atoi(display) + 7000; sprintf(artsd_port,"%d", nPort); @@ -1021,8 +940,6 @@ if (on == SCREEN_SAVER_FORCER) { - UpdateCurrentTimeIf(); - lastDeviceEventTime = currentTime; if (mode == ScreenSaverReset) what = SCREEN_SAVER_OFF; else diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Options.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Options.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Options.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Options.c 2019-12-16 06:31:54.000000000 +0000 @@ -172,6 +172,8 @@ nxagentOptions.ReconnectTolerance = DEFAULT_TOLERANCE; nxagentOptions.KeycodeConversion = DEFAULT_KEYCODE_CONVERSION; + + nxagentOptions.AutoGrab = False; } /* diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Options.h nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Options.h --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Options.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Options.h 2019-12-16 06:31:54.000000000 +0000 @@ -365,7 +365,7 @@ int DeferLevel; /* - * Maxuimum elapsed time before a new full + * Maximum elapsed time before a new full * synchronization. */ @@ -450,6 +450,13 @@ * Convert evdev keycodes to pc105. */ KeycodeConversionMode KeycodeConversion; + + /* + * True if agent should grab the input in windowed mode whenever the + * agent window gets the focus + */ + int AutoGrab; /* Should be Bool but I do not want to include Xlib.h here */ + } AgentOptionsRec; typedef AgentOptionsRec *AgentOptionsPtr; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c 2019-12-16 06:31:54.000000000 +0000 @@ -49,6 +49,7 @@ #include "Events.h" #include "Holder.h" #include "Args.h" +#include "Utils.h" #include "compext/Compext.h" #include @@ -501,7 +502,7 @@ FreeResource(pPixmapPriv -> mid, RT_NONE); } - free(pPixmap); + SAFE_free(pPixmap); return True; } @@ -700,7 +701,6 @@ PixmapPtr nxagentPixmapPtr(Pixmap pixmap) { - int i; struct nxagentPixmapPair pair; if (pixmap == None) @@ -714,7 +714,7 @@ FindClientResourcesByType(clients[serverClient -> index], RT_NX_PIXMAP, nxagentPixmapMatchID, &pair); - for (i = 0; (pair.pMap == NULL) && (i < MAXCLIENTS); i++) + for (int i = 0; (pair.pMap == NULL) && (i < MAXCLIENTS); i++) { if (clients[i]) { @@ -790,8 +790,8 @@ Bool nxagentDisconnectAllPixmaps(void) { - int r = 1; int i; + int r = 1; #ifdef TEST fprintf(stderr, "nxagentDisconnectAllPixmaps: Going to iterate through pixmap resources.\n"); @@ -958,8 +958,6 @@ { Bool result = 1; - int i; - #ifdef TEST fprintf(stderr, "nxagentReconnectAllPixmaps: Going to recreate all pixmaps.\n"); #endif @@ -991,7 +989,7 @@ #endif - for (i = 0, result = 1; i < MAXCLIENTS; result = 1, i++) + for (int i = 0, result = 1; i < MAXCLIENTS; result = 1, i++) { if (clients[i] != NULL) { @@ -1095,7 +1093,7 @@ { FatalError("XGetImage: Failed.\n"); - free(data); + SAFE_free(data); return False; } @@ -1138,10 +1136,9 @@ if (!integrity) { - int i; char *p, *q; - for (i = 0, p = image -> data, q = data; i < length; i++) + for (int i = 0, p = image -> data, q = data; i < length; i++) { if (p[i] != q[i]) { @@ -1172,7 +1169,7 @@ XDestroyImage(image); } - free(data); + SAFE_free(data); } else { @@ -1187,7 +1184,6 @@ Bool nxagentCheckAllPixmapIntegrity(void) { - int i; Bool imageIsGood = True; #ifdef TEST @@ -1197,7 +1193,7 @@ FindClientResourcesByType(clients[serverClient -> index], RT_NX_PIXMAP, nxagentCheckOnePixmapIntegrity, &imageIsGood); - for (i = 0; (i < MAXCLIENTS) && (imageIsGood); i++) + for (int i = 0; (i < MAXCLIENTS) && (imageIsGood); i++) { if (clients[i]) { @@ -1270,7 +1266,7 @@ nxagentPutImage(pDrawable, pGC, depth, xPict, yPict, width, height, 0, format, data); - free(data); + SAFE_free(data); } #ifdef WARNING else @@ -1355,7 +1351,7 @@ /* FIXME: If the pixmap has a different depth from the window, the - XPutImage returns a BadMatch. For example this may happens if + XPutImage returns a BadMatch. For example this may happen if the Render extension is enabled. Can we fix this creating a new pixmap? */ @@ -1372,7 +1368,7 @@ /* * If the framebuffer is updated continuously, the nxagent - * visualization become too much slow. + * visualization becomes much too slow. */ if ((GetTimeInMillis() - showTime) < 500) @@ -1418,7 +1414,7 @@ fprintf(stderr, "nxagentPixmapOnShadowDisplay: XCreateImage failed.\n"); #endif - free(data); + SAFE_free(data); return False; } @@ -1577,7 +1573,7 @@ fprintf(stderr, "nxagentFbOnShadowDisplay: XCreateImage failed.\n"); #endif - free(data); + SAFE_free(data); return False; } @@ -1630,11 +1626,10 @@ void nxagentPrintResources(void) { Bool result; - int i; nxagentPrintResourceTypes(); - for (i = 0; i < MAXCLIENTS; i++) + for (int i = 0; i < MAXCLIENTS; i++) { if (clients[i]) { diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Pointer.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Pointer.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Pointer.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Pointer.c 2019-12-16 06:31:54.000000000 +0000 @@ -40,7 +40,7 @@ #include "X.h" #include "Xproto.h" #include "screenint.h" -#include "input.h" +#include "inputstr.h" #include "misc.h" #include "scrnintstr.h" #include "servermd.h" @@ -162,7 +162,6 @@ break; case DEVICE_CLOSE: - #ifdef TEST fprintf(stderr, "nxagentPointerProc: Called for [DEVICE_CLOSE].\n"); #endif diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c 2019-12-16 06:31:54.000000000 +0000 @@ -53,6 +53,7 @@ #include "Splash.h" #include "Error.h" #include "Keystroke.h" +#include "Utils.h" #ifdef XKB #include "XKBsrv.h" @@ -134,7 +135,7 @@ /* * Path of state File */ -char stateFile[PATH_MAX]; +char stateFile[PATH_MAX] = {0}; void setStatePath(char* path) @@ -448,8 +449,7 @@ return 0; } - free(nxagentKeyboard); - nxagentKeyboard = NULL; + SAFE_free(nxagentKeyboard); } nxagentSaveOptions(); @@ -464,7 +464,7 @@ fprintf(stderr, "nxagentReconnect: changing nxagentKeyboard from [null/null] to [clone].\n"); #endif - free(nxagentKeyboard); + SAFE_free(nxagentKeyboard); nxagentKeyboard = strdup("clone"); } @@ -635,8 +635,7 @@ nxagentXkbState.Initialized = 0; - free(nxagentOldKeyboard); - nxagentOldKeyboard = NULL; + SAFE_free(nxagentOldKeyboard); nxagentInitPointerMap(); @@ -681,7 +680,7 @@ #endif saveAgentState("RUNNING"); - nxagentRemoveSplashWindow(NULL); + nxagentRemoveSplashWindow(); /* * We let the proxy flush the link on our behalf @@ -760,8 +759,7 @@ nxagentDisconnectDisplay(); } - free(nxagentOldKeyboard); - nxagentOldKeyboard = NULL; + SAFE_free(nxagentOldKeyboard); return 0; } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Render.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Render.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Render.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Render.c 2019-12-16 06:31:54.000000000 +0000 @@ -45,6 +45,7 @@ #include "Drawable.h" #include "Trap.h" #include "Args.h" +#include "Utils.h" #define Atom XlibAtom #define Pixmap XlibPixmap @@ -2528,7 +2529,7 @@ if (normalizedImages != images) { - free(normalizedImages); + SAFE_free(normalizedImages); } #ifdef DEBUG @@ -2636,7 +2637,7 @@ nparams); #endif - free(szFilter); + SAFE_free(szFilter); } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Rootless.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Rootless.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Rootless.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Rootless.c 2019-12-16 06:31:54.000000000 +0000 @@ -120,12 +120,10 @@ void nxagentPrintRootlessTopLevelWindowMap(void) { - int i; - fprintf(stderr, "nxagentPrintRootlessTopLevelWindowMap: Map size is [%d] num of entry [%d].\n", topLevelParentMap.size, topLevelParentMap.next); - for (i = 0; i < topLevelParentMap.next; i++) + for (int i = 0; i < topLevelParentMap.next; i++) { fprintf(stderr, "nxagentPrintRootlessTopLevelWindowMap: [%d] pWin at [%p] XID at [%ld].\n", i, (void *) topLevelParentMap.elt[i].pWin, (long int) topLevelParentMap.elt[i].xid); @@ -136,9 +134,7 @@ void nxagentRootlessAddTopLevelWindow(WindowPtr pWin, Window w) { - int i; - - for (i = 0; i < topLevelParentMap.next; i++) + for (int i = 0; i < topLevelParentMap.next; i++) { if (topLevelParentMap.elt[i].pWin == pWin) { @@ -181,9 +177,7 @@ WindowPtr nxagentRootlessTopLevelWindow(Window w) { - int i; - - for (i = 0; i < topLevelParentMap.next; i++) + for (int i = 0; i < topLevelParentMap.next; i++) { if (w == topLevelParentMap.elt[i].xid) { @@ -196,9 +190,7 @@ void nxagentRootlessDelTopLevelWindow(WindowPtr pWin) { - int i; - - for (i = 0; i < topLevelParentMap.next; i++) + for (int i = 0; i < topLevelParentMap.next; i++) { if (pWin == topLevelParentMap.elt[i].pWin) { @@ -289,10 +281,7 @@ } } - if (children_return) - { - XFree(children_return); - } + SAFE_XFree(children_return); return treesMatch; } @@ -340,7 +329,7 @@ if (!ntoplevel) { - free(toplevel); + SAFE_free(toplevel); return; } @@ -405,7 +394,7 @@ #endif - free(toplevel); + SAFE_free(toplevel); return; } @@ -485,7 +474,7 @@ { #ifdef TEST fprintf(stderr, "nxagentExportProperty: WARNING! Ignored ChangeProperty " - "on %swindow %lx property %s type %s nUnits %ld format %d\n", + "on %swindow [0x%lx] property [%s] type [%s] nUnits [%ld] format [%d]\n", nxagentWindowTopLevel(pWin) ? "toplevel " : "", nxagentWindow(pWin), validateString(propertyS), validateString(typeS), nUnits, format); #endif @@ -506,7 +495,6 @@ /* FIXME: is it okay here to ignore malloc fails? */ unsigned long *buffer = malloc(nUnits * sizeof(*buffer)); int *input = value; - int i; if (buffer) { @@ -514,7 +502,7 @@ export = True; output = (char*) buffer; - for (i = 0; i < nUnits; i++) + for (int i = 0; i < nUnits; i++) { buffer[i] = input[i]; } @@ -565,8 +553,8 @@ propHints.flags &= ~IconPixmapHint; #ifdef WARNING - fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon pixmap %x from hint " - "exporting property %s type %s on window %p.\n", + fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon pixmap [0x%x] from hint " + "exporting property [%s] type [%s] on window [%p].\n", (unsigned int) wmHints.icon_pixmap, propertyS, typeS, (void *) pWin); #endif @@ -587,8 +575,8 @@ propHints.flags &= ~IconWindowHint; #ifdef WARNING - fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon window %x from hint " - "exporting property %s type %s on window %p.\n", + fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon window [0x%x] from hint " + "exporting property [%s] type [%s] on window [%p].\n", (unsigned int) wmHints.icon_window, propertyS, typeS, (void *) pWin); #endif @@ -609,8 +597,8 @@ propHints.flags &= ~IconMaskHint; #ifdef WARNING - fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon mask %x from hint " - "exporting property %s type %s on window %p.\n", + fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon mask [0x%x] from hint " + "exporting property [%s] type [%s] on window [%p].\n", (unsigned int) wmHints.icon_mask, propertyS, typeS, (void *) pWin); #endif @@ -631,8 +619,8 @@ propHints.flags &= ~WindowGroupHint; #ifdef WARNING - fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up window group %x from hint " - "exporting property %s type %s on window %p.\n", + fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up window group [0x%x] from hint " + "exporting property [%s] type [%s] on window [%p].\n", (unsigned int) wmHints.window_group, propertyS, typeS, (void *) pWin); #endif @@ -644,13 +632,12 @@ XlibAtom *atoms = malloc(nUnits * sizeof(*atoms)); Atom *input = value; const char *atomName = NULL; - int i; int j = 0; if (!atoms) { #ifdef WARNING - fprintf(stderr, "nxagentExportProperty: WARNING! malloc() failed for '%s'- bailing out.\n", typeS); + fprintf(stderr, "nxagentExportProperty: WARNING! malloc() failed for '[%s]'- bailing out.\n", typeS); #endif return False; } @@ -659,7 +646,7 @@ export = True; output = (char *) atoms; - for (i = 0; i < nUnits; i++) + for (int i = 0; i < nUnits; i++) { /* * Exporting the _NET_WM_PING property could @@ -679,7 +666,7 @@ if (atoms[j] == None) { #ifdef WARNING - fprintf(stderr, "nxagentExportProperty: WARNING! Failed to convert local atom %ld [%s].\n", + fprintf(stderr, "nxagentExportProperty: WARNING! Failed to convert local atom [%ld] [%s].\n", (long int) input[i], validateString(atomName)); #endif } @@ -703,12 +690,11 @@ XlibWindow *wind = malloc(nUnits * sizeof(*wind)); ClientPtr pClient = wClient(pWin); WindowPtr pWindow; - int i; if (!wind) { #ifdef WARNING - fprintf(stderr, "nxagentExportProperty: WARNING! malloc() failed for '%s' - bailing out.\n", typeS); + fprintf(stderr, "nxagentExportProperty: WARNING! malloc() failed for '[%s]' - bailing out.\n", typeS); #endif return False; } @@ -717,7 +703,7 @@ export = True; output = (char*) wind; - for (i = 0; i < nUnits; i++) + for (int i = 0; i < nUnits; i++) { pWindow = (WindowPtr)SecurityLookupWindow(input[i], pClient, DixDestroyAccess); @@ -728,8 +714,8 @@ else { #ifdef WARNING - fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up window %ld " - "exporting property %s type %s on window %p.\n", + fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up window [%ld] " + "exporting property [%s] type [%s] on window [%p].\n", (long int) input[i], propertyS, typeS, (void *) pWin); #endif @@ -774,15 +760,14 @@ } else if (mode == PropModeReplace) { - int n; - char *data; + char * data = (char *) output; XDeleteProperty(nxagentDisplay, nxagentWindow(pWin), propertyX); - data = (char *) output; - while (nUnits > 0) { + int n; + if ((format >> 3) * nUnits + sizeof(xChangePropertyReq) < (MAX_REQUEST_SIZE << 2)) { @@ -819,7 +804,7 @@ { #ifdef TEST fprintf(stderr, "nxagentExportProperty: WARNING! Ignored ChangeProperty " - "on %swindow %x property %s type %s nUnits %ld format %d\n", + "on %swindow [0x%x] property [%s] type [%s] nUnits [%ld] format [%d]\n", nxagentWindowTopLevel(pWin) ? "toplevel " : "", nxagentWindow(pWin), validateString(propertyS), validateString(typeS), nUnits, format); @@ -830,7 +815,7 @@ if (freeMem) { - free(output); + SAFE_free(output); } return export; @@ -866,7 +851,7 @@ if (pWin == NULL) { #ifdef TEST - fprintf(stderr, "nxagentImportProperty: Failed to look up remote window %lx property [%ld] exiting.\n", + fprintf(stderr, "nxagentImportProperty: Failed to look up remote window [0x%lx] property [%ld] exiting.\n", window, property); #endif @@ -885,7 +870,7 @@ } #ifdef TEST - fprintf(stderr, "nxagentImportProperty: Window %lx property [%ld]: %s\n", + fprintf(stderr, "nxagentImportProperty: Window [0x%lx] property [%ld]: [%s]\n", window, property, validateString(NameForAtom(propertyL))); #endif @@ -900,7 +885,7 @@ if (buffer == NULL && (nitems > 0)) { #ifdef WARNING - fprintf(stderr, "nxagentImportProperty: Failed to retrieve remote property [%ld] %s on Window %ld\n", + fprintf(stderr, "nxagentImportProperty: Failed to retrieve remote property [%ld] [%s] on Window [%ld]\n", (long int) property, validateString(NameForAtom(propertyL)), (long int) window); #endif } @@ -956,8 +941,8 @@ else if (wmState.icon) { #ifdef WARNING - fprintf(stderr, "nxagentImportProperty: WARNING! Failed to convert remote window %ld" - " importing property %ld of type WM_STATE", (long int) wmState.icon, + fprintf(stderr, "nxagentImportProperty: WARNING! Failed to convert remote window [%ld]" + " importing property [%ld] of type WM_STATE", (long int) wmState.icon, (long int) property); #endif } @@ -982,7 +967,7 @@ #ifdef WARNING fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote icon " - "pixmap %d from hint importing property [%ld] type %s on window %p.\n", + "pixmap [%d] from hint importing property [%ld] type [%s] on window [%p].\n", (unsigned int) wmHints.icon_pixmap, (long int) property, typeS, (void *) pWin); #endif @@ -1003,7 +988,7 @@ #ifdef WARNING fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote icon " - "window %x from hint importing property [%ld] type %s on window %p.\n", + "window [0x%x] from hint importing property [%ld] type [%s] on window [%p].\n", (unsigned int) wmHints.icon_window, (long int) property, typeS, (void *) pWin); #endif @@ -1024,7 +1009,7 @@ #ifdef WARNING fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote icon " - "mask %x from hint importing property [%ld] type %s on window %p.\n", + "mask [0x%x] from hint importing property [%ld] type [%s] on window [%p].\n", (unsigned int) wmHints.icon_mask, (long int) property, typeS, (void *) pWin); #endif } @@ -1044,7 +1029,7 @@ #ifdef WARNING fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote window " - "group %x from hint importing property [%ld] type %s on window %p.\n", + "group [0x%x] from hint importing property [%ld] type [%s] on window [%p].\n", (unsigned int) wmHints.window_group, (long int) property, typeS, (void *) pWin); #endif @@ -1055,12 +1040,11 @@ { Atom *atoms = malloc(nitems * sizeof(Atom)); Atom *input = (Atom*) buffer; - int i; if (atoms == NULL) { #ifdef WARNING - fprintf(stderr, "nxagentImportProperty: WARNING! malloc() failed for '%s' - bailing out.\n", typeS); + fprintf(stderr, "nxagentImportProperty: WARNING! malloc() failed for '[%s]' - bailing out.\n", typeS); #endif return; @@ -1070,14 +1054,14 @@ import = True; output = (char *) atoms; - for (i = 0; i < nitems; i++) + for (int i = 0; i < nitems; i++) { atoms[i] = nxagentRemoteToLocalAtom(input[i]); if (atoms[i] == None) { #ifdef WARNING - fprintf(stderr, "nxagentImportProperty: WARNING! Failed to convert remote atom %ld.\n", + fprintf(stderr, "nxagentImportProperty: WARNING! Failed to convert remote atom [%ld].\n", (long int) input[i]); #endif } @@ -1088,12 +1072,11 @@ Window *input = (Window*) buffer; Window *wind = malloc(nitems * sizeof(Window)); WindowPtr pWindow; - int i; if (!wind) { #ifdef WARNING - fprintf(stderr, "nxagentImportProperty: WARNING! malloc() failed for '%s' - bailing out.\n", typeS); + fprintf(stderr, "nxagentImportProperty: WARNING! malloc() failed for '[%s]' - bailing out.\n", typeS); #endif return; @@ -1102,7 +1085,7 @@ import = True; output = (char*) wind; - for (i = 0; i < nitems; i++) + for (int i = 0; i < nitems; i++) { pWindow = nxagentWindowPtr(input[i]); @@ -1113,8 +1096,8 @@ else { #ifdef WARNING - fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote window %lx " - "importing property [%ld] type %s on window %p.\n", + fprintf(stderr, "nxagentImportProperty: WARNING! Failed to look up remote window [0x%lx] " + "importing property [%ld] type [%s] on window [%p].\n", (long int) input[i], (long int) property, typeS, (void*)pWin); #endif @@ -1127,7 +1110,7 @@ { #ifdef TEST fprintf(stderr, "nxagentImportProperty: ChangeProperty " - "on window %lx property [%ld] type %s nitems %ld format %d\n", + "on window [0x%lx] property [%ld] type [%s] nitems [%ld] format [%d]\n", window, property, typeS, nitems, format); #endif @@ -1138,14 +1121,14 @@ { #ifdef TEST fprintf(stderr, "nxagentImportProperty: WARNING! Ignored ChangeProperty " - "on window %lx property [%ld] type %s ntems %ld format %d\n", + "on window [0x%lx] property [%ld] type [%s] ntems [%ld] format [%d]\n", window, property, validateString(typeS), nitems, format); #endif } if (freeMem) { - free(output); + SAFE_free(output); } return; @@ -1183,7 +1166,7 @@ struct nxagentPropertyRec *tmp = nxagentPropertyList.first; #ifdef TEST - fprintf(stderr, "nxagentRemovePropertyFromList: Property %ld on Window %lx to list, list size is %d.\n\n", + fprintf(stderr, "nxagentRemovePropertyFromList: Property [%ld] on Window [0x%lx] to list, list size is [%d].\n\n", nxagentPropertyList.first -> property, nxagentPropertyList.first -> window, nxagentPropertyList.size); #endif @@ -1197,7 +1180,7 @@ nxagentPropertyList.last = NULL; } - free(tmp); + SAFE_free(tmp); } } @@ -1220,8 +1203,8 @@ } #ifdef TEST - fprintf(stderr, "nxagentAddPropertyToList: Adding record Property %ld - Window %lx[%p]" - "to list, list size is %d.\n", property, nxagentWindow(pWin), (void*) pWin, + fprintf(stderr, "nxagentAddPropertyToList: Adding record Property [%ld] - Window [0x%lx][%p]" + "to list, list size is [%d].\n", property, nxagentWindow(pWin), (void*) pWin, nxagentPropertyList.size); #endif @@ -1262,12 +1245,12 @@ XPropertyEvent *X = p; #ifdef TEST - fprintf(stderr, "nxagentNotifyMatchChangeProperty: Property notify on window %lx property %ld.\n", + fprintf(stderr, "nxagentNotifyMatchChangeProperty: Property notify on window [0x%lx] property [%ld].\n", X -> window, X -> atom); if (first) { - fprintf(stderr, "nxagentNotifyMatchChangeProperty: First element on list is window %lx property %ld list size is %d.\n", + fprintf(stderr, "nxagentNotifyMatchChangeProperty: First element on list is window [0x%lx] property [%ld] list size is [%d].\n", first -> window, first -> property, nxagentPropertyList.size); } else diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Screen.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Screen.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Screen.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Screen.c 2019-12-16 06:31:54.000000000 +0000 @@ -135,7 +135,6 @@ #include "unistd.h" #endif -extern Bool nxagentIpaq; extern Pixmap nxagentIconPixmap; extern Pixmap nxagentIconShape; extern Bool useXpmIcon; @@ -147,9 +146,7 @@ Window nxagentScreenSaverWindows[MAXSCREENS]; #ifdef NXAGENT_ONSTART -Atom nxagentWMStart; -Window nxagentSplashWindow = None; -Pixmap nxagentPixmapLogo; +Atom nxagentReadyAtom; #endif ScreenPtr nxagentDefaultScreen = NULL; @@ -297,78 +294,118 @@ } } -void nxagentMinimizeFromFullScreen(ScreenPtr pScreen) +/* check if possible_parent is parent of candidate */ +Bool nxagentIsParentOf(Display *d, XlibWindow possible_parent, XlibWindow candidate) { - XUnmapWindow(nxagentDisplay, nxagentFullscreenWindow); + XlibWindow parent, root, *children = NULL; + unsigned int num_children; - if (nxagentIpaq) + if (XQueryTree(d, candidate, &root, &parent, &children, &num_children)) { - XMapWindow(nxagentDisplay, nxagentIconWindow); - XIconifyWindow(nxagentDisplay, nxagentIconWindow, - DefaultScreen(nxagentDisplay)); + SAFE_XFree(children); + + #ifdef TEST + fprintf(stderr, "%s: parent of full screen window [%p] root [%p] possible_parent [%p] candidate [%p]\n", __func__, parent, root, possible_parent, candidate); + #endif + return (parent == possible_parent); } else { - XIconifyWindow(nxagentDisplay, nxagentIconWindow, - DefaultScreen(nxagentDisplay)); + return False; } } -void nxagentMaximizeToFullScreen(ScreenPtr pScreen) +/* + * Pressing the minimize keystroke while in fullscreen mode will call + * this function. It will unmap the fullscreen window and iconify the + * previously created icon window immediately. The window manager may + * decide how to show an iconified window. kwin e.g. shows it in the + * task bar. + */ +void nxagentMinimizeFromFullScreen(ScreenPtr pScreen) { - if (nxagentIpaq) - { - XUnmapWindow(nxagentDisplay, nxagentIconWindow); + XUnmapWindow(nxagentDisplay, nxagentFullscreenWindow); + XIconifyWindow(nxagentDisplay, nxagentIconWindow, + DefaultScreen(nxagentDisplay)); +} - XMapWindow(nxagentDisplay, nxagentFullscreenWindow); - } - else - { /* - XUnmapWindow(nxagentDisplay, nxagentIconWindow); + * This is the opposite function to nxagentMinimizeFromFullscreen. It + * will map the fullscreen window and unmap the icon window. It is + * only called if fullscreen mode was active when the minimize + * keystroke was pressed. + * Some window managers tend to do 'interesting' things with the + * icon window, which we try to counterfeit here. + */ +void nxagentMaximizeToFullScreen(ScreenPtr pScreen) +{ +/* + XUnmapWindow(nxagentDisplay, nxagentIconWindow); */ + + Window root = RootWindow(nxagentDisplay, DefaultScreen(nxagentDisplay)); + /* -FIXME: We'll check for ReparentNotify and LeaveNotify events after XReparentWindow() - in order to avoid the session window is iconified. - We could avoid the session window is iconified when a LeaveNotify event is received, - so this check would be unnecessary. +FIXME: We'll check for ReparentNotify and LeaveNotify events after + XReparentWindow() in order to avoid the session window being + iconified. We could avoid the session window being iconified + when a LeaveNotify event is received, so this check would be + unnecessary. */ - struct timeval timeout; - int i; - XEvent e; - XReparentWindow(nxagentDisplay, nxagentFullscreenWindow, - RootWindow(nxagentDisplay, DefaultScreen(nxagentDisplay)), 0, 0); + /* only reparent if necessary. FIXME: also check if the desired coordinates match */ - for (i = 0; i < 100 && nxagentWMIsRunning; i++) + if (!nxagentIsParentOf(nxagentDisplay, root, nxagentFullscreenWindow)) { - #ifdef TEST - fprintf(stderr, "nxagentMaximizeToFullscreen: WARNING! Going to wait for the ReparentNotify event.\n"); - #endif + XReparentWindow(nxagentDisplay, nxagentFullscreenWindow, + root, 0, 0); - if (XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, ReparentNotify, &e)) + for (int i = 0; i < 100 && nxagentWMIsRunning; i++) { - break; - } + XEvent e; - XSync(nxagentDisplay, 0); + #ifdef TEST + fprintf(stderr, "nxagentMaximizeToFullscreen: WARNING! Going to wait for the ReparentNotify event [%d].\n", i); + #endif + + if (XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, ReparentNotify, &e)) + { + break; + } - timeout.tv_sec = 0; - timeout.tv_usec = 50 * 1000; + XSync(nxagentDisplay, 0); - nxagentWaitEvents(nxagentDisplay, &timeout); + nxagentWaitEvents(nxagentDisplay, 50); + } + } + else + { + #ifdef TEST + fprintf(stderr, "%s: FullscreenWindow already is child of root window - skipping reparenting,\n", __func__); + #endif } - XMapRaised(nxagentDisplay, nxagentFullscreenWindow); + XMapRaised(nxagentDisplay, nxagentFullscreenWindow); - XIconifyWindow(nxagentDisplay, nxagentIconWindow, - DefaultScreen(nxagentDisplay)); + XIconifyWindow(nxagentDisplay, nxagentIconWindow, + DefaultScreen(nxagentDisplay)); + + /* swallow all LeaveNotify events for the FullscreenWindow; + Normally this does not swallow anything these days, but when + using fvwm you see one of these events here. */ + while (1) + { + XEvent e; + if (!XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, LeaveNotify, &e)) + break; + #ifdef TEST + fprintf(stderr, "%d: swallowing LeaveNotify event\m", __func__); + #endif + } - while (XCheckTypedWindowEvent(nxagentDisplay, nxagentFullscreenWindow, LeaveNotify, &e)); /* - XMapWindow(nxagentDisplay, nxagentIconWindow); + XMapWindow(nxagentDisplay, nxagentIconWindow); */ - } } Window nxagentCreateIconWindow(void) @@ -404,11 +441,11 @@ if (nxagentReportWindowIds) { - fprintf (stderr, "NXAGENT_WINDOW_ID: ICON_WINDOW,WID:[0x%x]\n", nxagentIconWindow); + fprintf(stderr, "NXAGENT_WINDOW_ID: ICON_WINDOW,WID:[0x%x]\n", w); } #ifdef TEST fprintf(stderr, "nxagentCreateIconWindow: Created new icon window with id [0x%x].\n", - nxagentIconWindow); + w); #endif /* @@ -446,11 +483,8 @@ window_name, window_name, NULL , 0 , sizeHints, wmHints, NULL); - if (sizeHints) - XFree(sizeHints); - - if (wmHints) - XFree(wmHints); + SAFE_XFree(sizeHints); + SAFE_XFree(wmHints); /* * Enable events from the icon window. @@ -844,6 +878,18 @@ return count; } +void freeDepths(DepthPtr depths, int num) +{ + for (int i = 0; i < num; i++) + { + #ifdef DEBUG + fprintf(stderr, "%s: freeing depth [%d] index [%d] vids [%p]\n", __func__, depths[i].depth, i, (void*) depths[i].vids); + #endif + SAFE_free(depths[i].vids); + } + SAFE_free(depths); +} + Bool nxagentOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) { @@ -881,7 +927,7 @@ nxagentQueryAtoms(pScreen); #ifdef NXAGENT_ONSTART - nxagentWMStart = nxagentAtoms[3]; /* WM_NX_READY */ + nxagentReadyAtom = nxagentAtoms[3]; /* WM_NX_READY */ #endif /* @@ -1335,6 +1381,8 @@ if (!pFrameBufferBits) { + freeDepths(depths, numDepths); + SAFE_free(visuals); return FALSE; } @@ -1356,6 +1404,8 @@ if (!fbScreenInit(pScreen, pFrameBufferBits, nxagentOption(RootWidth), nxagentOption(RootHeight), monitorResolution, monitorResolution, PixmapBytePad(nxagentOption(RootWidth), rootDepth), bitsPerPixel)) { + freeDepths(depths, numDepths); + SAFE_free(visuals); return FALSE; } @@ -1391,22 +1441,15 @@ * by fbScreenInit with our own. */ - free(pScreen -> visuals); - free(pScreen -> allowedDepths); - - pScreen -> visuals = visuals; + freeDepths(pScreen->allowedDepths, pScreen->numDepths); pScreen -> allowedDepths = depths; - pScreen -> numVisuals = numVisuals; pScreen -> numDepths = numDepths; - pScreen -> rootVisual = defaultVisual; pScreen -> rootDepth = rootDepth; - /* - * Complete the initialization of the RANDR - * extension. - */ - - nxagentInitRandRExtension(pScreen); + SAFE_free(pScreen -> visuals); + pScreen -> visuals = visuals; + pScreen -> numVisuals = numVisuals; + pScreen -> rootVisual = defaultVisual; /* * Set up the internal structures used for @@ -1692,6 +1735,13 @@ #define POSITION_OFFSET (pScreen->myNum * (nxagentOption(Width) + \ nxagentOption(Height)) / 32) + + /* + * Complete the initialization of the RANDR + * extension. + */ + + nxagentInitRandRExtension(pScreen); } #ifdef TEST @@ -1776,32 +1826,43 @@ nxagentDefaultVisual(pScreen), valuemask, &attributes); - if (nxagentOption(Rootless) == 0) - { - valuemask = CWEventMask; - mask = PointerMotionMask; - attributes.event_mask = mask; - - nxagentInputWindows[pScreen -> myNum] = - XCreateWindow(nxagentDisplay, - nxagentDefaultWindows[pScreen -> myNum], - 0, 0, - nxagentOption(Width), - nxagentOption(Height), - 0, 0, InputOnly, - nxagentDefaultVisual(pScreen), - valuemask , &attributes); - } - if (nxagentReportWindowIds) { - fprintf (stderr, "NXAGENT_WINDOW_ID: SCREEN_WINDOW:[%d],WID:[0x%x]\n", pScreen -> myNum, nxagentInputWindows[pScreen->myNum]); + fprintf(stderr, "NXAGENT_WINDOW_ID: SCREEN_WINDOW:[%d],WID:[0x%x]\n", pScreen->myNum, nxagentDefaultWindows[pScreen->myNum]); } + #ifdef TEST - fprintf(stderr, "nxagentOpenScreen: Created new default window with id [0x%x].\n", - nxagentDefaultWindows[pScreen->myNum]); + fprintf(stderr, "nxagentOpenScreen: Created new default window for screen [%d] with id [0x%x].\n", + pScreen->myNum, nxagentDefaultWindows[pScreen->myNum]); #endif + if (nxagentOption(Rootless) == 0) + { + valuemask = CWEventMask; + mask = PointerMotionMask; + attributes.event_mask = mask; + + nxagentInputWindows[pScreen->myNum] = + XCreateWindow(nxagentDisplay, + nxagentDefaultWindows[pScreen->myNum], + 0, 0, + nxagentOption(Width), + nxagentOption(Height), + 0, 0, InputOnly, + nxagentDefaultVisual(pScreen), + valuemask , &attributes); + + if (nxagentReportWindowIds) + { + fprintf(stderr, "NXAGENT_WINDOW_ID: INPUT_WINDOW:[%d],WID:[0x%x]\n", pScreen->myNum, nxagentInputWindows[pScreen->myNum]); + } + + #ifdef TEST + fprintf(stderr, "nxagentOpenScreen: Created new input window for screen [%d] with id [0x%x].\n", + pScreen->myNum, nxagentInputWindows[pScreen->myNum]); + #endif + } + /* * Setting WM_CLASS to "X2GoAgent" when running in X2Go Agent mode * we need it to properly display all window parameters by some WMs @@ -1826,25 +1887,14 @@ hint.res_class = strdup("NXAgent"); } XSetClassHint(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &hint); - free(hint.res_name); - free(hint.res_class); + SAFE_free(hint.res_name); + SAFE_free(hint.res_class); } if (nxagentOption(Fullscreen)) { nxagentFullscreenWindow = nxagentDefaultWindows[pScreen->myNum]; } - - if (nxagentIpaq) - { - XWindowChanges ch; - unsigned int ch_mask; - - ch.stack_mode = Below; - ch_mask = CWStackMode; - - XConfigureWindow(nxagentDisplay, nxagentFullscreenWindow, ch_mask, &ch); - } } if (nxagentOption(Fullscreen)) @@ -1922,17 +1972,8 @@ nxagentWindowName, argv , argc , sizeHints, wmHints, NULL); - if (sizeHints) - { - XFree(sizeHints); - sizeHints = NULL; - } - - if (wmHints) - { - XFree(wmHints); - wmHints = NULL; - } + SAFE_XFree(sizeHints); + SAFE_XFree(wmHints); /* * Clear the window but let it unmapped. We'll map it @@ -1954,7 +1995,7 @@ } else { - nxagentIconWindow = 0; + nxagentIconWindow = None; } /* @@ -2124,26 +2165,31 @@ Bool nxagentCloseScreen(ScreenPtr pScreen) { - int i; - #ifdef DEBUG fprintf(stderr, "running nxagentCloseScreen()\n"); #endif - for (i = 0; i < pScreen->numDepths; i++) - { - free(pScreen->allowedDepths[i].vids); - } + /* + * We have called fbScreenInit() in nxagenOpenScreen, which in turn + * called fbOpenScreen. But we are not using the data as created by + * fbOpenScreen but have freed it and replaced by our own. So we free + * our own stuff here and take care that fbCloseScreen will not free + * them again. + */ + + freeDepths(pScreen->allowedDepths, pScreen->numDepths); + pScreen->allowedDepths = NULL; + pScreen->numDepths = 0; /* * Free the frame buffer. */ - free(((PixmapPtr)pScreen -> devPrivate) -> devPrivate.ptr); + SAFE_free(((PixmapPtr)pScreen -> devPrivate) -> devPrivate.ptr); + SAFE_free(pScreen->devPrivate); + SAFE_free(pScreen->visuals); - free(pScreen->allowedDepths); - free(pScreen->visuals); - free(pScreen->devPrivate); + fbCloseScreen(pScreen); /* * Reset the geometry and alpha information @@ -3058,10 +3104,7 @@ if (result == 1) { - if (!nxagentWMPassed) - { - nxagentRemoveSplashWindow(NULL); - } + nxagentRemoveSplashWindow(); NXShadowExportChanges(&numRects, &ptBox); pBox = (BoxRec *)ptBox; @@ -3101,7 +3144,7 @@ length = nxagentImageLength(width, height, ZPixmap, 0, nxagentMasterDepth); - free(tBuffer); + SAFE_free(tBuffer); tBuffer = malloc(length); @@ -3158,7 +3201,7 @@ RegionUnion(&nxagentShadowUpdateRegion, &nxagentShadowUpdateRegion, &updateRegion); } - free(tBuffer); + SAFE_free(tBuffer); RegionUninit(&updateRegion); } @@ -3376,7 +3419,7 @@ cBuffer = (unsigned char *) *buffer; *buffer = (char *) icBuffer; - free(cBuffer); + SAFE_free(cBuffer); } #ifdef NXAGENT_ARTSD @@ -3559,7 +3602,7 @@ strlen(local_buf), local_buf, 1); } - free(local_buf); + SAFE_free(local_buf); } } } @@ -3983,7 +4026,7 @@ #endif number = 1; - free(screeninfo); + SAFE_free(screeninfo); if (!(screeninfo = malloc(sizeof(XineramaScreenInfo)))) { return FALSE; @@ -4252,8 +4295,7 @@ } /* release allocated memory */ - free(screeninfo); - screeninfo = NULL; + SAFE_free(screeninfo); #ifdef DEBUG for (i = 0; i < pScrPriv->numCrtcs; i++) { @@ -4368,7 +4410,7 @@ XSetClipRectangles(nxagentDisplay, gc, 0, 0, pRects, nRects, Unsorted); - free((char *) pRects); + SAFE_free(pRects); extents = *RegionExtents(&cleanRegion); @@ -4514,7 +4556,7 @@ XSetClipRectangles(nxagentDisplay, gc, 0, 0, pRects, nRects, Unsorted); - free(pRects); + SAFE_free(pRects); extents = *RegionExtents(clipRegion); @@ -4594,7 +4636,7 @@ XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[screen], sizeHints); - XFree(sizeHints); + SAFE_XFree(sizeHints); } /* @@ -4613,7 +4655,7 @@ sizeHints->max_height = maxheight; XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], sizeHints); - XFree(sizeHints); + SAFE_XFree(sizeHints); } } @@ -4754,7 +4796,7 @@ fprintf(stderr, "nxagentShowPixmap: XGetImage failed.\n"); #endif - free(data); + SAFE_free(data); return; } @@ -4787,7 +4829,7 @@ XDestroyImage(image); } - free(data); + SAFE_free(data); /* FIXME @@ -4839,7 +4881,7 @@ fprintf(stderr, "nxagentFbRestoreArea: XGetImage failed.\n"); #endif - free(data); + SAFE_free(data); return; } @@ -4899,7 +4941,7 @@ /* FIXME - free(data); + SAFE_free(data); */ } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Splash.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Splash.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Splash.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Splash.c 2019-12-16 06:31:54.000000000 +0000 @@ -58,19 +58,24 @@ * Colors used to paint the splash screen. */ -int nxagentLogoDepth; -int nxagentLogoWhite; -int nxagentLogoRed; -int nxagentLogoBlack; -int nxagentLogoGray; +#define nxagentLogoWhite 0xffffff +#define nxagentLogoBlack 0x000000 +#define nxagentLogoDarkGray 0x222222 +#define nxagentLogoLightGray 0xbbbbbb + +Pixmap nxagentPixmapLogo; +Window nxagentSplashWindow = None; +Bool nxagentWMPassed = False; -void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height); +static void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height); /* * From Screen.c. */ -extern Atom nxagentWMStart; +#ifdef NXAGENT_ONSTART +extern Atom nxagentReadyAtom; +#endif /* * From Clipboard.c. @@ -78,27 +83,35 @@ extern Atom serverCutProperty; -int nxagentShowSplashWindow(Window parentWindow) +void nxagentShowSplashWindow(Window parentWindow) { XWindowAttributes getAttributes; XWindowChanges values; XSetWindowAttributes attributes; GC gc; + /* + * Show splash window only when running as X2Go Agent + */ + if(!nxagentX2go) + return; + #ifdef TEST - fprintf(stderr, "nxagentShowSplashWindow: Got called.\n"); + fprintf(stderr, "%s: Got called.\n", __func__); #endif #ifdef NXAGENT_TIMESTAMP { extern unsigned long startTime; - fprintf(stderr, "nxagentShowSplashWindow: Initializing splash start at [%d] milliseconds.\n", + fprintf(stderr, "%s: Initializing splash start at [%d] milliseconds.\n", __func__, GetTimeInMillis() - startTime); } #endif - XSetSelectionOwner(nxagentDisplay, nxagentWMStart, None, CurrentTime); + #ifdef NXAGENT_ONSTART + XSetSelectionOwner(nxagentDisplay, nxagentReadyAtom, None, CurrentTime); + #endif nxagentWMPassed = False; @@ -133,7 +146,7 @@ getAttributes.height = nxagentOption(RootHeight); #ifdef TEST - fprintf(stderr, "nxagentShowSplashWindow: Going to create new splash window.\n"); + fprintf(stderr, "%s: Going to create new splash window.\n", __func__); #endif nxagentSplashWindow = @@ -146,7 +159,7 @@ BlackPixel (nxagentDisplay, 0)); #ifdef TEST - fprintf(stderr, "nxagentShowSplashWindow: Created new splash window with id [%ld].\n", + fprintf(stderr, "%s: Created new splash window with id [%ld].\n", __func__, nxagentSplashWindow); #endif @@ -162,45 +175,34 @@ #ifdef NXAGENT_TIMESTAMP { extern unsigned long startTime; - fprintf(stderr, "nxagentShowSplashWindow: Splash ends [%d] milliseconds.\n", + fprintf(stderr, "%s: Splash ends [%d] milliseconds.\n", __func__, GetTimeInMillis() - startTime); } #endif - - return True; } void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) { - XPoint rect[4]; - int w, h, c, w2, h2; - - /* - * Show only X2GO Logo when running as X2Go Agent - */ - if(! nxagentX2go) - { - nxagentPixmapLogo = 0L; - return; - } + int depth = DefaultDepth(nxagentDisplay, DefaultScreen(nxagentDisplay)); #ifdef DEBUG - fprintf(stderr, "nxagentPaintLogo: Got called.\n"); + fprintf(stderr, "%s: Got called.\n", __func__); #endif #ifdef NXAGENT_LOGO_DEBUG - fprintf(stderr, "nxagentPaintLogo: begin\n"); - fprintf(stderr, "nxagentPaintLogo: gen params are: w=%d h=%d d=%d r=%x w=%x b=%x\n",width, height, - nxagentLogoDepth, nxagentLogoRed, - nxagentLogoWhite, nxagentLogoBlack); + fprintf(stderr, "%s: begin\n", __func__); + fprintf(stderr, "%s: gen params are: w=%d h=%d d=%d w=%x b=%x g1=%x g2=%x \n", __func__, + width, height, depth, + nxagentLogoWhite, nxagentLogoBlack, nxagentLogoDarkGray, nxagentLogoLightGray); #endif - w = width/scale; - h = height/scale; + int w = width/scale; + int h = height/scale; - w2 = w/2; - h2 = h/2; + int w2 = w/2; + int h2 = h/2; + int c; if (height > width) { c = w/30; @@ -210,42 +212,52 @@ c = w/48; } - rect[0].x = 0; rect[0].y = 0; - rect[1].x = 0; rect[1].y = h; - rect[2].x = w; rect[2].y = h; - rect[3].x = w; rect[3].y = 0; - XSetFunction(nxagentDisplay, gc, GXcopy); XSetFillStyle(nxagentDisplay, gc, FillSolid); - XSetForeground(nxagentDisplay, gc, nxagentLogoBlack); - XSetBackground(nxagentDisplay, gc, nxagentLogoRed); - - nxagentPixmapLogo = XCreatePixmap(nxagentDisplay, win, width, height, nxagentLogoDepth); + nxagentPixmapLogo = XCreatePixmap(nxagentDisplay, win, width, height, depth); if (!nxagentPixmapLogo) { return; } + if (blackRoot) + { + XSetForeground(nxagentDisplay, gc, nxagentLogoBlack); + XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); + } + else + { + XSetForeground(nxagentDisplay, gc, nxagentLogoWhite); + XSetBackground(nxagentDisplay, gc, nxagentLogoBlack); + } + + XPoint rect[4]; + rect[0].x = 0; rect[0].y = 0; + rect[1].x = 0; rect[1].y = h; + rect[2].x = w; rect[2].y = h; + rect[3].x = w; rect[3].y = 0; + + /* paint background */ XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); #ifdef NXAGENT_LOGO_DEBUG - fprintf(stderr, "filled first poly\n"); + fprintf(stderr, "%s: filled first poly\n", __func__); #endif - XSetForeground(nxagentDisplay, gc, nxagentLogoRed); - XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); - /* * Draw X2GO Logo */ + if (blackRoot) + XSetForeground(nxagentDisplay, gc, nxagentLogoDarkGray); + else + XSetForeground(nxagentDisplay, gc, nxagentLogoLightGray); + /* - * Begin 'X'. + * Start 'X'. */ - XSetForeground(nxagentDisplay, gc, nxagentLogoGray); - XSetBackground(nxagentDisplay, gc, nxagentLogoWhite); rect[0].x = w2-7*c; rect[0].y = h2-5*c; rect[1].x = w2-8*c; rect[1].y = h2-5*c; rect[2].x = w2-4*c; rect[2].y = h2+3*c; @@ -379,22 +391,28 @@ XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo); #ifdef NXAGENT_LOGO_DEBUG - fprintf(stderr, "nxagentPaintLogo: end\n"); + fprintf(stderr, "%s: end\n", __func__); #endif } -void nxagentRemoveSplashWindow(WindowPtr pWin) +void nxagentRemoveSplashWindow(void) { - if (nxagentReconnectTrap) return; + if (nxagentWMPassed) + return; + + if (nxagentReconnectTrap) + return; #ifdef TEST - fprintf(stderr, "nxagentRemoveSplashWindow: Destroying the splash window.\n"); + fprintf(stderr, "%s: Destroying the splash window.\n", __func__); #endif if (!nxagentWMPassed) { - XSetSelectionOwner(nxagentDisplay, nxagentWMStart, + #ifdef NXAGENT_ONSTART + XSetSelectionOwner(nxagentDisplay, nxagentReadyAtom, nxagentDefaultWindows[0], CurrentTime); + #endif nxagentWMPassed = True; } @@ -407,7 +425,7 @@ nxagentRefreshWindows(screenInfo.screens[0]->root); #ifdef TEST - fprintf(stderr, "nxagentRemoveSplashWindow: setting the ownership of %s (%d) on window 0x%lx\n", + fprintf(stderr, "%s: setting the ownership of %s (%d) on window 0x%lx\n", __func__ "NX_CUT_BUFFER_SERVER", (int)serverCutProperty, nxagentWindow(screenInfo.screens[0]->root)); #endif @@ -418,7 +436,6 @@ if (nxagentPixmapLogo) { XFreePixmap(nxagentDisplay, nxagentPixmapLogo); - nxagentPixmapLogo = (Pixmap) 0; } } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Splash.h nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Splash.h --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Splash.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Splash.h 2019-12-16 06:31:54.000000000 +0000 @@ -37,18 +37,9 @@ extern int XdmcpStartTime; extern int nxagentXdmcpUp; -extern int nxagentLogoDepth; -extern int nxagentLogoWhite; -extern int nxagentLogoRed; -extern int nxagentLogoBlack; -extern int nxagentLogoGray; - extern Window nxagentSplashWindow; -extern int nxagentWMPassed; - -extern int nxagentShowSplashWindow(Window); - -extern void nxagentRemoveSplashWindow(WindowPtr pWin); +extern void nxagentShowSplashWindow(Window); +extern void nxagentRemoveSplashWindow(); #endif /* __Splash_H__ */ diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Split.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Split.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Split.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Split.c 2019-12-16 06:31:54.000000000 +0000 @@ -804,7 +804,7 @@ fprintf(stderr, "nxagentWaitDrawable: Yielding control to the NX transport.\n"); #endif - nxagentWaitEvents(nxagentDisplay, NULL); + nxagentWaitEvents(nxagentDisplay, 0); } } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/TestExt.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/TestExt.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/TestExt.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/TestExt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXAGENT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -/* - -Copyright 1993 by Davor Matic - -Permission to use, copy, modify, distribute, and sell this software -and its documentation for any purpose is hereby granted without fee, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation. Davor Matic makes no representations about -the suitability of this software for any purpose. It is provided "as -is" without express or implied warranty. - -*/ - -#include -#include -#include -#undef Bool -#include "screenint.h" -#include "input.h" -#include "misc.h" -#include "scrnintstr.h" -#include "servermd.h" -#include "mipointer.h" -#define XTestSERVER_SIDE -#include "xtestext1.h" - -extern CARD32 nxagentLastEventTime; - -void XTestGetPointerPos(short *fmousex, short *fmousey); - -void XTestJumpPointer(int jx, int jy, int dev_type); - -void XTestGenerateEvent(int dev_type, int keycode, int keystate, - int mousex, int mousey); - -void XTestGetPointerPos(short *fmousex, short *fmousey) -{ - int x,y; - - miPointerPosition(&x, &y); - *fmousex = x; - *fmousey = y; -} - -void XTestJumpPointer(int jx, int jy, int dev_type) -{ - miPointerAbsoluteCursor(jx, jy, GetTimeInMillis()); -} - -void XTestGenerateEvent(int dev_type, int keycode, int keystate, - int mousex, int mousey) -{ -/* - xEvent tevent; - - tevent.u.u.type = (dev_type == XE_POINTER) ? - (keystate == XTestKEY_UP) ? ButtonRelease : ButtonPress : - (keystate == XTestKEY_UP) ? KeyRelease : KeyPress; - tevent.u.u.detail = keycode; - tevent.u.keyButtonPointer.rootX = mousex; - tevent.u.keyButtonPointer.rootY = mousey; - tevent.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis(); - mieqEnqueue(&tevent); -*/ -} diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Trap.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Trap.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Trap.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Trap.c 2019-12-16 06:31:54.000000000 +0000 @@ -120,3 +120,11 @@ int nxagentXkbNumTrap = 0; + +/* + * Set to indicate we are processing a clipboard event triggered by + * the real X server. This is used to avoid endless loops if callbacks + * would trigger another event by the real X server + */ + +int nxagentExternalClipboardEventTrap = 0; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Trap.h nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Trap.h --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Trap.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Trap.h 2019-12-16 06:31:54.000000000 +0000 @@ -121,4 +121,12 @@ extern int nxagentXkbNumTrap; +/* + * Set to indicate we are processing a clipboard event triggered by + * the real X server. This is used to avoid endless loops if callbacks + * would trigger another event by the real X server + */ + +extern int nxagentExternalClipboardEventTrap; + #endif /* __Trap_H__ */ diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Utils.h nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Utils.h --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Utils.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Utils.h 2019-12-16 06:31:54.000000000 +0000 @@ -45,5 +45,6 @@ } #define SAFE_XFree(what) do {if (what) {XFree(what); what = NULL;}} while (0) +#define SAFE_free(what) do {free(what); what = NULL;} while (0) #endif /* __Utils_H__ */ diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Window.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Window.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Window.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Window.c 2019-12-16 06:31:54.000000000 +0000 @@ -63,6 +63,7 @@ #include "Init.h" #include "Composite.h" #include "Events.h" +#include "Utils.h" #include #include "compext/Compext.h" @@ -118,12 +119,6 @@ extern Bool nxagentReportPrivateWindowIds; -/* - * Also referenced in Events.c. - */ - -int nxagentSplashCount = 0; - #define RECTLIMIT 25 #define BSPIXMAPLIMIT 128 @@ -156,12 +151,6 @@ unsigned long*, unsigned long*, unsigned char**); /* - * From NXwindow.c. - */ - -void nxagentClearSplash(WindowPtr pWin); - -/* * Other local functions. */ @@ -247,6 +236,15 @@ return match.pWin; } +/* + * from "Definition of the Porting Layer for X v11 Sample Server": + * + * This routine is a hook for when DIX creates a window. It should + * fill in the "Window Procedures in the WindowRec" below and also + * allocate the devPrivate block for it. + * + * See Xserver/fb/fbwindow.c for the sample server implementation. + */ Bool nxagentCreateWindow(WindowPtr pWin) { unsigned long mask; @@ -259,16 +257,6 @@ return True; } - nxagentSplashCount++; - - if (nxagentSplashCount == 2) - { - nxagentClearSplash(nxagentRootTileWindow); - } - #ifdef NXAGENT_LOGO_DEBUG - fprintf(stderr, "nxagentCreateWindow: nxagentSplashCount [%d]\n", nxagentSplashCount); - #endif - if (pWin->drawable.class == InputOnly) { mask = CWEventMask; @@ -478,14 +466,6 @@ nxagentWindowPriv(pWin)->siblingAbove = None; nxagentWindowPriv(pWin)->pPicture = NULL; - if (nxagentRootTileWindow) - { - if (nxagentWindowPriv(pWin)->window != nxagentWindowPriv(nxagentRootTileWindow)->window) - { - XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow)->window); - } - } - if (pWin->nextSib) { nxagentWindowPriv(pWin->nextSib)->siblingAbove = nxagentWindow(pWin); @@ -530,7 +510,7 @@ #ifdef DEBUG else { - fprintf(stderr, "%s: Added property [%s], value [%s] for root window [%x].\n", __func__, name, NX_VERSION_CURRENT_STRING, pWin); + fprintf(stderr, "%s: Added property [%s], value [%s] for root window [%x].\n", __func__, name, NX_VERSION_CURRENT_STRING, pWin); } #endif } @@ -553,6 +533,15 @@ return False; } +/* + * from "Definition of the Porting Layer for X v11 Sample Server": + * + * This routine is a hook for when DIX destroys a window. It should + * deallocate the devPrivate block for it and any other blocks that + * need to be freed, besides doing other cleanup actions. + * + * See Xserver/fb/fbwindow.c for the sample server implementation. + */ Bool nxagentDestroyWindow(WindowPtr pWin) { nxagentPrivWindowPtr pWindowPriv; @@ -644,24 +633,6 @@ nxagentRootlessDelTopLevelWindow(pWin); } - nxagentSplashCount--; - - #ifdef DEBUG - fprintf(stderr, "nxagentDestroyWindow: The splash counter is now [%d].\n", - nxagentSplashCount); - #endif - - if (nxagentSplashCount == 1) - { - XClearWindow(nxagentDisplay, nxagentWindowPriv(nxagentRootTileWindow) -> window); - } - - if (pWin == nxagentRootTileWindow) - { - nxagentWindowPriv(nxagentRootTileWindow)->window = None; - nxagentRootTileWindow = None; - } - pWindowPriv->window = None; if (pWin -> optional) @@ -683,6 +654,20 @@ return True; } +/* + * from "Definition of the Porting Layer for X v11 Sample Server": + * + * This routine is a hook for when DIX moves or resizes a window. It + * should do whatever private operations need to be done when a window + * is moved or resized. For instance, if DDX keeps a pixmap tile used + * for drawing the background or border, and it keeps the tile rotated + * such that it is longword aligned to longword locations in the frame + * buffer, then you should rotate your tiles here. The actual graphics + * involved in moving the pixels on the screen and drawing the border + * are handled by CopyWindow(), below. + * + * See Xserver/fb/fbwindow.c for the sample server implementation. + */ Bool nxagentPositionWindow(WindowPtr pWin, int x, int y) { if (nxagentScreenTrap == 1) @@ -695,7 +680,7 @@ (void *) pWin, nxagentWindow(pWin), x, y); #endif - nxagentAddConfiguredWindow(pWin, CWParent | CWX | CWY | CWWidth | + nxagentAddConfiguredWindow(pWin, CWSibling | CWX | CWY | CWWidth | CWHeight | CWBorderWidth); return True; @@ -769,7 +754,12 @@ else { nxagentFullscreenWindow = None; - nxagentUngrabPointerAndKeyboard(NULL); + + /* if we had AutoGrab before entering fullscreen reactivate it now */ + if (nxagentOption(AutoGrab)) + nxagentGrabPointerAndKeyboard(NULL); + else + nxagentUngrabPointerAndKeyboard(NULL); } } @@ -799,6 +789,11 @@ } w = nxagentDefaultWindows[pScreen -> myNum]; + + /* + * override_redirect makes the window manager ignore the window and + * not add decorations, see ICCCM) + */ attributes.override_redirect = switchOn; valuemask = CWOverrideRedirect; XUnmapWindow(nxagentDisplay, w); @@ -812,7 +807,6 @@ * Change to fullscreen mode. */ - struct timeval timeout; int i; XEvent e; @@ -837,10 +831,7 @@ XSync(nxagentDisplay, 0); - timeout.tv_sec = 0; - timeout.tv_usec = 50 * 1000; - - nxagentWaitEvents(nxagentDisplay, &timeout); + nxagentWaitEvents(nxagentDisplay, 50); } if (i < 100) @@ -971,14 +962,28 @@ } } - if (nxagentOption(WMBorderWidth) > 0 && nxagentOption(WMTitleHeight) > 0) + /* + * FIXME: These are 0 most of the time nowadays. The effect is, + * that the window is moving a bit to right/bottom every time + * fullscreen mode is left. To fix this query the frame extents + * from the window manager via _NET_REQUEST_FRAME_EXTENTS + */ + + if (nxagentOption(WMBorderWidth) > 0) { nxagentChangeOption(X, nxagentOption(SavedX) - nxagentOption(WMBorderWidth)); - nxagentChangeOption(Y, nxagentOption(SavedY) - nxagentOption(WMTitleHeight)); } else { nxagentChangeOption(X, nxagentOption(SavedX)); + } + + if (nxagentOption(WMTitleHeight) > 0) + { + nxagentChangeOption(Y, nxagentOption(SavedY) - nxagentOption(WMTitleHeight)); + } + else + { nxagentChangeOption(Y, nxagentOption(SavedY)); } @@ -1005,6 +1010,10 @@ XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, nxagentOption(Width), nxagentOption(Height)); + /* if we had AutoGrab before entering fullscreen reactivate it now */ + if (nxagentOption(AutoGrab)) + nxagentGrabPointerAndKeyboard(NULL); + nxagentSetPrintGeometry(pScreen -> myNum); } @@ -1218,6 +1227,15 @@ nxagentOption(Width), nxagentOption(Height)); } +/* + * This will update the window on the real X server by calling + * XConfigureWindow()/XMapWindow()/XLowerWindow()/XRaiseWindow() + * mask definesthe values that need to be updated, see e.g + * man XConfigureWindow. + * + * In addition to the bit flags known to Xorg it uses these + * self-defined ones: CW_Update, CW_Shape, CW_Map, CW_RootlessRestack. + */ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) { unsigned int valuemask; @@ -1243,7 +1261,7 @@ { if (mask & CW_RootlessRestack) { - mask = CWStackingOrder; + mask = CWStackMode; } } @@ -1258,7 +1276,7 @@ if (mask & CW_Update) { - mask |= CWX | CWY | CWWidth | CWHeight | CWBorderWidth | CWStackingOrder; + mask |= CWX | CWY | CWWidth | CWHeight | CWBorderWidth | CWStackMode; } if (mask & CWX) @@ -1337,7 +1355,7 @@ MAKE_SYNC_CONFIGURE_WINDOW; } - if (mask & CWStackingOrder && + if (mask & CWStackMode && nxagentWindowPriv(pWin)->siblingAbove != nxagentWindowSiblingAbove(pWin)) { WindowPtr pSib; @@ -1422,22 +1440,18 @@ fprintf(stderr, "nxagentConfigureWindow: Failed QueryTree request.\n "); } - if (children_return) - { - XFree(children_return); - } + SAFE_XFree(children_return); } #endif } - #ifdef NXAGENT_SPLASH /* * This should bring again the splash window * on top, so why the else clause? Is this * really needed? * * - * else if (mask & CWStackingOrder) + * else if (mask & CWStackMode) * { * if (nxagentSplashWindow) * { @@ -1456,7 +1470,6 @@ * } * } */ - #endif /* NXAGENT_SPLASH */ if (mask & CW_RootlessRestack) { @@ -1510,6 +1523,16 @@ } } +/* + * from "Definition of the Porting Layer for X v11 Sample Server": + * + * This function will be called when a window is reparented. At the + * time of the call, pWin will already be spliced into its new + * position in the window tree, and pPriorParent is its previous + * parent. This function can be NULL. + * + * We simply pass this pver to the real X server. + */ void nxagentReparentWindow(WindowPtr pWin, WindowPtr pOldParent) { if (nxagentScreenTrap) @@ -1529,6 +1552,16 @@ pWin->origin.y - wBorderWidth(pWin)); } +/* + * from "Definition of the Porting Layer for X v11 Sample Server": + * + * ChangeWindowAttributes is called whenever DIX changes window + * attributes, such as the size, front-to-back ordering, title, or + * anything of lesser severity that affects the window itself. The + * sample server implements this routine. It computes accelerators for + * quickly putting up background and border tiles. (See description of + * the set of routines stored in the WindowRec.) + */ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) { XSetWindowAttributes attributes; @@ -1822,6 +1855,7 @@ return 1; } +/* Set the WM_STATE property of pWin to the desired value */ void nxagentSetWMState(WindowPtr pWin, CARD32 desired) { Atom prop = MakeAtom("WM_STATE", strlen("WM_STATE"), True); @@ -1834,6 +1868,20 @@ } } +/* + * from "Definition of the Porting Layer for X v11 Sample Server": + * + * RealizeWindow/UnRealizeWindow: + * These routines are hooks for when DIX maps (makes visible) and + * unmaps (makes invisible) a window. It should do whatever private + * operations need to be done when these happen, such as allocating or + * deallocating structures that are only needed for visible + * windows. RealizeWindow does NOT draw the window border, background + * or contents; UnrealizeWindow does NOT erase the window or generate + * exposure events for underlying windows; this is taken care of by + * DIX. DIX does, however, call PaintWindowBackground() and + * PaintWindowBorder() to perform some of these. +-+ */ Bool nxagentRealizeWindow(WindowPtr pWin) { if (nxagentScreenTrap == 1) @@ -1844,12 +1892,12 @@ /* * Not needed. * - * nxagentConfigureWindow(pWin, CWStackingOrder); + * nxagentConfigureWindow(pWin, CWStackMode); * * nxagentFlushConfigureWindow(); */ - nxagentAddConfiguredWindow(pWin, CWStackingOrder); + nxagentAddConfiguredWindow(pWin, CWStackMode); nxagentAddConfiguredWindow(pWin, CW_Shape); /* add by dimbor */ @@ -1866,20 +1914,6 @@ #endif */ - /* - * Mapping of the root window is called by - * InitRootWindow in DIX. Skip the operation - * if we are in rootless mode. - */ - - /* - * if (!nxagentOption(Rootless) || - * nxagentRootlessWindow != pWin) - * { - * XMapWindow(nxagentDisplay, nxagentWindow(pWin)); - * } - */ - #ifdef TEST if (nxagentOption(Rootless) && nxagentLastWindowDestroyed) { @@ -1894,6 +1928,7 @@ return True; } +/* See nxagentRealizeWindow for a description */ Bool nxagentUnrealizeWindow(WindowPtr pWin) { if (nxagentScreenTrap) @@ -1918,8 +1953,6 @@ void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) { - void (*PaintWindowBackgroundBackup)(WindowPtr, RegionPtr, int); - if (pWin->backgroundState == BackgroundPixmap) { pWin->background.pixmap = nxagentVirtualPixmap(pWin->background.pixmap); @@ -1930,13 +1963,22 @@ pWin->border.pixmap = nxagentVirtualPixmap(pWin->border.pixmap); } - PaintWindowBackgroundBackup = pWin->drawable.pScreen -> PaintWindowBackground; + /* + * Call fbPaintWindow(). We need to temporarily replace + * PaintWindowBackground() by ourself because fbPaintWindow() is + * recursively calling it for parent windows, too. + */ + { + void (*PaintWindowBackgroundBackup)(WindowPtr, RegionPtr, int); + + PaintWindowBackgroundBackup = pWin->drawable.pScreen -> PaintWindowBackground; - pWin->drawable.pScreen -> PaintWindowBackground = nxagentFrameBufferPaintWindow; + pWin->drawable.pScreen -> PaintWindowBackground = nxagentFrameBufferPaintWindow; - fbPaintWindow(pWin, pRegion, what); + fbPaintWindow(pWin, pRegion, what); - pWin->drawable.pScreen -> PaintWindowBackground = PaintWindowBackgroundBackup; + pWin->drawable.pScreen -> PaintWindowBackground = PaintWindowBackgroundBackup; + } if (pWin->backgroundState == BackgroundPixmap) { @@ -2003,18 +2045,53 @@ RegionUninit(&temp); } +/* + * from "Definition of the Porting Layer for X v11 Sample Server": + * + * CopyWindow is called when a window is moved, and graphically moves + * to pixels of a window on the screen. It should not change any other + * state within DDX (see PositionWindow(), above). + * + * oldpt is the old location of the upper-left corner. oldRegion is + * the old region it is coming from. The new location and new region + * is stored in the WindowRec. oldRegion might modified in place by + * this routine (the sample implementation does this). + * + * CopyArea could be used, except that this operation has more + * complications. First of all, you do not want to copy a rectangle + * onto a rectangle. The original window may be obscured by other + * windows, and the new window location may be similarly + * obscured. Second, some hardware supports multiple windows with + * multiple depths, and your routine needs to take care of that. + * + * The pixels in oldRegion (with reference point oldpt) are copied to + * the window's new region (pWin->borderClip). pWin->borderClip is + * gotten directly from the window, rather than passing it as a + * parameter. + * + * The sample server implementation is in Xserver/fb/fbwindow.c. + */ void nxagentCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion) { fbCopyWindow(pWin, oldOrigin, oldRegion); } +/* + * from "Definition of the Porting Layer for X v11 Sample Server": + * + * Whenever the cliplist for a window is changed, this function is + * called to perform whatever hardware manipulations might be + * necessary. When called, the clip list and border clip regions in + * the window are set to the new values. dx,dy are the distance that + * the window has been moved (if at all). + */ void nxagentClipNotify(WindowPtr pWin, int dx, int dy) { /* - * nxagentConfigureWindow(pWin, CWStackingOrder); + * nxagentConfigureWindow(pWin, CWStackMode); */ - nxagentAddConfiguredWindow(pWin, CWStackingOrder); + nxagentAddConfiguredWindow(pWin, CWStackMode); nxagentAddConfiguredWindow(pWin, CW_Shape); #ifndef NXAGENT_SHAPE @@ -2026,6 +2103,20 @@ #endif /* NXAGENT_SHAPE */ } +/* + * from "Definition of the Porting Layer for X v11 Sample Server": + * + * The WindowExposures() routine paints the border and generates + * exposure events for the window. pRegion is an unoccluded region of + * the window, and pBSRegion is an occluded region that has backing + * store. Since exposure events include a rectangle describing what + * was exposed, this routine may have to send back a series of + * exposure events, one for each rectangle of the region. The count + * field in the expose event is a hint to the client as to the number + * of regions that are after this one. This routine must be + * provided. The sample server has a machine-independent version in + * Xserver/mi/miexpose.c. + */ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed) { /* @@ -2516,7 +2607,7 @@ * Map the icon window. */ - if (nxagentIconWindow != 0) + if (nxagentIconWindow != None) { #ifdef TEST fprintf(stderr, "nxagentMapDefaultWindows: Mapping icon window id [%ld].\n", @@ -2524,12 +2615,6 @@ #endif XMapWindow(nxagentDisplay, nxagentIconWindow); - - if (nxagentIpaq != 0) - { - XIconifyWindow(nxagentDisplay, nxagentIconWindow, - DefaultScreen(nxagentDisplay)); - } } /* @@ -3051,7 +3136,7 @@ &hints); #ifdef _XSERVER64 - free(data64); + SAFE_free(data64); #endif } } @@ -3298,7 +3383,7 @@ XDestroyImage(image); } - free(data); + SAFE_free(data); } else { @@ -3340,6 +3425,7 @@ } } +/* pass Eventmask to the real X server (for the rootless toplevel window only) */ void nxagentSetTopLevelEventMask(WindowPtr pWin) { if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) @@ -3350,26 +3436,13 @@ } /* - * This function must return 1 if we want the - * exposures to be sent as the window's extents. - * This is actually a harmless, but useful hack, - * as it speeds up the window redraws considera- - * bly, when using a very popular WM theme. + * Run nxagentConfigureWindow() on all windows in + * nxagentConfiguredWindowList and move them from the list + * afterwards. The list will be empty then. + * + * This is also taking care of entries in nxagentExposeQueue that need + * to be synchronized with the real X server. */ - -int nxagentExtentsPredicate(int total) -{ - #ifdef TEST - if (total == 6 || total == 11 || total == 10) - { - fprintf(stderr, "nxagentExtentsPredicate: WARNING! Returning [%d] with [%d] rectangles.\n", - (total == 6 || total == 11 || total == 10), total); - } - #endif - - return (total == 6 || total == 11 || total == 10); -} - void nxagentFlushConfigureWindow(void) { ConfiguredWindowStruct *index; @@ -3399,16 +3472,16 @@ if (index == nxagentConfiguredWindowList) { - free(index); + SAFE_free(index); break; } else { ConfiguredWindowStruct *tmp = index; index = index -> prev; - free(tmp); + SAFE_free(tmp); } -} + } nxagentConfiguredWindowList = NULL; @@ -3438,6 +3511,14 @@ return; } +/* + * from "Definition of the Porting Layer for X v11 Sample Server": + * + * If this routine is not NULL, DIX calls it shortly after calling + * ValidateTree, passing it the same arguments. This is useful for + * managing multi-layered framebuffers. The sample server sets this to + * NULL. + */ void nxagentPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) { /* @@ -3449,14 +3530,24 @@ return; } +/* + * Add the given window to the beginning of + * nxagentconfiguredWindowList. This list collects all windows that + * need to be reconfigured on the real X server. valuemask defines + * what changes need to be done. The required values (like position, + * size, ...) are already stored in pWin). + * + * Note that we just add the window to the list here. The actual work + * will be done by nxagentFlushConfigureWindow() later. + */ void nxagentAddConfiguredWindow(WindowPtr pWin, unsigned int valuemask) { unsigned int mask; - mask = valuemask & (CWParent | CWX | CWY | CWWidth | CWHeight | - CWBorderWidth | CWStackingOrder | CW_Map | CW_Update | CW_Shape); + mask = valuemask & (CWSibling | CWX | CWY | CWWidth | CWHeight | + CWBorderWidth | CWStackMode | CW_Map | CW_Update | CW_Shape); - valuemask &= ~(CWParent | CWX | CWY | CWWidth | CWHeight | CWBorderWidth | CWStackingOrder); + valuemask &= ~(CWSibling | CWX | CWY | CWWidth | CWHeight | CWBorderWidth | CWStackMode); if (mask & CWX && nxagentWindowPriv(pWin)->x != @@ -3493,11 +3584,11 @@ valuemask |= CWBorderWidth; } - if (mask & CWStackingOrder && + if (mask & CWStackMode && nxagentWindowPriv(pWin)->siblingAbove != nxagentWindowSiblingAbove(pWin)) { - valuemask |= CWStackingOrder; + valuemask |= CWStackMode; } { @@ -3518,6 +3609,12 @@ return; } +/* + * remove pWin from nxgentConfigureWindowList + * + * This is just updating the linked list and freeing the + * given entry. It will not perform any X stuff + */ void nxagentDeleteConfiguredWindow(WindowPtr pWin) { ConfiguredWindowStruct *index, *previous, *tmp; @@ -3532,16 +3629,14 @@ { if (index -> prev == NULL && index -> next == NULL) { - free(nxagentConfiguredWindowList); - nxagentConfiguredWindowList = NULL; - + SAFE_free(nxagentConfiguredWindowList); return; } else if (index -> prev == NULL) { tmp = nxagentConfiguredWindowList; index = nxagentConfiguredWindowList = tmp -> next; - free(tmp); + SAFE_free(tmp); nxagentConfiguredWindowList -> prev = NULL; continue; @@ -3550,7 +3645,7 @@ { tmp = index; index = index -> prev; - free(tmp); + SAFE_free(tmp); index -> next = NULL; return; @@ -3561,7 +3656,7 @@ index = index -> next; previous -> next = index; index -> prev = previous; - free(tmp); + SAFE_free(tmp); continue; } @@ -3603,16 +3698,14 @@ { if (index -> prev == NULL && index -> next == NULL) { - free(nxagentStaticResizedWindowList); - nxagentStaticResizedWindowList = NULL; - + SAFE_free(nxagentStaticResizedWindowList); return; } else if (index -> prev == NULL) { tmp = nxagentStaticResizedWindowList; index = nxagentStaticResizedWindowList = tmp -> next; - free(tmp); + SAFE_free(tmp); nxagentStaticResizedWindowList -> prev = NULL; continue; @@ -3621,7 +3714,7 @@ { tmp = index; index = index -> prev; - free(tmp); + SAFE_free(tmp); index -> next = NULL; return; @@ -3632,7 +3725,7 @@ index = index -> next; previous -> next = index; index -> prev = previous; - free(tmp); + SAFE_free(tmp); continue; } @@ -3765,8 +3858,7 @@ if ((nxagentBSPixmapList[i] != NULL) && (nxagentBSPixmapList[i] -> storingPixmapId == pixmapId)) { - free(nxagentBSPixmapList[i]); - nxagentBSPixmapList[i] = NULL; + SAFE_free(nxagentBSPixmapList[i]); if (i < BSPIXMAPLIMIT - 1) { @@ -3804,8 +3896,7 @@ { for (int i = 0; i < BSPIXMAPLIMIT; i++) { - free(nxagentBSPixmapList[i]); - nxagentBSPixmapList[i] = NULL; + SAFE_free(nxagentBSPixmapList[i]); } return 1; @@ -3813,16 +3904,16 @@ StoringPixmapPtr nxagentFindItemBSPixmapList(unsigned long pixmapId) { - int i; - - for (i = 0; i < BSPIXMAPLIMIT; i++) + for (int i = 0; i < BSPIXMAPLIMIT; i++) { if ((nxagentBSPixmapList[i] != NULL) && (nxagentBSPixmapList[i] -> storingPixmapId == pixmapId)) { #ifdef TEST - fprintf(stderr, "nxagentFindItemBSPixmapList: pixmapId [%lu].\n", pixmapId); - fprintf(stderr, "nxagentFindItemBSPixmapList: nxagentBSPixmapList[%d] -> storingPixmapId [%lu].\n", + fprintf(stderr, "%s: pixmapId [%lu].\n", __func__, pixmapId); + fprintf(stderr, "%s: nxagentBSPixmapList[%d] = [%p].\n", __func__, + i, (void *) nxagentBSPixmapList[i]); + fprintf(stderr, "%s: nxagentBSPixmapList[%d] -> storingPixmapId [%lu].\n", __func__, i, nxagentBSPixmapList[i] -> storingPixmapId); #endif @@ -3830,15 +3921,13 @@ } } - #ifdef TEST - fprintf(stderr, "nxagentFindItemBSPixmapList: WARNING! Item not found.\n"); + #ifdef WARNING + fprintf(stderr, "%s: WARNING! Item not found.\n", __func__); #endif #ifdef TEST - fprintf(stderr, "nxagentFindItemBSPixmapList: Pixmap with id [%lu] not found.\n", + fprintf(stderr, "%s: Pixmap with id [%lu] not found.\n", __func__, pixmapId); - fprintf(stderr, "nxagentBSPixmapList[%d] = [%p].\n", - i, (void *) nxagentBSPixmapList[i]); #endif return NULL; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Windows.h nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Windows.h --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/hw/nxagent/Windows.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/hw/nxagent/Windows.h 2019-12-16 06:31:54.000000000 +0000 @@ -159,9 +159,6 @@ #define nxagentDefaultWindowIsVisible() \ (nxagentVisibility != VisibilityFullyObscured) -#define CWParent CWSibling -#define CWStackingOrder CWStackMode - #define CW_Map (1 << 15) #define CW_Update (1 << 16) #define CW_Shape (1 << 17) diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/Imakefile nx-libs-3.5.99.22/nx-X11/programs/Xserver/Imakefile --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/Imakefile 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/Imakefile 2019-12-16 06:31:54.000000000 +0000 @@ -115,7 +115,7 @@ #endif #if BuildDamage DAMAGEDIR = damageext - DAMAGELIB = $(DAMAGEDIR)/libdamage.a + DAMAGELIB = $(DAMAGEDIR)/libdamageext.a #endif #if BuildComposite CWDIR = miext/cw @@ -246,7 +246,6 @@ hw/nxagent/NXpicture.o \ hw/nxagent/NXextension.o \ hw/nxagent/NXglxext.o \ - hw/nxagent/NXmiexpose.o \ hw/nxagent/NXresource.o \ hw/nxagent/NXdamage.o \ $(NULL) @@ -264,7 +263,6 @@ hw/nxagent/NXextension.o \ hw/nxagent/NXglxext.o \ hw/nxagent/NXxvdisp.o \ - hw/nxagent/NXmiexpose.o \ hw/nxagent/NXresource.o \ hw/nxagent/NXdamage.o \ $(NULL) @@ -282,7 +280,6 @@ hw/nxagent/NXextension.o \ hw/nxagent/NXglxext.o \ hw/nxagent/NXxvdisp.o \ - hw/nxagent/NXmiexpose.o \ hw/nxagent/NXresource.o \ hw/nxagent/NXdamage.o \ dix/main.o \ diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/include/dixstruct.h nx-libs-3.5.99.22/nx-X11/programs/Xserver/include/dixstruct.h --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/include/dixstruct.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/include/dixstruct.h 2019-12-16 06:31:54.000000000 +0000 @@ -37,10 +37,6 @@ * translation from client ids to server addresses. */ -#ifdef DEBUG -#define MAX_REQUEST_LOG 100 -#endif - extern CallbackListPtr ClientStateCallback; typedef struct { @@ -121,10 +117,6 @@ KeyCode minKC,maxKC; #endif -#ifdef DEBUG - unsigned char requestLog[MAX_REQUEST_LOG]; - int requestLogIndex; -#endif unsigned long replyBytesRemaining; #ifdef XCSECURITY XID authId; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/include/globals.h nx-libs-3.5.99.22/nx-X11/programs/Xserver/include/globals.h --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/include/globals.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/include/globals.h 2019-12-16 06:31:54.000000000 +0000 @@ -20,7 +20,6 @@ extern Bool loadableFonts; extern int defaultColorVisualClass; -extern Bool Must_have_memory; extern int GrabInProgress; extern char *ConnectionInfo; extern Bool noTestExtensions; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/mi/Imakefile nx-libs-3.5.99.22/nx-X11/programs/Xserver/mi/Imakefile --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/mi/Imakefile 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/mi/Imakefile 2019-12-16 06:31:54.000000000 +0000 @@ -39,15 +39,6 @@ MIINITEXTSRC = miinitext.c MIINITEXTOBJ = miinitext.o -#if (!(defined(NXAgentServer) && NXAgentServer)) -NXAGENT_SKIP_SRCS = \ - miexpose.c \ - $(NULL) -NXAGENT_SKIP_OBJS = \ - miexpose.o \ - $(NULL) -#endif - SRCS = $(CBRT_SRC) \ mivaltree.c \ mipolyseg.c \ @@ -83,7 +74,7 @@ migc.c \ micmap.c \ mioverlay.c \ - $(NXAGENT_SKIP_SRCS) \ + miexpose.c \ $(NULL) OBJS = $(CBRT_OBJ) \ @@ -121,7 +112,7 @@ migc.o \ micmap.o \ mioverlay.o \ - $(NXAGENT_SKIP_OBJS) \ + miexpose.o \ $(NULL) #if defined(XorgVersion) diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/mi/micursor.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/mi/micursor.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/mi/micursor.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/mi/micursor.c 2019-12-16 06:31:54.000000000 +0000 @@ -53,8 +53,6 @@ #include "misc.h" #include "mi.h" -extern Bool Must_have_memory; - void miRecolorCursor( pScr, pCurs, displayed) ScreenPtr pScr; @@ -65,11 +63,9 @@ * This is guaranteed to correct any color-dependent state which may have * been bound up in private state created by RealizeCursor */ - (* pScr->UnrealizeCursor)( pScr, pCurs); - Must_have_memory = TRUE; /* XXX */ - (* pScr->RealizeCursor)( pScr, pCurs); - Must_have_memory = FALSE; /* XXX */ - if ( displayed) - (* pScr->DisplayCursor)( pScr, pCurs); + pScr->UnrealizeCursor(pScr, pCurs); + pScr->RealizeCursor(pScr, pCurs); + if (displayed) + pScr->DisplayCursor(pScr, pCurs); } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/mi/miexpose.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/mi/miexpose.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/mi/miexpose.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/mi/miexpose.c 2019-12-16 06:31:54.000000000 +0000 @@ -126,7 +126,6 @@ */ -#ifndef NXAGENT_SERVER RegionPtr miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, plane) @@ -152,7 +151,7 @@ the window background */ WindowPtr pSrcWin; - BoxRec expBox; + BoxRec expBox = { 0, }; Bool extents; /* This prevents warning about pscr not being used. */ @@ -373,7 +372,6 @@ return NULL; } } -#endif /* send GraphicsExpose events, or a NoExpose event, based on the region */ @@ -491,7 +489,6 @@ free(pEvent); } -#ifndef NXAGENT_SERVER void miWindowExposures(pWin, prgn, other_exposed) WindowPtr pWin; @@ -580,7 +577,6 @@ else if (exposures && exposures != prgn) RegionDestroy(exposures); } -#endif /* this code is highly unlikely. it is not haile selassie. @@ -628,7 +624,6 @@ return 0; } -#ifndef NXAGENT_SERVER void miPaintWindow(pWin, prgn, what) register WindowPtr pWin; @@ -654,8 +649,8 @@ ChangeGCVal newValues [COUNT_BITS] = {{ 0 }}; BITS32 gcmask, index, mask; - RegionRec prgnWin; - DDXPointRec oldCorner; + RegionRec prgnWin = {0}; + DDXPointRec oldCorner = {0}; BoxRec box = {0}; WindowPtr pBgWin; GCPtr pGC; @@ -762,7 +757,10 @@ if (screenContext[i] == (GCPtr)NULL) { if (!ResType && !(ResType = CreateNewResourceType(tossGC))) + { + free(prect); return; + } screenContext[i] = CreateGC((DrawablePtr)pWin, (BITS32) 0, (XID *)NULL, &status); if (!screenContext[i]) @@ -883,7 +881,6 @@ FreeScratchGC(pGC); } } -#endif /* MICLEARDRAWABLE -- sets the entire drawable to the background color of * the GC. Useful when we have a scratch drawable and need to initialize diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/mi/migc.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/mi/migc.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/mi/migc.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/mi/migc.c 2019-12-16 06:31:54.000000000 +0000 @@ -68,11 +68,9 @@ { GCOpsPtr ret; - /* XXX */ Must_have_memory = TRUE; - ret = (GCOpsPtr) malloc(sizeof(GCOps)); - /* XXX */ Must_have_memory = FALSE; + ret = malloc(sizeof(GCOps)); if (!ret) - return 0; + return NULL; *ret = *prototype; ret->devPrivate.val = 1; return ret; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/mi/miinitext.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/mi/miinitext.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/mi/miinitext.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/mi/miinitext.c 2019-12-16 06:31:54.000000000 +0000 @@ -171,9 +171,6 @@ #endif /* FIXME: this whole block of externs should be from the appropriate headers */ -#ifdef XTESTEXT1 -extern void XTestExtension1Init(void); -#endif #ifdef SHAPE extern void ShapeExtensionInit(void); #endif @@ -231,7 +228,6 @@ */ #ifndef __DARWIN__ extern void GlxExtensionInit(void); -extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); #else extern void DarwinGlxExtensionInit(void); extern void DarwinGlxWrapInitVisuals(miInitVisualsProcPtr *); @@ -382,9 +378,6 @@ if (!noPanoramiXExtension) PanoramiXExtensionInit(); # endif #endif -#ifdef XTESTEXT1 - if (!noTestExtensions) XTestExtension1Init(); -#endif #ifdef SHAPE if (!noShapeExtension) ShapeExtensionInit(); #endif @@ -480,9 +473,7 @@ { miResetInitVisuals(); #ifdef GLXEXT -#ifndef __DARWIN__ - GlxWrapInitVisuals(&miInitVisualsProc); -#else +#ifdef __DARWIN__ DarwinGlxWrapInitVisuals(&miInitVisualsProc); #endif #endif diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/mi/miwindow.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/mi/miwindow.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/mi/miwindow.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/mi/miwindow.c 2019-12-16 06:31:54.000000000 +0000 @@ -1052,6 +1052,7 @@ * pointer to the parent, so maybe doesn't change * the attribute of the window itself. This is to * be better investigated. + * Update: Red Hat fixed this bug the same way (BZ 676270). */ if (WasViewable && pOldClip) diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/os/access.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/os/access.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/os/access.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/os/access.c 2019-12-16 06:31:54.000000000 +0000 @@ -1348,6 +1348,7 @@ if (getpeerucred(fd, &peercred) < 0) { FreeLocalClientCreds(lcc); return -1; + } lcc->euid = ucred_geteuid(peercred); if (lcc->euid != -1) lcc->fieldsSet |= LCC_UID_SET; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/os/io.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/os/io.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/os/io.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/os/io.c 2019-12-16 06:31:54.000000000 +0000 @@ -424,8 +424,6 @@ if (oci->ignoreBytes > 0) { assert(needed == oci->ignoreBytes || needed == oci->size); - oci->ignoreBytes -= gotnow; - needed = gotnow = 0; /* * The _XSERVTransRead call above may return more or fewer bytes than we * want to ignore. Ignore the smaller of the two sizes. diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/os/utils.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/os/utils.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/os/utils.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/os/utils.c 2019-12-16 06:31:54.000000000 +0000 @@ -257,8 +257,6 @@ int auditTrailLevel = 1; -Bool Must_have_memory = FALSE; - #if defined(SVR4) || defined(__linux__) || defined(CSRG_BASED) #define HAS_SAVED_IDS_AND_SETEUID #endif @@ -636,6 +634,7 @@ ErrorF("v video blanking for screen-saver\n"); ErrorF("-v screen-saver without video blanking\n"); ErrorF("-wm WhenMapped default backing-store\n"); + ErrorF("-wr create root window with white background\n"); ErrorF("-maxbigreqsize set maximal bigrequest size \n"); #ifdef PANORAMIX ErrorF("+xinerama Enable XINERAMA (PanoramiX) extension\n"); @@ -998,6 +997,8 @@ defaultScreenSaverBlanking = DontPreferBlanking; else if ( strcmp( argv[i], "-wm") == 0) defaultBackingStore = WhenMapped; + else if ( strcmp( argv[i], "-wr") == 0) + whiteRoot = TRUE; else if ( strcmp( argv[i], "-maxbigreqsize") == 0) { if(++i < argc) { long reqSizeArg = atol(argv[i]); diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/os/WaitFor.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/os/WaitFor.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/os/WaitFor.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/os/WaitFor.c 2019-12-16 06:31:54.000000000 +0000 @@ -143,13 +143,6 @@ #include #endif -#ifdef XTESTEXT1 -/* - * defined in xtestext1dd.c - */ -extern int playback_on; -#endif /* XTESTEXT1 */ - struct _OsTimerRec { OsTimerPtr next; CARD32 expires; @@ -244,13 +237,6 @@ BlockHandler((void *)&wt, (void *)&LastSelectMask); if (NewOutputPending) FlushAllOutput(); -#ifdef XTESTEXT1 - /* XXX how does this interact with new write block handling? */ - if (playback_on) { - wt = &waittime; - XTestComputeWaitTime (&waittime); - } -#endif /* XTESTEXT1 */ #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_WAKEUP) @@ -375,11 +361,7 @@ #endif selecterr = GetErrno(); WakeupHandler(i, (void *)&LastSelectMask); -#ifdef XTESTEXT1 - if (playback_on) { - i = XTestProcessInputAction (i, &waittime); - } -#endif /* XTESTEXT1 */ + SmartScheduleStartTimer (); if (i <= 0) /* An error or timeout occurred */ diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/record/set.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/record/set.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/record/set.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/record/set.c 2019-12-16 06:31:54.000000000 +0000 @@ -357,7 +357,8 @@ if (!prls) goto bailout; prls->baseSet.ops = &IntervalListSetOperations; } - memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval)); + if (nIntervals > 0) + memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval)); prls->nIntervals = nIntervals; bailout: if (stackIntervals) free(stackIntervals); diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/render/glyph.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/render/glyph.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/render/glyph.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/render/glyph.c 2019-12-16 06:31:54.000000000 +0000 @@ -144,6 +144,7 @@ return TRUE; } +#ifndef NXAGENT_SERVER GlyphRefPtr FindGlyphRef (GlyphHashPtr hash, CARD32 signature, Bool match, GlyphPtr compare) { @@ -192,6 +193,7 @@ } return gr; } +#endif CARD32 HashGlyph (GlyphPtr glyph) @@ -589,7 +591,8 @@ height = extents.y2 - extents.y1; pMaskPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, - maskFormat->depth); + maskFormat->depth, + CREATE_PIXMAP_USAGE_SCRATCH); if (!pMaskPixmap) return; component_alpha = NeedsComponent(maskFormat->format); diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/render/picture.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/render/picture.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/render/picture.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/render/picture.c 2019-12-16 06:31:54.000000000 +0000 @@ -979,6 +979,8 @@ { PicturePtr pPicture; pPicture = (PicturePtr) malloc(sizeof(PictureRec)); + if (!pPicture) + return 0; pPicture->pDrawable = 0; pPicture->pFormat = 0; pPicture->pNext = 0; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/Xext/Imakefile nx-libs-3.5.99.22/nx-X11/programs/Xserver/Xext/Imakefile --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/Xext/Imakefile 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/Xext/Imakefile 2019-12-16 06:31:54.000000000 +0000 @@ -73,21 +73,21 @@ #endif SRCS = shape.c $(SHMSRCS) xcmisc.c\ - xtest.c xtest1di.c xtest1dd.c sleepuntil.c \ + xtest.c sleepuntil.c \ bigreq.c sync.c $(SCRNSAVSRC) \ $(XF86BIGFSRCS) $(SECURITYSRCS) \ $(PNRXSRCS) $(DPMSSRCS) \ $(XVSRCS) $(XRESSRCS) $(DMXSRCS) OBJS = shape.o $(SHMOBJS) xcmisc.o \ - xtest.o xtest1di.o xtest1dd.o sleepuntil.o \ + xtest.o sleepuntil.o \ bigreq.o sync.o $(SCRNSAVOBJ) \ $(XF86BIGFOBJS) $(SECURITYOBJS) \ $(PNRXOBJS) $(DPMSOBJS) \ $(XVOBJS) $(XRESOBJS) $(DMXOBJS) SOBJS = $(SHMOBJS) $(SECURITYOBJS) \ - shape.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o $(PNRXOBJS) \ + shape.o xtest.o sleepuntil.o $(PNRXOBJS) \ $(XF86BIGFOBJS) #if defined(NXAgentServer) && NXAgentServer diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/Xext/xtest1dd.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/Xext/xtest1dd.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/Xext/xtest1dd.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/Xext/xtest1dd.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1612 +0,0 @@ -/* - * File: xtest1dd.c - * - * This file contains the device dependent parts of the input - * synthesis extension. - */ - -/* - - -Copyright 1986, 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Hewlett-Packard not be used in -advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Hewlett-Packard makes no representations about the -suitability of this software for any purpose. It is provided -"as is" without express or implied warranty. - -This software is not subject to any license of the American -Telephone and Telegraph Company or of the Regents of the -University of California. - -*/ - -/*************************************************************** - * include files - ***************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include "misc.h" -#include "dixstruct.h" -#define XTestSERVER_SIDE -#include - -#include "xtest1dd.h" - -/*************************************************************** - * defines - ***************************************************************/ - -/* - * the size of the fake input action array - */ -#define ACTION_ARRAY_SIZE 100 - -/*************************************************************** - * externals - ***************************************************************/ - -/* - * Holds the xTestInputAction event type code. - * This is defined in xtestext1di.c. - */ -extern int XTestInputActionType; -/* - * Holds the xTestFakeAck event type code. - * This is defined in xtestext1di.c. - */ -extern int XTestFakeAckType; -/* - * used in the WriteReplyToClient macro - */ -extern int exclusive_steal; - -/*************************************************************** - * variables - ***************************************************************/ - -/* - * array to hold fake input actions - */ -struct { - /* - * holds the action type, one of: XTestDELAY_ACTION, - * XTestKEY_ACTION, XTestMOTION_ACTION, XTestJUMP_ACTION - */ - CARD8 type; - /* - * holds the device type, in the range 0 to 15 - */ - CARD8 device; - /* - * for XTestKEY_ACTION type, holds the keycode - */ - CARD8 keycode; - /* - * for XTestKEY_ACTION type, holds the key up/down state - */ - CARD8 keystate; - /* - * for XTestMOTION_ACTION and XTestJUMP_ACTION types, - * holds the x and y coordinates to move the mouse to - */ - int x; - int y; - /* - * holds the time to delay (in milliseconds) before performing - * the action - */ - CARD32 delay_time; -}action_array[ACTION_ARRAY_SIZE]; - -/* - * write index for input action array - */ -static int write_index = 0; -/* - * read index for input action array - */ -static int read_index = 0; -/* - * this is where the input actions are accumulated until they are sent - * to a client (in a wire event) - */ -static xTestInputActionEvent input_action_packet; -/* - * holds the index (in bytes) into the input actions buffer in the - * current input action event - */ -static int packet_index; -/* - * logical x position of the mouse during input action gathering - */ -short xtest_mousex; -/* - * logical y position of the mouse during input action gathering - */ -short xtest_mousey; -/* - * logical x position of the mouse while we are reading fake input actions - * from the client and putting them into the fake input action array - */ -static short pmousex; -/* - * logical y position of the mouse while we are reading fake input actions - * from the client and putting them into the fake input action array - */ -static short pmousey; -/* - * The playback_on flag is set to 1 while there are input actions in the - * input action array. It is set to 0 when the server has received all of - * the user actions. - */ -int playback_on = 0; -/* - * identity of the client using XTestGetInput to get user input actions - */ -ClientPtr current_xtest_client; -/* - * if 1 send multiple input actions per XTestInputAction event; - * if 0 send one input action per XTestInputAction event - */ -static char packed_mode; -/* - * identity of the client using the XTestFakeInput function to send some - * fake input actions to the server - */ -ClientPtr playback_client = NULL; -/* - * Set to 1 when the XTestFAKE_ACK_REQUEST flag is set in a XTestFakeInput - * request. Set back to 0 when all of the input actions have been sent - * to the server. - */ -static int acknowledge = 0; -/* - * The server's idea of the current time is saved in these variables when - * a XTestFakeInput request is received. It is restored when all fake input - * actions are sent to the server or when the playback client disconnects. - */ -static int saved_sec; -static int saved_usec; -/* - * Set to 1 when there is a valid time in saved_sec and saved_usec. - */ -static int time_saved = 0; -/* - * holds the extension's notion of what the current time is while it is - * sending input actions to a client - */ -static struct timeval current_time; -/* - * holds the time when the extension should place the next fake input action - * into the server's normal events queue - */ -static struct timeval play_time; -/* - * set to 1 when play_time is first set, cleared to 0 when the - * client using the extension disconnects, or when XTestReset is called - */ -static char play_clock = 0; -/* - * holds the amount of time left until the next input action from the - * input action array can be sent to the server - */ -static struct timeval rtime; -/* - * Set to 1 after the extension is done waiting for the correct time delay - * for an input action to be sent to the server. Remains a 1 until the time - * delay for the next input action is computed. Then set to 0 if the - * extension has to wait for the correct time delay. - */ -static int go_for_next = 1; -/* - * needed to restore waitime if playback is to be aborted - */ -static struct timeval *restorewait; -/* - * tmon special command key - * - * To use the test monitor program (called tmon) efficiently, it is - * desirable to have the extension be able to recognize a special "trigger" - * key. If the extension did not do this, tmon would have to have the - * extension send all keyboard user input actions exclusively to tmon, - * only to have tmon send them right back if they were not the command key. - * - * If the extension can recognize the command key, then tmon can let the - * extension handle keyboard user input actions normally until the command - * key is pressed (and released), and only then have the extension start - * sending keyboard user input actions exclusively to tmon. - * - * Any key on the keyboard can be used for this command key. It is most - * convenient if it is a low-frequency key. If you want to generate a - * normal occurrance of this key to a client, just hit it twice. Tmon - * will recognize the first occurrance of the key, take control of the input - * actions, and wait for certain keys. If it sees another occurrance of the - * command key, it will send one occurrance of the command key to the - * extension, and go back to waiting. - * - * set and also referenced in device layer - * XXX there should be a way to set this through the protocol - */ -KeyCode xtest_command_key = 0; - -/*************************************************************** - * function declarations - ***************************************************************/ - -static void parse_key_fake( - XTestKeyInfo * /* fkey */ - ); -static void parse_motion_fake( - XTestMotionInfo * /* fmotion */ - ); -static void parse_jump_fake( - XTestJumpInfo * /* fjump */ - ); -static void parse_delay_fake( - XTestDelayInfo * /* tevent */ - ); -static void send_ack( - ClientPtr /* client */ - ); -static void start_play_clock( - void - ); -static void compute_action_time( - struct timeval * /* rtime */ - ); -static int find_residual_time( - struct timeval * /* rtime */ - ); - -static CARD16 check_time_event( - void - ); -static CARD32 current_ms( - struct timeval * /* otime */ - ); -static int there_is_room( - int /* actsize */ - ); - -/****************************************************************************** - * - * stop_stealing_input - * - * Stop stealing input actions. - */ -void -stop_stealing_input() -{ -/* - * put any code that you might need to stop stealing input actions here - */ - if (packet_index != 0) - { - /* - * if there is a partially full input action event waiting - * when this function is called, send it to the client - */ - flush_input_actions(); - } -} - -/****************************************************************************** - * - * steal_input - * - * Start stealing input actions and sending them to the passed-in client. - */ -void -steal_input(client, mode) -/* - * which client is to receive the input action events - */ -ClientPtr client; -/* - * what input action packing mode to use. one of 0, XTestPACKED_MOTION, - * or XTestPACKED_ACTIONS; optionally 'or'ed with XTestEXCLUSIVE, - */ -CARD32 mode; -{ - if (packet_index != 0) - { - /* - * if there is a partially full input action event waiting - * when this function is called, send it to the client - */ - flush_input_actions(); - } - else - { - /* - * otherwise, set up a new input action event - */ - input_action_packet.type = XTestInputActionType; - packet_index = 0; - } - /* - * set up the new input action packing mode - */ - packed_mode = mode & ~(XTestEXCLUSIVE); - /* - * keep track of where the mouse is - */ - XTestGetPointerPos(&xtest_mousex, &xtest_mousey); - /* - * keep track of which client is getting input actions - */ - current_xtest_client = client; - /* - * find out what time it is - */ - X_GETTIMEOFDAY(¤t_time); - /* - * jump to the initial position of the mouse, using a device type of 0. - */ - XTestStealJumpData(xtest_mousex, xtest_mousey, 0); -} - -/****************************************************************************** - * - * flush_input_actions - * - * Write the input actions event to the current requesting client - * and re-initialize the input action event. - */ -void -flush_input_actions() -{ - /* - * pointer to the input action event - */ - char *rep; - /* - * loop index - */ - int i; - - if (packet_index == 0) - { - /* - * empty input actions event - */ - return; - } - else if (packet_index < XTestACTIONS_SIZE) - { - /* - * fill to the end of the input actions event with 0's - */ - for (i = packet_index; i sequence; - /* - * send the input action event to the client - */ - WriteEventsToClient(current_xtest_client, 1, (xEvent *) rep); - /* - * re-initialize the input action event - */ - input_action_packet.type = XTestInputActionType; - packet_index = 0; -} - -/****************************************************************************** - * - * XTestStealJumpData - * - * Create one or more input actions and put them in the input action - * event. The input actions will be an (maybe) XTestDELAY_ACTION - * and an XTestJUMP_ACTION. - */ -void -XTestStealJumpData(jx, jy, dev_type) -/* - * the x and y coordinates to jump to - */ -int jx; -int jy; -/* - * which device caused the jump - */ -int dev_type; -{ - XTestJumpInfo *jmp_ptr; - /* - * time delta (in ms) from previous event - */ - CARD16 tchar; - - /* - * Get the time delta from the previous event. If needed, - * the check_time_event routine will put an XTestDELAY_ACTION - * type action in the input action event. - */ - tchar = check_time_event(); - if (!there_is_room(sizeof(XTestJumpInfo))) - { - /* - * If there isn't room in the input action event for - * an XTestJUMP_ACTION, then send that event to the - * client and start filling an empty one. - */ - flush_input_actions(); - } - /* - * update the logical mouse position - */ - xtest_mousex = jx; - xtest_mousey = jy; - /* - * point jmp_ptr to the correct place in the input action event - */ - jmp_ptr = (XTestJumpInfo *) - &(input_action_packet.actions[packet_index]); - /* - * compute the input action header - */ - jmp_ptr->header = (XTestPackDeviceID(dev_type) | XTestJUMP_ACTION); - /* - * set the x and y coordinates to jump to in the input action - */ - jmp_ptr->jumpx = jx; - jmp_ptr->jumpy = jy; - /* - * set the delay time in the input action - */ - jmp_ptr->delay_time = tchar; - /* - * increment the packet index by the size of the input action - */ - packet_index = packet_index + sizeof(XTestJumpInfo); - if (packed_mode == 0) - { - /* - * if input actions are not packed, send the input - * action event to the client - */ - flush_input_actions(); - } -} - -/****************************************************************************** - * - * current_ms - * - * Returns the number of milliseconds from the passed-in time to the - * current time, and then updates the passed-in time to the current time. - */ -static CARD32 -current_ms(otime) -struct timeval *otime; -{ - struct timeval tval; - unsigned long the_ms; - unsigned long sec; - unsigned long usec; - - /* - * get the current time - */ - X_GETTIMEOFDAY(&tval); - if (tval.tv_usec < otime->tv_usec) - { - /* - * borrow a second's worth of microseconds if needed - */ - usec = tval.tv_usec - otime->tv_usec + 1000000; - sec = tval.tv_sec - 1 - otime->tv_sec; - } - else - { - usec = tval.tv_usec - otime->tv_usec; - sec = tval.tv_sec - otime->tv_sec; - } - /* - * update the passed-in time to the new time - */ - *otime = tval; - /* - * compute the number of milliseconds contained in - * 'sec' seconds and 'usec' microseconds - */ - the_ms = (sec * 1000000L + usec) / 1000L; - return (the_ms); -} - -/****************************************************************************** - * - * check_time_event - * - * If time delta is > XTestSHORT_DELAY_TIME then insert a time event - * and return 0; else return the delay time. - */ -static CARD16 -check_time_event() -{ - CARD32 tstamp; - CARD16 tchar; - XTestDelayInfo *tptr; - - /* - * get the number of milliseconds between input actions - */ - tstamp = current_ms(¤t_time); - /* - * if the number of milliseconds is too large to fit in a CARD16, - * then add a XTestDELAY_ACTION to the input action event. - */ - if (tstamp > XTestSHORT_DELAY_TIME) - { - /* - * If there isn't room in the input action event for - * an XTestDELAY_ACTION, then send that event to the - * client and start filling an empty one. - */ - if (!there_is_room(sizeof(XTestDelayInfo))) - { - flush_input_actions(); - } - /* - * point tptr to the correct place in the input action event - */ - tptr = (XTestDelayInfo *) - (&(input_action_packet.actions[packet_index])); - /* - * compute the input action header - */ - tptr->header = XTestPackDeviceID(XTestDELAY_DEVICE_ID) | - XTestDELAY_ACTION; - /* - * set the delay time in the input action - */ - tptr->delay_time = tstamp; - /* - * increment the packet index by the size of the input action - */ - packet_index = packet_index + (sizeof(XTestDelayInfo)); - if (packed_mode != XTestPACKED_ACTIONS) - { - /* - * if input actions are not packed, send the input - * action event to the client - */ - flush_input_actions(); - } - /* - * set the returned delay time to 0 - */ - tchar = 0; - } - else - { - /* - * set the returned delay time to the computed delay time - */ - tchar = tstamp; - } - return(tchar); -} - -/****************************************************************************** - * - * there_is_room - * - * Checks if there is room in the input_action_packet for an input action - * of the size actsize bytes. Returns 1 if there is space, 0 otherwise. - * - */ -static int -there_is_room(actsize) -/* - * the number of bytes of space needed - */ -int actsize; -{ - if ((packet_index + actsize) > XTestACTIONS_SIZE) - { - return(0); - } - else - { - return(1); - } -} - -/****************************************************************************** - * - * XTestStealMotionData - * - * Put motion information from the locator into an input action. - * - * called from x_hil.c - */ -void -XTestStealMotionData(dx, dy, dev_type, mx, my) -/* - * the x and y delta motion of the locator - */ -int dx; -int dy; -/* - * which locator did the moving - */ -int dev_type; -/* - * the x and y position of the locator before the delta motion - */ -int mx; -int my; -{ - /* - * pointer to a XTestMOTION_ACTION input action - */ - XTestMotionInfo *fm; - /* - * time delta from previous event - */ - CARD16 tchar; - - /* - * if the current position of the locator is not the same as - * the logical position, then update the logical position - */ - if ((mx != xtest_mousex) || (my != xtest_mousey)) - { - XTestStealJumpData(mx, my, dev_type); - } - /* - * if the delta motion is outside the range that can - * be held in a motion input action, use a jump input action - */ - if ((dx > XTestMOTION_MAX) || (dx < XTestMOTION_MIN) || - (dy > XTestMOTION_MAX) || (dy < XTestMOTION_MIN)) - { - XTestStealJumpData((xtest_mousex + dx), - (xtest_mousey + dy), dev_type); - } - else - { - /* - * compute the new logical position of the mouse - */ - xtest_mousex += dx; - xtest_mousey += dy; - /* - * Get the time delta from the previous event. If needed, - * the check_time_event routine will put an XTestDELAY_ACTION - * type action in the input action event. - */ - tchar = check_time_event(); - /* - * If there isn't room in the input action event for - * an XTestDELAY_ACTION, then send that event to the - * client and start filling an empty one. - */ - if (!there_is_room(sizeof(XTestMotionInfo))) - { - flush_input_actions(); - /* - * point fm to the correct place in the input action event - */ - } - fm = (XTestMotionInfo *) - &(input_action_packet.actions[packet_index]); - /* - * compute the input action header - */ - fm->header = XTestMOTION_ACTION; - if (dx < 0) - { - fm->header |= XTestX_NEGATIVE; - dx = abs(dx); - } - if (dy < 0) - { - fm->header |= XTestY_NEGATIVE; - dy = abs(dy); - } - fm->header |= XTestPackDeviceID(dev_type); - /* - * compute the motion data byte - */ - fm->motion_data = XTestPackYMotionValue(dy); - fm->motion_data |= XTestPackXMotionValue(dx); - /* - * set the delay time in the input action - */ - fm->delay_time = tchar; - /* - * increment the packet index by the size of the input action - */ - packet_index = packet_index + sizeof(XTestMotionInfo); - if (packed_mode == 0) - { - /* - * if input actions are not packed, send the input - * action event to the client - */ - flush_input_actions(); - } - - } -} - -/****************************************************************************** - * - * XTestStealKeyData - * - * Place this key data in the input_action_packet. - * - */ -Bool -XTestStealKeyData(keycode, keystate, dev_type, locx, locy) -/* - * which key/button moved - */ -unsigned keycode; -/* - * whether the key/button was pressed or released - */ -int keystate; -/* - * which device caused the input action - */ -int dev_type; -/* - * the x and y coordinates of the locator when the action happenned - */ -int locx; -int locy; -{ - /* - * pointer to key/button motion input action - */ - XTestKeyInfo *kp; - /* - * time delta from previous event - */ - CARD16 tchar; - char keytrans = 0; - - /* - * update the logical position of the locator if the physical position - * of the locator is not the same as the logical position. - */ - if ((locx != xtest_mousex) || (locy != xtest_mousey)) - { - XTestStealJumpData(locx, locy, dev_type); - } - /* - * Get the time delta from the previous event. If needed, - * the check_time_event routine will put an XTestDELAY_ACTION - * type action in the input action event. - */ - tchar = check_time_event(); - if (!there_is_room(sizeof(XTestKeyInfo))) - { - /* - * If there isn't room in the input action event for - * an XTestDELAY_ACTION, then send that event to the - * client and start filling an empty one. - */ - flush_input_actions(); - } - /* - * point kp to the correct place in the input action event - */ - kp = (XTestKeyInfo *) - (&(input_action_packet.actions[packet_index])); - /* - * compute the input action header - */ - kp->header = XTestPackDeviceID(dev_type); - if ((keystate == KeyRelease) || (keystate == ButtonRelease)) - { - keytrans = XTestKEY_UP; - } - else if ((keystate == KeyPress) || (keystate == ButtonPress)) - { - keytrans = XTestKEY_DOWN; - } - else - { - printf("%s: invalid key/button state %d.\n", - XTestEXTENSION_NAME, - keystate); - } - kp->header = kp->header | keytrans | XTestKEY_ACTION; - /* - * set the keycode in the input action - */ - kp->keycode = keycode; - /* - * set the delay time in the input action - */ - kp->delay_time = tchar; - /* - * increment the packet index by the size of the input action - */ - packet_index = packet_index + sizeof(XTestKeyInfo); - /* - * if the command key has been released or input actions are not - * packed, send the input action event to the client - */ - if(((keycode == xtest_command_key) && (keystate == KeyRelease)) || - (packed_mode != XTestPACKED_ACTIONS)) - { - flush_input_actions(); - } - /* return TRUE if the event should be passed on to DIX */ - if (exclusive_steal) - return ((keystate == KeyRelease) && - (keycode == xtest_command_key)); - else - return ((keystate != KeyRelease) || - (keycode != xtest_command_key)); -} - -/****************************************************************************** - * - * parse_fake_input - * - * Parsing routine for a XTestFakeInput request. It will take a request - * and parse its contents into the input action array. Eventually the - * XTestProcessInputAction routine will be called to take input actions - * from the input action array and send them to the server to be handled. - */ -void -parse_fake_input(client, req) -/* - * which client did the XTestFakeInput request - */ -ClientPtr client; -/* - * a pointer to the xTestFakeInputReq structure sent by the client - */ -char *req; -{ - /* - * if set to 1, done processing input actions from the request - */ - int done = 0; - /* - * type of input action - */ - CARD8 action_type; - /* - * device type - */ - CARD8 dev_type; - /* - * pointer to an xTestFakeInputReq structure - */ - xTestFakeInputReq *request; - /* - * holds the index into the action list in the request - */ - int parse_index; - - /* - * get a correct-type pointer to the client-supplied request data - */ - request = (xTestFakeInputReq *) req; - /* - * save the acknowledge requested state for use in - * XTestProcessInputAction - */ - acknowledge = request->ack; - /* - * set up an index into the action list in the request - */ - parse_index = 0; - if (write_index >= ACTION_ARRAY_SIZE) - { - /* - * if the input action array is full, don't add any more - */ - done = 1; - } - while (!done) - { - /* - * get the type of input action in the list - */ - action_type = (request->action_list[parse_index]) - & XTestACTION_TYPE_MASK; - /* - * get the type of device in the list - */ - dev_type = XTestUnpackDeviceID(request->action_list[parse_index]); - /* - * process the input action appropriately - */ - switch (action_type) - { - case XTestKEY_ACTION: - parse_key_fake((XTestKeyInfo *) - &(request->action_list[parse_index])); - parse_index = parse_index + sizeof(XTestKeyInfo); - break; - case XTestMOTION_ACTION: - parse_motion_fake((XTestMotionInfo *) - &(request->action_list[parse_index])); - parse_index = parse_index + sizeof(XTestMotionInfo); - break; - case XTestJUMP_ACTION: - parse_jump_fake((XTestJumpInfo *) - &(request->action_list[parse_index])); - parse_index = parse_index + sizeof(XTestJumpInfo); - break; - case XTestDELAY_ACTION: - if (dev_type == XTestDELAY_DEVICE_ID) - { - parse_delay_fake((XTestDelayInfo *) - &(request->action_list[parse_index])); - parse_index = parse_index + - sizeof(XTestDelayInfo); - } - else - { - /* - * An invalid input action header byte has - * been detected, so there are no more - * input actions in this request. - * The intended invalid action header byte - * for this case should have a value of 0. - */ - done = 1; - } - break; - } - if (parse_index >= XTestMAX_ACTION_LIST_SIZE) - { - /* - * entire XTestFakeInput request has been processed - */ - done = 1; - } - if (write_index >= ACTION_ARRAY_SIZE) - { - /* - * no room in the input actions array - */ - done = 1; - } - } - if (write_index > read_index) - { - /* - * there are fake input actions in the input action array - * to be given to the server - */ - playback_on = 1; - playback_client = client; - } -} - -/****************************************************************************** - * - * parse_key_fake - * - * Called from parse_fake_input. - * - * Copy the fake key input action from its packed form into the array of - * pending input events. - */ -static void -parse_key_fake(fkey) -XTestKeyInfo *fkey; -{ - action_array[write_index].type = XTestKEY_ACTION; - action_array[write_index].device = XTestUnpackDeviceID(fkey->header); - action_array[write_index].keycode = fkey->keycode; - action_array[write_index].keystate = fkey->header & XTestKEY_STATE_MASK; - action_array[write_index].delay_time = fkey->delay_time; - write_index++; -} - -/****************************************************************************** - * - * parse_motion_fake - * - * Called from parse_fake_input. - * - * Copy the fake motion input action from its packed form into the array of - * pending input events. - */ -static void -parse_motion_fake(fmotion) -XTestMotionInfo *fmotion; -{ - int dx; - int dy; - - dx = (XTestUnpackXMotionValue(fmotion->motion_data)); - dy = (XTestUnpackYMotionValue(fmotion->motion_data)); - if (((fmotion->header) & XTestX_SIGN_BIT_MASK) == XTestX_NEGATIVE) - { - pmousex -= dx; - } - else - { - pmousex += dx; - } - if (((fmotion->header) & XTestY_SIGN_BIT_MASK) == XTestY_NEGATIVE) - { - pmousey -= dy; - } - else - { - pmousey += dy; - } - action_array[write_index].type = XTestJUMP_ACTION; - action_array[write_index].device = XTestUnpackDeviceID(fmotion->header); - action_array[write_index].x = pmousex; - action_array[write_index].y = pmousey; - action_array[write_index].delay_time = fmotion->delay_time; - write_index++; -} - -/****************************************************************************** - * - * parse_jump_fake - * - * Called from parse_fake_input. - * - * Copy the fake jump input action from its packed form into the array of - * pending input events. - */ -static void -parse_jump_fake(fjump) -XTestJumpInfo *fjump; -{ - pmousex = fjump->jumpx; - pmousey = fjump->jumpy; - action_array[write_index].type = XTestJUMP_ACTION; - action_array[write_index].device = XTestUnpackDeviceID(fjump->header); - action_array[write_index].x = pmousex; - action_array[write_index].y = pmousey; - action_array[write_index].delay_time = fjump->delay_time; - write_index++; -} - -/****************************************************************************** - * - * parse_delay_fake - * - * Called from parse_fake_input. - * - * Copy the fake delay input action from its packed form into the array of - * pending input events. - */ -static void -parse_delay_fake(tevent) -XTestDelayInfo *tevent; -{ - action_array[write_index].type = XTestDELAY_ACTION; - action_array[write_index].delay_time = tevent->delay_time; - write_index++; -} - -/****************************************************************************** - * - * XTestComputeWaitTime - * - * Compute the amount of time the server should wait before sending the - * next monitor event in playback mode. - */ -void -XTestComputeWaitTime(waittime) -struct timeval *waittime; -{ - /* - * The playback_on flag is set to 1 in parse_fake_input. It is set to - * 0 in XTestProcessInputAction if the server has replayed all input - * actions. - */ - if (playback_on) - { - if (!play_clock) - { - /* - * if the playback clock has never been set, - * then do it now - */ - start_play_clock(); - } - /* - * We need to save the waittime the first time through. This - * is a value the server uses, and we have to restore it when - * all of the input actions are processed by the server. - */ - if (!time_saved) - { - saved_sec = waittime->tv_sec; - saved_usec = waittime->tv_usec; - time_saved = 1; - } - if (go_for_next) - { - /* - * if we just processed an input action, figure out - * how long to wait for the next input action - */ - compute_action_time(&rtime); - } - else - { - /* - * else just find out how much more time to wait - * on the current input action - */ - (void)find_residual_time(&rtime); - } - waittime->tv_sec = rtime.tv_sec; - waittime->tv_usec = rtime.tv_usec; - } -} - -/****************************************************************************** - * - * XTestProcessInputAction - * - * If there are any input actions in the input action array, - * then take one out and process it. - * - */ -int -XTestProcessInputAction(readable, waittime) -/* - * This is the value that a 'select' function returned just before this - * routine was called. If the select timed out, this value will be 0. - * - * This extension modifies the select call's timeout value to cause the - * select to time out when the next input action is ready to given to - * the server. This routine is called immediately after the select, to - * give it a chance to process an input action. If we have an input action - * to process and the only reason that the select returned was because it - * timed out, then we change the select value to 1 and return 1 instead of 0. - */ -int readable; -/* - * this is the timeout value that the select was called with - */ -struct timeval *waittime; -{ -int mousex, mousey; - /* - * if playback_on is 0, then the input action array is empty - */ - if (playback_on) - { - restorewait = waittime; - /* - * figure out if we need to wait for the next input action - */ - if (find_residual_time(&rtime) > 0) - { - /* - * still have to wait before processing the current - * input action - */ - go_for_next = 0; - } - else - { - /* - * don't have to wait any longer before processing - * the current input action - */ - go_for_next = 1; - } - /* - * if we have an input action to process and the only reason - * that the select returned was because it timed out, then we - * change the select value to 1 and return 1 instead of 0 - */ - if (readable == 0) - { - readable++; - } - /* - * if we don't need to wait, then get an input action from - * the input action array and process it - */ - if (go_for_next) - { - /* - * There are three possible types of input actions in - * the input action array (motion input actions are - * converted to jump input actions before being put - * into the input action array). Delay input actions - * are processed by the compute_action_time function - * which is called from XTestComputeWaitTime. The - * other two types of input actions are processed here. - */ - if (action_array[read_index].type == XTestJUMP_ACTION) - { - XTestJumpPointer( - action_array[read_index].x, - action_array[read_index].y, - action_array[read_index].device); - } - if (action_array[read_index].type == XTestKEY_ACTION) - { - GetSpritePosition(&mousex, &mousey); - XTestGenerateEvent( - action_array[read_index].device, - action_array[read_index].keycode, - action_array[read_index].keystate, - mousex, - mousey); - } - read_index++; - /* - * if all input actions are processed, then restore - * the server state - */ - if (read_index >= write_index) - { - waittime->tv_sec = saved_sec; - waittime->tv_usec = saved_usec; - time_saved = 0; - playback_on = 0; - if (acknowledge) - { - /* - * if the playback client is waiting - * for an xTestFakeAck event, send - * it to him - */ - send_ack(playback_client); - acknowledge = 0; - } - write_index = 0; - read_index = 0; - playback_client = (ClientPtr) NULL; - play_clock = 0; - } - } - } - return(readable); -} - -/****************************************************************************** - * - * send_ack - * - * send an xTestFakeAck event to the client - */ -static void -send_ack(client) -ClientPtr client; -{ - xTestFakeAckEvent rep; - - /* - * set the serial number of the xTestFakeAck event - */ - rep.sequenceNumber = client->sequence; - rep.type = XTestFakeAckType; - WriteEventsToClient(client, 1, (xEvent *) &rep); -} - -/****************************************************************************** - * - * start_play_clock - * - * start the clock for play back. - */ -static void -start_play_clock() -{ - X_GETTIMEOFDAY(&play_time); - /* - * flag that play_time is valid - */ - play_clock = 1; -} - -/****************************************************************************** - * - * compute_action_time - * - * Set the play clock to the time when the next input action should be put - * into the server's input queue. Fill the rtime structure with values - * for the delta until the time for the next input action. - */ -static void -compute_action_time(rtime) -struct timeval *rtime; -{ - /* - * holds the delay time in milliseconds - */ - unsigned long dtime; - /* - * holds the number of microseconds in the sum of the dtime value - * and the play_time value - */ - unsigned long tot_usec; - /* - * holds the number of seconds and microseconds in the - * dtime value - */ - unsigned long sec; - unsigned long usec; - /* - * holds the current time - */ - struct timeval btime; - - /* - * Put the time from the current input action in dtime - */ - dtime = action_array[read_index].delay_time; - /* - * If the current input action is a delay input action, - * add in the time from the following input action. - */ - if ((action_array[read_index].type == XTestDELAY_ACTION) && - ((read_index + 1) < write_index)) - { - read_index++; - dtime = dtime + action_array[read_index].delay_time; - } - /* - * compute the number of seconds and microseconds in the - * dtime value - */ - sec = dtime / 1000; - usec = (dtime % 1000) * 1000; - /* - * get the current time in btime - */ - X_GETTIMEOFDAY(&btime); - /* - * compute the number of microseconds in the sum of the dtime value - * and the current usec value - */ - tot_usec = btime.tv_usec + usec; - /* - * if it is greater than one second's worth, adjust the seconds - */ - if (tot_usec >= 1000000) - { - tot_usec -= 1000000; - sec++; - } - play_time.tv_usec = tot_usec; - play_time.tv_sec = btime.tv_sec + sec; - /* - * put the time until the next input action in rtime - */ - rtime->tv_sec = sec; - rtime->tv_usec = usec; -} - -/****************************************************************************** - * - * find_residual_time - * - * Find the time interval from the current time to the value in play_time. - * This is the time to wait till putting the next input action into the - * server's input queue. If the time is already up, reset play_time to - * the current time. - */ -static int -find_residual_time(the_residual) -struct timeval *the_residual; -{ - /* - * if > 0, there is time to wait. If < 0, then don't wait - */ - int wait = 1; - /* - * holds the current time - */ - struct timeval btime; - /* - * holds the current time in seconds and microseconds - */ - unsigned long bsec; - unsigned long busec; - /* - * holds the playback time in seconds and microseconds - */ - unsigned long psec; - unsigned long pusec; - - /* - * get the current time in btime - */ - X_GETTIMEOFDAY(&btime); - /* - * get the current time in seconds and microseconds - */ - bsec = btime.tv_sec; - busec = btime.tv_usec; - /* - * get the playback time in seconds and microseconds - */ - psec = play_time.tv_sec; - pusec = play_time.tv_usec; - /* - * if the current time is already later than the playback time, - * we don't need to wait - */ - if (bsec > psec) - { - wait = -1; - } - else - { - if (bsec == psec) - { - /* - * if the current and playback times have the same - * second value, then compare the microsecond values - */ - if ( busec >= pusec) - { - /* - * if the current time is already later than - * the playback time, we don't need to wait - */ - wait = -1; - } - else - { - the_residual->tv_usec = pusec - busec; - the_residual->tv_sec = 0; - } - } - else - { - if (busec > pusec) - { - /* - * 'borrow' a second's worth of microseconds - * from the seconds left to wait - */ - the_residual->tv_usec = 1000000 - busec + pusec; - psec--; - the_residual->tv_sec = psec - bsec; - } - else - { - the_residual->tv_sec = psec - bsec; - the_residual->tv_usec = pusec - busec; - } - } - } - if (wait < 0) - { - /* - * if don't need to wait, set the playback time - * to the current time - */ - X_GETTIMEOFDAY(&play_time); - /* - * set the time to wait to 0 - */ - the_residual->tv_sec = 0; - the_residual->tv_usec = 0; - } - return(wait); -} - -/****************************************************************************** - * - * abort_play_back - */ -void -abort_play_back() -{ - /* - * If we were playing back input actions at the time of the abort, - * restore the original wait time for the select in the main wait - * loop of the server - */ - if (playback_on) - { - restorewait->tv_sec = saved_sec; - restorewait->tv_usec = saved_usec; - } - /* - * make the input action array empty - */ - read_index = 0; - write_index = 0; - /* - * we are no longer playing back anything - */ - playback_on = 0; - play_clock = 0; - go_for_next = 1; - /* - * there is no valid wait time saved any more - */ - time_saved = 0; - /* - * there are no valid clients using this extension - */ - playback_client = (ClientPtr) NULL; - current_xtest_client = (ClientPtr) NULL; -} - -/****************************************************************************** - * - * return_input_array_size - * - * Return the number of input actions in the input action array. - */ -void -return_input_array_size(client) -/* - * which client to send the reply to - */ -ClientPtr client; -{ - xTestQueryInputSizeReply rep; - - rep.type = X_Reply; - /* - * set the serial number of the reply - */ - rep.sequenceNumber = client->sequence; - rep.length = 0; - rep.size_return = ACTION_ARRAY_SIZE; - WriteReplyToClient(client, - sizeof(xTestQueryInputSizeReply), - (void *) &rep); -} diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/Xext/xtest1dd.h nx-libs-3.5.99.22/nx-X11/programs/Xserver/Xext/xtest1dd.h --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/Xext/xtest1dd.h 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/Xext/xtest1dd.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,126 +0,0 @@ -/************************************************************ - -Copyright 1996 by Thomas E. Dickey - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of the above listed -copyright holder(s) not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. - -THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD -TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE -LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -********************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#ifndef XTEST1DD_H -#define XTEST1DD_H 1 - -extern short xtest_mousex; -extern short xtest_mousey; -extern int playback_on; -extern ClientPtr current_xtest_client; -extern ClientPtr playback_client; -extern KeyCode xtest_command_key; - -extern void stop_stealing_input( - void -); - -extern void -steal_input( - ClientPtr /* client */, - CARD32 /* mode */ -); - -extern void -flush_input_actions( - void -); - -extern void -XTestStealJumpData( - int /* jx */, - int /* jy */, - int /* dev_type */ -); - -extern void -XTestStealMotionData( - int /* dx */, - int /* dy */, - int /* dev_type */, - int /* mx */, - int /* my */ -); - -extern Bool -XTestStealKeyData( - unsigned /* keycode */, - int /* keystate */, - int /* dev_type */, - int /* locx */, - int /* locy */ -); - -extern void -parse_fake_input( - ClientPtr /* client */, - char * /* req */ -); - -extern void -XTestComputeWaitTime( - struct timeval * /* waittime */ -); - -extern int -XTestProcessInputAction( - int /* readable */, - struct timeval * /* waittime */ -); - -extern void -abort_play_back( - void -); - -extern void -return_input_array_size( - ClientPtr /* client */ -); - -extern void XTestGenerateEvent( - int /* dev_type */, - int /* keycode */, - int /* keystate */, - int /* mousex */, - int /* mousey */ -); - -extern void XTestGetPointerPos( - short * /* fmousex */, - short * /* fmousey */ -); - -extern void XTestJumpPointer( - int /* jx */, - int /* jy */, - int /* dev_type */ -); - -#endif /* XTEST1DD_H */ diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/Xext/xtest1di.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/Xext/xtest1di.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/Xext/xtest1di.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/Xext/xtest1di.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,915 +0,0 @@ -/* - * File: xtest1di.c - * - * This file contains the device independent parts of the input - * synthesis extension. - */ - -/* - - -Copyright 1986, 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation - -Permission to use, copy, modify, and distribute this -software and its documentation for any purpose and without -fee is hereby granted, provided that the above copyright -notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting -documentation, and that the name of Hewlett-Packard not be used in -advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Hewlett-Packard makes no representations about the -suitability of this software for any purpose. It is provided -"as is" without express or implied warranty. - -This software is not subject to any license of the American -Telephone and Telegraph Company or of the Regents of the -University of California. - -*/ - -/***************************************************************************** - * include files - ****************************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include -#include -#include "misc.h" -#include "os.h" -#include "gcstruct.h" -#include "extnsionst.h" -#include "dixstruct.h" -#include "opaque.h" -#define XTestSERVER_SIDE -#include - -#include "xtest1dd.h" - -/***************************************************************************** - * defines - ****************************************************************************/ - -/***************************************************************************** - * variables - ****************************************************************************/ - -/* - * Holds the request type code for this extension. The request type code - * for this extension may vary depending on how many extensions are installed - * already, so the initial value given below will be added to the base request - * code that is aquired when this extension is installed. - */ -static int XTestReqCode = 0; -/* - * Holds the two event type codes for this extension. The event type codes - * for this extension may vary depending on how many extensions are installed - * already, so the initial values given below will be added to the base event - * code that is aquired when this extension is installed. - */ -int XTestInputActionType = 0; -int XTestFakeAckType = 1; -/* - * true => monitor stealing input - */ -int on_steal_input = FALSE; -/* - * true => monitor alone getting input - */ -int exclusive_steal = FALSE; -/* - * holds the resource type assigned to this extension - */ -static RESTYPE XTestType; -/* - * holds the resource ID for the client currently using XTestGetInput - */ -static XID current_client_id; - -/***************************************************************************** - * function declarations - ****************************************************************************/ - -static DISPATCH_PROC(ProcXTestDispatch); -static DISPATCH_PROC(SProcXTestDispatch); -static DISPATCH_PROC(ProcTestFakeInput); -static DISPATCH_PROC(SProcTestFakeInput); -static DISPATCH_PROC(ProcTestGetInput); -static DISPATCH_PROC(SProcTestGetInput); -static DISPATCH_PROC(ProcTestStopInput); -static DISPATCH_PROC(SProcTestStopInput); -static DISPATCH_PROC(ProcTestReset); -static DISPATCH_PROC(SProcTestReset); -static DISPATCH_PROC(ProcTestQueryInputSize); -static DISPATCH_PROC(SProcTestQueryInputSize); - -static void XTestResetProc( - ExtensionEntry * /* unused */ - ); -static void SReplyXTestDispatch( - ClientPtr /* client_ptr */, - int /* size */, - char * /* reply_ptr */ - ); -static void SEventXTestDispatch( - xEvent * /* from */, - xEvent * /* to */ - ); - -static int XTestCurrentClientGone( - void * /* value */, - XID /* id */ - ); - -/***************************************************************************** - * - * XTestExtension1Init - * - * Called from InitExtensions in main() or from QueryExtension() if the - * extension is dynamically loaded. - * - * XTestExtension1Init has no events or errors - * (other than the core errors). - */ -void -XTestExtension1Init(void) -{ - /* - * holds the pointer to the extension entry structure - */ - ExtensionEntry *extEntry; - - extEntry = AddExtension(XTestEXTENSION_NAME, - XTestEVENT_COUNT, - 0, - ProcXTestDispatch, - SProcXTestDispatch, - XTestResetProc, - StandardMinorOpcode); - if (extEntry) - { - /* - * remember the request code assigned to this extension - */ - XTestReqCode = extEntry->base; - /* - * make an atom saying that this extension is present - */ - (void) MakeAtom(XTestEXTENSION_NAME, - strlen(XTestEXTENSION_NAME), - TRUE); - /* - * remember the event codes assigned to this extension - */ - XTestInputActionType += extEntry->eventBase; - XTestFakeAckType += extEntry->eventBase; - /* - * install the routine to handle byte-swapping the replies - * for this extension in the ReplySwapVector table - */ - ReplySwapVector[XTestReqCode] = (ReplySwapPtr) SReplyXTestDispatch; - /* - * install the routine to handle byte-swapping the events - * for this extension in the EventSwapVector table - */ - EventSwapVector[XTestInputActionType] = SEventXTestDispatch; - EventSwapVector[XTestFakeAckType] = SEventXTestDispatch; - /* - * get the resource type for this extension - */ - XTestType = CreateNewResourceType(XTestCurrentClientGone); - if (XTestType == 0) - { - FatalError("XTestExtension1Init: CreateNewResourceType failed\n"); - } - } - else - { - FatalError("XTestExtension1Init: AddExtensions failed\n"); - } -} - -/***************************************************************************** - * - * ProcXTestDispatch - * - * - */ -static int -ProcXTestDispatch(client) - register ClientPtr client; -{ - REQUEST(xReq); - if (stuff->data == X_TestFakeInput) - { - return(ProcTestFakeInput(client)); - } - else if (stuff->data == X_TestGetInput) - { - return(ProcTestGetInput(client)); - } - else if (stuff->data == X_TestStopInput) - { - return(ProcTestStopInput(client)); - } - else if (stuff->data == X_TestReset) - { - return(ProcTestReset(client)); - } - else if (stuff->data == X_TestQueryInputSize) - { - return(ProcTestQueryInputSize(client)); - } - else - { - SendErrorToClient(client, - XTestReqCode, - stuff->data, - None, - BadRequest); - return(BadRequest); - } -} - -/***************************************************************************** - * - * SProcXTestDispatch - * - * - */ -static int -SProcXTestDispatch(client) - register ClientPtr client; -{ - REQUEST(xReq); - if (stuff->data == X_TestFakeInput) - { - return(SProcTestFakeInput(client)); - } - else if (stuff->data == X_TestGetInput) - { - return(SProcTestGetInput(client)); - } - else if (stuff->data == X_TestStopInput) - { - return(SProcTestStopInput(client)); - } - else if (stuff->data == X_TestReset) - { - return(SProcTestReset(client)); - } - else if (stuff->data == X_TestQueryInputSize) - { - return(SProcTestQueryInputSize(client)); - } - else - { - SendErrorToClient(client, - XTestReqCode, - stuff->data, - None, - BadRequest); - return(BadRequest); - } -} - -/***************************************************************************** - * - * SProcTestFakeInput - * - * - */ -static int -SProcTestFakeInput(client) - register ClientPtr client; -{ - /* - * index counter - */ - int i; - /* - * pointer to the next input action in the request - */ - CARD8 *input_action_ptr; - /* - * holds the type of the next input action in the request - */ - int input_action_type; - - REQUEST(xTestFakeInputReq); - /* - * byte-swap the fields in the request - */ - swaps(&stuff->length); - swapl(&stuff->ack); - /* - * have to parse and then byte-swap the input action list here - */ - for (i = 0; i < XTestMAX_ACTION_LIST_SIZE;) - { - /* - * point to the next input action in the request - */ - input_action_ptr = &(((xTestFakeInputReq *) stuff)->action_list[i]); - /* - * figure out what type of input action it is - */ - input_action_type = (*input_action_ptr) & XTestACTION_TYPE_MASK; - /* - * byte-swap the input action according to it's type - */ - switch (input_action_type) - { - case XTestKEY_ACTION: - /* - * byte-swap the delay_time field - */ - swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time)); - /* - * advance to the next input action - */ - i += sizeof(XTestKeyInfo); - break; - case XTestMOTION_ACTION: - /* - * byte-swap the delay_time field - */ - swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time)); - /* - * advance to the next input action - */ - i += sizeof(XTestMotionInfo); - break; - case XTestJUMP_ACTION: - /* - * byte-swap the jumpx field - */ - swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx)); - /* - * byte-swap the jumpy field - */ - swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy)); - /* - * byte-swap the delay_time field - */ - swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time)); - /* - * advance to the next input action - */ - i += sizeof(XTestJumpInfo); - break; - default: - /* - * if this is a delay input action, then byte-swap it, - * otherwise we have reached the end of the input - * actions in this request - */ - if (XTestUnpackDeviceID(*input_action_ptr) == - XTestDELAY_DEVICE_ID) - { - /* - * byte-swap the delay_time field - */ - swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time)); - /* - * advance to the next input action - */ - i += sizeof(XTestDelayInfo); - } - else - { - /* - * if the input action header byte is 0 or - * ill-formed, then there are no more input - * actions in this request - */ - i = XTestMAX_ACTION_LIST_SIZE; - } - break; - } - } - return(ProcTestFakeInput(client)); -} - -/***************************************************************************** - * - * SProcTestGetInput - * - * - */ -static int -SProcTestGetInput(client) - register ClientPtr client; -{ - REQUEST(xTestGetInputReq); - /* - * byte-swap the fields in the request - */ - swaps(&stuff->length); - swapl(&stuff->mode); - return(ProcTestGetInput(client)); -} - -/***************************************************************************** - * - * SProcTestStopInput - * - * - */ -static int -SProcTestStopInput(client) - register ClientPtr client; -{ - REQUEST(xTestStopInputReq); - /* - * byte-swap the length field in the request - */ - swaps(&stuff->length); - return(ProcTestStopInput(client)); -} - -/***************************************************************************** - * - * SProcTestReset - * - * - */ -static int -SProcTestReset(client) - register ClientPtr client; -{ - REQUEST(xTestResetReq); - /* - * byte-swap the length field in the request - */ - swaps(&stuff->length); - return(ProcTestReset(client)); -} - -/***************************************************************************** - * - * SProcTestQueryInputSize - * - * - */ -static int -SProcTestQueryInputSize(client) - register ClientPtr client; -{ - REQUEST(xTestQueryInputSizeReq); - /* - * byte-swap the length field in the request - */ - swaps(&stuff->length); - return(ProcTestQueryInputSize(client)); -} - -/***************************************************************************** - * - * ProcTestFakeInput - * - * - */ -static int -ProcTestFakeInput(client) - register ClientPtr client; -{ - REQUEST(xTestFakeInputReq); - REQUEST_SIZE_MATCH(xTestFakeInputReq); - - if (playback_client == NULL) - { - playback_client = client; - current_client_id = FakeClientID(client->index); - AddResource(current_client_id, - XTestType, - 0); - MakeClientGrabImpervious(client); - } - if (playback_client == client) - { - /* - * This extension does not need to clean up any - * server state when a client using this function - * "goes away". The server will just process any - * input actions that have already been sent to it, - * and will then reset its association with a client. - */ - parse_fake_input(client, (char *)stuff); - return(Success); - } - else - { - /* - * this is a request by another client to send fake - * input while the server is still being used - */ - SendErrorToClient(client, - XTestReqCode, - X_TestFakeInput, - None, - BadAccess); - return(BadAccess); - } -} - -/***************************************************************************** - * - * ProcTestGetInput - * - * - */ -static int -ProcTestGetInput(client) - register ClientPtr client; -{ - REQUEST(xTestGetInputReq); - REQUEST_SIZE_MATCH(xTestGetInputReq); - if (on_steal_input) - { - /* - * this is a request by another client to get fake input - * while the server is still sending input to the first client - */ - SendErrorToClient(client, - XTestReqCode, - X_TestGetInput, - None, - BadAccess); - return(BadAccess); - } - else - { - /* - * Set up a resource associated with the client using this - * function so that this extension gets called when the - * client "goes away". This allows this extension to - * clean up the server state. - */ - current_client_id = FakeClientID(client->index); - AddResource(current_client_id, - XTestType, - 0); - /* - * indicate that a client is stealing input - */ - on_steal_input = TRUE; - if ((stuff->mode & XTestEXCLUSIVE) == 0) - { - exclusive_steal = FALSE; - } - else - { - exclusive_steal = TRUE; - } - steal_input(client, stuff->mode); - return(Success); - } -} - -/***************************************************************************** - * - * ProcTestStopInput - * - * - */ -static int -ProcTestStopInput(client) - register ClientPtr client; -{ - REQUEST_SIZE_MATCH(xTestStopInputReq); - if (on_steal_input && (current_xtest_client == client)) - { - on_steal_input = FALSE; - exclusive_steal = FALSE; - stop_stealing_input(); - /* - * remove the resource associated with this client - */ - FreeResource(current_client_id, RT_NONE); - return(Success); - } - else - { - /* - * this is a request to stop fake input when fake input has - * never been started or from a client that hasn't started - * fake input - */ - SendErrorToClient(client, - XTestReqCode, - X_TestStopInput, - None, - BadAccess); - return(BadAccess); - } -} - -/***************************************************************************** - * - * ProcTestReset - * - * - */ -static int -ProcTestReset(client) - register ClientPtr client; -{ - REQUEST_SIZE_MATCH(xTestResetReq); - on_steal_input = FALSE; - exclusive_steal = FALSE; - /* - * defined in xtest1dd.c - */ - stop_stealing_input(); - /* - * defined in xtest1dd.c - */ - abort_play_back(); - return(Success); -} - -/***************************************************************************** - * - * ProcTestQueryInputSize - * - * - */ -static int -ProcTestQueryInputSize(client) - register ClientPtr client; -{ - REQUEST_SIZE_MATCH(xTestQueryInputSizeReq); - /* - * defined in xtest1dd.c - */ - return_input_array_size(client); - return(Success); -} - -/***************************************************************************** - * - * XTestResetProc - * - * This function is called by the server when the server has no clients - * connected to it. It must put eveything back the way it was before - * this extension was installed. - */ -/*ARGSUSED*/ -static void -XTestResetProc(unused) - ExtensionEntry * unused; -{ - /* - * remove the routine to handle byte-swapping the replies - * for this extension in the ReplySwapVector table - */ - ReplySwapVector[XTestReqCode] = ReplyNotSwappd; - /* - * remove the routine to handle byte-swapping the events - * for this extension in the EventSwapVector table - */ - EventSwapVector[XTestInputActionType] = NotImplemented; - EventSwapVector[XTestFakeAckType] = NotImplemented; - /* - * reset the variables initialized just once at load time - */ - XTestReqCode = 0; - XTestInputActionType = 0; - XTestFakeAckType = 1; - on_steal_input = FALSE; - exclusive_steal = FALSE; - playback_client = 0; /* Don't really need this but it looks nice */ -} - -/***************************************************************************** - * - * PXTestCurrentClientGone - * - * This routine is called when a client that has asked for input actions - * to be sent to it "goes away". This routine must clean up the - * server state. - */ -/*ARGSUSED*/ -static int -XTestCurrentClientGone(value, id) - void * value; - XID id; -{ - /* - * defined in xtest1dd.c - */ - on_steal_input = FALSE; - exclusive_steal = FALSE; - /* - * defined in xtestdd.c - */ - playback_client = 0; - abort_play_back(); - return TRUE; -} - -/***************************************************************************** - * - * SReplyXTestDispatch - * - * Swap any replies defined in this extension. - */ -static void -SReplyXTestDispatch(client_ptr, size, reply_ptr) - ClientPtr client_ptr; - int size; - char *reply_ptr; -{ - /* - * pointer to xTestQueryInputSizeReply - */ - xTestQueryInputSizeReply *rep_ptr; - - /* - * there is only one reply in this extension, so byte-swap it - */ - rep_ptr = (xTestQueryInputSizeReply *) reply_ptr; - swaps(&(rep_ptr->sequenceNumber)); - swapl(&(rep_ptr->length)); - swapl(&(rep_ptr->size_return)); - /* - * now write the swapped reply to the client - */ - WriteToClient(client_ptr, size, reply_ptr); -} - -/***************************************************************************** - * - * SEventXTestDispatch - * - * Swap any events defined in this extension. - */ -static void -SEventXTestDispatch(from, to) - xEvent *from; - xEvent *to; -{ - /* - * index counter - */ - int i; - /* - * pointer to the next input action in the event - */ - CARD8 *input_action_ptr; - /* - * holds the type of the next input action in the event - */ - int input_action_type; - - - /* - * copy the type information from the "from" event to the "to" event - */ - ((xTestInputActionEvent *) to)->type = - ((xTestInputActionEvent *) from)->type; - /* - * copy the sequence number information from the "from" event to the - * "to" event - */ - ((xTestInputActionEvent *) to)->sequenceNumber = - ((xTestInputActionEvent *) from)->sequenceNumber; - /* - * byte-swap the sequence number in the "to" event - */ - swaps(&(((xTestInputActionEvent *) to)->sequenceNumber)); - /* - * If the event is an xTestInputActionEvent, then it needs more - * processing. Otherwise, it is an xTestFakeAckEvent, which - * has no other information in it. - */ - if ((((xTestInputActionEvent *) to)->type & 0x7f) == - XTestInputActionType) - { - /* - * copy the input actions from the "from" event - * to the "to" event - */ - for (i = 0; i < XTestACTIONS_SIZE; i++) - { - ((xTestInputActionEvent *) to)->actions[i] = - ((xTestInputActionEvent *) from)->actions[i]; - } - /* - * byte-swap the input actions in the "to" event - */ - for (i = 0; i < XTestACTIONS_SIZE; i++) - { - /* - * point to the next input action in the event - */ - input_action_ptr = &(((xTestInputActionEvent *) to)->actions[i]); - /* - * figure out what type of input action it is - */ - input_action_type = (*input_action_ptr) & - XTestACTION_TYPE_MASK; - /* - * byte-swap the input action according to it's type - */ - switch (input_action_type) - { - case XTestKEY_ACTION: - /* - * byte-swap the delay_time field - */ - swaps(&(((XTestKeyInfo *) input_action_ptr)->delay_time)); - /* - * advance to the next input action - */ - i += sizeof(XTestKeyInfo); - break; - case XTestMOTION_ACTION: - /* - * byte-swap the delay_time field - */ - swaps(&(((XTestMotionInfo *) input_action_ptr)->delay_time)); - /* - * advance to the next input action - */ - i += sizeof(XTestMotionInfo); - break; - case XTestJUMP_ACTION: - /* - * byte-swap the jumpx field - */ - swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpx)); - /* - * byte-swap the jumpy field - */ - swaps(&(((XTestJumpInfo *) input_action_ptr)->jumpy)); - /* - * byte-swap the delay_time field - */ - swaps(&(((XTestJumpInfo *) input_action_ptr)->delay_time)); - /* - * advance to the next input action - */ - i += sizeof(XTestJumpInfo); - break; - default: - /* - * if this is a delay input action, then - * byte-swap it, otherwise we have reached the - * end of the input actions in this event - */ - if (XTestUnpackDeviceID(*input_action_ptr) == - XTestDELAY_DEVICE_ID) - { - /* - * byte-swap the delay_time field - */ - swapl(&(((XTestDelayInfo *) input_action_ptr)->delay_time)); - /* - * advance to the next input action - */ - i += sizeof(XTestDelayInfo); - } - else - { - /* - * if the input action header byte is 0 - * or ill-formed, then there are no - * more input actions in this event - */ - i = XTestACTIONS_SIZE; - } - break; - } - } - } -} diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/Xi/chgkbd.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/Xi/chgkbd.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/Xi/chgkbd.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/Xi/chgkbd.c 2019-12-16 06:31:54.000000000 +0000 @@ -153,11 +153,9 @@ df->time = xf->time; df->traceGood = xf->traceGood; if (df->traceSize != xf->traceSize) { - Must_have_memory = TRUE; /* XXX */ df->trace = (WindowPtr *) realloc(df->trace, xf->traceSize * sizeof(WindowPtr)); - Must_have_memory = FALSE; /* XXX */ } df->traceSize = xf->traceSize; for (i = 0; i < df->traceSize; i++) diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/ddxBeep.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/ddxBeep.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/ddxBeep.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/ddxBeep.c 2019-12-16 06:31:54.000000000 +0000 @@ -142,10 +142,6 @@ next= 0; pitch= oldPitch= ctrl->bell_pitch; duration= oldDuration= ctrl->bell_duration; -#ifdef DEBUG - if (xkbDebugFlags>1) - ErrorF("beep: %d (count= %d)\n",xkbInfo->beepType,xkbInfo->beepCount); -#endif name= None; switch (xkbInfo->beepType) { default: diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/ddxCtrls.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/ddxCtrls.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/ddxCtrls.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/ddxCtrls.c 2019-12-16 06:31:54.000000000 +0000 @@ -46,12 +46,6 @@ realRepeat= ctrl->autoRepeat; if ((dev->kbdfeed)&&(XkbDDXUsesSoftRepeat(dev))) ctrl->autoRepeat= 0; -#ifdef DEBUG -if (xkbDebugFlags&0x4) { - ErrorF("XkbDDXKeybdCtrlProc: setting repeat to %d (real repeat is %d)\n", - ctrl->autoRepeat,realRepeat); -} -#endif if (dev->key && dev->key->xkbInfo && dev->key->xkbInfo->kbdProc) (*dev->key->xkbInfo->kbdProc)(dev,ctrl); ctrl->autoRepeat= realRepeat; @@ -92,23 +86,6 @@ unsigned char *rep_old, *rep_new, *rep_fb; changed= new->enabled_ctrls^old->enabled_ctrls; -#ifdef NOTDEF - if (changed&XkbRepeatKeysMask) { - if (dev->kbdfeed) { - int realRepeat; - - if (new->enabled_ctrls&XkbRepeatKeysMask) - dev->kbdfeed->ctrl.autoRepeat= realRepeat= 1; - else dev->kbdfeed->ctrl.autoRepeat= realRepeat= 0; - - if (XkbDDXUsesSoftRepeat(dev)) - dev->kbdfeed->ctrl.autoRepeat= FALSE; - if (dev->kbdfeed->CtrlProc) - (*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl); - dev->kbdfeed->ctrl.autoRepeat= realRepeat; - } - } -#endif for (rep_old = old->per_key_repeat, rep_new = new->per_key_repeat, rep_fb = dev->kbdfeed->ctrl.autoRepeats, diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/ddxList.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/ddxList.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/ddxList.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/ddxList.c 2019-12-16 06:31:54.000000000 +0000 @@ -41,14 +41,6 @@ #include #include -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - #ifdef WIN32 /* from ddxLoad.c */ extern const char* Win32TempDir(); @@ -210,9 +202,8 @@ #ifndef WIN32 in= Popen(buf,"r"); #else -#ifdef DEBUG_CMD - ErrorF("xkb executes: %s\n",buf); -#endif + if (xkbDebugFlags) + DebugF("xkb executes: %s\n",buf); if (System(buf) < 0) ErrorF("Could not invoke keymap compiler\n"); else diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/ddxLoad.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/ddxLoad.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/ddxLoad.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/ddxLoad.c 2019-12-16 06:31:54.000000000 +0000 @@ -57,14 +57,6 @@ #include #endif -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif - /* * If XKM_OUTPUT_DIR specifies a path without a leading slash, it is * relative to the top-level XKB configuration directory. @@ -166,44 +158,19 @@ #define System(x) Win32System(x) #endif -#ifdef MAKE_XKM_OUTPUT_DIR -/* Borrow trans_mkdir from Xtransutil.c to more safely make directories */ -# undef X11_t -# define TRANS_SERVER -# define PRMSG(lvl,x,a,b,c) \ - if (lvl <= 1) { LogMessage(X_ERROR,x,a,b,c); } else ((void)0) -# include -# ifndef XKM_OUTPUT_DIR_MODE -# define XKM_OUTPUT_DIR_MODE 0755 -# endif -#endif - static void OutputDirectory( char* outdir, size_t size) { #ifndef WIN32 - if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size) -#ifdef MAKE_XKM_OUTPUT_DIR - && (trans_mkdir(XKM_OUTPUT_DIR, XKM_OUTPUT_DIR_MODE) == 0) -#endif - ) + if (getuid() == 0 && (strlen(XKM_OUTPUT_DIR) < size)) { /* if server running as root it *may* be able to write */ /* FIXME: check whether directory is writable at all */ (void) strcpy (outdir, XKM_OUTPUT_DIR); } else -#endif -#ifdef _PATH_VARTMP - if ((strlen(_PATH_VARTMP) + 1) < size) - { - (void) strcpy (outdir, _PATH_VARTMP); - if (outdir[strlen(outdir) - 1] != '/') /* Hi IBM, Digital */ - (void) strcat (outdir, "/"); - } else -#endif -#ifdef WIN32 +#else if (strlen(Win32TempDir()) + 1 < size) { (void) strcpy(outdir, Win32TempDir()); @@ -264,15 +231,10 @@ xkm_output_dir,outFile) == -1) cmd = NULL; } -#ifdef DEBUG if (xkbDebugFlags) { - ErrorF("XkbDDXCompileNamedKeymap compiling keymap using:\n"); - ErrorF(" \"cmd\"\n"); + DebugF("XkbDDXCompileNamedKeymap compiling keymap using:\n"); + DebugF(" \"cmd\"\n"); } -#endif -#ifdef DEBUG_CMD - ErrorF("xkb executes: %s\n",cmd); -#endif if (System(cmd)==0) { if (nameRtrn) { strncpy(nameRtrn,outFile,nameRtrnLen); @@ -284,9 +246,7 @@ free(cmd); return True; } -#ifdef DEBUG - ErrorF("Error compiling keymap (%s)\n",names->keymap); -#endif + DebugF("Error compiling keymap (%s)\n",names->keymap); if (outFile!=NULL) _XkbFree(outFile); if (cmd!=NULL) @@ -389,7 +349,7 @@ #ifdef __sun if (Pclose(out) != 0) { - ErrorF("Warning: Spurious failure reported in Pclose() runnning 'xkbcomp'.\n"); + ErrorF("Warning: Spurious failure reported in Pclose() running 'xkbcomp'.\n"); } if (1) #else @@ -399,12 +359,8 @@ if (fclose(out)==0 && System(buf) >= 0) #endif { -#ifdef DEBUG_CMD - ErrorF("xkb executes: %s\n",buf); - ErrorF("xkbcomp input:\n"); - XkbWriteXKBKeymapForNames(stderr,names,NULL,xkb,want,need); - ErrorF("end xkbcomp input\n"); -#endif + if (xkbDebugFlags) + DebugF("xkb executes: %s\n",buf); if (nameRtrn) { strncpy(nameRtrn,keymap,nameRtrnLen); nameRtrn[nameRtrnLen-1]= '\0'; @@ -413,24 +369,20 @@ free (buf); return True; } -#ifdef DEBUG else - ErrorF("Error compiling keymap (%s)\n",keymap); -#endif + DebugF("Error compiling keymap (%s)\n",keymap); #ifdef WIN32 /* remove the temporary file */ unlink(tmpname); #endif } -#ifdef DEBUG else { #ifndef WIN32 - ErrorF("Could not invoke keymap compiler\n"); + DebugF("Could not invoke keymap compiler\n"); #else - ErrorF("Could not open file %s\n", tmpname); + DebugF("Could not open file %s\n", tmpname); #endif } -#endif if (nameRtrn) nameRtrn[0]= '\0'; if (buf != NULL) @@ -452,15 +404,16 @@ &&(!isalpha(xkm_output_dir[0]) || xkm_output_dir[1]!=':') #endif ) { - if (strlen(XkbBaseDirectory)+strlen(xkm_output_dir) - +strlen(mapName)+6 <= PATH_MAX) - { - sprintf(buf,"%s/%s%s.xkm",XkbBaseDirectory, - xkm_output_dir,mapName); - } + if (snprintf(buf, PATH_MAX, "%s/%s%s.xkm", XkbBaseDirectory, + xkm_output_dir, mapName) >= PATH_MAX) + buf[0] = '\0'; + } + else + { + if (snprintf(buf, PATH_MAX, "%s%s.xkm", xkm_output_dir, mapName) + >= PATH_MAX) + buf[0] = '\0'; } - else if (strlen(xkm_output_dir)+strlen(mapName)+5 <= PATH_MAX) - sprintf(buf,"%s%s.xkm",xkm_output_dir,mapName); if (buf[0] != '\0') file= fopen(buf,"rb"); else file= NULL; @@ -505,17 +458,13 @@ return 0; } else if (!XkbDDXCompileNamedKeymap(xkb,names,nameRtrn,nameRtrnLen)) { -#ifdef NOISY - ErrorF("Couldn't compile keymap file\n"); -#endif + DebugF("Couldn't compile keymap file\n"); return 0; } } else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need, nameRtrn,nameRtrnLen)){ -#ifdef NOISY - ErrorF("Couldn't compile keymap file\n"); -#endif + DebugF("Couldn't compile keymap file\n"); return 0; } file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX); @@ -530,11 +479,9 @@ (void) unlink (fileName); return 0; } -#ifdef DEBUG else if (xkbDebugFlags) { - ErrorF("Loaded %s, defined=0x%x\n",fileName,finfoRtrn->defined); + DebugF("Loaded %s, defined=0x%x\n",fileName,finfoRtrn->defined); } -#endif fclose(file); (void) unlink (fileName); return (need|want)&(~missing); @@ -559,9 +506,9 @@ sprintf(buf,"rules/%s",rules_name); } else { - if (strlen(XkbBaseDirectory)+strlen(rules_name)+8 > PATH_MAX) + if (snprintf(buf, PATH_MAX, "%s/rules/%s", XkbBaseDirectory, rules_name) + >= PATH_MAX) return False; - sprintf(buf,"%s/rules/%s",XkbBaseDirectory,rules_name); } if ((file= fopen(buf,"r"))==NULL) return False; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/maprules.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/maprules.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/maprules.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/maprules.c 2019-12-16 06:31:54.000000000 +0000 @@ -48,16 +48,6 @@ #include "xkbstr.h" #include -#ifdef DEBUG -#define PR_DEBUG(s) fprintf(stderr,s) -#define PR_DEBUG1(s,a) fprintf(stderr,s,a) -#define PR_DEBUG2(s,a,b) fprintf(stderr,s,a,b) -#else -#define PR_DEBUG(s) -#define PR_DEBUG1(s,a) -#define PR_DEBUG2(s,a,b) -#endif - /***====================================================================***/ #define DFLT_LINE_SIZE 128 @@ -169,8 +159,8 @@ } if (checkbang && ch=='!') { if (line->num_line!=0) { - PR_DEBUG("The '!' legal only at start of line\n"); - PR_DEBUG("Line containing '!' ignored\n"); + DebugF("The '!' legal only at start of line\n"); + DebugF("Line containing '!' ignored\n"); line->num_line= 0; inComment= 0; break; @@ -271,9 +261,7 @@ register int i; int len, ndx; _Xstrtokparams strtok_buf; -#ifdef DEBUG Bool found; -#endif l_ndx_present = v_ndx_present = present= 0; @@ -282,9 +270,7 @@ bzero((char *)remap,sizeof(RemapSpec)); remap->number = len; while ((tok=_XStrtok(str," ",strtok_buf))!=NULL) { -#ifdef DEBUG found= False; -#endif str= NULL; if (strcmp(tok,"=")==0) continue; @@ -297,22 +283,20 @@ *end != '\0' || ndx == -1) break; if (ndx < 1 || ndx > XkbNumKbdGroups) { - PR_DEBUG2("Illegal %s index: %d\n", cname[i], ndx); - PR_DEBUG1("Index must be in range 1..%d\n", + DebugF("Illegal %s index: %d\n", cname[i], ndx); + DebugF("Index must be in range 1..%d\n", XkbNumKbdGroups); break; } } else { ndx = 0; } -#ifdef DEBUG found= True; -#endif if (present&(1<num_remap= 0; return; } if ((present&COMPONENT_MASK)==0) { - PR_DEBUG("Mapping needs at least one component\n"); - PR_DEBUG("Illegal mapping ignored\n"); + DebugF("Mapping needs at least one component\n"); + DebugF("Illegal mapping ignored\n"); remap->num_remap= 0; return; } if (((present&COMPONENT_MASK)&(1<num_remap= 0; return; } @@ -432,8 +412,8 @@ } if (remap->num_remap==0) { - PR_DEBUG("Must have a mapping before first line of data\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("Must have a mapping before first line of data\n"); + DebugF("Illegal line of data ignored\n"); return False; } bzero((char *)&tmp,sizeof(FileSpec)); @@ -445,8 +425,8 @@ continue; } if (nread>remap->num_remap) { - PR_DEBUG("Too many words on a line\n"); - PR_DEBUG1("Extra word \"%s\" ignored\n",tok); + DebugF("Too many words on a line\n"); + DebugF("Extra word \"%s\" ignored\n",tok); continue; } tmp.name[remap->remap[nread].word]= tok; @@ -454,8 +434,8 @@ append = True; } if (nreadnum_remap) { - PR_DEBUG1("Too few words on a line: %s\n", line->line); - PR_DEBUG("line ignored\n"); + DebugF("Too few words on a line: %s\n", line->line); + DebugF("line ignored\n"); return False; } @@ -901,9 +881,7 @@ } if (!rules->rules) { rules->sz_rules= rules->num_rules= 0; -#ifdef DEBUG - fprintf(stderr,"Allocation failure in XkbRF_AddRule\n"); -#endif + DebugF("Allocation failure in XkbRF_AddRule\n"); return NULL; } bzero((char *)&rules->rules[rules->num_rules],sizeof(XkbRF_RuleRec)); @@ -975,9 +953,8 @@ if ((!base)||(!rules)) return False; if (locale) { - if (strlen(base)+strlen(locale)+2 > PATH_MAX) + if (snprintf(buf, PATH_MAX, "%s-%s", base, locale) >= PATH_MAX) return False; - sprintf(buf,"%s-%s", base, locale); } else { if (strlen(base)+1 > PATH_MAX) @@ -1020,7 +997,7 @@ } if (!vars->desc) { vars->sz_desc= vars->num_desc= 0; - PR_DEBUG("Allocation failure in XkbRF_AddVarDesc\n"); + DebugF("Allocation failure in XkbRF_AddVarDesc\n"); return NULL; } vars->desc[vars->num_desc].name= NULL; @@ -1057,7 +1034,7 @@ XkbRF_DescribeVarsRec); } if ((!rules->extra_names)||(!rules->extra)) { - PR_DEBUG("allocation error in extra parts\n"); + DebugF("allocation error in extra parts\n"); rules->sz_extra= rules->num_extra= 0; rules->extra_names= NULL; rules->extra= NULL; @@ -1100,7 +1077,7 @@ } if (extra_ndx<0) { XkbRF_DescribeVarsPtr var; - PR_DEBUG1("Extra heading \"%s\" encountered\n",tok); + DebugF("Extra heading \"%s\" encountered\n",tok); var= XkbRF_AddVarToDescribe(rules,tok); if (var) extra_ndx= var-rules->extra; @@ -1111,20 +1088,20 @@ } if (headingtype == HEAD_NONE) { - PR_DEBUG("Must have a heading before first line of data\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("Must have a heading before first line of data\n"); + DebugF("Illegal line of data ignored\n"); continue; } len = strlen(line.line); if ((tmp.name= strtok(line.line, " \t")) == NULL) { - PR_DEBUG("Huh? No token on line\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("Huh? No token on line\n"); + DebugF("Illegal line of data ignored\n"); continue; } if (strlen(tmp.name) == len) { - PR_DEBUG("No description found\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("No description found\n"); + DebugF("Illegal line of data ignored\n"); continue; } @@ -1132,8 +1109,8 @@ while ((*tok!='\n')&&isspace(*tok)) tok++; if (*tok == '\0') { - PR_DEBUG("No description found\n"); - PR_DEBUG("Illegal line of data ignored\n"); + DebugF("No description found\n"); + DebugF("Illegal line of data ignored\n"); continue; } tmp.desc= tok; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkbAccessX.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkbAccessX.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkbAccessX.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkbAccessX.c 2019-12-16 06:31:54.000000000 +0000 @@ -126,11 +126,9 @@ xE.u.u.type = type; xE.u.u.detail = keyCode; xE.u.keyButtonPointer.time = GetTimeInMillis(); -#ifdef DEBUG if (xkbDebugFlags&0x8) { - ErrorF("AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up")); + DebugF("AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up")); } -#endif if (!_XkbIsPressEvent(type) && isRepeat) XkbLastRepeatEvent= (void *)&xE; @@ -524,10 +522,8 @@ XkbRepeatKeysMask)) { if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key)) { -#ifdef DEBUG if (xkbDebugFlags&0x10) - ErrorF("Starting software autorepeat...\n"); -#endif + DebugF("Starting software autorepeat...\n"); xkbi->repeatKey = key; xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer, 0, ctrls->repeat_delay, diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkbActions.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkbActions.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkbActions.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkbActions.c 2019-12-16 06:31:54.000000000 +0000 @@ -81,6 +81,20 @@ proc,xkbUnwrapProc); } +void +XkbFreePrivates(DeviceIntPtr device) +{ + if (device && + device->devPrivates && + device->nPrivates > 0 && + xkbDevicePrivateIndex != -1 && + xkbDevicePrivateIndex < device->nPrivates) + { + free(device->devPrivates[xkbDevicePrivateIndex].ptr); + device->devPrivates[xkbDevicePrivateIndex].ptr = NULL; + } +} + #ifdef XINPUT extern void ProcessOtherEvent( xEvent * /* xE */, @@ -1142,7 +1156,6 @@ KeyClassPtr keyc; int changed,sendEvent; Bool genStateNotify; -XkbStateRec oldState; XkbAction act; XkbFilterPtr filter; Bool keyEvent; @@ -1157,7 +1170,7 @@ xkbi= keyc->xkbInfo; key= xE->u.u.detail; if ((xkbi->flags&_XkbStateNotifyInProgress)==0) { - oldState= xkbi->state; + xkbi->prev_state = xkbi->state; xkbi->flags|= _XkbStateNotifyInProgress; genStateNotify= True; } @@ -1303,11 +1316,10 @@ else if (keyEvent) FixKeyState(xE,dev); - xkbi->prev_state= oldState; XkbComputeDerivedState(xkbi); keyc->prev_state= keyc->state; keyc->state= XkbStateFieldFromRec(&xkbi->state); - changed = XkbStateChangedFlags(&oldState,&xkbi->state); + changed = XkbStateChangedFlags(&xkbi->prev_state,&xkbi->state); if (genStateNotify) { if (changed) { xkbStateNotify sn; diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkb.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkb.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkb.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkb.c 2019-12-16 06:31:54.000000000 +0000 @@ -2363,7 +2363,7 @@ else first= last= 0; if (change.map.num_modmap_keys>0) { firstMM= change.map.first_modmap_key; - lastMM= first+change.map.num_modmap_keys-1; + lastMM= firstMM + change.map.num_modmap_keys - 1; } else firstMM= lastMM= 0; if ((last>0) && (lastMM>0)) { @@ -5677,10 +5677,8 @@ return status; } else if (length!=0) { -#ifdef DEBUG ErrorF("Internal Error! BadLength in ProcXkbGetDeviceInfo\n"); ErrorF(" Wrote %d fewer bytes than expected\n",length); -#endif return BadLength; } if (stuff->wanted&(~supported)) { diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkbEvents.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkbEvents.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkbEvents.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkbEvents.c 2019-12-16 06:31:54.000000000 +0000 @@ -804,21 +804,19 @@ xkbi= pXDev->key->xkbInfo; if ( pClient->xkbClientFlags & _XkbClientInitialized ) { -#ifdef DEBUG if ((xkbDebugFlags&0x10)&& ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) { - ErrorF("XKbFilterWriteEvents:\n"); - ErrorF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state); - ErrorF(" XkbLastRepeatEvent!=xE (0x%x!=0x%x) %s\n", + DebugF("XKbFilterWriteEvents:\n"); + DebugF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state); + DebugF(" XkbLastRepeatEvent!=xE (0x%x!=0x%x) %s\n", XkbLastRepeatEvent,xE, ((XkbLastRepeatEvent!=(void *)xE)?"True":"False")); - ErrorF(" (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n", + DebugF(" (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n", pClient->xkbClientFlags, (_XkbWantsDetectableAutoRepeat(pClient)?"True":"False")); - ErrorF(" !IsRelease(%d) %s\n",xE[0].u.u.type, + DebugF(" !IsRelease(%d) %s\n",xE[0].u.u.type, (!_XkbIsReleaseEvent(xE[0].u.u.type))?"True":"False"); } -#endif /* DEBUG */ if ( (XkbLastRepeatEvent==(void *)xE) && (_XkbWantsDetectableAutoRepeat(pClient)) && (_XkbIsReleaseEvent(xE[0].u.u.type)) ) { @@ -853,13 +851,11 @@ if (xE[0].u.u.type == ButtonPress && ((xE[0].u.keyButtonPointer.state >> 7) & button_mask) == button_mask && (xkbi->lockedPtrButtons & button_mask) == button_mask) { -#ifdef DEBUG /* If the MouseKeys is pressed, and the "real" mouse is also pressed * when the mouse is released, the server does not behave properly. * Faking a release of the button here solves the problem. */ - ErrorF("Faking release of button %d\n", xE[0].u.u.detail); -#endif + DebugF("Faking release of button %d\n", xE[0].u.u.detail); XkbDDXFakePointerButton(ButtonRelease, xE[0].u.u.detail); } } @@ -868,19 +864,16 @@ for (i=0;istate; - ErrorF("XKbFilterWriteEvents (non-XKB):\n"); - ErrorF("event= 0x%04x\n",xE[0].u.keyButtonPointer.state); - ErrorF("lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods, - s->grab_mods); - ErrorF("compat lookup= 0x%02x, grab= 0x%02x\n", - s->compat_lookup_mods, - s->compat_grab_mods); + DebugF("XKbFilterWriteEvents (non-XKB):\n"); + DebugF("event= 0x%04x\n",xE[0].u.keyButtonPointer.state); + DebugF("lookup= 0x%02x, grab= 0x%02x\n",xkbi->state.lookup_mods, + xkbi->state.grab_mods); + DebugF("compat lookup= 0x%02x, grab= 0x%02x\n", + xkbi->state.compat_lookup_mods, + xkbi->state.compat_grab_mods); } -#endif if ( (type>=KeyPress)&&(type<=MotionNotify) ) { CARD16 old,new; @@ -900,9 +893,7 @@ if (type == ButtonPress && ((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask && (xkbi->lockedPtrButtons & button_mask) == button_mask) { -#ifdef DEBUG - ErrorF("Faking release of button %d\n", xE[i].u.u.detail); -#endif + DebugF("Faking release of button %d\n", xE[i].u.u.detail); XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail); } } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/XKBGAlloc.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/XKBGAlloc.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/XKBGAlloc.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/XKBGAlloc.c 2019-12-16 06:31:54.000000000 +0000 @@ -37,12 +37,6 @@ #include #include "xkbgeom.h" -#ifdef X_NOT_POSIX -#define Size_t unsigned int -#else -#define Size_t size_t -#endif - /***====================================================================***/ static void @@ -463,7 +457,7 @@ unsigned short * num, unsigned short * total, int num_new, - Size_t sz_elem) + size_t sz_elem) { if (num_new<1) return Success; @@ -708,7 +702,8 @@ for (i=0,alias=geom->key_aliases;inum_key_aliases;i++,alias++) { if (strncmp(alias->alias,aliasStr,XkbKeyNameLength)==0) { bzero(alias->real,XkbKeyNameLength); - strncpy(alias->real,realStr,XkbKeyNameLength); + memcpy(alias->real, realStr, + min(XkbKeyNameLength, strlen(realStr))); return alias; } } @@ -718,8 +713,8 @@ } alias= &geom->key_aliases[geom->num_key_aliases]; bzero(alias,sizeof(XkbKeyAliasRec)); - strncpy(alias->alias,aliasStr,XkbKeyNameLength); - strncpy(alias->real,realStr,XkbKeyNameLength); + memcpy(alias->alias, aliasStr, min(XkbKeyNameLength, strlen(aliasStr))); + memcpy(alias->real, realStr, min(XkbKeyNameLength, strlen(realStr))); geom->num_key_aliases++; return alias; } @@ -936,8 +931,8 @@ if ((row->num_keys>=row->sz_keys)&&(_XkbAllocOverlayKeys(row,1)!=Success)) return NULL; key= &row->keys[row->num_keys]; - strncpy(key->under.name,under,XkbKeyNameLength); - strncpy(key->over.name,over,XkbKeyNameLength); + memcpy(key->under.name, under, min(XkbKeyNameLength, strlen(under))); + memcpy(key->over.name, over, min(XkbKeyNameLength, strlen(over))); row->num_keys++; return key; } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkbInit.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkbInit.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkbInit.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkbInit.c 2019-12-16 06:31:54.000000000 +0000 @@ -284,10 +284,6 @@ /***====================================================================***/ -#if defined(luna) -#define XKB_DDX_PERMANENT_LOCK 1 -#endif - #include "xkbDflts.h" static Bool @@ -394,15 +390,6 @@ names->indicators[LED_COMPOSE-1] = CREATE_ATOM("Compose"); #endif } -#ifdef DEBUG_RADIO_GROUPS - if (names->num_rg<1) { - names->radio_groups= (Atom *)_XkbCalloc(RG_COUNT, sizeof(Atom)); - if (names->radio_groups) { - names->num_rg = RG_COUNT; - names->radio_groups[RG_BOGUS_FUNCTION_GROUP]= CREATE_ATOM("BOGUS"); - } - } -#endif if (xkb->geom!=NULL) names->geometry= xkb->geom->name; else names->geometry= unknown; @@ -773,9 +760,7 @@ sli= XkbFindSrvLedInfo(pXDev,XkbDfltXIClass,XkbDfltXIId,0); if (sli && xkbi) XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask); -#ifdef DEBUG - else ErrorF("No indicator feedback in XkbFinishInit (shouldn't happen)!\n"); -#endif + else DebugF("No indicator feedback in XkbFinishInit (shouldn't happen)!\n"); return softRepeat; } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/XKBMAlloc.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/XKBMAlloc.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/XKBMAlloc.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/XKBMAlloc.c 2019-12-16 06:31:54.000000000 +0000 @@ -52,10 +52,8 @@ ((!XkbIsLegalKeycode(xkb->min_key_code))|| (!XkbIsLegalKeycode(xkb->max_key_code))|| (xkb->max_key_codemin_key_code))) { -#ifdef DEBUG -fprintf(stderr,"bad keycode (%d,%d) in XkbAllocClientMap\n", + DebugF("bad keycode (%d,%d) in XkbAllocClientMap\n", xkb->min_key_code,xkb->max_key_code); -#endif return BadValue; } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/XKBMisc.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/XKBMisc.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/XKBMisc.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/XKBMisc.c 2019-12-16 06:31:54.000000000 +0000 @@ -413,10 +413,7 @@ if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) { CARD8 old; old= xkb->ctrls->per_key_repeat[key/8]; -#ifdef RETURN_SHOULD_REPEAT - if (*XkbKeySymsPtr(xkb,key) != XK_Return) -#endif - xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8)); + xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8)); if (changes && (old!=xkb->ctrls->per_key_repeat[key/8])) changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask; } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkbPrKeyEv.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkbPrKeyEv.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkbPrKeyEv.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkbPrKeyEv.c 2019-12-16 06:31:54.000000000 +0000 @@ -52,11 +52,9 @@ xkbi= keyc->xkbInfo; key= xE->u.u.detail; -#ifdef DEBUG if (xkbDebugFlags&0x8) { - ErrorF("XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up")); + DebugF("XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up")); } -#endif if ( (xkbi->repeatKey==key) && (xE->u.u.type==KeyRelease) && ((xkbi->desc->ctrls->enabled_ctrls&XkbRepeatKeysMask)==0) ) { diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkbUtils.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkbUtils.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkbUtils.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkbUtils.c 2019-12-16 06:31:54.000000000 +0000 @@ -187,20 +187,10 @@ unsigned key,nG,explicit; KeySymsPtr pCore; int types[XkbNumKbdGroups]; -KeySym tsyms[XkbMaxSymsPerKey],*syms; +KeySym tsyms[XkbMaxSymsPerKey] = {NoSymbol},*syms; XkbMapChangesPtr mc; xkb= pXDev->key->xkbInfo->desc; -#ifdef NOTYET - if (firstmin_key_code) { - if (first>=XkbMinLegalKeyCode) { - xkb->min_key_code= first; - /* 1/12/95 (ef) -- XXX! should zero out the new maps */ - changes->map.changed|= XkbKeycodesMask; -generate a NewKeyboard notify here? - } - } -#endif if (first+num-1>xkb->max_key_code) { /* 1/12/95 (ef) -- XXX! should allow XKB structures to grow */ num= xkb->max_key_code-first+1; @@ -685,6 +675,10 @@ else group= newGroup; } else { +#ifdef NXAGENT_SERVER + /* we have seen division by zero here */ + if (ctrls->num_groups != 0) +#endif group%= ctrls->num_groups; } } diff -Nru nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkmread.c nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkmread.c --- nx-libs-3.5.99.20/nx-X11/programs/Xserver/xkb/xkmread.c 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/nx-X11/programs/Xserver/xkb/xkmread.c 2019-12-16 06:31:54.000000000 +0000 @@ -50,10 +50,6 @@ return MakeAtom(str,strlen(str),!only_if_exists); } -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif - /***====================================================================***/ static XPointer @@ -547,10 +543,8 @@ register unsigned i; for (i=0;imap->num_types;i++) { if (xkb->map->types[i].name==name) { -#ifdef DEBUG if (xkb->map->types[i].num_levels!=width) - fprintf(stderr,"Group width mismatch between key and type\n"); -#endif + DebugF("Group width mismatch between key and type\n"); return &xkb->map->types[i]; } } @@ -1072,10 +1066,8 @@ ignored_result = fread(file_info,SIZEOF(xkmFileInfo),1,file); size_toc= file_info->num_toc; if (size_toc>max_toc) { -#ifdef DEBUG - fprintf(stderr,"Warning! Too many TOC entries; last %d ignored\n", + DebugF("Warning! Too many TOC entries; last %d ignored\n", size_toc-max_toc); -#endif size_toc= max_toc; } for (i=0;itype,XkbMessage),0); break; } return NULL; @@ -1215,11 +1211,7 @@ if (result->xkb==NULL) result->xkb= XkbAllocKeyboard(); for (i=0;i&2 exit 1 fi - CPPCHECK_OPTS='--error-exitcode=0 --force --quiet' + CPPCHECK_OPTS='--error-exitcode=0 --force --quiet --suppressions-list=./static-analysis-suppressions' # we exclude some external projects - CPPCHECK_EXCLUDES='-i ./nx-X11/extras/Mesa* -i ./nx-X11/extras/Mesa_* -i nx-X11/programs/Xserver/GL/mesa*' + CPPCHECK_EXCLUDES='-i ./nx-X11/extras/ -i nx-X11/programs/Xserver/GL/mesa* -i ./.pc -i ./nx-X11/.build-exports -i ./nx-X11/exports -i ./doc' echo "$(cppcheck --version):"; cppcheck $CPPCHECK_OPTS $CPPCHECK_EXCLUDES .; fi diff -Nru nx-libs-3.5.99.20/static-analysis-suppressions nx-libs-3.5.99.22/static-analysis-suppressions --- nx-libs-3.5.99.20/static-analysis-suppressions 1970-01-01 00:00:00.000000000 +0000 +++ nx-libs-3.5.99.22/static-analysis-suppressions 2019-12-16 06:31:54.000000000 +0000 @@ -0,0 +1,26 @@ +memleak:nx-X11/programs/Xserver/dix/gc.c +memleak:nx-X11/lib/include/xtrans/Xtrans.c:982 +memleak:nx-X11/lib/include/xtrans/Xtrans.c:987 +memleak:nx-X11/lib/include/xtrans/Xtrans.c:1004 +memleak:nx-X11/lib/include/xtrans/Xtrans.c:1009 +uninitvar:nx-X11/lib/include/xtrans/Xtranssock.c:1107 +uninitvar:nx-X11/lib/include/xtrans/Xtranssock.c:1109 +uninitvar:nx-X11/lib/include/xtrans/Xtranssock.c:1146 +uninitvar:nx-X11/lib/include/xtrans/Xtranssock.c:1148 +memleak:nx-X11/lib/include/xtrans/Xtranssock.c:2446 +memleak:nx-X11/lib/include/xtrans/Xtranssock.c:2458 +nullPointer:nx-X11/programs/Xserver/Xext/security.c +nullPointerArithmetic:nx-X11/programs/Xserver/randr/rrcrtc.c +nullPointerArithmetic:nx-X11/programs/Xserver/randr/rroutput.c +nullPointerArithmetic:nx-X11/programs/Xserver/randr/rrprovider.c +nullPointerArithmetic:nx-X11/programs/Xserver/randr/rrscreen.c +memleak:nx-X11/programs/Xserver/render/render.c:2929 +memleak:nx-X11/programs/Xserver/render/render.c:2991 +memleak:nx-X11/programs/Xserver/render/render.c:3049 +memleak:nx-X11/programs/Xserver/render/render.c:3103 +memleak:nx-X11/programs/Xserver/render/render.c:3157 +memleak:nx-X11/programs/Xserver/render/render.c:3288 +doubleFree:nx-X11/programs/Xserver/hw/nxagent/Keyboard.c:1699 +uninitStructMember:nx-X11/programs/Xserver/mi/miwideline.c:190 +invalidFree:nxcomp/src/EncodeBuffer.cpp:84 +invalidFree:nxcomp/src/EncodeBuffer.cpp:106 diff -Nru nx-libs-3.5.99.20/.travis.yml nx-libs-3.5.99.22/.travis.yml --- nx-libs-3.5.99.20/.travis.yml 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/.travis.yml 2019-12-16 06:31:54.000000000 +0000 @@ -39,7 +39,7 @@ sources: - ubuntu-toolchain-r-test packages: - - g++-8 + - g++-9 # imake - xutils-dev # X11 libaries @@ -56,7 +56,7 @@ - x11-xkb-utils env: - - MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" + - MATRIX_EVAL="CC=gcc-9 && CXX=g++-9" - STATIC_ANALYSIS="no" - os: linux @@ -89,10 +89,10 @@ addons: apt: sources: - - llvm-toolchain-xenial-7 + - llvm-toolchain-xenial-8 - ubuntu-toolchain-r-test packages: - - clang-7 + - clang-8 # imake - xutils-dev # X11 libaries @@ -109,7 +109,7 @@ - x11-xkb-utils env: - - MATRIX_EVAL="CC=clang-7 && CXX=clang++-7" + - MATRIX_EVAL="CC=clang-8 && CXX=clang++-8" - STATIC_ANALYSIS="no" before_install: @@ -117,5 +117,7 @@ script: # run static analysis tools - ./run-static-analysis.sh + # print compiler version + - ${CC} --version # build all packages - make diff -Nru nx-libs-3.5.99.20/VERSION nx-libs-3.5.99.22/VERSION --- nx-libs-3.5.99.20/VERSION 2019-04-25 10:48:24.000000000 +0000 +++ nx-libs-3.5.99.22/VERSION 2019-12-16 06:31:54.000000000 +0000 @@ -1 +1 @@ -3.5.99.20 +3.5.99.22