Commit Graph

167 Commits

Author SHA1 Message Date
akallabeth 1849632c43
Fixed format strings to match arguments (#8254)
* Fixed format strings to match arguments

Reviewed and replaced all %d specifiers to match proper type

* Added proxy dynamic channel command type to log messages.
2022-09-29 14:55:27 +02:00
2fly2 8dfadc5885
fix moving a window shrinks it 14x7 when connect to server 2019 (#8083)
* fix moving a window shrinks it 14x7 when connect to server 2019

Signed-off-by: 2fly2 <wjatchd@163.com>

* use clang-format to apply correct formatting

Signed-off-by: 2fly2 <wjatchd@163.com>

Signed-off-by: 2fly2 <wjatchd@163.com>
2022-08-16 14:22:03 +02:00
akallabeth bc8b4ade1c reformatted 2022-06-23 08:48:39 +02:00
akallabeth bbf3b8deba Cleaned up xf_AppWindowFromX11Window use 2022-05-19 11:23:43 +02:00
2fly2 e1e2eef4e1 fix moving a window shrinks it 14x7 when connect to server 2019
Signed-off-by: 2fly2 <wjatchd@163.com>
2022-05-07 13:34:27 +02:00
akallabeth fb90ac280a Refactored color.h
* Remove implementations from header
* Rename functions to be FreeRDP specific
* Add deprecation define for old names
* Fixed missing includes
2022-04-28 08:40:47 +02:00
akallabeth 73cdcdfe09
Logging and parser fixes (#7796)
* Fixed remdesk settings pointer

* Fixed sign warnings in display_write_monitor_layout_pdu

* Use freerdp_abort_connect_context and freerdp_shall_disconnect_context

* Added and updates settings

* info assert/dynamic timezone

* mcs assert/log/flags

* Fixed and added assertions for wStream

* Unified stream length checks

* Added new function to check for lenght and log
* Replace all usages with this new function

* Cleaned up PER, added parser logging

* Cleaned up BER, added parser logging

* log messages

* Modified Stream_CheckAndLogRequiredLengthEx

* Allow custom format and options
* Add Stream_CheckAndLogRequiredLengthExVa for prepared va_list

* Improved Stream_CheckAndLogRequiredLength

* Now have log level adjustable
* Added function equivalents for existing logger
* Added a backtrace in case of a failure is detected

* Fixed public API input checks
2022-04-19 14:29:17 +02:00
Armin Novak 4d03d7c0bf Freerdp remove #ifdef HAVE_CONFIG_H 2022-03-03 11:26:48 +01:00
Armin Novak b2ad47a809 Reorganized FreeRDP headers 2022-03-03 11:26:48 +01:00
Armin Novak 538b34c51d Moved rail application start to client common 2022-02-22 16:43:21 +01:00
akallabeth 700d6dcd9e Use client/common mouse functions 2022-02-22 09:44:13 +01:00
akallabeth 7641710f60 Use a client/common context component
* Allows moving common client code from specific client to a
  generic client/common implementation
2022-02-22 09:44:13 +01:00
Armin Novak ccfe0c129e Removed checks already done by WINPR_ASSERT 2021-06-16 11:46:42 +02:00
Armin Novak 31862e60f9 Added missing return checks 2021-06-16 11:46:42 +02:00
Armin Novak 880c603c26 Renamed HashTable_Add to HashTable_Insert
* Since the changes break HashTable_Add rename it so that it will
  not fail silently
2021-06-16 11:46:42 +02:00
Armin Novak cb642699c8 Modified HashTable API to be opaque
* Reuse wObject function pointers
* Add missing getters/setters
* Clean up return types, const correctness of arguments
2021-06-16 11:46:42 +02:00
akallabeth 43311130a2 Fixed CodeQL warnings 2021-02-19 11:19:49 +01:00
akallabeth dfbf300389 Conservative keyboard state sync, refactored input API 2020-11-10 10:26:41 +01:00
Armin Novak e50a8e09ee Fixed warnings. 2020-08-10 12:26:46 +02:00
Armin Novak 72ca88f49c Reformatted to new style 2019-11-07 10:53:54 +01:00
akallabeth 4679bb6b53 Fix ##5593: duplicated typedef. 2019-09-22 16:42:31 +02:00
Armin Novak 843f18b110 Fix issue reported in #5560: language bar might not be supported by server. 2019-09-03 08:07:45 +02:00
Martin Fleisz ff036e0198
Merge pull request #5386 from akallabeth/rails_spec_update
Rails spec update
2019-05-09 12:49:55 +02:00
Armin Novak 2cc714a57d Updated RAILS implementation
* Implement new messages and callbacks
* Announce most recent channel features
* Added settings to configure flags to announce
2019-05-08 17:25:15 +02:00
Martin Fleisz 30c3b86655 core: Move image conversion for icon data into the library 2019-05-08 17:06:17 +02:00
Martin Fleisz 25fc56a625
Merge pull request #5260 from akallabeth/rail_spec_update
Rail spec update
2019-04-29 11:27:26 +02:00
Armin Novak 05901280fe Fixed unused argument warnings. 2019-04-05 09:14:35 +02:00
Armin Novak e009a62f06 Fixed sign-compare warnings 2019-04-05 09:14:35 +02:00
Armin Novak aacf5bddc4 Updated rail channel, supporting all new messages. 2019-02-19 15:04:11 +01:00
Armin Novak 0d3192b9f7 Fixed rail window key hash function to work with UINT32 2018-12-10 11:16:43 +01:00
akallabeth 2927114e7b
Merge pull request #5117 from hardening/rail_hash
rails: allow a window with id == 0
2018-12-10 10:26:52 +01:00
David Fort 88e361fa00 rails: allow a window with id == 0 2018-12-08 00:32:00 +01:00
Armin Novak f5e449a4f8 Cleaned up xf_rail_server_handshake 2018-12-05 09:13:04 +01:00
Armin Novak 43e17c9755 Fixed color conversion, log level and buffer types 2018-11-14 11:57:57 +01:00
ilammy 9292b2231f xfreerdp: set _NET_WM_ICON to RAIL app icon
Icons on X11 windows are configured using the _NET_WM_ICON property
described in Extended Window Manager Hints. Here we implement converison
from DIB bitmaps used by RAIL to the format expected by _NET_WM_ICON,
and actually set the icon for RAIL app windows.

Both DIB format and _NET_WM_ICON (or rather, Xlib) are weird. Let's
start with RAIL's format. That's the one used in BMP and ICO formats
on Windows. It has some strange properties but thankfully FreeRDP's
freerdp_image_copy() can handle most of them for us. (With an exception
of monochrome and 16-color formats that it does not support. Sorry, but
I'm too lazy to fix them. They are not seem to be used by any real
application either.) The one thing that it can't do is to apply the
alpha transparency bitmask so we have to do it manually. This instantly
reminds us that DIB format has HISTORY: it's vertically flipped and
each must be padded to 4 bytes. Both these quirks having reasonable
(for a certain definition of 'reason') explanations. Such is life.
(Also, 8-bit images require a color palette which we must fill in.)

So okay, now comes _NET_WM_ICON. It is more sane (or rather, easier to
deal with). The bitmap is represented with a tiny [width, height] header
followed by an array of pixels in ARGB format. There is no padding, no
weird color formats. But here's a catch: you can't simply take the
output of freerdp_image_copy() and cast to (unsigned char*) of colors.
We have to allocate an array of C's longs and copy the pixels there,
because that's what Xlib expects (and this is mentioned in the spec).
Simply casting an array of bytes causes crashes on 64-bit systems.
So don't try to cheat or "optimize" and read the docs, kids.

Note that XFlush() call after XChangeProperty(). It's there because it
seems to helps see the icon quicker with Unity on Ubuntu 14.04. I don't
know why. (And Unity does not support _NET_WM_ICON officially. But it
sorta kinda works sometimes.)

Oh, and while we're here, delete some old, unused, and commented out
code that was setting window icons in the past. It's not needed anymore.
2018-11-14 10:53:45 +01:00
ilammy 8163b6d1ce xfreerdp: add RAIL icon cache
This commit adds a cache for RAIL application icons. It is (surpisingly)
used to cache icons for remote applications. This mechanism is described
in MS-RDPERP 3.1.1.2 Icon Cache Support and related items.

Note that some (actually, most) of the icons are not cached. These are
marked with CacheId == 0xFF. In order to keep the code clean we do not
introduce a special case and instead use a 'scratch' icon and simply
pretend to return an xfRailIcon from cache.

We're going to set icons via _NET_WM_ICON property which explains
why we use "long" values to store pixel data. The icon conversion
is not implemented in this commit, it's only stubs.

However, we do implement processing of window information orders that
contain new icons or cached references to previously sent icons. Note
that it is important to not fail (i.e., to not return FALSE) if we
cannot find a window for the icon by its ID. The server occasionally
likes to be slow or something and send icon updates for nonexistent
windows. This behavior is mandated by the spec, too:

    MS-RDPERP 3.2.5.1.6 Processing Window Information Orders

    Upon receipt of a Window Information Order for an icon or
    cached icon, as specified in sections 2.2.1.3.1.2.2 and
    2.2.1.3.1.2.3, the client SHOULD locate the local RAIL window
    that corresponds to the WindowId reported in the Hdr field
    and apply the icon updates to the RAIL window. If no such
    window can be found, the client SHOULD ignore the order.

Indeed, we silently ignore such orders now.
2018-11-14 10:53:45 +01:00
Armin Novak a5b689b35d Readded override redirect but reset on focus loss. 2018-09-26 12:38:16 +02:00
Armin Novak 97c909107f Fixed const correctness for RAIL callbacks. 2018-09-14 10:07:22 +02:00
Armin Novak 47110a723d Removed duplicate checks, more functions static. 2018-03-01 12:39:29 +01:00
Armin Novak d181c79463 Fixed rail window cleanup. 2018-02-09 09:35:26 +01:00
Armin Novak 6950d95af0 Fix #4398: Ignore min/max info for non existing window. 2018-02-08 16:55:11 +01:00
Armin Novak e23af1d2fc Fixed missing argument checks. 2018-01-08 13:21:02 +01:00
weizhenwei c39aecbdb4 fix memory leak of pKeys at xf_rail_invalidate_region() 2017-06-21 15:26:28 +08: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
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
Armin Novak d46d0c3d4a Fixed invalid return from xf_rail_window_icon 2017-03-28 11:47:46 +02: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
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
Armin Novak 3b9c74ec0b Reformatted file. 2016-10-06 13:43:14 +02:00
Armin Novak f2d7766db6 Moved common async input handling to core library. 2016-10-06 13:43:12 +02:00