Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions backend/fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static bool twin_fbdev_work(void *closure)
return true;
}

twin_context_t *twin_fbdev_init(int width, int height)
twin_context_t *twin_fbdev_init(int width maybe_unused, int height maybe_unused)
{
char *fbdev_path = getenv(FBDEV_NAME);
if (!fbdev_path) {
Expand Down Expand Up @@ -283,15 +283,24 @@ twin_context_t *twin_fbdev_init(int width, int height)
goto bail_vt_fd;
}

/* Use actual framebuffer resolution instead of caller-supplied dimensions.
* The physical display size is authoritative -- the caller's width/height
* are only hints suitable for resizable backends like SDL.
* Read directly from fb_var which was already validated by
* twin_fbdev_apply_config() above -- no redundant ioctl needed.
*/
int fb_width = tx->fb_var.xres;
int fb_height = tx->fb_var.yres;

const twin_put_span_t fbdev_put_spans[] = {
_twin_fbdev_put_span16,
_twin_fbdev_put_span24,
_twin_fbdev_put_span32,
};
/* Create TWIN screen */
ctx->screen = twin_screen_create(
width, height, NULL, fbdev_put_spans[tx->fb_var.bits_per_pixel / 8 - 2],
ctx);
fb_width, fb_height, NULL,
fbdev_put_spans[tx->fb_var.bits_per_pixel / 8 - 2], ctx);
if (!ctx->screen) {
log_error("Failed to create screen");
goto bail_fb_unmap;
Expand Down
20 changes: 10 additions & 10 deletions src/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,19 @@ twin_window_t *twin_window_create(twin_screen_t *screen,
width += left + right;
height += top + bottom;
#else
/* No-WM: ignore position, clamp to screen, no decorations */
/* No-WM: the single window always covers the entire screen
* regardless of what the application requested. The screen
* dimensions are authoritative -- they come from the backend
* (hardware resolution for fbdev, window size for SDL, etc.).
*/
left = 0;
top = 0;
right = 0;
bottom = 0;
x = 0;
y = 0;
if (width > screen->width)
width = screen->width;
if (height > screen->height)
height = screen->height;
width = screen->width;
height = screen->height;
#endif

window->client.left = left;
Expand Down Expand Up @@ -156,14 +158,12 @@ void twin_window_configure(twin_window_t *window,
#if defined(CONFIG_WINDOW_MANAGER)
_twin_window_style_size(style, &border);
#else
/* No-WM: ignore position, clamp to screen, zero margins */
/* No-WM: always match the screen provided by the backend. */
border.left = border.right = border.top = border.bottom = 0;
x = 0;
y = 0;
if (width > window->screen->width)
width = window->screen->width;
if (height > window->screen->height)
height = window->screen->height;
width = window->screen->width;
height = window->screen->height;
#endif

twin_pixmap_disable_update(window->pixmap);
Expand Down