feat: spreadsheet cell resizing
This commit is contained in:
@@ -149,6 +149,18 @@ void gui::desktop_compose(DesktopState* ds) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if focused external window requests a cursor style
|
||||
if (cur_style == CURSOR_ARROW && ds->focused_window >= 0) {
|
||||
Window* fwin = &ds->windows[ds->focused_window];
|
||||
if (fwin->external && fwin->ext_cursor > 0) {
|
||||
Rect cr = fwin->content_rect();
|
||||
if (cr.contains(ds->mouse.x, ds->mouse.y)) {
|
||||
if (fwin->ext_cursor == 1) cur_style = CURSOR_RESIZE_H;
|
||||
else if (fwin->ext_cursor == 2) cur_style = CURSOR_RESIZE_V;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw cursor last
|
||||
draw_cursor(fb, ds->mouse.x, ds->mouse.y, cur_style);
|
||||
}
|
||||
|
||||
@@ -434,6 +434,32 @@ void gui::desktop_handle_mouse(DesktopState* ds) {
|
||||
ds->ctx_menu_open = false;
|
||||
}
|
||||
|
||||
// Forward continuous mouse events to focused window (hover, drag, release)
|
||||
if (!left_pressed && ds->focused_window >= 0) {
|
||||
Window* win = &ds->windows[ds->focused_window];
|
||||
if (win->state != WIN_MINIMIZED && win->state != WIN_CLOSED) {
|
||||
Rect cr = win->content_rect();
|
||||
// Forward if mouse is over content (hover/move) or button is held/released (drag continuity)
|
||||
if (cr.contains(mx, my) || left_held || left_released) {
|
||||
if (win->external) {
|
||||
Montauk::WinEvent wev;
|
||||
montauk::memset(&wev, 0, sizeof(wev));
|
||||
wev.type = 1; // mouse
|
||||
wev.mouse.x = mx - cr.x;
|
||||
wev.mouse.y = my - cr.y;
|
||||
wev.mouse.scroll = 0;
|
||||
wev.mouse.buttons = buttons;
|
||||
wev.mouse.prev_buttons = prev;
|
||||
montauk::win_sendevent(win->ext_win_id, &wev);
|
||||
} else if (win->on_mouse) {
|
||||
ev.x = mx;
|
||||
ev.y = my;
|
||||
win->on_mouse(win, ev);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle scroll events on focused window
|
||||
if (ev.scroll != 0 && ds->focused_window >= 0) {
|
||||
Window* win = &ds->windows[ds->focused_window];
|
||||
|
||||
@@ -114,10 +114,11 @@ void desktop_poll_external_windows(DesktopState* ds) {
|
||||
for (int i = 0; i < ds->window_count; i++) {
|
||||
if (ds->windows[i].external && ds->windows[i].ext_win_id == extId) {
|
||||
found = true;
|
||||
// Update dirty flag
|
||||
// Update dirty flag and cursor
|
||||
if (extWins[e].dirty) {
|
||||
ds->windows[i].dirty = true;
|
||||
}
|
||||
ds->windows[i].ext_cursor = extWins[e].cursor;
|
||||
// Re-map if external app resized its buffer
|
||||
if (extWins[e].width != ds->windows[i].content_w ||
|
||||
extWins[e].height != ds->windows[i].content_h) {
|
||||
|
||||
Reference in New Issue
Block a user