Skip to content

Commit

Permalink
fixup! feat: DPI awareness
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed Aug 26, 2024
1 parent f4810de commit c0c1189
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/ui-server/src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ float ui_server_get_window_scale(app_window_t *window)
if (conn) {
return css_metrics_actual_scale(&conn->updater->metrics);
}
return app_window_get_dpi(window) / 96.f;
if (window) {
return app_window_get_dpi(window) / 96.f;
}
return 1.f;
}

static void ui_server_on_window_close(app_event_t *e, void *arg)
Expand Down Expand Up @@ -192,8 +195,7 @@ static void ui_server_on_window_paint(app_event_t *e, void *arg)
continue;
}
ui_rect_from_pd_rect(
&rect,
&e->paint.rect,
&rect, &e->paint.rect,
css_metrics_actual_scale(&conn->updater->metrics));
ui_widget_mark_dirty_rect(conn->widget, &rect,
UI_BOX_TYPE_GRAPH_BOX);
Expand Down

0 comments on commit c0c1189

Please sign in to comment.