On Thu Feb 27 16:00:21 2025 +0000, Joe Souza wrote:
> I'll answer #2 first:
> Under Windows, Ctrl-C definitely does break out of a DIR /P pause.
> Regarding the second part, I completely agree that the proper way to
> handle this would be to wait on both input and the Ctrl-C event. I have
> tried this. You may recall in an earlier iteration of my changes for a
> prior merge request, I left some code commented out which I then removed
> after you raised issue with it. This code was a call to
> WaitForMultipleObjects, waiting on both the input handle and the Ctrl-C
> event. The problem here which I believe I had stated at the time is
> that with Wine, the input handle is always signaled, even if there is no
> input waiting. The result was that the wait was always being satisfied
> immediately and DIR /P was not pausing at all. So that approach was
> abandoned in favor of what we have now.
> #1:
> This code here is based on the previous code for WCMD_Pause. That code
> was setting console mode flags to 0. I'm guessing that PAUSE has
> operated this way for many years. My changes use the new
> WCMD_wait_for_input for both PAUSE and DIR /P, and I did not want to
> break PAUSE behavior. Further, ENABLE_ECHO_INPUT is on by default, and
> counter to Microsoft's docs for SetConsoleMode, on Wine the character is
> echoed even if ENABLE_LINE_INPUT is disabled. The end result here is
> that DIR /P was echoing the character that the user pressed, whereas
> Windows does not exhibit that behavior.
> All that said, based on shortcomings in Wine that I discuss above, I
> believe that my changes here are currently the best approach.
the attached patch (on top of what you sent earlier on) should work as expected:
* the annoying parts: console handles don't support overlapped mode, and input console handles are signaled when there's a pending event... but a pending event could be mouse move, window resize, ctrl key down & up... maybe that's the reason you always check it as signaled
* so the attached patch waits on both console input handle and control c event, but has to discriminate when the console input handle is signaled whether there's an actual character or some other things
* it's still racy at some places, but given the API I don't see a clean way to do it
* [wait-con.patch](/uploads/a537c394d4b98165b791a7979ad3f8ca/wait-con.patch)
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7400#note_96140
This MR adds clipboard support to the winewayland driver by using the wlr-data-control-unstable-v1 protocol. Note that this protocol was recently merged into wayland-protocols as ext-data-control-v1, but it's not yet widely supported, so I preferred to use the wlr version for now.
This MR has many similarities to https://gitlab.winehq.org/wine/wine/-/merge_requests/7236, but due to the unconstrained nature of wlr-data-control-unstable-v1 the implementation is simpler and more robust. It can neatly fit into the existing Wine clipboard design (single proxy window in the desktop process) without requiring any event forwarding etc.
Since wlr-data-control-unstable-v1/ext-data-control-v1 is considered privileged, it may not be available in all situations, e.g., in sandboxes, and there are also a couple of compositors that may not implement it at all. It is therefore useful to have a simple fallback using the core wl_data_device interface. This fallback is not part of this MR, but I have pushed a WIP implementation based on this MR at: https://gitlab.winehq.org/afrantzis/wine/-/commits/wayland-copy-paste-data-… (note: only the win32 -> wayland direction implemented at the moment). The new fallback approach is different from https://gitlab.winehq.org/wine/wine/-/merge_requests/7236 in that when using wl_data_device it creates per-process clipboard windows instead of forwarding messages from the desktop clipboard window. This allows it to work within the design of this MR with minimal changes and maximum code reuse.
--
v3: winewayland: Normalize received MIME type strings.
winewayland: Support copying data from native clipboard to win32 apps.
winewayland: Support exporting various clipboard formats.
winewayland: Generalize support for exporting clipboard formats.
winewayland: Support copying text from win32 clipboard to native apps.
winewayland: Implement zwlr_data_control_device_v1 initialization.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7336
On Thu Feb 27 10:01:08 2025 +0000, eric pouech wrote:
> 1) concerning the mode for waiting a key,
> * ENABLE_PROCESS_INPUT is already set... default mode is 0x1f7 (so all
> flags except ENABLE_WINDOW_INPUT and ENABLE_VIRTUAL_TERMINAL_PROCESSING)
> * so IMO you just need to clear the ENABLE_LINE_INPUT flag to get key
> press without wating for end of line
> 2) for ctrl-c handling
> * likely the ctrl-c is reported through the ctrl-c handler and it's not
> clear to me if native does break the read operation in this case and
> whether we should wait on both read operation & ctrl-c event
I'll answer #2 first:
Under Windows, Ctrl-C definitely does break out of a DIR /P pause. Regarding the second part, I completely agree that the proper way to handle this would be to wait on both input and the Ctrl-C event. I have tried this. You may recall in an earlier iteration of my changes for a prior merge request, I left some code commented out which I then removed after you raised issue with it. This code was a call to WaitForMultipleObjects, waiting on both the input handle and the Ctrl-C event. The problem here which I believe I had stated at the time is that with Wine, the input handle is always signaled, even if there is no input waiting. The result was that the wait was always being satisfied immediately and DIR /P was not pausing at all. So that approach was abandoned in favor of what we have now.
#1:
This code here is based on the previous code for WCMD_Pause. That code was setting console mode flags to 0. I'm guessing that PAUSE has operated this way for many years. My changes use the new WCMD_wait_for_input for both PAUSE and DIR /P, and I did not want to break PAUSE behavior. Further, ENABLE_ECHO_INPUT is on by default, and counter to Microsoft's docs for SetConsoleMode, on Wine the character is echoed even if ENABLE_LINE_INPUT is disabled. The end result here is that DIR /P was echoing the character that the user pressed, whereas Windows does not exhibit that behavior.
All that said, based on shortcomings in Wine that I discuss above, I believe that my changes here are currently the best approach.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7400#note_96130
This is the refactoring of the tests in !7160. I submit a new seperate MR because I want to get the tests upstreamed first, otherwise making changes to tests patches needs rebasing the implementation patches. So plz review the tests MR first.
--
v2: mfreadwrite/tests: Test sample processing for writer.
mfreadwrite/tests: Test AddStream and SetInputMediaType for writer.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7332
Related Wine issue: https://bugs.winehq.org/show_bug.cgi?id=52714
I'm starting work on updating/extending Linux force feedback API and one of my goals is to expose the number and an array that contains the device's ffb-enabled axes. As I'm mainly working with USB PID driver, I already have a POC of obtaining this data.
What prompted this is that currently Wine always creates virtual joysticks with two PID ffb axes. This causes issues with [Richard Burns Rally](https://github.com/ValveSoftware/Proton/issues/6702#issuecomment-267…, as this game incorrectly initializes a `CONSTANT_FORCE` effect with all the FFB axes that contain `DIDOI_FFACTUATOR` flag and then trying to update `cAxes` and `rgdwAxes` values which leads to `DIERR_INVALIDPARAM`.
Now, this flag is set by wine while enumerating virtual device's axes and while `(axis index < FFB axes)`, flag is applied. This means, that every device which has FFB functionality and at least two axes, will report FFB on `X`, `Y`.
While updated API would mean a lot of steering wheels would correctly report only 1 axis, a lot of USB PID wheels still include `X` and `Y` in their `AXES_ENABLE` and `DIRECTION` usages. This, again, would lead to broken FFB (in affected games).
On Windows, there's a possibility of overwriting some joystick capabilities with registry entries, which ends up removing `DIDOI_FFACTUATOR` flag from a selected axis. This doesn't work in Wine.
This MR allows Wine to add an arbitrary number (up to `PID_AXES_MAX`) of axes to the PID descriptor, based on the value of Haptic Axes from SDL or from Linux FF api in the future (I'm working on it). Additionally, to work around RBR and other games with similar, wrong FFB handling, I introduced a [hint](https://github.com/libsdl-org/SDL/issues/12341) to SDL that allows a dynamic overwrite of the number of haptic axes. For the Linux API, I'll figure out a nice way to override when the number of axes will be exposed.
With these changes, I was able to successfully get force feedback on my Moza Racing R9 with all axes usable. With additional traces in the dinput code, I confirmed that with one axis defined in the PID descriptor, the game created a constant force effect with just one axis and `cAxes = 1`.
--
v5: dinput/tests: Fix the 3-axis joystick descriptor
winebus: Get the number of haptic axes from SDL
winebus: Support creation of arbitrary number of PID axes
https://gitlab.winehq.org/wine/wine/-/merge_requests/7422
Related Wine issue: https://bugs.winehq.org/show_bug.cgi?id=52714
I'm starting work on updating/extending Linux force feedback API and one of my goals is to expose the number and an array that contains the device's ffb-enabled axes. As I'm mainly working with USB PID driver, I already have a POC of obtaining this data.
What prompted this is that currently Wine always creates virtual joysticks with two PID ffb axes. This causes issues with [Richard Burns Rally](https://github.com/ValveSoftware/Proton/issues/6702#issuecomment-267…, as this game incorrectly initializes a `CONSTANT_FORCE` effect with all the FFB axes that contain `DIDOI_FFACTUATOR` flag and then trying to update `cAxes` and `rgdwAxes` values which leads to `DIERR_INVALIDPARAM`.
Now, this flag is set by wine while enumerating virtual device's axes and while `(axis index < FFB axes)`, flag is applied. This means, that every device which has FFB functionality and at least two axes, will report FFB on `X`, `Y`.
While updated API would mean a lot of steering wheels would correctly report only 1 axis, a lot of USB PID wheels still include `X` and `Y` in their `AXES_ENABLE` and `DIRECTION` usages. This, again, would lead to broken FFB (in affected games).
On Windows, there's a possibility of overwriting some joystick capabilities with registry entries, which ends up removing `DIDOI_FFACTUATOR` flag from a selected axis. This doesn't work in Wine.
This MR allows Wine to add an arbitrary number (up to `PID_AXES_MAX`) of axes to the PID descriptor, based on the value of Haptic Axes from SDL or from Linux FF api in the future (I'm working on it). Additionally, to work around RBR and other games with similar, wrong FFB handling, I introduced a [hint](https://github.com/libsdl-org/SDL/issues/12341) to SDL that allows a dynamic overwrite of the number of haptic axes. For the Linux API, I'll figure out a nice way to override when the number of axes will be exposed.
With these changes, I was able to successfully get force feedback on my Moza Racing R9 with all axes usable. With additional traces in the dinput code, I confirmed that with one axis defined in the PID descriptor, the game created a constant force effect with just one axis and `cAxes = 1`.
--
v4: dinput/tests: Fix the 3-axis joystick descriptor
winebus: Get the number of haptic axes from SDL
winebus: Support creation of arbitrary number of PID axes
https://gitlab.winehq.org/wine/wine/-/merge_requests/7422