@@ -157,6 +157,8 @@ struct weston_wm_window {
157157 int x ;
158158 int y ;
159159 bool pos_dirty ;
160+ int frame_x ;
161+ int frame_y ;
160162 int map_request_x ;
161163 int map_request_y ;
162164 struct weston_output_weak_ref legacy_fullscreen_output ;
@@ -757,6 +759,7 @@ weston_wm_window_send_configure_notify(struct weston_wm_window *window)
757759{
758760 xcb_configure_notify_event_t configure_notify ;
759761 struct weston_wm * wm = window -> wm ;
762+ bool is_our_resource = our_resource (wm , window -> id );
760763 int x , y ;
761764
762765 weston_wm_window_get_child_position (window , & x , & y );
@@ -776,13 +779,18 @@ weston_wm_window_send_configure_notify(struct weston_wm_window *window)
776779 xcb_send_event (wm -> conn , 0 , window -> id ,
777780 XCB_EVENT_MASK_STRUCTURE_NOTIFY ,
778781 (char * ) & configure_notify );
782+
783+ wm_printf (wm , "XWM: send_configure_notify (window %d) %d,%d @ %dx%d%s\n" ,
784+ window -> id , x , y , window -> width , window -> height ,
785+ is_our_resource ? ", ours" : "" );
779786}
780787
781788static void
782- weston_wm_window_send_event_configure_notify_window_position (struct weston_wm_window * window , int x , int y )
789+ weston_wm_window_send_event_configure_notify_with_position (struct weston_wm_window * window , int x , int y )
783790{
784791 xcb_configure_notify_event_t configure_notify ;
785792 struct weston_wm * wm = window -> wm ;
793+ bool is_our_resource = our_resource (wm , window -> id );
786794
787795 configure_notify .response_type = XCB_CONFIGURE_NOTIFY ;
788796 configure_notify .pad0 = 0 ;
@@ -800,6 +808,10 @@ weston_wm_window_send_event_configure_notify_window_position(struct weston_wm_wi
800808 xcb_send_event (wm -> conn , 0 , window -> id ,
801809 XCB_EVENT_MASK_STRUCTURE_NOTIFY ,
802810 (char * ) & configure_notify );
811+
812+ wm_printf (wm , "XWM: send_event_configure_notify_window_position (window %d) %d,%d @ %dx%d%s\n" ,
813+ window -> id , x , y , window -> width , window -> height ,
814+ is_our_resource ? ", ours" : "" );
803815}
804816
805817static void
@@ -1018,8 +1030,16 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve
10181030 if (!wm_lookup_window (wm , configure_notify -> window , & window ))
10191031 return ;
10201032
1021- window -> x = configure_notify -> x ;
1022- window -> y = configure_notify -> y ;
1033+ if (window -> override_redirect || is_our_resource ) {
1034+ /* override or frame */
1035+ window -> frame_x = configure_notify -> x ;
1036+ window -> frame_y = configure_notify -> y ;
1037+ }
1038+ if (window -> override_redirect || !is_our_resource ) {
1039+ /* override or not frame */
1040+ window -> x = configure_notify -> x ;
1041+ window -> y = configure_notify -> y ;
1042+ }
10231043 window -> pos_dirty = false;
10241044
10251045 if (window -> override_redirect ) {
@@ -1037,9 +1057,8 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve
10371057 window -> x , window -> y );
10381058 } else if (is_our_resource ) {
10391059 if (window -> shsurf )
1040- xwayland_api -> set_position (window -> shsurf ,
1041- window -> x , window -> y ,
1042- window -> width , window -> height );
1060+ xwayland_api -> move_position (window -> shsurf ,
1061+ window -> frame_x , window -> frame_y );
10431062 }
10441063}
10451064
@@ -1755,6 +1774,8 @@ weston_wm_window_create(struct weston_wm *wm,
17551774 window -> x = x ;
17561775 window -> y = y ;
17571776 window -> pos_dirty = false;
1777+ window -> frame_x = INT_MIN ;
1778+ window -> frame_y = INT_MIN ;
17581779 window -> map_request_x = INT_MIN ; /* out of range for valid positions */
17591780 window -> map_request_y = INT_MIN ; /* out of range for valid positions */
17601781 weston_output_weak_ref_init (& window -> legacy_fullscreen_output );
@@ -3068,24 +3089,26 @@ send_position(struct weston_surface *surface, int32_t x, int32_t y)
30683089{
30693090 struct weston_wm_window * window = get_wm_window (surface );
30703091 struct weston_wm * wm ;
3071- uint32_t values [2 ];
3072- uint16_t mask ;
30733092 int dx , dy ;
30743093
30753094 if (!window || !window -> wm )
30763095 return ;
30773096
30783097 wm = window -> wm ;
3098+
3099+ wm_printf (wm , "XWM: send_position (window %d) input %d,%d frame %d,%d window %d,%d%s\n" ,
3100+ window -> id , x , y ,
3101+ window -> frame_x , window -> frame_y ,
3102+ window -> x , window -> y ,
3103+ window -> override_redirect ? ", override" : "" );
3104+
30793105 /* We use pos_dirty to tell whether a configure message is in flight.
30803106 * This is needed in case we send two configure events in a very
30813107 * short time, since window->x/y is set in after a roundtrip, hence
30823108 * we cannot just check if the current x and y are different. */
3083- if (window -> x != x || window -> y != y || window -> pos_dirty ) {
3109+ if (window -> frame_x != x || window -> frame_y != y || window -> pos_dirty ) {
30843110 window -> pos_dirty = true;
3085- values [0 ] = x ;
3086- values [1 ] = y ;
3087- mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y ;
3088- weston_wm_configure_window (wm , window -> frame_id , mask , values );
3111+ weston_wm_window_configure_frame_with_position (window , x , y );
30893112
30903113 // !!! need further investigation !!!
30913114 /* Xwayland reparents app's window with our own frame window
@@ -3097,7 +3120,7 @@ send_position(struct weston_surface *surface, int32_t x, int32_t y)
30973120 event to let application knows actual app's window position (rather
30983121 than offset from parent/frame window */
30993122 weston_wm_window_get_child_position (window , & dx , & dy );
3100- weston_wm_window_send_event_configure_notify_window_position (window , x + dx , y + dy );
3123+ weston_wm_window_send_event_configure_notify_with_position (window , x + dx , y + dy );
31013124
31023125 xcb_flush (wm -> conn );
31033126 }
0 commit comments