Commit Graph

1447 Commits

Author SHA1 Message Date
Armin Novak 6950d95af0 Fix #4398: Ignore min/max info for non existing window. 2018-02-08 16:55:11 +01:00
Armin Novak ed9d86b1a3 Fixed GFX output expose. 2018-02-08 13:55:36 +01:00
Armin Novak c0ec81c3c7 Do not update client if output suppressed. 2018-02-08 11:59:00 +01:00
Armin Novak 253beda330 Fixed formatting. 2018-02-08 11:55:57 +01:00
Armin Novak 17b17d609a Fixed SuppressOutput update. 2018-02-08 11:55:15 +01:00
Bernhard Miklautz db2d1ffcce cmdline refactor: move cmd struct to extra file
Move the cmd struct to a extra header file. This allows it to only
include the header file in generate_argument_docbook.c and therefore
remove a linker dependencies.
2018-02-01 17:13:44 +01:00
Armin Novak 7f75b57fd6 Fixed memory leak. 2018-01-22 16:17:37 +01:00
Armin Novak 51e59e1f2e Check argument, xfc->window is NULL in RAILS mode 2018-01-08 13:21:03 +01:00
Armin Novak e23af1d2fc Fixed missing argument checks. 2018-01-08 13:21:02 +01:00
Armin Novak ac1d6e8153 Fixed #3676, #4269: Screen update for RAIL with GFX 2018-01-08 13:21:02 +01:00
David Fort e1cc601963
Merge pull request #4323 from akallabeth/scanbuild_fixes
Scanbuild and other warnings fixed
2018-01-08 11:16:21 +01:00
akallabeth 4077d55a6c
Merge pull request #4332 from hardening/xrandr_and_fixes
Xrandr and fixes
2018-01-08 09:20:56 +01:00
David Fort 191b8f950f Fix for #4330
Since ec027bf dynamic resolution is broken when used with egfx. Before that commit
we were tracking a server sent resize by setting a DesktopResize callback. This callback
is called when the desktop is resized by the server. Anyway the problem was that when this
callback is called, the activation sequence is not always completed, which were leading to
some freeze with 2012r2 servers (sending packets before the sequence is finished).
So with the faulty commit, we are tracking server resizes by subscribing to the Actived
event, that is called at the end of a reactivation sequence, so we're sure to not send packets
when not fully activated.
Anyway the issue that shows on (#4330) is that when you use egfx, no reactivation sequence happens,
the server only sends a ResetGraphics message with the new size, and so we miss the resized event.
This fix introduces a new GraphicsReset event, makes the display channel subscribe to that event,
and react accordingly.
2017-12-23 13:50:54 +01:00
David Fort 58b5573c82 Use more xrandr attributes when available and preserve [desktop|device]ScaleFactor
Fix a too restrictive detection of XRandr support.
Set more monitor's attributes like physical size and orientation when XRandr is
available.
Set [desktop|device]ScaleFactor when it has been given on the command line, this
should fix #4324.
2017-12-23 13:46:42 +01:00
Armin Novak 5144e6e600 Exit client thread if freerdp_connect fails
freerdp_disconnect must only be called, if the connection
was established. Otherwise all resources are cleaned up twice
leading to double free and other issues.
2017-12-22 11:09:23 +01:00
Armin Novak 9c93c6cbf3 Fixed unused variable warnings. 2017-12-21 11:04:50 +01:00
Armin Novak 1628045f67 Fullscreen without _NET_WM_FULLSCREEN_MONITORS
Some window managers do not support _NET_WM_FULLSCREEN_MONITORS.
In that case multimonitor fullscreen does not properly work, so
add a path resizing the window over all screens instead.
Based on @erbth pull request, adding proper X11 atom checks.
2017-12-20 16:54:44 +01:00
David Fort ce89a9096e disp: improve window resizing
To workaround a bug with 2012r2 servers, don't send any resize during renegociation
and don't resize at a too high rate (every 200ms is good enough).
2017-12-19 20:59:10 +01:00
David Fort 80dab90f1a disp: implement dynamic resolution for X11
If the display channel is available we use it to allow the user to resize the
xfreerdp window. When the window is resized we announce a new monitor layout and
the server reacts by doing a reactivation sequence to the new size.
The minimum window size is limited to 300x300 as 2012 servers crash horribly
if we send them a smaller layout.
2017-12-14 15:13:11 +01:00
David Fort 11ee81be60 Fix XRandr for old systems and MacOSX
We need a recent enough version of XRandr to correctly detect monitor.
Also this patch adds some typo or style fixes.
2017-12-08 10:59:38 +01:00
David Fort e064aa6a99 xfreerdp: when available use xrandr to get display infos 2017-11-29 10:38:48 +01:00
Armin Novak d81e2ec351 Fixed X11 stride on screen update. 2017-11-21 11:09:16 +01:00
Armin Novak 24233b299c Fix #4111: 15bpp color handling for brush. 2017-11-20 15:00:09 +01:00
Martin Fleisz 4ff1251488
Merge pull request #4236 from akallabeth/scan_fix_remastered
Scanbuild warning fixes
2017-11-17 13:02:46 +01:00
David Fort 6666564493
Merge pull request #4186 from RangeeGmbH/multimonitor_primary_fix
FreeRDP multimonitor: Use first command line element, then primary, …
2017-11-16 15:26:03 +01:00
Armin Novak 5ffde16883 Fixed NULL arguments and compile warnings. 2017-11-15 15:54:38 +01:00
David Fort 960b992f76
Merge pull request #4151 from ondrejholy/manpages-update-master
Manpage and /help update
2017-11-09 15:24:27 +01:00
Kai Harms e2c651bce4 FreeRDP multimonitor: Use first command line element, then primary, then fallback to 0,0 2017-11-07 10:11:29 +00:00
Armin Novak ce00f4dd8f Silence WLog_ERR messages if last error is set. 2017-11-06 14:02:22 +01:00
akallabeth e7b8833e9e
Merge pull request #4187 from hardening/multimon_fix
Multimonitor fix
2017-11-06 10:02:07 +01:00
Armin Novak afb08c9dfb X11 window title fix 2017-10-31 18:00:15 +01:00
Roman Kalashnikov 40d84d4be1
Fixed twice assigned values 2017-10-31 00:11:25 +03:00
David Fort 46c7097a86 multimon: flag the primary monitor according to the /monitors option
The first monitor of the list is considered like the primary monitor.
2017-10-17 14:31:11 +02:00
Ondrej Holy 362593629a client/X11: Mention also aliases in man page
Aliases are not currently mentioned in man page. Let's mention them.
2017-09-27 11:20:25 +02:00
Ondrej Holy 7538c86ce3 client/X11: Improve man page generation
This patch contains several improvements:
- add missing colons before format strings
- always print format string after argument
- do not duplicate format string before description
- use <replaceable> only for variables in format string
- use +/- for boolean arguments
- print also default value for all kinds of arguments
2017-09-27 11:20:25 +02:00
Ondrej Holy a49c856d78 client/X11: Remove const qualifier
Const keyword is used for some alloced strings and cast is used to
free it currently. Let's remove the unwanted const qualifier.
2017-09-27 11:20:25 +02:00
David Fort 9ac54ede6d Fix displaying of raw surfaces 2017-09-26 13:56:08 +02:00
Bernhard Miklautz 4592deee72 extend /size to allow width or height percentages (#4146)
If the size parameter is used with a percentages like /size:50% now
an additional 'w' or 'h' can be appended (like /size:50%w) to specify
where the percentage should be applied. If both or none are set the
behavior is like it was before and the percentage is applied to width
and height.
2017-09-25 09:35:49 +02:00
Bernhard Miklautz aa9ff84978 Merge pull request #4116 from ChickenPeanut/patch-1
Fixed BadValue with XCreateWindow
2017-09-21 14:50:34 +02:00
Ondrej Holy 3137caebf2 Fix colors on big endian (#4135)
* client/x11: Fix colors on big endian

The bitmaps are recieved in little endian byte order (LSBFirst in terms
of X11). This is a problem on systems, where bitmaps are expected in big
endian byte order (MSBFirst). X11 client tries to handle this situation
by different color formats (e.g. RGBX vs. BGRX), but this doesn't work.
BGRX is not MSBFirst variant of RGBX, it should be XRGB. But this would
work only for 32/24 depths, where color channels matches bytes. Let's
say to the XServer that all the bitmaps are in LSBFirst encoding instead
of changing the color formats on big endian systems.

https://github.com/FreeRDP/FreeRDP/issues/2520

* client/x11: Fix cursor color on big endian

The cursor color is wrong on big endian systems. It is not probably
possible to force bitmap_order for XcursorImage as it is possible for
XImage. Fortunately, cursors are always 32 bit so we can use ABGR
instead of BGRA to deal with.

https://github.com/FreeRDP/FreeRDP/issues/2520

* client/x11: Fix comment indentation

The comment has wrong indentation for some reason, let's fix it.

* client/x11: Fix BGR vs. RGB detection

The BGR vs. RGB detection code is leftover from history and I am conviced
that it is wrong with the current color handling, where invert flag is TRUE
by default. However, I suppose that the detection still makes sense and
XServer may use the inverted formats in some cases. Maybe we can force XServer
to use our masks somehow, but let's just fix the value to FALSE now.

* client/x11: Remove unused color shifts

The color shifts are lefover from history and are not used in current
code. Let's remove them.
2017-09-18 10:47:56 +02:00
Ondrej Holy 4239660e34 client/X11: Check arguments in xf_Bitmap_SetSurface
Arguments of xf_Bitmap_SetSurface are not checked before use currently
which may lead to segfaults. It may happen if bitmap is not found in a
cache from some reason. Let's check the arguments before use similarly
as it is done in client/Windows/wf_graphics.c in order to avoid segfaults.

https://github.com/FreeRDP/FreeRDP/issues/4117
2017-09-07 09:38:44 +02:00
ChickenPeanut 0efb07bc66 Fixed BadValue with XCreateWindow
xf_FixWindowCoordinates occasionally set the dimensions of the window to invalid values (0) because the minimum value check was done at the beginning of the method rather than at the end
2017-09-03 18:52:34 -04:00
abma 165de91287 Revert "Possible fix for #4081 and #2707 (#4087)"
This reverts most of commit 6b7b602370.

Part of #4096
2017-08-22 22:45:38 +02:00
Jiang, Zihao 790c48017c Client/X11: Fix h264 context leak when DeleteSurface (#4089) 2017-08-14 10:16:14 +02:00
Kai 6b7b602370 Possible fix for #4081 and #2707 (#4087)
* detect openbox automatically

* format code

* copyright update

* free prop at the end of the function
2017-08-14 10:10:53 +02:00
Armin Novak dd4b5ea126 Disable JPEG codec support if not compiled in. 2017-07-24 15:23:36 +02:00
Armin Novak b51a103b70 Fixed uninitialized values. 2017-07-20 09:35:41 +02:00
Armin Novak 8b9e3fa51e Fixed use of reserved keywords for include guards. 2017-07-20 09:35:41 +02:00
Armin Novak 0490aeb018 Fixed clang malloc integer overflow warnings. 2017-07-20 09:29:48 +02:00
Norbert Federa 36b8f54c5e Fixed a few compiler warnings 2017-07-10 17:52:05 +02:00
akallabeth 2f231a8e17 Merge pull request #3992 from johnjmullen/fix-barcode-scanner
Fix issue #3229 Barcode Scanner USB - missing double characters
2017-07-07 08:53:21 +02:00
weizhenwei c39aecbdb4 fix memory leak of pKeys at xf_rail_invalidate_region() 2017-06-21 15:26:28 +08:00
David Fort 5ef9232703 Merge pull request #3905 from ilammy/x11-cliprdr/file-clipping
Local-to-remote file clipping for xfreerdp
2017-06-07 21:20:34 +02:00
John Mullen de1868b6ab Fix issue #3229 Barcode Scanner USB - missing double characters
With some usb barcode scanners, repeated characters do not appear in the freerdp session.
It looks like this is because the KeyRelease signal is not sent for the first character.
Removing this if check fixes the problem.
2017-06-05 17:06:07 -04:00
ilammy ac2b13fdcc client/X11: do not fixup HTML data length
The data provided by local applications can be actually encoded in
UTF-16 (e.g., Firefox does this to HTML). UTF-16 allows embedded null
bytes so we should not use strlen() to fix up the data. The HTML format
synthesizer can handle trailing null bytes just fine and can detect
whether it deals with UTF-8 or UTF-16.
2017-05-31 05:01:30 +03:00
ilammy 34b092058f x11/cliprdr: make callbacks static
Most of the functions is this file are internal-use callbacks so they do
not need to be exported from the compilation unit. Mark functions static
as appropriate.
2017-05-24 23:05:42 +03:00
David Fort 17a4e95a5b Drop some annoying warning
Probably that some unused functions should be removed, but at least it makes
it compile with no warnings.
2017-05-12 13:54:16 +02:00
Armin Novak b1d631f1e5 Added support for Set Keyboard IME Status 2017-05-12 09:43:58 +02:00
David Fort d170c10ee6 Fix H264 in multi monitor case
The H264 context is surface specific, so in multi-monitor (with multiple surfaces)
the decoding was failing. This patch fixes that by introducing a surface specific
h264 context.
2017-05-02 18:39:33 +02:00
ilammy 82f3abac49 client/X11: teach RAIL to use clipboard redirection
XSelection protocol does not define any global clipboard as there is on
Windows. Instead each window has its own property for clipboard content
(like CLIPBOARD or PRIMARY) and there is a global notion of clipboard
ownership.  Only one window can claim ownership of some clipboard type
at the moment.

FreeRDP uses CLIPBOARD for clipboard transfers (it's the one used by
applications when Ctrl+V is pressed). For regular desktop sessions the
session window itself is used for clipboard interactions via
xfc->drawable field. However, for remote app session there is no session
window. We cannot use the current remote app window as it may change or
be destroyed without closing the session. We also cannot use the root
window as it is already used for CF_RAW transfer protocol.

Therefore we create a simple dummy window to put into xfc->drawable for
this exact job: to act as a clipboard vessel on behalf of the entire
remote app session.

xf_create_window() usually creates the window as we immediately start in
RAIL mode when possible. xf_rail_enable_remoteapp_mode() is invoked only
when autologin failed or remote desktop had to show the session window
to the user for some reason.
2017-05-01 02:10:55 +03:00
Shaun Maher b547386498 WS_EX_NOACTIVATE treated as unmanaged\nWindows that carry the WS_EX_NOACTIVATE are treated the same as WS_EX_TOOLWINDOW in that they should not be handled as normal windows by the X window manager. The prevents an issue with MS Outlook 2013 (and probably other applications) where attempting to resize the vertical columns causes some sort of WS_EX_NOACTIVATE window to be created which steals focus and aborts the resizing action. 2017-04-22 18:44:37 +10:00
Norbert Federa 263348ff2b client/x11: fix gfx drawing bug with /multimon
The surface's damage region is not relative to the output but
lives in its own universe starting at origin 0,0.

Also fixed the drawing coordinates used in the XRENDER code path
which is used with /smart-sizing
2017-04-11 12:30:37 +02:00
ilammy b9ab82214a x11/cliprdr: negotiate file streaming support
Now that we've got everything in place to handle files it's time to tell
the server that we can actually do this.

MS-RDPECLIP 3.2.5.1.3 Sending a Client Clipboard Capabilities PDU asks
us politely to not advertise file clipping support if the server did not
do that itself. Thus we need to parse the capabilities sent by the
server and take a note whether it supports file clipping.

There is also no point in advertising file clipping support if
wClipboard failed to initalize any local file subsystem, in which case
we cannot handle files for real. Take a note of this as well when we
register the file formats.

If everthing is really in place and the stars shine upon us then we are
allowed to set CB_STREAM_FILECLIP_ENABLED in the capabilities. There is
no command line switch to disable file clipping (and there is little
reason to), so we always support it if we can.

We also set an additional flag CB_FILECLIP_NO_FILE_PATHS flag in the
capabilities because it seems to be necessary for the server to send the
"FileGroupDescriptorW" format to us. Otherwise the server will only send
the old CF_HDROP format which can't be handled well without enabled disk
drive redirection and a properly negotiated server-side temporary
directory.
2017-04-09 03:15:49 +03:00
ilammy 401bf8b0af x11/cliprdr: provide file content to the server
xf_cliprdr_server_file_contents_request() handles the
CLIPRDR_FILECONTENTS_REQUEST which is sent by the server to retrieve the
size or data of a single file. The server can only request one of these
things at a time, do confirm this.

The actual handling of the requests is done by wClipboardDelegate. In
order to handle its resposes we register a bunch of our own callbacks
which simply pass the responses to the server.

In case of an error we should always send a CB_RESPONSE_FAIL to the
server. If we do not then the file transfer progress dialog may end up
hanging in the remote session forever until the user logs out or kills
explorer.exe. We do wnat this.
2017-04-09 03:15:49 +03:00
ilammy 5fb89985f0 x11/cliprdr: handle text/uri-list format
To handle a new format we should first be able to transform the format
name from the local clipboard owner into its remote representation. In
our case this will be trasforming the "text/uri-list" target into the
"FileGroupDescriptorW" named format.

Add CB_FORMAT_TEXTURILIST to identify the local format by its ID during
the data conversion step. This numeric ID has nothing to do with the ID
which will be sent to server. It's a bit weird, but that's how XFreeRDP
works.

After that add a new client format with this ID and appropriate local
and remote format names (in atom and formatName fields respectively).
Do this only if wClipboard actually supports "text/uri-list" format.
(It could fail to initialize the local file subsystem, in which case
it will fail all file-related requests and there would be no point in
advertising the file format support in the first place.)

Finally, handle the actual format data request for a new named format
in xf_cliprdr_process_requested_data(). Remember to convert the
FILEDESCRIPTOR array we receive from wClipboard into the
CLIPRDR_FILELIST expected by the server. Also take care to not leak
memory during this conversion.

Note that this handles only the CLIPRDR_FORMAT_DATA_REQUEST. The server
is still not able to retrieve the file content as this is done via a
separate request-reply sequence.
2017-04-09 03:15:49 +03:00
ilammy 96fe94c85f x11/cliprdr: impove error handling
Unify error handling in xf_clipboard_new() by using a common cleanup
code path. This fixes a leak of clipboard->system and format names when
an error occurs during initialization.

Also reformat the code to fit into 100 column limit without this line
break insanity and with improved readability.

I do not particularly like to use a variable with such a descriptive
name 'n' far away in the error handling part, but its short name is
kinda important for readability so let's keep it as is.
2017-04-09 03:15:49 +03:00
Armin Novak 850d7fbc38 Update changed rectangles instead of extent. 2017-03-30 18:17:21 +02:00
Armin Novak 197378975b Let bitmaps keep XBitmap during lifetime. 2017-03-28 12:14:19 +02:00
Armin Novak 73bf4547a5 X11 GFX: Restrict to region, ignore alpha
* Restrict the screen update to the changed region
* Ignore differences in color format alpha
2017-03-28 12:14:19 +02:00
Armin Novak d46d0c3d4a Fixed invalid return from xf_rail_window_icon 2017-03-28 11:47:46 +02:00
Norbert Federa fa2086686b some performance fixes
- draw only the updated region in the gdi and x11 surface bits implementation
- don't repeatedly call IsProcessorFeaturePresentEx in rfx rlgr decoder
- fix ugly and unaligned profiler print layout and remove an unnecessary value
2017-03-27 20:14:13 +02:00
Armin Novak 8c687611af Print logon error info. 2017-03-17 13:48:32 +01:00
Mariusz Białończyk 3e8446f11b Manual: remove a space in examples 2017-03-06 14:28:30 +01:00
Armin Novak b2c29158be Scanbuild warning, argument checks and leak fixes.
* Added Stream_GetRemainingCapacity to check remaining stream size
  before writes.
* Fixed shadow server memory leak.
* Fixed lots of scanbuild warnings
* Added missing argument checks in many functions
* Added missing static function declarations
2017-03-02 18:13:43 +01:00
Bernhard Miklautz 23cfd34525 Merge pull request #3746 from volth/command-line-action-script-rebased
Add command line option to override action script path
2017-02-20 14:08:14 +01:00
akallabeth ba99e35f72 Merge pull request #3733 from chipitsine/master
Resolve issues detected by cppcheck
2017-02-17 10:46:35 +01:00
Ilya Shipitsin 9b12feb237 an argument check in xf_UpdateWindowArea 2017-02-17 13:38:05 +05:00
Armin Novak 198bc6d9e1 Fixed compiler warnings. 2017-02-16 13:17:49 +01:00
Martin Fleisz 0d43201e3c Merge pull request #3767 from akallabeth/ssse3_optimize
Ssse3 optimize and sanitize address
2017-02-16 09:51:28 +01:00
Armin Novak 03abaf1aee Align scanline to multiple of 16, required for ASM 2017-02-15 12:08:32 +01:00
ilammy 11c55f8dcd client/X11: cache original clipboard data for raw transfers
FreeRDP uses clipboard->data to cache the result of the Windows->X11
clipboard format conversion, and xf_cliprdr_process_selection_request()
immediately provides this result to local applications if they request
the same clipboard format again. This saves us a possibly costly
conversion in case where the user pastes data repeatedly.

However, this caching mechanism did not support raw clipboard transfers
where the unmodified data is passed between two FreeRDP clients. We use
the same XClipboard protocol for this, so the clipboard->data is in play.
We clear the cached value when we receive new data from the server, so
initially raw transfers are fine. But if some local application (e.g.,
a clipboard manager) asks for some data format before the data is pasted
into the second FreeRDP session then clipboard->data will contain the
*converted* data. And this converted cached data will be provided to
the second FreeRDP session as a part of the raw data transfer. Instead
we should have provided the original data.

In order to achieve this we are now caching the original data in the
same way as the converted one, and the original data is now correctly
provided when the second FreeRDP session asks for a raw data transfer.
2017-02-11 00:48:36 +02:00
Volth e7487cea27 Add command line option to override action script path 2017-02-08 08:30:24 +00:00
Armin Novak df764f5aad Fixed GDI color decoding issues. 2017-02-01 11:02:23 +01:00
Ilya Shipitsin 0a3bd2af4d Remove redundant condition
[client/X11/xf_rail.c:205] -> [client/X11/xf_rail.c:220]: (warning) Either the condition 'if(appWindow)' is redundant or there is possible null pointer dereference: appWindow.
[client/X11/xf_rail.c:206] -> [client/X11/xf_rail.c:220]: (warning) Either the condition 'if(appWindow)' is redundant or there is possible null pointer dereference: appWindow.
[client/X11/xf_rail.c:207] -> [client/X11/xf_rail.c:220]: (warning) Either the condition 'if(appWindow)' is redundant or there is possible null pointer dereference: appWindow.
[client/X11/xf_rail.c:208] -> [client/X11/xf_rail.c:220]: (warning) Either the condition 'if(appWindow)' is redundant or there is possible null pointer dereference: appWindow.
[client/X11/xf_rail.c:215] -> [client/X11/xf_rail.c:220]: (warning) Either the condition 'if(appWindow)' is redundant or there is possible null pointer dereference: appWindow.
[client/X11/xf_rail.c:216] -> [client/X11/xf_rail.c:220]: (warning) Either the condition 'if(appWindow)' is redundant or there is possible null pointer dereference: appWindow.
[client/X11/xf_rail.c:217] -> [client/X11/xf_rail.c:220]: (warning) Either the condition 'if(appWindow)' is redundant or there is possible null pointer dereference: appWindow.
[client/X11/xf_rail.c:218] -> [client/X11/xf_rail.c:220]: (warning) Either the condition 'if(appWindow)' is redundant or there is possible null pointer dereference: appWindow.
2017-01-31 14:10:58 +05:00
Ilya Shipitsin 12f5368819 make cppcheck even more happier:
[channels/tsmf/client/gstreamer/tsmf_X11.c:317] -> [channels/tsmf/client/gstreamer/tsmf_X11.c:322]: (warning) Either the condition '!decoder' is redundant or there is possible null pointer dereference: decoder.
[channels/tsmf/client/gstreamer/tsmf_X11.c:470] -> [channels/tsmf/client/gstreamer/tsmf_X11.c:475]: (warning) Either the condition '!decoder' is redundant or there is possible null pointer dereference: decoder.
[channels/tsmf/client/gstreamer/tsmf_X11.c:472] -> [channels/tsmf/client/gstreamer/tsmf_X11.c:475]: (warning) Either the condition '!decoder' is redundant or there is possible null pointer dereference: decoder.
[channels/tsmf/client/tsmf_media.c:179] -> [channels/tsmf/client/tsmf_media.c:181]: (warning) Either the condition '!stream' is redundant or there is possible null pointer dereference: stream.
[client/Windows/wf_cliprdr.c:2219] -> [client/Windows/wf_cliprdr.c:2222]: (warning) Either the condition '!formatDataResponse' is redundant or there is possible null pointer dereference: formatDataResponse
[client/Windows/wf_cliprdr.c:2445] -> [client/Windows/wf_cliprdr.c:2448]: (warning) Either the condition '!fileContentsResponse' is redundant or there is possible null pointer dereference: fileContentsResponse.
[client/X11/xf_cliprdr.c:911] -> [client/X11/xf_cliprdr.c:913]: (warning) Either the condition '!clipboard' is redundant or there is possible null pointer dereference: clipboard.
[client/X11/xf_graphics.c:504] -> [client/X11/xf_graphics.c:506]: (warning) Either the condition '!xfc' is redundant or there is possible null pointer dereference: xfc.
[libfreerdp/core/transport.c:861] -> [libfreerdp/core/transport.c:863]: (warning) Either the condition '!transport' is redundant or there is possible null pointer dereference: transport.
[server/shadow/shadow_server.c:777] -> [server/shadow/shadow_server.c:791]: (warning) Either the condition '!server' is redundant or there is possible null pointer dereference: server.
[server/shadow/shadow_server.c:778] -> [server/shadow/shadow_server.c:791]: (warning) Either the condition '!server' is redundant or there is possible null pointer dereference: server.
[server/shadow/shadow_server.c:779] -> [server/shadow/shadow_server.c:791]: (warning) Either the condition '!server' is redundant or there is possible null pointer dereference: server.
[server/shadow/shadow_server.c:781] -> [server/shadow/shadow_server.c:791]: (warning) Either the condition '!server' is redundant or there is possible null pointer dereference: server.
[server/shadow/shadow_server.c:782] -> [server/shadow/shadow_server.c:791]: (warning) Either the condition '!server' is redundant or there is possible null pointer dereference: server.
[server/shadow/shadow_server.c:783] -> [server/shadow/shadow_server.c:791]: (warning) Either the condition '!server' is redundant or there is possible null pointer dereference: server.
[server/shadow/shadow_server.c:784] -> [server/shadow/shadow_server.c:791]: (warning) Either the condition '!server' is redundant or there is possible null pointer dereference: server.
[server/shadow/shadow_server.c:785] -> [server/shadow/shadow_server.c:791]: (warning) Either the condition '!server' is redundant or there is possible null pointer dereference: server.
[server/shadow/shadow_server.c:787] -> [server/shadow/shadow_server.c:791]: (warning) Either the condition '!server' is redundant or there is possible null pointer dereference: server.
[server/shadow/shadow_server.c:789] -> [server/shadow/shadow_server.c:791]: (warning) Either the condition '!server' is redundant or there is possible null pointer dereference: server.
2017-01-26 14:44:19 +05:00
Armin Novak 052736a825 Fixed conversion to XColor. 2017-01-25 08:34:23 +01:00
Armin Novak 042594bf82 Fixed stride for XCreateImage. 2017-01-25 08:34:16 +01:00
Armin Novak 6ceb574402 Fixed staging surface scanline. 2017-01-23 11:32:25 +01:00
Armin Novak b32c241b9f Fixed color format selection for 16bpp 2017-01-23 11:32:25 +01:00
Armin Novak 0acc54a4f7 Fixed scanline for RFX. 2017-01-23 11:30:56 +01:00
Bernhard Miklautz d817469b78 Install man pages
* man pages are only build/installed if WITH_MANPAGES is enabled
* create a new cmake function install_freerdp_man to unified install man
  pages
* install all man pages using the new function
* update the nightly packages accordingly
2017-01-16 11:34:32 +01:00
akallabeth 9e636f2d71 Merge pull request #3622 from khvMX/master
Ungrab keyboard feature for X11
2017-01-11 16:31:15 +01:00
Armin Novak 085ee3ac0f Fixed patblt for mono color. #3678 2017-01-09 15:25:47 +01:00
Armin Novak 03adbd24a8 AutoReconnect support unlimited retries. 2017-01-09 12:34:09 +01:00
Viktor Mukha d129102e4c X11 ungrab keyboard only if RightCtrl is released right away 2016-12-20 10:59:45 +01:00
Viktor Mukha b99a697796 X11 will ungrab keyboard when RightCtrl is pressed 2016-12-16 14:15:47 +01:00
Norbert Federa f71b6b46e8 fix string format specifiers
- fixed invalid, missing or additional arguments
- removed all type casts from arguments
- added missing (void*) typecasts for %p arguments
- use inttypes defines where appropriate
2016-12-16 13:48:43 +01:00
Martin Fleisz 2b9165466d Merge pull request #3648 from akallabeth/clear_codec_fixed
Clear Codec and AVC420 fixes
2016-12-15 16:02:05 +01:00
Armin Novak f0203900d7 Fixed +auto-reconnect (#3650) 2016-12-15 12:10:11 +01:00
Armin Novak 514a33d435 Respecting color depth with RDP_CODEC_ID_NONE. 2016-12-07 13:22:52 +01:00
Armin Novak d4b823d5cb Using a single codec context per session. 2016-12-07 13:22:00 +01:00
akallabeth ac9e7530d3 Merge pull request #3637 from mfleisz/rfx_api_simplify
codec: Remove src format parameter from rfx_process_message
2016-12-02 09:38:33 +01:00
Martin Fleisz e059e3dea3 codec: Remove src format parameter from rfx_process_message
This parameter is not required. Default param is BGRX32
and if an other format is required rfx_codec_set_pixel_format
can be used.
2016-12-01 17:21:06 +01:00
Bernhard Miklautz c82cd6cb57 Fix issues in wlog man page
* fix spelling errors
* move man page from section 1 to section 7
* fix the man page header to match the actual section
* adapt the packages for wlog.7

Fixes #3632
2016-12-01 15:36:31 +01:00
Norbert Federa c6e6b44143 countless WLog/printf format specifier fixes 2016-11-25 17:06:25 +01:00
Martin Fleisz 9e474b43d1 Merge pull request #3623 from akallabeth/mouse_wheel_event_check
Check hwheel capability before sending mouse event.
2016-11-25 13:41:07 +01:00
Armin Novak a0fed88574 Check hwheel capability before sending mouse event. 2016-11-24 13:19:46 +01:00
Viktor Mukha 649073ef7b Ungrab keyboard feature for X11 2016-11-24 11:35:30 +01:00
Armin Novak 3c25ffb38c Unified scanline padding function. 2016-11-24 09:02:06 +01:00
Norbert Federa 812def37f1 Merge pull request #3612 from akallabeth/align_fix
Fixed broken scanline alignment.
2016-11-23 17:57:47 +01:00
Martin Fleisz faefe54d69 Merge pull request #3603 from realjiangms/fix_shadow_resize
X11/client: call gdi resize on hw desktop resize.
2016-11-23 15:47:32 +01:00
Armin Novak 61a1c8ccc5 Fixed broken scanline alignment. 2016-11-23 12:54:20 +01:00
zihao.jiang e3506bfe88 X11/client: call gdi resize on hw desktop resize. The gdi primary buffer is used in client/X11/xf_gdi.c, it should be big enough to hold the full screen update 2016-11-17 14:36:02 +08:00
Armin Novak f62d00445e Fixed surface alignment. 2016-10-28 11:54:34 +02:00
David Fort 043243f43c Merge pull request #3560 from akallabeth/gfx_10_2
Gfx 10.2 caps and deactivate GDI unsupported functions
2016-10-21 09:29:51 +02:00
Martin Fleisz f5a6645832 Merge pull request #3571 from akallabeth/clang_fixes
Clang fixes
2016-10-19 15:45:17 +02:00
Armin Novak 4ceda8a097 Fixed uninitialized return. 2016-10-19 11:11:35 +02:00
Armin Novak b6907aa2b1 Deactivated unsupported operations. 2016-10-16 15:11:01 +02:00
Armin Novak 9c50e1a635 Replaced _VF formats with copy flags. 2016-10-14 10:36:52 +02:00
Armin Novak 25c7372fe6 Fixed offset and stride for X11 surface bits. 2016-10-12 09:32:05 +02:00
Armin Novak 8286fa4b96 Fixed format flip and offsets for GDI. 2016-10-11 18:50:01 +02:00
Armin Novak 404ae7d83c Fixed Windows 7 RFX issues. 2016-10-11 14:34:07 +02:00
zihao.jiang 34b4bca119 Fix nsc client after after color conversion huge fix
nsc codec client doesn't work:
1. We should mark invalid region for software gdi
2. Checked the code before color conversion fix, the correct color format should be PIXEL_FORMAT_BGRX32_VF (corresponds to old PIXEL_FORMAT_XRGB32_VF)
3. For gdi:hw: xfc->bitmap_buffer is never used/initialized. However gdi->primary_buffer is always maintained. So use primary_buffer to hold the decoded bitmap data
2016-10-11 02:18:31 +08:00
Martin Fleisz 38f9d0f675 Merge pull request #3529 from akallabeth/warning_fixes
Variadic macro warning fixes
2016-10-10 12:23:57 +02:00
Armin Novak 249bb1292f Fixed pointer color mapping. 2016-10-10 09:19:43 +02:00
Armin Novak 943e295714 WLog using C99 compatible variadic macros. 2016-10-07 14:05:27 +02:00
Armin Novak 649d270ccd Fixed GDI_RGN->null initialization. 2016-10-06 13:43:15 +02:00
Armin Novak 8f1adf64ee Refactored ClipboardSetData. 2016-10-06 13:43:15 +02:00
Armin Novak 97e8f9ec49 Fixed broken return check. 2016-10-06 13:43:15 +02:00
Armin Novak 70f3d43975 Removed broken return check. 2016-10-06 13:43:15 +02:00
Armin Novak 3b9c74ec0b Reformatted file. 2016-10-06 13:43:14 +02:00
Armin Novak dec268d1ab Reformatted file. 2016-10-06 13:43:13 +02:00
Armin Novak ab231f8180 Reformatted file. 2016-10-06 13:43:13 +02:00
Armin Novak 569c6a578d Reformatted file. 2016-10-06 13:43:13 +02:00
Armin Novak f2d7766db6 Moved common async input handling to core library. 2016-10-06 13:43:12 +02:00
Armin Novak 4e11883f27 Fixed X11 cursor decoding. 2016-10-06 13:43:11 +02:00
Armin Novak 83c6a7942d Removed broken X11 command. 2016-10-06 13:43:11 +02:00
Armin Novak 161685b25c Fixed some more glyph chache bugs. 2016-10-06 13:43:11 +02:00
Armin Novak 0c57065c73 GlyphCache: Erasing destination if not redundant. 2016-10-06 13:43:11 +02:00
Armin Novak c242467346 Fixed some X11 functions. 2016-10-06 13:43:10 +02:00
Armin Novak 22ddec810b Moved pre and post channel hooks. 2016-10-06 13:43:10 +02:00
Armin Novak 9c64e77a84 Disabled thread local storage on iOS.
iOS does not support Thread Local Storage.
Disabling it for now until a solution is found.
Print a compiler warning informing developers about this issue.
2016-10-06 13:43:10 +02:00
Armin Novak d35823cf69 Moved channel init code to core library. 2016-10-06 13:43:09 +02:00
Armin Novak dadc5262ae Removed static channel variables.
Global static variables do not work, if more than one instance
of an RDP client is running in the same process space.
Removed the varaibles where possible and replaced them with
thread local storage where necessary.
2016-10-06 13:43:09 +02:00
Armin Novak b765374d32 Refactored BitBlt, implementing everything now. 2016-10-06 13:43:08 +02:00
Armin Novak 3b21209e72 Fixed xfreerdp GDI color order. 2016-10-06 13:43:07 +02:00
Armin Novak c8a7065f93 Refactored xfContext. 2016-10-06 13:43:06 +02:00
Armin Novak 9af71b9878 Fixed color conversion from order. 2016-10-06 13:43:06 +02:00
Armin Novak 7dbeeb2df6 Fixed hardware GDI. 2016-10-06 13:43:04 +02:00
Armin Novak 9d82c4701b Removed duplicate code. 2016-10-06 13:43:03 +02:00
Armin Novak 867528015a Simplified bitmap drawing. 2016-10-06 13:43:03 +02:00
Armin Novak 032bdef955 Unified bitmap drawing. 2016-10-06 13:43:03 +02:00
Armin Novak b8ff3cb235 Fixed (a lot of) GDI drawing issues. 2016-10-06 13:43:03 +02:00
Armin Novak 3f90966da6 Bug fixes. 2016-10-06 13:43:03 +02:00
Armin Novak 85bbe2a908 API refactoring. 2016-10-06 13:43:03 +02:00
Armin Novak e650fdb2b6 Bugfixes. 2016-10-06 13:43:02 +02:00
Armin Novak 9d5ca34d0d Fixed pointer initialisation for X11. 2016-10-06 13:43:02 +02:00
Armin Novak 04fb4e4e4c Fixed rectangle clipping and warnings. 2016-10-06 13:43:02 +02:00
Armin Novak c229a1939d Updated codec API, unified drawing order color decoding. 2016-10-06 13:43:02 +02:00
Armin Novak bc8217ed42 Removed palette, using GDI one. 2016-10-06 13:43:01 +02:00
Armin Novak 8fffda5740 Fixed clearcodec and codecs reset. 2016-10-06 13:43:01 +02:00
Armin Novak 9fc8dc6b5d Removed gdi->codecs, unused. 2016-10-06 13:43:00 +02:00
Armin Novak a6cef5cde7 Fixed GFX related issues. 2016-10-06 13:43:00 +02:00
Armin Novak e860fde4bc Fixed function arguments. 2016-10-06 13:43:00 +02:00
Armin Novak 03907c82a9 Fixed issues. 2016-10-06 13:43:00 +02:00
Armin Novak d98677094e Fixed warnings. 2016-10-06 13:43:00 +02:00
Armin Novak 716c5c53e9 256 color support. 2016-10-06 13:42:59 +02:00
Armin Novak 48d1b4ee13 Fixed color ordering for GDI. 2016-10-06 13:42:59 +02:00
Armin Novak ac8c72238d Api update. 2016-10-06 13:42:59 +02:00
Armin Novak da956e0388 ... 2016-10-06 13:42:59 +02:00
Armin Novak 24599af991 More color fixes. 2016-10-06 13:42:58 +02:00
Armin Novak df35c135d1 Fixed color conversion, unified GFX and updated API. 2016-10-06 13:42:58 +02:00
Nathan Kidd 24aa71e6cb client/X11: Only upconvert < 24 bit RFX tiles
Fixing this logical typo gives a slight performance boost /
CPU usage reduction on heavy loads.
2016-09-23 21:26:56 -04:00
David Fort 1fdcae9a6a Add an environment variables section to the man 2016-06-21 15:28:38 +02:00
David Fort 0905cc2ba7 man pages needed love
This patch cleans things up so that generated man pages for argument are nicer.
2016-06-21 09:49:44 +02:00
Norbert Federa 374f97aad3 client/x11: don't close locked mutex 2016-06-07 19:01:03 +02:00
zihao.jiang e7d9e91864 channels/rdpgfx: Make freerdp_client_codecs_prepare calls codec reset. It fix broken h264 client from #3328. Also it doesn't make sense that we don't need width and height for codec initialization while we need them for codec reset 2016-05-30 02:00:05 +08:00
Bernhard Miklautz 8cb873b054 client/X11: fix build without client interface
Fix build when -DWITH_CLIENT_INTERFACE=OFF is used.
2016-05-03 10:44:42 +02:00
Bernhard Miklautz 783807229d build: add missing dependencies
Add all missing dependencies found with --no-undefined. Since
dependencies aren't exported anymore (if not required) it is no necessary
to explicitly list all required libraries.
2016-04-07 15:10:00 +02:00
Bernhard Miklautz 9e8c6c99b6 First shot on fixing over linking
If a target is linked against libraries with cmake
(target_link_libraries) and the libraries are not marked as PRIVATE
they are "exported" and in case a other target is linked against this
target it is also linked against *all* (not private) libraries.

Without declaring private libraries PRIVATE a lot of over linking
(linking against unneeded libraries) was done.
2016-03-29 18:14:34 +02:00
Armin Novak 5bc333c626 Implemented GFX AVC444 support. 2016-03-16 13:43:18 +01:00
Armin Novak 3a3ec85898 Unified RDPGFX_RECT16 and RECTANGLE_16 2016-03-16 13:43:17 +01:00
Armin Novak 36cbf1b583 Fixed error handling for channel load failures. 2016-03-14 13:13:43 +01:00
Martin Fleisz 66ae3f2c77 Merge pull request #3177 from akallabeth/codec_reset_fix
Fixed codec reset, now resetting resolution too.
2016-03-11 11:22:59 +01:00
Norbert Federa ef4b29e5b3 ConvertFromUnicode fixes and misc hardening
- Added missing ConvertFromUnicode checks
- If ConvertToUnicode allocates memory, guarantee the null termination
  similar to ConvertFromUnicode's implementation
- Fixed some TestUnicodeConversion.c CTest return values
- Added some CTests for ConvertFromUnicode and ConvertToUnicode
- Misc code and protocol hardening fixes in the surrounding code regions
  that have been touched
2016-03-03 16:56:19 +01:00
Armin Novak 8997c6c03a Added log messages for unsupported surface commands. 2016-03-02 14:46:33 +01:00
Armin Novak 2e110c7f35 Fixed codec reset, now resetting resolution too.
H264 and others require the surface resolution to work properly.
This initializes the codecs and the resolution on reset.
2016-03-02 14:46:33 +01:00
akallabeth 05aa425cae Merge pull request #2851 from ilammy/x11-cliprdr/improve-format-support
Improve clipboard format support in X11 client
2016-02-23 09:56:17 +01:00
ilammy 93fc349ce6 client/X11: harden xf_cliprdr_parse_server_format_list()
* Make sure that numFormats has reasonable value

This will help catching errors like writing -1 as an unsigned number
of formats into the serialized stream, or trying to read the property
after someone else erroneosly messed with it, or other similar mistakes
which would result into reading and then sending garbage to the server.

We read the list xf_cliprdr_get_raw_server_formats() from an X window
property. Properties generally cannot be larger than 4 KB and each
format requires at least 5 bytes (most of them are named, though),
which gives us 512-ish limit on the number of formats we can squeeze
into the property.

However, it's hard to find an application that provides more than
20 formats (I've seen like 15 for MS Office apps), thus I believe
we can safely assume than anything that does not fit into a byte
means that we are reading garbage rather than a good format list.

* Check for the end of stream when reading format names

This also prevents reading garbage and getting segmentation faults
and Valgrind warnings when somebody somewhere sometimes forgets to
put a terminating null character where it belongs.

strnlen() and strndup() functions are provided by POSIX.1-2008
which we can reasonably expect to be available in 2016.
2016-02-23 01:20:34 +02:00
Armin Novak b35f6658b9 Moved common code from cli clients to client lib. 2016-02-05 02:05:37 +01:00
Armin Novak cbf2892ccc Implemented temporary certificate accept.
Certificates can now be accepted temporarily.
The callbacks for certificate validation have been
modified to extend the information presented to the user.
2016-02-05 02:04:57 +01:00
Martin Fleisz 2db8c7e107 Merge pull request #3052 from abma/fix3051
fix #3051: fullscreen switching with CTRL+ALT+ENTER doesn't work any …
2016-01-15 09:51:51 +01:00
Armin Novak e7c8ea4db9 Fixed memory leak. 2016-01-15 09:33:21 +01:00
abma ba286684c4 fix keyboard release (thanks hardening!) 2016-01-15 01:59:08 +01:00
abma bedb4a2d64 fix #3051: fullscreen switching with CTRL+ALT+ENTER doesn't work any more 2016-01-13 23:05:32 +01:00
Bernhard Miklautz 6fa3608111 cleanup cmake exports and pkg-config files
With this commit the "exported" components (usable with pkg-config and
cmake find module package)
* winpr - winpr library and headers
* freerdp - core library and headers
* freerdp-client - client specific library
* freerdp-server - server specific library
* rdtk - rdtk headers and library

To allow the installation of multiple different version (different major
number) the include files were moved into the respective sub folder:
freerdp -> freerdp{MAJOR}/freerdp (currently freerdp2/freerdp/)
winpr -> winpr{MAJOR}/winpr (currently winrp1/winpr/)
rdtk -> rdpk{MAJOR}/rdtk (currently rdtk0/rdtk/

The generated pkg-config and cmake find modules now also include the major
version number. Currently the following pkg-config are generated and
installed.
* winpr1
* freerdp2
* freerdp-server2
* freerdp-client2
* rdtk0

As cmake is able to handle multiple versions out of the box the
following can be used to find a specific module:

find_package(WinPR)
find_package(FreeRDP)
find_package(FreeRDP-Server)
find_package(FreeRDP-Client)
find_package(RdTk)

As cmake doesn't automatically resolve dependencies for packages it is
necessary to manually include the requirements. For example if
FreeRDP-Client is required WinPR and FreeRDP need to be included
(find_package) as well.

This commit also fixes the installation when STATIC_CHANNELS are built.
WITH STATIC_CHANNELS all channels are linked into libfreerdp-client, for
this all channels are generated as linker archive and linked together in
the final step. Before the intermediate linker archives were, although
not required and useful, installed. Same applies for server side
channels.
2016-01-12 17:32:33 +01:00
Roland Kaufmann 600d3c5ccb Add option to disable pointer button mapping
In case the old behaviour of not reverse-mapping the mouse buttons is
desirable, a command-line option is added to disable the mapping. This
option is made experimental for the time being.

The default is to do the reverse mapping, as this is the intuitive
behaviour (the mouse then works as it would on the console).
2015-12-15 17:42:57 +01:00
Roland Kaufmann 9f43291126 Get pointer button mapping from input system
If XInput extension is available, then find the (first) pointer device
and use the button mapping of that one. If there are more than one
pointer devices, they could have different button mappings, but it is
not clear how this should be communicated to the RDP server.

If XInput is not available, attempt to fallback to the old global
mapping. (This mapping exists, but is not correct if there actually
is an XInput extension loaded, as it is then not used).
2015-12-15 17:42:05 +01:00
Roland Kaufmann 6ca8962045 Map logical to physical mouse button events
RDP expects to receive an indicator of the physical mouse button that
was pressed on the client, whereas X11 deliver a value for which
logical mouse button that was pressed.

This patch introduces a (reverse) mapping from logical mouse buttons to
physical mouse buttons, so that the RDP server can do correct mapping
for the event on its end.

However, no actual mapping is done here; this patch just introduces the
framework to do so. Thus, there should be no behavioural change from
this patch alone.

There is an implicit assumption that only the first three buttons are
mapped to eachother. Enabling more a general mapping would require
extensive changes to the event handling as fourth logical button and
up is used for special functionality such as wheel.
2015-12-15 17:42:05 +01:00
Binyamin Sagal 23fea1615f Fix horizontal scrolling direction and capability detection 2015-12-14 21:48:31 +02:00
Armin Novak a5db7117c8 Implemented horizontal wheel support.
Horizontal mouse wheel input capabilities are now checked
and if available mouse buttons 6 and 7 are mapped to the
horizontal wheel for the X11 client.
2015-12-14 18:29:23 +01:00
Binyamin Sagal d81784cec6 remove horizontal scroll maping to forward/back
partal fix for #2302
2015-12-14 18:01:04 +01:00
Hardening 57fe581b16 Merge pull request #2824 from bjcollins/nla_auth_exit_code
Return FREERDP_ERROR_AUTHENTICATION_FAILED on an authentication failure
2015-12-08 22:46:29 +01:00
ilammy 7bce7ef372 client/X11: transfer raw clipboard format data
The second step of raw transfer is to transfer the format data itself.
This has been already implemented in XFreeRDP before, but several
tweaks are required for it to work correctly.

The idea of raw data transfer is to request for _FREERDP_RAW clipboard
format while putting the actual formatId into _FREERDP_CLIPRDR property
where the requested data is expected to arrive to. Then the clipboard
owner will check for the real formatId and deliver the expected data.

This stays true, but the check is performed in a more straightforward
way, and CF_RAW format (numerically equal to zero) is not considered
an unknown destination format when performing (identity) conversions
with wClipboard. This is not an issue because wClipboard will allow
only identity conversion for CF_RAW, it will fail if something else
is going to be converted into CF_RAW.
2015-11-14 19:03:10 +02:00
ilammy 391ed0d91d client/X11: transfer raw clipboard format lists
The first part of raw transfer sequence is to transfer the format
list of the session A into the session B. Then we will be able to
request/reply with raw data using proper format IDs.

xf_cliprdr_server_format_list() of the session A now exposes the
raw server format list. As soon as the list is received, it is
serialized and put into _FREERDP_CLIPRDR_FORMATS property.

xf_cliprdr_get_requested_targets() of the session B now checks
whether the clipboard owner is a FreeRDP session with enabled
raw transfer capability. If it is, the raw format list is simply
extracted from _FREERDP_CLIPRDR_FORMATS of the clipboard owner.
Otherwise, the format list is populated from the usual TARGETS
clipboard format.
2015-11-14 19:03:10 +02:00
ilammy 626e40a9c1 client/X11: add raw clipboard transfer indication
Some time ago there was a property _FREERDP_CLIPRDR_ID which was indended
to indicate that an XFreeRDP window owns a clipboard. This was necessary
for raw transfers. This property was used by xf_cliprdr_is_self_owned()
function. However, raw transfer support was broken and the meaning of
xf_cliprdr_is_self_owned() gradually changed into checking whether
the *current* window owns the clipboard, not just any XFreeRDP window.
Thus _FREERDP_CLIPRDR_ID was removed in a4580923e7 (xfreerdp/clipr:
fix self owned test and hardening).

However, now we are going to fix raw transfers and we need that property.
This patch reintroduces a similar property "_FREERDP_CLIPRDR_RAW" which
indicates that a window is an XFreeRDP window with enabled raw transfer.
It is currently used by xf_cliprdr_server_format_data_request() to
correctly request format data from another XFreeRDP instance via raw
transfer protocol.

This property can be queried from the clipboard owner with the function
xf_cliprdr_is_raw_transfer_available() and can be enabled or disabled
on the current window by xf_cliprdr_set_raw_transfer_enabled().

Disabling raw transfers will be necesary to correctly implement file
transfers in the future. However, currently raw transfers are always
enabled.
2015-11-14 19:03:10 +02:00
ilammy 532371d5aa client/X11: remove unused function
xf_cliprdr_send_data_request() is actually used instead of this one.
2015-11-14 19:03:10 +02:00
ilammy 46fb66e0fb client/X11: send clipboard format data errors correctly
xf_cliprdr_send_data_response() is consistently called with NULL
data pointer as a way to report errors, but it was not setting
the msgFlags field accordingly.
2015-11-14 19:03:10 +02:00
ilammy d7c9a31b4b client/X11: correctly trim terminating null bytes from strings
Sometimes Windows sends strings with excess null terminating bytes.
For example, when one copies digits from calc.exe. At the same time,
some local applications freak out when they encounter null bytes
(at least LibreOffice is known to be replacing them with '#').

According to the specification of UTF8_STRING format [1], the string
data must not contain any trailing null bytes. So they all should be
trimmed, not only the last one.

Also, if the trailing null byte is not present, the length should not
be adjusted. For example, Firefox is actually sending "HTML Format"
without a null byte while Internet Explorer adds one. The spec for
text/html format [2] says nothing about the teminating null byte, so
we are free to remove it, but at least we should not mistakingly
delete '>' character of "</html>" tag when it is the last character.

[1] http://www.pps.univ-paris-diderot.fr/~jch/software/UTF8_STRING/UTF8_STRING.text

[2] https://www.ietf.org/rfc/rfc2854.txt
2015-11-14 19:03:10 +02:00
ilammy b9a297379b client/X11: improve named clipboard format support
Clipboard formats are identified by numerical IDs and literal names.
We can keep using arbitrary defined IDs for local clipboard formats
as we are sure that they have some fixed meaning, but the server can
and will be using its own IDs, which can be different from ours for
the named formats.

Therefore:

1) A correct way to compare a local format to a remote one is
   to check the names first, and only then compare their IDs.
   (Extra care should be taken to support short format names.)

2) Server IDs cannot be used with wClipboard directly when dealing
   with named formats. Format name should be used to extract correct
   local ID for the use with Clipboard{Set,Get}Data().

Also, I find the notion of 'alternate' format IDs to be confusing.
We either deal with a fixed ID format (declared in <winpr/user.h>),
or a format that was given an arbitrary fixed ID for local use
(defined in <freerdp/channels/cliprdr.h>), or a remote format
identified by a pair of an ID and a name. Format IDs can be local
and remote, but there are no 'alternates'.

So now:

1) A new function xf_cliprdr_formats_equal() is used to compare
   formats correctly in xf_cliprdr_get_server_format_by_atom()
   when searching for a server format corresponding to a local
   one, and in xf_cliprdr_server_format_list() when constructing
   a local TARGETS list from the server format list.

2) Correct local format IDs are used with wClipboard conversions
   by xf_cliprdr_process_requested_data() and
   xf_cliprdr_server_format_data_response().

3) We refer to formatId and formatName when doing requests,
   and srcFormatId and dstFormatId when doing conversions,
   instead of using formatId and altFormatId for both purposes.

4) Server format ID and name are used to identify cached clipboard
   contents. The name is compared directly as a pointer because it
   will be a pointer from the same clipboard->serverFormats array.

   Also, the clipboard contents are invalidated when format list
   arrives, so xf_cliprdr_server_format_list() now also clears
   the format ID and name together with the data.
2015-11-14 19:03:10 +02:00
ilammy 8434709fc6 client/X11: improve clipboard format search functions
The functions now have appropriate names which tell what exactly
they are searching for:

    xf_cliprdr_get_client_format_by_id()
        Get a client-provided format by client-side ID.

    xf_cliprdr_get_client_format_by_atom()
        Get a client-provided format by client-side format name.

    xf_cliprdr_get_server_format_by_atom()
        Get a corresponding server format by client-side format name.

The return types of functions have been adjusted accordingly and
correct formats are now used everywhere without mixing them up:
client-side formats are used for client -> server data flow,
while server-side ones are used for server -> client tranfers.

This resolves the issue #1414 as, for some reason, xfreerdp required
server format list to be present to be able to provide its own client
formats. Actually, we need only client format list to provide these.

Also, CF_RAW special case is handled in a more elegant way: it is
assumed to be present in every server format list (which is true).
2015-11-14 19:03:10 +02:00
Hardening be8f8f7238 Merge pull request #2970 from bmiklautz/prep_2.0
2.0 preparations
2015-11-11 12:54:34 +01:00
Wouter van Kesteren 857c003e47 cmake: tweak manpage install location
This patch is needed when wanting to install binaries/libraries to other
locations than data. The linux distro Exherbo installs binaries and
libraries to /usr/<chost>/bin, /usr/<chost>/lib respectively but
manpages should still go in /usr/share/man/ because they are
architecture independent, without this patch they go in
/usr/<chost>/share/man unconditionally.

cmake documentation states:
DATAROOTDIR - read-only architecture-independent data root (share)

So this patch makes it use that so that its configurable.
2015-11-09 21:57:41 +01:00
Bernhard Miklautz 67368b2ec7 Adapt error level for debug messages
When using xfreerdp a regular invocation should really only report grave
problems as error. "Regular" messages should be either info or even
debug.
2015-11-09 18:27:38 +01:00
Norbert Federa 3eee70b164 Merge pull request #2926 from bjcollins/rail_fixes
Rail fixes
2015-11-06 13:34:42 +01:00
Norbert Federa 7ddd15d8de client/X11: fix post fullscreen repositioning 2015-11-04 17:58:21 +01:00
Norbert Federa 48be0815c1 client/X11: multimon/fullscreen fixes
- fixed wrong calculation of xfc->fullscreenMonitors.[right|bottom]
- only use _NET_WM_FULLSCREEN_MONITORS if at least 2 monitors are involved
- call XMoveWindow before setting the _NET_WM_STATE_FULLSCREEN property
2015-11-04 15:01:31 +01:00
Norbert Federa a4580923e7 xfreerdp/clipr: fix self owned test and hardening
- xf_cliprdr_is_self_owned() lied if multiple xfreerdp instances were
  running.
- fixed a few unchecked callocs
- added/modified and handled some return values in compliance with
  the new hardened channel api
2015-10-20 21:28:29 +02:00
bjcollins ace5bba0ed Cleanup unnecessary/unintended changes from last commit 2015-10-15 19:10:04 -05:00
bjcollins 8e27b6d05e RemoteApp Support
1. Remove all uses of "localWindowOffsetCorr" variables, they added an extra layer of complexity and they are not actually needed to handle coordination of window position/size between
the local coordinate system and the remote one. This logic was causing issues in the case where the window was moved off the left side of the screen.

2. Update the xf_setWindowVisibilityRects function to offset the visibility rects as necessary when the window is hanging off the left side of the screen.

3. Stop sending mouse events when doing keyboard moves/sizes(as desired), and stop sending two mouse events for non-keyboard moves/sizes

4. Move location of new UTF8_STRING variable from previous commit

5. Refresh window and window shape for any window position/size updates, this helps keep the local and server windows in sync and works around some race conditions
2015-10-15 18:41:55 -05:00
bjcollins cc676c4468 Remote app support
All window state order offsets are signed according to the RDP spec, lets treat them as such.
2015-10-15 18:18:21 -05:00
bjcollins cb4e4cf6fc Store Miscellaneous X11 Atoms into variables to match how we handle other X11 Atoms. 2015-10-15 14:59:53 -05:00
bjcollins d1a8119dac RemoteApp support
Remove use of WindowRects to affect window shape, the VisibilityRects are used for this purpose.
2015-10-15 14:47:10 -05:00
bjcollins 5bfbee8f78 Ensure that app windows always get a window type assigned to them. 2015-10-15 14:39:59 -05:00
bjcollins 6934c18adf Continue processing all other window orders for new remote app windows instead
of existing after only looking at part of the information. For instance, window visibility
rects are part of the message with the new order and were being ignored.
2015-10-15 14:35:07 -05:00
bjcollins 964f0addbf Do not support fullscreen toggle keyboard sequence in remote_app mode. There is no support in interface for this
and the fullscreen code is not designed to handle remote app windows.
2015-10-15 14:31:15 -05:00
bjcollins 6d3565bd4c Fix xf_rail_paint fencepost error
The regions used to store and calculate the invalidRegion are exclusive
of the bottom and right edges, not inclusive.

Fixes "mouse droppings" in mspaint.exe when moving the mouse leftwards
across the canvas.
2015-10-15 14:29:48 -05:00
Marc-André Moreau 029cbf3aca libfreerdp-gdi: fix egfx multimon support 2015-10-13 15:50:39 -04:00
Marc-André Moreau 4ab373aced xfreerdp: fix multiple egfx context support in X11 GFX 2015-10-13 14:49:30 -04:00
volth 2b7681da85 Update xf_keyboard.c
With Japanese physical keyboard and English layout, pressing the extra keys can cause FreeRDP crash.
2015-09-23 18:40:34 +00:00
bjcollins 47c260177c fix window title for rail as it was not being set on initial window creation
remove duplicate call to XStoreName when setting window title
expand WITH_XEXT #define for rail window rects as extra unecessary work was being done when WITH_XEXT was not defined
2015-09-18 16:14:30 -05:00
bjcollins 7fbc7e45a7 Clean up NLA authentication failure handling code
1. Make use of freerdp_set_last_error to set authentication failure without the helper functions
2. Rename ssl callback function
3. Break out AuthenticationOnly exit handling from bad connect handling
2015-09-15 14:07:14 -05:00
bjcollins 32a1406dc4 Return FREERDP_ERROR_AUTHENTICATION_FAILED on an authentication failure
when using NLA with xfreerdp.
2015-09-15 14:07:14 -05:00
Peter Harris 5f2f68f0e7 xfreerdp: Fix window shape
Don't abort the entire xf_rail_window_common function when the window is
already in the correct location.

To reproduce:
 - move an application off the edge of the screen
 - resize the window to cause a shape to be set
 - move the application window fully on the screen
 - resize the application window larger
 - note lack of drawing in newly enlarged portion of window

Bug introduced in abf6d4f71e "xfreerdp:
prepare RAIL migration away from libfreerdp-rail" when
xf_rail_MoveWindow was copy-and-pasted into xf_rail_window_common
without noticing that the "return" would omit the rest of the combined
function, not just the portion that was pasted.
2015-09-10 18:15:55 -04:00
Peter Harris 769ac2d35f Fix drawing with negative window origin
Since REGION16 uses unsigned values, when appWindow->x or appWindow->y
is negative, the region will have a very large left or top value.

Avoid this problem by clamping to 0 before casting to an unsigned value.
2015-09-03 18:48:42 -04:00
Armin Novak 551eca246b Ignoring H264 decompression failures.
When connecting to windows 8.1 machines the remote RDP server
implementation sometimes sends invalid H264 data. To avoid client
disconnections ignore the broken updates.
2015-09-03 12:11:15 +02:00
Norbert Federa 2d5e249eff Merge pull request #2825 from akallabeth/pointer_decoding_fix
Fixed color pointer decoding.
2015-09-01 11:09:42 +02:00
Martin Haimberger 52405a3e79 Remove WIN32ERROR type
All return values are UINT now.
2015-08-27 05:38:20 -07:00
Martin Haimberger 420a86e1c7 Merge remote-tracking branch 'upstream/master' into mh-channel-fix
Conflicts:
	channels/drdynvc/client/drdynvc_main.c
	channels/rdpgfx/client/rdpgfx_main.c
	client/X11/xf_gfx.c
2015-08-25 00:07:04 -07:00
Armin Novak 4a62e6bee4 Added length arguments and checks. 2015-08-06 11:24:42 +02:00
Armin Novak 416ac0baea Fixed return and argument checks. 2015-08-05 17:32:46 +02:00
Martin Haimberger 2862109337 Merge remote-tracking branch 'upstream/master' into mh-channel-fix
Conflicts:
	channels/smartcard/client/smartcard_main.c
	channels/smartcard/client/smartcard_operations.c
2015-07-30 07:29:12 -07:00
Marc-André Moreau 5cb06ecc68 Merge branch 'master' of github.com:FreeRDP/FreeRDP 2015-07-28 09:21:33 -04:00
MartinHaimberger 45f9519b58 Merge pull request #2723 from akallabeth/pwd_from_stdin
New /from-stdin
2015-07-15 14:12:13 +02:00
Martin Haimberger 6ab0187d84 Merge remote-tracking branch 'upstream/master' into mh-channel
Conflicts:
	channels/audin/client/oss/audin_oss.c
	channels/drive/client/drive_main.c
	channels/printer/client/printer_cups.c
	channels/printer/client/printer_main.c
	channels/rail/client/rail_main.c
	channels/rdpgfx/client/rdpgfx_main.c
	channels/rdpsnd/client/oss/rdpsnd_oss.c
	channels/remdesk/client/remdesk_main.c
	channels/remdesk/server/remdesk_main.c
	channels/tsmf/client/tsmf_media.c
2015-07-15 01:57:07 -07:00
MartinHaimberger b06d83ba80 Merge pull request #2766 from akallabeth/snprintf_to_sprintf_s
Replaced snprintf with sprintf_s
2015-07-15 09:47:43 +02:00
Bernhard Miklautz f589d5d6e0 x11: reorder xf_post_disconnect
Channels like EGFX need resources like the main window in order to
work correctly. Before the window, GDI,.. is freed it needs to be
ensured that all channels are stopped properly to prevent them to access
already freed resources. Disconnecting the channels first fixed a
possible race condition/SEGFAULT that could occur with remote initiated
disconnects.
2015-07-14 15:28:55 +02:00
Bernhard Miklautz 68e8569110 winpr/synch: remove the dependency on winsock.h
winsock.h pulls in a lot of defines and dependencies that are not
required and partially unwanted in winpr's core (for parts that are not
related to network). In order to get rid of this dependency and have an
independent defines for extended winpr functions the WINPR_FD_* defines
are used internally (and for exposed functions). Where required, like in
WSAEventSelect, the FD_* is mapped to WINPR_FD_*.
2015-07-14 11:39:41 +02:00
Marc-André Moreau 3781e803ed channels/rdpgfx: improve frame ack handling 2015-07-06 16:28:52 -04:00
Armin Novak cf9f975341 Replaced snprintf with sprintf_s 2015-07-03 13:26:15 +02:00