refactor dynamic-cursor-color patch
Signed-off-by: Kipras Melnikovas <kipras@kipras.org> Signed-off-by: Debucquoy <debucqquoy.anthony@gmail.com>
This commit is contained in:
		
				
					committed by
					
						
						Debucquoy
					
				
			
			
				
	
				
						parent
						
							74e2cea30d
						
					
				
				
					commit
					785b3a4666
				
			
							
								
								
									
										19
									
								
								x.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								x.c
									
									
									
									
									
								
							@ -1541,6 +1541,7 @@ void
 | 
			
		||||
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
 | 
			
		||||
{
 | 
			
		||||
	Color drawcol;
 | 
			
		||||
	XRenderColor colbg;
 | 
			
		||||
 | 
			
		||||
	/* remove the old cursor */
 | 
			
		||||
	if (selected(ox, oy))
 | 
			
		||||
@ -1570,10 +1571,24 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
 | 
			
		||||
			g.fg = defaultfg;
 | 
			
		||||
			g.bg = defaultrcs;
 | 
			
		||||
		} else {
 | 
			
		||||
			/** this is the main part of the dynamic cursor color patch */
 | 
			
		||||
			g.bg = g.fg;
 | 
			
		||||
			g.fg = defaultbg;
 | 
			
		||||
			g.bg = defaultcs;
 | 
			
		||||
		}
 | 
			
		||||
		drawcol = dc.col[g.bg];
 | 
			
		||||
 | 
			
		||||
		/**
 | 
			
		||||
		 * and this is the second part of the dynamic cursor color patch.
 | 
			
		||||
		 * it handles the `drawcol` variable
 | 
			
		||||
		*/
 | 
			
		||||
		if (IS_TRUECOL(g.bg)) {
 | 
			
		||||
			colbg.alpha = 0xffff;
 | 
			
		||||
			colbg.red = TRUERED(g.bg);
 | 
			
		||||
			colbg.green = TRUEGREEN(g.bg);
 | 
			
		||||
			colbg.blue = TRUEBLUE(g.bg);
 | 
			
		||||
			XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colbg, &drawcol);
 | 
			
		||||
		} else {
 | 
			
		||||
			drawcol = dc.col[g.bg];
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* draw the new one */
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user