Commit Graph

41 Commits

Author SHA1 Message Date
qiannian 5191409708 app: [Windows] support TopMost option
Use HWND_TOPMOST and HWND_NOTOPMOST when applying Config.TopMost on Windows.

Leave SWP_NOZORDER set when TopMost hasn't changed, so other Configure calls don't reorder the window.

Signed-off-by: qiannian <qianniancn@gmail.com>
2026-06-27 10:38:28 +02:00
qiannian 30dc7ff294 app: [Windows] don't make raised windows topmost
Use HWND_TOP instead of HWND_TOPMOST in ActionRaise so raising a
window no longer pins it on top.

Signed-off-by: qiannian <qianniancn@gmail.com>
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2026-06-25 18:53:27 +02:00
Elias Naur 9e18cb93fb ap/internal/windows: change type of HWND_TOPMOST to syscall.Handle
syscall.Handle is equivalent to the C type HWND.

Inspired by a patch by qiannian.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2026-06-25 11:18:57 +02:00
inkeliz 74671a7f9e app/internal/windows: add SendMessage, FindWindow
Also replace calls to the deprecated StringToUTF16Ptr syscall.

Signed-off-by: inkeliz <inkeliz@inkeliz.com>
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2025-12-15 22:20:24 +01:00
Marc 809a6d0dc7 app: [Windows] add minimal support for devices with touch screens
The Windows Pointer API
(https://learn.microsoft.com/en-us/windows/win32/api/_inputmsg/) was used
to allow the detection of events when interacting with touch screens. This
also opens the gates for supporting other types of input devices (e.g. pens
and touchpads). Mouse events are now part of the pointer events (primary
events trigger WM_POINTER<DOWN|UP>, whereas secondary ones vanilla
WM_POINTERUPDATE, and cancellations WM_POINTERCAPTURECHANGED).
A fourth and fifth button (usually found in modern mice) has also been added
for completeness, though their integration in other OS-es shall be the
objective of future patches.

Signed-off-by: Marc <marc.leroy@samantree.com>
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2025-05-27 19:16:47 +02:00
Elias Naur 97044e53b5 app: [Windows] track window state changes initiated by the OS
Like the previous change, update the Windows backend to track and report
window state changes initiated by the OS.

References: https://todo.sr.ht/~eliasnaur/gio/600
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2024-10-22 19:05:27 +02:00
Elias Naur 9dceca6c95 Revert "app: [Windows] suppress double-click behaviour for custom decorations"
This reverts commit 82cbb7b8da.

As Egon Elbre points out in

https://todo.sr.ht/~eliasnaur/gio/600#event-377179

this is not the right fix.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2024-10-22 19:05:19 +02:00
Elias Naur 82cbb7b8da app: [Windows] suppress double-click behaviour for custom decorations
Fixes: https://todo.sr.ht/~eliasnaur/gio/600
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2024-07-13 18:09:13 +02:00
Elias Naur 313c488ec3 app: [Windows] remove padding from maximized custom decorated windows
As described in https://devblogs.microsoft.com/oldnewthing/20150304-00/?p=44543
Windows extends maximized windows outside the visible display. This is
not appropriate for custom decorated windows, so this change implements
a workaround in the handling of WM_NCCALCSIZE.

While here, replace the deltas field from window state to fix issues
when switching between decoration modes.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2023-09-08 15:22:40 -05:00
Elias Naur 0e77a2b521 app: [Windows] enable drop shadows for custom decorated windows
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2023-08-16 15:44:04 -06:00
Elias Naur 63550cc81e app: [Windows] make custom decorated windows behave like regular windows
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2023-08-16 15:44:04 -06:00
Inkeliz 90688fdd17 app,io/system: [API] add StageInactive when window is not in focus
Now, Gio will send one system.StageEvent with system.StageInactive when
the window is not active. It is implemented on macOS and Windows.

This change is not fully backward compatible, if your code compares
the Stage (`stage < system.StageRunning`), you need to consider
the new system.StageInactive.

Signed-off-by: inkeliz <inkeliz@inkeliz.com>
2022-09-19 11:07:41 -06:00
Elias Naur 3f38e67ce0 io/system: add ActionInputOp to register window move gesture areas
The app.Window.Perform(ActionMove) is the wrong abstraction for
initiating a move gesture: Windows needs to know the move gesture
area at pointer move, and macOS needs to know the pointer button
down event that triggers the move gesture. This change replaces
Perform(ActionMove) with a new system.ActionInputOp that marks an
area movable.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-06-25 19:40:46 +02:00
Elias Naur fd3a3eb1b9 app: [Windows] support resize gestures for undecorated windows
We're about to remove the client-controlled system.Action machinery
for resize gestures initiated by the client. This is the replacement
implementation for Windows, where the behaviour is hard-coded to
mimic the decorated automatic handling.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-06-25 18:41:32 +02:00
Egon Elbre cbbb5865e5 app/internal/windows: fix WS_CLIPCHILDREN value
Fixes: https://todo.sr.ht/~eliasnaur/gio/419
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2022-05-31 09:25:12 +02:00
Elias Naur 95365d5878 app/internal/windows,app: [Windows] generalize windows.GetPointerLong
We're about to use it to store the Go window cgo.Handle.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-03-02 18:15:38 +01:00
Elias Naur fea2f888bb all: replace unsafe slice operations with unsafe.Slice
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-03-02 16:53:02 +01:00
Egon Elbre b7a42da386 app: [windows] add missing cursors
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2022-02-22 10:39:12 +01:00
Elias Naur 31f55232bf app,widget,io: implement IME positioning
This change implements reporting of the caret position from Editor, as well
as Windows, macOS, Android support. As a result, the IME composition window
on Windows and macOS is now positioned correctly.

References: https://todo.sr.ht/~eliasnaur/gio/246
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-02-13 20:09:06 +01:00
Elias Naur cffa748c6a app: [Windows] simplify GetWindowRect, delete old workaround
Go issue #34474 was fixed in 1.14 and backported to 1.13.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-02-13 18:52:08 +01:00
Elias Naur 27e0b9cc7d app,app/internal/windows: [Windows] implement IME support
References: https://todo.sr.ht/~eliasnaur/gio/246
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-02-13 18:52:08 +01:00
Jan Kåre Vatne c4f98d3c1e app: [API] add minimized window mode, change methods to options
The window modes are extended, following microsoft conventions.
We have Fullscreen, Overlapping, Maximized and Minimized.
These modes can be set via options when a new window is creates,
or modified later by calling helper functions like w.Maximize() and w.Center()

The window configuration is automatically updated when a user
modifies the window by dragging or clicking the icons on the window's title-bar,
minimizing or maximizing the window.

Any change, either by the user or the application will emit a ConfigChange event.

This is implemented and tested on Windows only.

API change. the app.Window methods Maximize and Center are replaced with similar
options. For example, to maximize a window use

    w.Option(app.Maximized.Option())

Also, Maximize and Center implementations for X11 and macOS are left for a future
change.

Fixes: https://todo.sr.ht/~eliasnaur/gio/315
Signed-off-by: Jan Kåre Vatne <jkvatne@online.no>
2022-01-15 17:30:22 +01:00
Pierre Curto 3a20330d82 app: detect fullscreen mode for macOS and Windows
When an application goes into or out of fullscreen mode,
Gio now emits a ConfigEvent with the current window mode.

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2021-12-26 10:20:54 +01:00
Inkeliz f4c82adeff app/internal/windows: don't crash on app.Fullscreen on windows/386
Before this patch, use of `app.Fullscreen` would result in "Failed to
find SetWindowLongPtrW procedure in user32.dll" when running on 32 bit
Windows.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-11-16 16:31:13 +01:00
Jan Kåre Vatne 9835cd5996 app: add Window.Maximize and Center, add Windows implementation
Signed-off-by: Jan Kare Vatne <jkvatne@online.no>
2021-11-10 17:03:23 +01:00
Pierre Curto 2f66ed1dc8 app: add Window.Raise to bring a window to the front
Fixes gio#252

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2021-09-09 07:46:09 +02:00
Elias Naur 060ae1cdf9 all: add //go:build lines
They're automatically added by Go 1.17 source formatters. This change
adds them all now.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-07-26 15:17:51 +02:00
pierre ce7f0da06e app/internal/wm: use Option method to initialize windows
Added (*w.window).Option methods to the backends and use them for setting the initial options passed into NewWindow.

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-04-02 21:15:42 +02:00
pierre 238dd1aa86 app: added support for fullscreen mode
The option field WindowMode allows changing the window mode of an application in either Windowed or Fullscreen.
Only macOS, Windows and X11 platforms are currently supported.

Updates gio#89.

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-03-23 23:26:46 +01:00
pierre a581acf3fd io/pointer: added the grab cursor
Signed-off-by: pierre <pierre.curto@gmail.com>
2021-02-08 09:15:14 +01:00
pierre d604455582 app: added windows.TRUE for Windows
Signed-off-by: pierre <pierre.curto@gmail.com>
2021-01-27 22:21:18 +01:00
pierre f7d1f46c1f app: make cursor support more robust on Windows
Post a dedicated message upon Window.SetCursor calls.
Make sure that the cursor is only changed if the cursor is in the window.

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-01-27 17:51:45 +01:00
Inkeliz 0dfb04eb2d app/internal/window: [windows] add icon support
That change adds the icon to the "window navbar".

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2020-12-11 20:24:33 +01:00
pierre 69cc2c795c app: add support for system cursors
Signed-off-by: pierre <pierre.curto@gmail.com>
2020-12-03 16:45:17 +01:00
Pierre Curto 4c3de5f5d2 app: support horizontal scrolling on Windows and Linux
Fixes #181.

Signed-off-by: pierre <pierre.curto@gmail.com>
2020-11-27 09:24:48 +01:00
Josiah Niedrauer 42e568775c io/key: implement key.Release state
Implement key state for the following platforms:
js, wayland, windows, x11.

Unsupported platforms will continue to function as before, sending
key.Press for all key events.

Signed-off-by: Josiah Niedrauer <josiah@niedrauer.com>
2020-11-01 17:13:00 +01:00
Elias Naur 39fd161bea app/internal/window: use GetDpiForWindow if available
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-07-19 10:41:47 +02:00
Jason 9cfbdafe14 app/window,app/internal/window: allow min/max window size
The app.MinSize and app.MaxSize options restricts the window size:

w := app.NewWindow(
	app.Size(unit.Dp(600), unit.Dp(596)),
	app.MinSize(unit.Dp(600), unit.Dp(596)),
	app.MaxSize(unit.Dp(600), unit.Dp(596)),
	app.Title(APPNAME),
)

Signed-off-by: Jason <sourcehut@sweatyballs.es>
2020-06-22 13:00:27 +02:00
Egon Elbre 0b713032fb app/internal: [Windows] support Window.Close
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-06-19 12:37:21 +02:00
Elias Naur f210651b08 app/internal/window,app/internal/windows: implement Windows clipboard access
Update gio#31

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-17 19:12:45 +02:00
Elias Naur 06a2228798 app/internal/windows: split out Windows syscalls from package window
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-12-01 23:25:04 +01:00