/* Return the pixel dimensions of the main screen in WIDTH and
HEIGHT. */
void
-BScreen_px_dim (int *width, int *height)
+be_get_screen_dimensions (int *width, int *height)
{
BScreen screen;
+ BRect frame;
+
if (!screen.IsValid ())
gui_abort ("Invalid screen");
- BRect frame = screen.Frame ();
- *width = frame.right - frame.left;
- *height = frame.bottom - frame.top;
+ frame = screen.Frame ();
+
+ *width = 1 + frame.right - frame.left;
+ *height = 1 + frame.bottom - frame.top;
}
/* Resize VIEW to WIDTH, HEIGHT. */
delete (BAlert *) alert;
}
-/* Place the resolution of the monitor in DPI in RSSX and RSSY. */
+/* Place the resolution of the monitor in DPI in X_OUT and Y_OUT. */
void
-BScreen_res (double *rrsx, double *rrsy)
+be_get_display_resolution (double *x_out, double *y_out)
{
BScreen s (B_MAIN_SCREEN_ID);
+ monitor_info i;
+ double x_inches, y_inches;
+ BRect frame;
+
if (!s.IsValid ())
gui_abort ("Invalid screen for resolution checks");
- monitor_info i;
if (s.GetMonitorInfo (&i) == B_OK)
{
- *rrsx = (double) i.width / (double) 2.54;
- *rrsy = (double) i.height / (double) 2.54;
- }
- else
- {
- *rrsx = 72.27;
- *rrsy = 72.27;
+ frame = s.Frame ();
+
+ x_inches = (double) i.width * 25.4;
+ y_inches = (double) i.height * 25.4;
+
+ *x_out = (double) BE_RECT_WIDTH (frame) / x_inches;
+ *y_out = (double) BE_RECT_HEIGHT (frame) / y_inches;
+ return;
}
+
+ *x_out = 72.0;
+ *y_out = 72.0;
}
/* Add WINDOW to OTHER_WINDOW's subset and parent it to
extern void *BBitmap_transform_bitmap (void *, void *, uint32_t, double,
int, int);
-extern void BScreen_px_dim (int *, int *);
-extern void BScreen_res (double *, double *);
+extern void be_get_display_resolution (double *, double *);
+extern void be_get_screen_dimensions (int *, int *);
/* Functions for creating and freeing cursors. */
extern void *BCursor_create_default (void);
/* Default min and max values. */
min_x = 0;
min_y = 0;
- BScreen_px_dim (&max_x, &max_y);
+
+ be_get_screen_dimensions (&max_x, &max_y);
+
+ max_x = max_x - 1;
+ max_y = max_y - 1;
block_input ();
BView_get_mouse (FRAME_HAIKU_VIEW (f), &x, &y);
int width, height;
check_haiku_display_info (terminal);
- BScreen_px_dim (&width, &height);
+ be_get_screen_dimensions (&width, &height);
return make_fixnum (width);
}
int width, height;
check_haiku_display_info (terminal);
- BScreen_px_dim (&width, &height);
+ be_get_screen_dimensions (&width, &height);
return make_fixnum (width);
}
struct haiku_display_info *dpyinfo = check_haiku_display_info (terminal);
int width, height;
- BScreen_px_dim (&width, &height);
+ be_get_screen_dimensions (&width, &height);
return make_fixnum (height / (dpyinfo->resy / 25.4));
}
struct haiku_display_info *dpyinfo = check_haiku_display_info (terminal);
int width, height;
- BScreen_px_dim (&width, &height);
+ be_get_screen_dimensions (&width, &height);
return make_fixnum (width / (dpyinfo->resx / 25.4));
}
dpyinfo->display = BApplication_setup ();
dpyinfo->next = x_display_list;
dpyinfo->n_planes = be_get_display_planes ();
- x_display_list = dpyinfo;
+ be_get_display_resolution (&dpyinfo->resx, &dpyinfo->resy);
- BScreen_res (&dpyinfo->resx, &dpyinfo->resy);
+ x_display_list = dpyinfo;
terminal = haiku_create_terminal (dpyinfo);
if (current_kboard == initial_kboard)