main now has a Haiku backend (#175). This branch takes it in place of
its own backend (haiku_be.cpp and its CI job are removed), and keeps
only these changes on top of it:
- RTLD_NOLOAD and ESOCKTNOSUPPORT are optional, so that the library
also builds with the headers of Haiku R1/beta5 (the sysroot of
D-Modem's haiku_sysroot.py, which the D-Modem GUI uses).
- COMn is the nth serial port in /dev/ports.
- A click on a disabled window (the owner of a modal dialog) brings
the dialog to the front and does not go to the window.
- docs/haiku.md tells these items.
Tested with the D-Modem GUI on Haiku R1/beta6 in QEMU.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTJUdomcnCN8okhJSr
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
The portable layer and the library now build for x86_64-unknown-haiku
with the system's clang and a sysroot of Haiku's packages
(SYSROOT=..., STDLIB=). The Interface Kit shows the windows.
- haiku.h, haiku_be.cpp and backend_haiku.cpp: the backend, in two
halves, as for Cocoa. The BApplication and each BWindow have their
own threads; they queue the input for the program's thread. A click
on a disabled window brings its modal dialog to the front.
- GetModuleFileName uses get_next_image_info (no /proc on Haiku), and
the command line comes from __libc_argv.
- COMn is the nth device in /dev/ports. Haiku's fonts and
~/config/settings/libmfc are used.
- Guards for the errno values, SIOCATMARK, RTLD_NOLOAD and the CS5 to
CS8 values that Haiku does not have or defines differently.
- The shared libraries link libbe, libnetwork and libbsd.
- docs/haiku.md, and the cross-haiku CI job, which builds the
libraries.
Tested with the D-Modem GUI on Haiku R1/beta6 in QEMU: menus, dialogs,
modal dialogs, the keyboard, moving windows and the serial ports.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTJUdomcnCN8okhJSr
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
The portable layer and the library now build for x86_64-unknown-haiku
and i586-pc-haiku with clang and a sysroot from clang-retro/unix-sdk.
The Haiku backend has two halves, as the Cocoa one has:
backend_haiku_be.cpp uses BApplication, BWindow, BView and BBitmap,
and backend_haiku.cpp connects them to the window manager of the
layer. The windows have no app_server border; the layer draws the
frame. Menus and tooltips float and do not take the focus. Keys,
modifiers, the mouse wheel, the cursor and the clipboard are mapped.
Other Haiku changes:
- the program path and argv come from the kernel and __libc_argv,
as Haiku has no /proc;
- the fonts come from the Haiku font folders (Noto Sans for the UI);
- the registry file is polled, as there is no inotify or kqueue;
- CSIZE, SIOCATMARK, ETOOMANYREFS, malloc.h and the tolower macro;
- CAsyncSocket::GetSockName and GetPeerName fail for an address that
is not IPv4, as on Windows (Haiku's sockaddr_in can hold an IPv6
address).
samples/showcase is a small SDI program with dialogs and common
controls. tests/run-haiku-tests.sh builds the tests and runs them in
Haiku in QEMU (unix-sdk's haiku-vm.py), and takes screenshots of the
sample. CI runs them in the nightly image for x86_64 and builds them
for i586. docs/haiku.md describes the port.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRUCocRdmh1id7SXNMg
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
winhelp_file.cpp uses std::abs, but it includes only <stdlib.h>. With
the libc++ of the macosx10.4 sysroot, <stdlib.h> does not declare
std::abs, so the build for Mac OS X 10.4 stopped with "no member named
'abs' in namespace 'std'".
Add a CI job that builds the libraries for i386 and PowerPC Mac OS X
10.4 against the nightly macosx10.4 sysroot, so that CI finds a missing
include of this type.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTLwxzpeGPkbLpNqXL
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
- Fill pattern brushes a row at a time: a division for each pixel was
most of the time of each key on a 68000, which divides in software.
- An edit control draws again only the lines that a change touches,
not all of the control.
- SetScrollInfo draws only the scroll bar whose thumb looks different.
- The Mac event loop takes all the events that wait, so that keys typed
fast are not lost from the small Event Manager queue.
In the 68k simulator, one key in MultiPad went from about 17 million
instructions to about 0.3 million.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRTDFNgD4oK9xbDsEGn
Signed-off-by: Neo-Desktop <321592+Neo-Desktop@users.noreply.github.com>
A program whose manifest asks for version 6 of the common controls, or
that runs with WINPORT_VISUAL_STYLES=1, now draws with a built-in visual
style of clang-retro's own: flat parts with one-pixel borders and slightly
rounded corners, in grays with the highlight color as accent.
WINPORT_VISUAL_STYLES=0 turns it off.
port/src/theme.cpp draws and measures the parts of the classes in the new
vsstyle.h and vssym32.h. uxtheme.cpp opens themes for those classes and
answers DrawThemeBackground, GetThemePartSize, GetThemeColor,
IsThemePartDefined and the rest from it; SetWindowTheme with empty
strings turns it off for a window. Buttons, edits, combo boxes, scroll
bars, progress bars, trackbars, spins, headers, tabs, toolbars, status
bars, rebar grippers and tree buttons draw with it, and the system colors
take its palette.
cmntest, whose manifest asks for the styles, checks the uxtheme calls.
Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
Without a compositing manager, a layered window on X11 got a bounding
shape for its fully clear pixels, but its alpha was not shown: a fading
splash or a half-transparent popup drew opaque.
X11 cannot blend windows by itself, so the backend now does what it
can: before such a window is mapped it takes a picture of the screen
under it from the root window, and draws the window's premultiplied
pixels over that picture. When the window moves, the part it covered
already comes from the old picture (the screen there shows the window
itself) and only the newly covered part is read from the root window.
The bounding and input shapes stay as they were. The picture does not
follow a window underneath that changes later; the README says so.
Checked on Xvfb with no compositing manager: a constant-alpha blue
window over a red and white checkerboard blends, and after a move the
checkerboard under it still lines up.
Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
GetGlyphOutline made only GGO_METRICS and GGO_NATIVE and refused the
rest with ERROR_NOT_SUPPORTED. Now it also gives:
- GGO_BITMAP, one bit for each pixel, and GGO_GRAY2_BITMAP,
GGO_GRAY4_BITMAP and GGO_GRAY8_BITMAP, a byte of 0 to 4, 16 or 64,
in rows on 4-byte bounds: the same coverage that text draws, so the
built-in bitmap font has bitmaps too. A glyph with no ink gives none.
- GGO_BEZIER: each quadratic curve raised to a cubic one, in
TT_PRIM_CSPLINE records, with the lines as before.
- With a matrix other than the identity, the glyph is drawn from its
transformed outline (8 x 8 samples a pixel, nonzero fill), and the
black box, the origin and the advance (gmCellIncX, gmCellIncY) are
transformed too.
wintest checks each bitmap's size, levels and bits, a space, the cubic
records against the quadratic ones, and an O turned a quarter turn.
Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
Windows Vista and later store large icon images (most often the
256 x 256 one) as PNG files inside icon resources and .ico files.
CreateIconFromResourceEx refused them; now such an image is decoded
with the stb_image that GDI+ already has and becomes the 32-bit DIB
with alpha that it stands for, with a mask set where the image is fully
clear. Resources, icon files (LoadImage with LR_LOADFROMFILE), OLE
pictures and the resource directory lookups all go through it.
wintest makes a 4 x 4 PNG icon with opaque, clear and half-transparent
rows, from bits with and without a size given and from an icon
file, and checks each row drawn on white.
Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
On Linux, OpenGL programs drew only with softgl. Now, when the system
has an OpenGL driver whose renderer is hardware, the wgl functions make
their contexts there, as an installable client driver does on Windows:
- libEGL.so.1 is loaded when OpenGL is first used, so a program still
needs no OpenGL library to start. The display is one of no window
system (EGL_MESA_platform_surfaceless), else a device
(EGL_EXT_platform_device), else the default one; the first with a
hardware renderer is used.
- Each context draws into a pbuffer of the window's (or bitmap's)
size. Before the picture goes to the window, it is read back into the
buffer that opengl.cpp copies with GDI, keeping the program's pack
states, pixel transfer, read buffer, read framebuffer and pack
buffer. So it works the same on X11, Wayland and with no display.
- The program's gl functions are still softgl's, which call through
the thread's dispatch table; a driver context points that table at
the driver's functions. The makefile takes the table's order from
port/softgl/src/dispatch.h (gl_names.inc), and a static_assert
checks the size.
- The pixel formats lose PFD_GENERIC_FORMAT and give the driver's depth
and stencil bits. wglGetProcAddress gives NULL for a vendor's
function whose extension is not there, as EGL gives a stub for any
name.
WINPORT_OPENGL=generic always uses softgl, and WINPORT_OPENGL=system
uses the driver even when its renderer is software (llvmpipe).
WINPORT_NO_EGL leaves it out. The README now says softgl gives OpenGL
1.5, not 1.1.
gltest runs once more over the system's driver where there is EGL,
and also checks a window that grows and the pixel states kept across
the read-back.
Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
Programs now see all of the desktop's monitors instead of one screen:
RandR monitors (or Xinerama screens) on X11, every wl_output placed
with xdg-output on Wayland, and every NSScreen on macOS, the primary
first. The headless backend takes a layout from WINPORT_MONITORS
("1024x768+0+0,800x600+1024+100") for tests.
- MonitorFromPoint, MonitorFromRect and MonitorFromWindow pick by the
largest overlap, with the NEAREST, PRIMARY and NULL fallbacks;
GetMonitorInfo gives each rcMonitor, rcWork and \\.\DISPLAYn name;
EnumDisplayMonitors clips and stops when the callback says so.
- EnumDisplayDevices, EnumDisplaySettingsEx and ChangeDisplaySettingsEx
are new (with DISPLAY_DEVICE and the EDS_ and DM_POSITION values);
the device mode of each monitor has its position.
- SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN, SM_CXVIRTUALSCREEN,
SM_CYVIRTUALSCREEN and SM_CMONITORS follow the layout, and so does
the default ClipCursor rectangle.
- A maximized window fills the work area of its own monitor.
- GetDpiForMonitor's MDT_RAW_DPI gives each monitor's own scale.
wintest lays out three monitors and checks the metrics, each lookup
with each flag, the info, enumeration with a clip, the devices and
modes, and a window maximized on the second monitor.
Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
A thread that calls SuspendThread on itself at once can run before
pthread_create has stored its handle in the Thread, so StopThread then
suspended (on macOS) or signalled (elsewhere) a thread that was not
there, and the thread ran on. core's "thread that holds itself" check
failed that way on macOS. A thread that stops itself now names itself
with pthread_self.
Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
Drags from other programs now reach a window's OLE drop target, not
only WM_DROPFILES. The backend describes the drag (its files and text,
how to fetch them, where the answers go), and the window's thread hands
it to the target under it as a data object with CF_HDROP,
CF_UNICODETEXT and CF_TEXT, fetched when the target asks. A window that
takes files still gets WM_DROPFILES. The target's effect goes back to
the other program.
Drags this program starts with DoDragDrop are offered to other programs
once they leave its windows, as a URI list of their CF_HDROP files and
as text:
- On X11, the drag loop follows the pointer over other windows and acts
as the XDND source: enter, position, status, drop, and the
XdndSelection requests.
- On Wayland, the compositor runs the rest of the drag
(wl_data_device.start_drag).
- On macOS, AppKit runs the rest of the drag (dragImage).
On Wayland and macOS a drag that comes back to the program's own
windows carries the original data object.
Incoming drags are handled as follows:
- On X11, through XDND, with any number of types, the source's action,
and the keys held.
- On Wayland, through wl_data_device, with actions.
- On macOS, through the dragging pasteboard, with files and text.
Tried with a GTK 3 program on Xvfb and on Weston, in both directions
and out and back. dragtest hands drags in as a backend does: text onto
the view's COleDropTarget with the effects going back, and files onto
a window that takes them.
Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
CMFCListCtrl and CMFCHeaderCtrl sort by an overridable comparison and
mark the sorted columns; CMFCTabCtrl shows a window per tab in each of
the Feature Pack's tab styles; CMFCPropertyGridCtrl edits grouped values
in place; CMFCShellTreeCtrl and CMFCShellListCtrl browse the shell
namespace together.
CArray of CObject pointers now serializes. The CBT hook keeps
m_pWndInit set through PreSubclassWindow, as MFC does, so a control can
tell being created from being subclassed. The portable layer gains
SHGetFileInfo and a system image list of document and folder icons.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRUqfQ3sTcDCMdNCGGs
GDI+ now decodes every frame of a GIF, exposes them along
FrameDimensionTime with GdipImageGetFrameCount and
GdipImageSelectActiveFrame, and reports each frame's delay and the
loop count as PropertyTagFrameDelay and PropertyTagLoopCount. Saving
with EncoderSaveFlag set to EncoderValueMultiFrame starts a session
that GdipSaveAdd and GdipSaveAddImage extend and EncoderValueFlush
ends; a multi-frame image saved whole is written animated. Each frame
gets its own color table and graphic control extension, with a
NETSCAPE2.0 loop block. Property items can be read, set and removed.
atlutiltest saves, reloads and resaves a three-frame GIF.
Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
CWinAppEx (its registry settings, window placement and the context menu,
keyboard, mouse, shell and tooltip managers), CSettingsStore and
CSettingsStoreSP, afxGlobalData, and the visual managers (classic, Office
XP, Windows, Office 2003, VS 2005, Office 2007, VS 2008, Windows 7).
They draw the standalone controls: CMFCButton, CMFCLinkCtrl,
CMFCMenuButton, CMFCColorButton with its palette, CMFCEditBrowseCtrl,
CMFCMaskedEdit, CMFCFontComboBox and CMFCSpinButtonCtrl.
The portable layer gains DrawState, TTM_SETTITLE and HIGHCONTRAST; CDC
gains DrawState's CBrush* overloads. fptest covers them on Windows and
natively.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRUqfQ3sTcDCMdNCGGs
CoCreateInstance(CLSID_ShellLink) now gives a shortcut object with
IShellLinkA and W, IPersistFile and IPersistStream. Shortcuts are kept
in Windows' .lnk format, so shortcuts made on Windows open here and the
other way round:
- the target as the LinkInfo's local path, in ANSI and UTF-16;
- the description, relative path, working directory, arguments and
icon as UTF-16 strings, with the show command, hotkey, and the
target's attributes, times and size in the header;
- reading also takes the target from the environment variables block.
SetPath expands %VARIABLES% and makes the path whole; GetIDList and
SetIDList go through the namespace's ID lists. Resolve finds a target
moved along with its shortcut by the relative path. A folder shows a
.lnk file as a link (SFGAO_LINK), and ShellExecute opens what a
shortcut points to. shlguid.h is new.
wintest checks every field through a file and a stream, the file's
header and LinkInfo, a moved target, a broken shortcut and SFGAO_LINK.
Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
Older MinGW-w64 comdef.h types the IFooPtr smart pointers only where
__uuidof is the compiler's, and Ubuntu's MinGW-w64 has no
libcomsuppw.a, so the mingw-wine job could not build the test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRUqfQ3sTcDCMdNCGGs
SuspendThread now stops a running thread where it is: with Mach's
thread_suspend on macOS, and elsewhere with a signal whose handler waits
until the count is back to zero. ResumeThread counts down and lets it
go; a thread can suspend itself and be resumed by another. The count is
kept as on Windows (MAXIMUM_SUSPEND_COUNT, ERROR_SIGNAL_REFUSED).
TerminateThread stops a thread for good: before it starts, while it
runs, or while it is held. As on Windows, nothing it holds is let go
and its stack is not unwound; its handle is signaled with the exit code.
The cooperative threads of DOS and the classic Mac OS can still be held
only before they start.
core tests threads made suspended, held while running (and by
themselves), and terminated at each stage.
Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRRw4kkFHrrHRhkcuLw
comutil.h gives _bstr_t, _variant_t and _com_error, comip.h _com_ptr_t
with _com_IIID, and comdef.h the _com_dispatch_ helpers that #import
wrappers call plus the IFooPtr smart pointers for the system's
interfaces. They are header only: what Windows has in comsupp.lib is
inline, and _com_raise_error is weak so a program can replace it.
comdeftest runs the same checks on Windows (against MinGW's headers and
comsupp) and on Linux and macOS (against these).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRUqfQ3sTcDCMdNCGGs