Commit 99041a6f authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Store only the pixmap size instead of the window rectangle in the GL drawable.

parent 9efcd61d
...@@ -259,7 +259,7 @@ struct gl_drawable ...@@ -259,7 +259,7 @@ struct gl_drawable
Pixmap pixmap; /* base pixmap if drawable is a GLXPixmap */ Pixmap pixmap; /* base pixmap if drawable is a GLXPixmap */
Colormap colormap; /* colormap used for the drawable */ Colormap colormap; /* colormap used for the drawable */
const struct wgl_pixel_format *format; /* pixel format for the drawable */ const struct wgl_pixel_format *format; /* pixel format for the drawable */
RECT rect; /* drawable rect, relative to whole window drawable */ SIZE pixmap_size; /* pixmap size for GLXPixmap drawables */
int swap_interval; int swap_interval;
BOOL refresh_swap_interval; BOOL refresh_swap_interval;
}; };
...@@ -1348,6 +1348,12 @@ static void free_gl_drawable( struct gl_drawable *gl ) ...@@ -1348,6 +1348,12 @@ static void free_gl_drawable( struct gl_drawable *gl )
static BOOL create_gl_drawable( HWND hwnd, struct gl_drawable *gl ) static BOOL create_gl_drawable( HWND hwnd, struct gl_drawable *gl )
{ {
XVisualInfo *visual = gl->format->visual; XVisualInfo *visual = gl->format->visual;
RECT rect;
int width, height;
GetClientRect( hwnd, &rect );
width = min( max( 1, rect.right ), 65535 );
height = min( max( 1, rect.bottom ), 65535 );
gl->drawable = 0; gl->drawable = 0;
...@@ -1389,8 +1395,7 @@ static BOOL create_gl_drawable( HWND hwnd, struct gl_drawable *gl ) ...@@ -1389,8 +1395,7 @@ static BOOL create_gl_drawable( HWND hwnd, struct gl_drawable *gl )
XInstallColormap(gdi_display, attrib.colormap); XInstallColormap(gdi_display, attrib.colormap);
gl->type = DC_GL_CHILD_WIN; gl->type = DC_GL_CHILD_WIN;
gl->window = XCreateWindow( gdi_display, dummy_parent, 0, 0, gl->window = XCreateWindow( gdi_display, dummy_parent, 0, 0, width, height,
gl->rect.right - gl->rect.left, gl->rect.bottom - gl->rect.top,
0, visual->depth, InputOutput, visual->visual, 0, visual->depth, InputOutput, visual->visual,
CWColormap | CWBorderPixel | CWOverrideRedirect, &attrib ); CWColormap | CWBorderPixel | CWOverrideRedirect, &attrib );
if (gl->window) if (gl->window)
...@@ -1410,13 +1415,13 @@ static BOOL create_gl_drawable( HWND hwnd, struct gl_drawable *gl ) ...@@ -1410,13 +1415,13 @@ static BOOL create_gl_drawable( HWND hwnd, struct gl_drawable *gl )
WARN("XComposite is not available, using GLXPixmap hack\n"); WARN("XComposite is not available, using GLXPixmap hack\n");
gl->type = DC_GL_PIXMAP_WIN; gl->type = DC_GL_PIXMAP_WIN;
gl->pixmap = XCreatePixmap( gdi_display, root_window, gl->pixmap = XCreatePixmap( gdi_display, root_window, width, height, visual->depth );
gl->rect.right - gl->rect.left, gl->rect.bottom - gl->rect.top,
visual->depth );
if (gl->pixmap) if (gl->pixmap)
{ {
gl->drawable = pglXCreatePixmap( gdi_display, gl->format->fbconfig, gl->pixmap, NULL ); gl->drawable = pglXCreatePixmap( gdi_display, gl->format->fbconfig, gl->pixmap, NULL );
if (!gl->drawable) XFreePixmap( gdi_display, gl->pixmap ); if (!gl->drawable) XFreePixmap( gdi_display, gl->pixmap );
gl->pixmap_size.cx = width;
gl->pixmap_size.cy = height;
} }
} }
...@@ -1442,9 +1447,6 @@ static BOOL set_win_format( HWND hwnd, const struct wgl_pixel_format *format ) ...@@ -1442,9 +1447,6 @@ static BOOL set_win_format( HWND hwnd, const struct wgl_pixel_format *format )
gl->swap_interval = 1; gl->swap_interval = 1;
gl->refresh_swap_interval = TRUE; gl->refresh_swap_interval = TRUE;
gl->format = format; gl->format = format;
GetClientRect( hwnd, &gl->rect );
gl->rect.right = min( max( 1, gl->rect.right ), 65535 );
gl->rect.bottom = min( max( 1, gl->rect.bottom ), 65535 );
if (!create_gl_drawable( hwnd, gl )) if (!create_gl_drawable( hwnd, gl ))
{ {
...@@ -1517,31 +1519,26 @@ static BOOL set_pixel_format(HDC hdc, int format, BOOL allow_change) ...@@ -1517,31 +1519,26 @@ static BOOL set_pixel_format(HDC hdc, int format, BOOL allow_change)
/*********************************************************************** /***********************************************************************
* sync_gl_drawable * sync_gl_drawable
*/ */
void sync_gl_drawable( HWND hwnd, const RECT *visible_rect, const RECT *client_rect ) void sync_gl_drawable( HWND hwnd, int width, int height )
{ {
struct gl_drawable *gl; struct gl_drawable *gl;
GLXDrawable glxp; GLXDrawable glxp;
Pixmap pix; Pixmap pix;
int mask = 0;
XWindowChanges changes; XWindowChanges changes;
changes.width = min( max( 1, client_rect->right - client_rect->left ), 65535 ); changes.width = min( max( 1, width ), 65535 );
changes.height = min( max( 1, client_rect->bottom - client_rect->top ), 65535 ); changes.height = min( max( 1, height ), 65535 );
if (!(gl = get_gl_drawable( hwnd, 0 ))) return; if (!(gl = get_gl_drawable( hwnd, 0 ))) return;
if (changes.width != gl->rect.right - gl->rect.left) mask |= CWWidth;
if (changes.height != gl->rect.bottom - gl->rect.top) mask |= CWHeight;
TRACE( "setting drawable %lx size %dx%d\n", gl->drawable, changes.width, changes.height ); TRACE( "setting drawable %lx size %dx%d\n", gl->drawable, changes.width, changes.height );
switch (gl->type) switch (gl->type)
{ {
case DC_GL_CHILD_WIN: case DC_GL_CHILD_WIN:
if (mask) XConfigureWindow( gdi_display, gl->window, mask, &changes ); XConfigureWindow( gdi_display, gl->window, CWWidth | CWHeight, &changes );
break; break;
case DC_GL_PIXMAP_WIN: case DC_GL_PIXMAP_WIN:
if (!mask) break;
pix = XCreatePixmap(gdi_display, root_window, changes.width, changes.height, pix = XCreatePixmap(gdi_display, root_window, changes.width, changes.height,
gl->format->visual->depth); gl->format->visual->depth);
if (!pix) goto done; if (!pix) goto done;
...@@ -1560,11 +1557,12 @@ void sync_gl_drawable( HWND hwnd, const RECT *visible_rect, const RECT *client_r ...@@ -1560,11 +1557,12 @@ void sync_gl_drawable( HWND hwnd, const RECT *visible_rect, const RECT *client_r
gl->pixmap = pix; gl->pixmap = pix;
gl->drawable = glxp; gl->drawable = glxp;
gl->pixmap_size.cx = width;
gl->pixmap_size.cy = height;
break; break;
default: default:
break; break;
} }
SetRect( &gl->rect, 0, 0, changes.width, changes.height );
done: done:
release_gl_drawable( gl ); release_gl_drawable( gl );
} }
...@@ -3344,7 +3342,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc ) ...@@ -3344,7 +3342,7 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc )
* copying */ * copying */
pglFlush(); pglFlush();
pglXCopySubBufferMESA( gdi_display, gl->drawable, 0, 0, pglXCopySubBufferMESA( gdi_display, gl->drawable, 0, 0,
gl->rect.right - gl->rect.left, gl->rect.bottom - gl->rect.top ); gl->pixmap_size.cx, gl->pixmap_size.cy );
break; break;
} }
if (pglXSwapBuffersMscOML) if (pglXSwapBuffersMscOML)
...@@ -3413,7 +3411,7 @@ struct opengl_funcs *get_glx_driver( UINT version ) ...@@ -3413,7 +3411,7 @@ struct opengl_funcs *get_glx_driver( UINT version )
return NULL; return NULL;
} }
void sync_gl_drawable( HWND hwnd, const RECT *visible_rect, const RECT *client_rect ) void sync_gl_drawable( HWND hwnd, int width, int height )
{ {
} }
......
...@@ -2307,8 +2307,13 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags ...@@ -2307,8 +2307,13 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags
if (!data->whole_window) if (!data->whole_window)
{ {
int width = data->client_rect.right - data->client_rect.left;
int height = data->client_rect.bottom - data->client_rect.top;
release_win_data( data ); release_win_data( data );
sync_gl_drawable( hwnd, visible_rect, rectClient ); if (width != old_client_rect.right - old_client_rect.left ||
height != old_client_rect.bottom - old_client_rect.top)
sync_gl_drawable( hwnd, width, height );
return; return;
} }
......
...@@ -579,7 +579,7 @@ extern void release_win_data( struct x11drv_win_data *data ) DECLSPEC_HIDDEN; ...@@ -579,7 +579,7 @@ extern void release_win_data( struct x11drv_win_data *data ) DECLSPEC_HIDDEN;
extern Window X11DRV_get_whole_window( HWND hwnd ) DECLSPEC_HIDDEN; extern Window X11DRV_get_whole_window( HWND hwnd ) DECLSPEC_HIDDEN;
extern XIC X11DRV_get_ic( HWND hwnd ) DECLSPEC_HIDDEN; extern XIC X11DRV_get_ic( HWND hwnd ) DECLSPEC_HIDDEN;
extern void sync_gl_drawable( HWND hwnd, const RECT *visible_rect, const RECT *client_rect ) DECLSPEC_HIDDEN; extern void sync_gl_drawable( HWND hwnd, int width, int height ) DECLSPEC_HIDDEN;
extern void set_gl_drawable_parent( HWND hwnd, HWND parent ) DECLSPEC_HIDDEN; extern void set_gl_drawable_parent( HWND hwnd, HWND parent ) DECLSPEC_HIDDEN;
extern void destroy_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN; extern void destroy_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment