Do not redraw window on PropertyChange
When receiving a PropertyChange XEvent, it's mostly because the focus of another window changed to another window. This isn't actually neccessary for dunst. We need the event only, to know, when the screens have switched. As redrawing the screen became more expensive with the drop of GTK3, we have to ignore this event and only really redraw the window, when the focus has moved to another screen.
This commit is contained in:
		
							parent
							
								
									a5d722799e
								
							
						
					
					
						commit
						8f5afaafb6
					
				
							
								
								
									
										11
									
								
								src/x11/x.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								src/x11/x.c
									
									
									
									
									
								
							| @ -730,6 +730,7 @@ static void x_win_move(int width, int height) | ||||
| 
 | ||||
|         int x, y; | ||||
|         screen_info *scr = get_active_screen(); | ||||
|         xctx.cur_screen = scr->scr; | ||||
|         /* calculate window position */ | ||||
|         if (xctx.geometry.mask & XNegative) { | ||||
|                 x = (scr->dim.x + (scr->dim.w - width)) + xctx.geometry.x; | ||||
| @ -908,9 +909,17 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer | ||||
|                         break; | ||||
|                 case FocusIn: | ||||
|                 case FocusOut: | ||||
|                 case PropertyNotify: | ||||
|                         wake_up(); | ||||
|                         break; | ||||
|                 case PropertyNotify: | ||||
|                         /* 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(); | ||||
|                         break; | ||||
|                 default: | ||||
|                         screen_check_event(ev); | ||||
|                         break; | ||||
|  | ||||
| @ -25,6 +25,7 @@ typedef struct _keyboard_shortcut { | ||||
| typedef struct _xctx { | ||||
|         Atom utf8; | ||||
|         Display *dpy; | ||||
|         int cur_screen; | ||||
|         Window win; | ||||
|         bool visible; | ||||
|         dimension_t geometry; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Benedikt Heine
						Benedikt Heine