src/video/x11/SDL_x11messagebox.c
changeset 9801 752406828724
parent 9733 dd3c3024723c
child 9998 f67cf37e9cd4
equal deleted inserted replaced
9800:978b538d177e 9801:752406828724
   437         X11_XGetWindowAttributes(display, windowdata->xwindow, &attrib);
   437         X11_XGetWindowAttributes(display, windowdata->xwindow, &attrib);
   438         x = attrib.x + ( attrib.width - data->dialog_width ) / 2;
   438         x = attrib.x + ( attrib.width - data->dialog_width ) / 2;
   439         y = attrib.y + ( attrib.height - data->dialog_height ) / 3 ;
   439         y = attrib.y + ( attrib.height - data->dialog_height ) / 3 ;
   440         X11_XTranslateCoordinates(display, windowdata->xwindow, RootWindow(display, data->screen), x, y, &x, &y, &dummy);
   440         X11_XTranslateCoordinates(display, windowdata->xwindow, RootWindow(display, data->screen), x, y, &x, &y, &dummy);
   441     } else {
   441     } else {
   442         x = ( DisplayWidth( display, data->screen ) - data->dialog_width ) / 2;
   442         const SDL_VideoDevice *dev = SDL_GetVideoDevice();
   443         y = ( DisplayHeight( display, data->screen ) - data->dialog_height ) / 3 ;
   443         if ((dev) && (dev->displays) && (dev->num_displays > 0)) {
       
   444             const SDL_VideoDisplay *dpy = &dev->displays[0];
       
   445             const SDL_DisplayData *dpydata = (SDL_DisplayData *) dpy->driverdata;
       
   446             x = dpydata->x + (( dpy->current_mode.w - data->dialog_width ) / 2);
       
   447             y = dpydata->y + (( dpy->current_mode.h - data->dialog_height ) / 3);
       
   448         } else {   /* oh well. This will misposition on a multi-head setup. Init first next time. */
       
   449             x = ( DisplayWidth( display, data->screen ) - data->dialog_width ) / 2;
       
   450             y = ( DisplayHeight( display, data->screen ) - data->dialog_height ) / 3 ;
       
   451         }
   444     }
   452     }
   445     X11_XMoveWindow( display, data->window, x, y );
   453     X11_XMoveWindow( display, data->window, x, y );
   446 
   454 
   447     sizehints = X11_XAllocSizeHints();
   455     sizehints = X11_XAllocSizeHints();
   448     if ( sizehints ) {
   456     if ( sizehints ) {