Wake up for fullscreen change events
The PropertyNotify handling has been changed in the dropgtk branch to ignore XEvents, when redrawing was unnecessary. But when the fullscreen state of a window changes, we can't ignore the event, because it didn't change the screen. Additionally, there had been a mistake in the handling of the cur_screen: The xctx.cur_screen field will only get updated, when the application is visible and gets redrawn. Therefore, when a PropertyNotify event arrived while the application had been hidden and the screens do not match anymore, wake_up() will be called albeit being unnecessary. Calling x_win_draw() when the screens change is also the preferable solution over wake_up(), as there is nothing subject to change in the queues when the displays change.
This commit is contained in:
		
							parent
							
								
									a7bc16874d
								
							
						
					
					
						commit
						0cf4753a68
					
				
							
								
								
									
										15
									
								
								src/x11/x.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								src/x11/x.c
									
									
									
									
									
								
							| @ -60,6 +60,7 @@ typedef struct _colored_layout { | ||||
| } colored_layout; | ||||
| 
 | ||||
| cairo_ctx_t cairo_ctx; | ||||
| static bool fullscreen_last = false; | ||||
| 
 | ||||
| /* FIXME refactor setup teardown handlers into one setup and one teardown */ | ||||
| static void x_shortcut_setup_error_handler(void); | ||||
| @ -848,6 +849,7 @@ gboolean x_mainloop_fd_check(GSource *source) | ||||
|  */ | ||||
| gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) | ||||
| { | ||||
|         bool fullscreen_now; | ||||
|         XEvent ev; | ||||
|         unsigned int state; | ||||
|         while (XPending(xctx.dpy) > 0) { | ||||
| @ -910,13 +912,20 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer | ||||
|                         wake_up(); | ||||
|                         break; | ||||
|                 case PropertyNotify: | ||||
|                         fullscreen_now = have_fullscreen_window(); | ||||
| 
 | ||||
|                         if (fullscreen_now != fullscreen_last) { | ||||
|                                 fullscreen_last = fullscreen_now; | ||||
|                                 wake_up(); | ||||
|                         } else if (   settings.f_mode != FOLLOW_NONE | ||||
|                         /* Ignore PropertyNotify, when we're still on the
 | ||||
|                          * same screen. PropertyNotify is only neccessary | ||||
|                          * to detect a focus change to another screen | ||||
|                          */ | ||||
|                         if(   settings.f_mode != FOLLOW_NONE | ||||
|                            && get_active_screen()->scr != xctx.cur_screen) | ||||
|                                 wake_up(); | ||||
|                                    && xctx.visible | ||||
|                                    && get_active_screen()->scr != xctx.cur_screen) { | ||||
|                                 x_win_draw(); | ||||
|                         } | ||||
|                         break; | ||||
|                 default: | ||||
|                         screen_check_event(ev); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Benedikt Heine
						Benedikt Heine