@@ -7480,6 +7480,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
7480
7480
says that a portable program can't use this, but Stephen Gildea assures
7481
7481
me that letting the compiler initialize it to zeros will work okay. */
7482
7482
static XComposeStatus compose_status ;
7483
+ XEvent configureEvent ;
7484
+ XEvent next_event ;
7483
7485
7484
7486
USE_SAFE_ALLOCA ;
7485
7487
@@ -8389,17 +8391,41 @@ handle_one_xevent (struct x_display_info *dpyinfo,
8389
8391
}
8390
8392
8391
8393
case ConfigureNotify :
8392
- f = x_top_window_to_frame (dpyinfo , event -> xconfigure .window );
8394
+ /* An opaque move can generate a stream of events as the window
8395
+ is dragged around. If the connection round trip time isn't
8396
+ really short, they may come faster than we can respond to
8397
+ them, given the multiple queries we can do to check window
8398
+ manager state, translate coordinates, etc.
8399
+
8400
+ So if this ConfigureNotify is immediately followed by another
8401
+ for the same window, use the info from the latest update, and
8402
+ consider the events all handled. */
8403
+ /* Opaque resize may be trickier; ConfigureNotify events are
8404
+ mixed with Expose events for multiple windows. */
8405
+ configureEvent = * event ;
8406
+ while (XPending (dpyinfo -> display ))
8407
+ {
8408
+ XNextEvent (dpyinfo -> display , & next_event );
8409
+ if (next_event .type != ConfigureNotify
8410
+ || next_event .xconfigure .window != event -> xconfigure .window )
8411
+ {
8412
+ XPutBackEvent (dpyinfo -> display , & next_event );
8413
+ break ;
8414
+ }
8415
+ else
8416
+ configureEvent = next_event ;
8417
+ }
8418
+ f = x_top_window_to_frame (dpyinfo , configureEvent .xconfigure .window );
8393
8419
#ifdef USE_CAIRO
8394
8420
if (f ) x_cr_destroy_surface (f );
8395
8421
#endif
8396
8422
#ifdef USE_GTK
8397
8423
if (!f
8398
8424
&& (f = any )
8399
- && event -> xconfigure .window == FRAME_X_WINDOW (f ))
8425
+ && configureEvent . xconfigure .window == FRAME_X_WINDOW (f ))
8400
8426
{
8401
- xg_frame_resized (f , event -> xconfigure .width ,
8402
- event -> xconfigure .height );
8427
+ xg_frame_resized (f , configureEvent . xconfigure .width ,
8428
+ configureEvent . xconfigure .height );
8403
8429
#ifdef USE_CAIRO
8404
8430
x_cr_destroy_surface (f );
8405
8431
#endif
@@ -8408,24 +8434,26 @@ handle_one_xevent (struct x_display_info *dpyinfo,
8408
8434
#endif
8409
8435
if (f )
8410
8436
{
8411
- x_net_wm_state (f , event -> xconfigure .window );
8437
+ x_net_wm_state (f , configureEvent . xconfigure .window );
8412
8438
8413
8439
#ifdef USE_X_TOOLKIT
8414
8440
/* Tip frames are pure X window, set size for them. */
8415
8441
if (! NILP (tip_frame ) && XFRAME (tip_frame ) == f )
8416
8442
{
8417
- if (FRAME_PIXEL_HEIGHT (f ) != event -> xconfigure .height
8418
- || FRAME_PIXEL_WIDTH (f ) != event -> xconfigure .width )
8443
+ if (FRAME_PIXEL_HEIGHT (f ) != configureEvent . xconfigure .height
8444
+ || FRAME_PIXEL_WIDTH (f ) != configureEvent . xconfigure .width )
8419
8445
SET_FRAME_GARBAGED (f );
8420
- FRAME_PIXEL_HEIGHT (f ) = event -> xconfigure .height ;
8421
- FRAME_PIXEL_WIDTH (f ) = event -> xconfigure .width ;
8446
+ FRAME_PIXEL_HEIGHT (f ) = configureEvent . xconfigure .height ;
8447
+ FRAME_PIXEL_WIDTH (f ) = configureEvent . xconfigure .width ;
8422
8448
}
8423
8449
#endif
8424
8450
8425
8451
#ifndef USE_X_TOOLKIT
8426
8452
#ifndef USE_GTK
8427
- int width = FRAME_PIXEL_TO_TEXT_WIDTH (f , event -> xconfigure .width );
8428
- int height = FRAME_PIXEL_TO_TEXT_HEIGHT (f , event -> xconfigure .height );
8453
+ int width =
8454
+ FRAME_PIXEL_TO_TEXT_WIDTH (f , configureEvent .xconfigure .width );
8455
+ int height =
8456
+ FRAME_PIXEL_TO_TEXT_HEIGHT (f , configureEvent .xconfigure .height );
8429
8457
8430
8458
/* In the toolkit version, change_frame_size
8431
8459
is called by the code that handles resizing
@@ -8436,8 +8464,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
8436
8464
to check the pixel dimensions as well. */
8437
8465
if (width != FRAME_TEXT_WIDTH (f )
8438
8466
|| height != FRAME_TEXT_HEIGHT (f )
8439
- || event -> xconfigure .width != FRAME_PIXEL_WIDTH (f )
8440
- || event -> xconfigure .height != FRAME_PIXEL_HEIGHT (f ))
8467
+ || configureEvent . xconfigure .width != FRAME_PIXEL_WIDTH (f )
8468
+ || configureEvent . xconfigure .height != FRAME_PIXEL_HEIGHT (f ))
8441
8469
{
8442
8470
change_frame_size (f , width , height , false, true, false, true);
8443
8471
x_clear_under_internal_border (f );
0 commit comments