Fix T69463: File Browser opens off-center on hiDPI
authorJulian Eisel <eiseljulian@gmail.com>
Wed, 4 Sep 2019 00:01:44 +0000 (02:01 +0200)
committerJulian Eisel <eiseljulian@gmail.com>
Wed, 4 Sep 2019 00:01:44 +0000 (02:01 +0200)
wmWindow.sizex/y doesn't have system's pixel size applied.

source/blender/windowmanager/intern/wm_event_system.c

index 9fe53cb3af0c255358446bef8310f914ef8fbe72..7192b25a7d547408bfcbcdbf091a68b791a81d1b 100644 (file)
@@ -2343,8 +2343,12 @@ static int wm_handler_fileselect_do(bContext *C,
       const int sizex = 1020 * UI_DPI_FAC;
       const int sizey = 600 * UI_DPI_FAC;
 
-      if (WM_window_open_temp(
-              C, win->sizex / 2, win->sizey / 2, sizex, sizey, WM_WINDOW_FILESEL) != NULL) {
+      if (WM_window_open_temp(C,
+                              WM_window_pixels_x(win) / 2,
+                              WM_window_pixels_y(win) / 2,
+                              sizex,
+                              sizey,
+                              WM_WINDOW_FILESEL) != NULL) {
         ScrArea *area = CTX_wm_area(C);
         ARegion *region_header = BKE_area_find_region_type(area, RGN_TYPE_HEADER);