Commit Graph

175 Commits

Author SHA1 Message Date
akallabeth 7a71441476 [warnings] fix integer multiplications
Ensure the integer width for size arguments is 64bit in a
multiplication. Leading 64bit constant 1ull expands width, a trailing
one is ignored.
2023-08-22 11:55:00 +02:00
Armin Novak 684558d6d7 [client,x11] wrap XChangeProperty
to debug bug reports occuring only with certain setups wrap the function
call with a logging edition so we have the arguments available in the
log for debugging.
2023-03-07 07:51:52 +01:00
akallabeth d4808dd3e1 Fixed various compiler warnings 2022-12-09 15:58:26 +01:00
akallabeth f553d453b8 [client,x11] use HashTable_ForEach for rail paint 2022-12-09 12:30:14 +01:00
Armin Novak 1bc110518d [x11,rail] cleaned up rail drawing code
The remote application drawing code was simplified
2022-12-09 12:30:14 +01:00
akallabeth 4d885e3a6e [client,x11] Initialize window with 32bit color
Allow alpha channel to be properly processed for rail
2022-12-09 12:30:14 +01:00
akallabeth 5799fb2018 Replace ConvertFromUnicode and ConvertToUnicode
* Use new ConvertUtf8ToWChar, ConvertUtf8NToWChar,
  ConvertUtf8ToWCharAlloc and ConvertUtf8NToWCharAlloc
* Use new ConvertWCharToUtf8, ConvertWCharNToUtf8,
  ConvertWCharToUtf8Alloc and ConvertWCharNToUtf8Alloc
* Use new Stream UTF16 to/from UTF8 read/write functions
* Use new settings UTF16 to/from UTF8 read/write functions
2022-11-28 10:42:36 +01:00
Armin Novak 697e020abd [rail] Added window update from surface 2022-11-11 06:42:45 +01:00
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