Use watch-cursor while loading thumbnails
This commit is contained in:
		
							parent
							
								
									bcc70bd7cb
								
							
						
					
					
						commit
						783213c0bb
					
				
							
								
								
									
										5
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								main.c
									
									
									
									
									
								
							| @ -476,9 +476,12 @@ void run() { | |||||||
| 
 | 
 | ||||||
| 	while (1) { | 	while (1) { | ||||||
| 		if (mode == MODE_THUMBS && tns_loaded < filecnt) { | 		if (mode == MODE_THUMBS && tns_loaded < filecnt) { | ||||||
|  | 			win_set_cursor(&win, CURSOR_WATCH); | ||||||
| 			tns_load(&tns, &win, filenames[tns_loaded++]); | 			tns_load(&tns, &win, filenames[tns_loaded++]); | ||||||
| 			tns_render(&tns, &win); | 			tns_render(&tns, &win); | ||||||
| 			if (!XPending(win.env.dpy)) | 			if (tns_loaded == filecnt) | ||||||
|  | 				win_set_cursor(&win, CURSOR_ARROW); | ||||||
|  | 			else if (!XPending(win.env.dpy)) | ||||||
| 				continue; | 				continue; | ||||||
| 		} else if (timeout) { | 		} else if (timeout) { | ||||||
| 			t.tv_sec = 0; | 			t.tv_sec = 0; | ||||||
|  | |||||||
							
								
								
									
										22
									
								
								window.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								window.c
									
									
									
									
									
								
							| @ -26,8 +26,9 @@ | |||||||
| #include "util.h" | #include "util.h" | ||||||
| #include "window.h" | #include "window.h" | ||||||
| 
 | 
 | ||||||
| static Cursor arrow; | static Cursor carrow; | ||||||
| static Cursor hand; | static Cursor chand; | ||||||
|  | static Cursor cwatch; | ||||||
| static GC bgc; | static GC bgc; | ||||||
| 
 | 
 | ||||||
| Atom wm_delete_win; | Atom wm_delete_win; | ||||||
| @ -107,8 +108,9 @@ void win_open(win_t *win) { | |||||||
| 	XSelectInput(e->dpy, win->xwin, StructureNotifyMask | KeyPressMask | | 	XSelectInput(e->dpy, win->xwin, StructureNotifyMask | KeyPressMask | | ||||||
| 	             ButtonPressMask | ButtonReleaseMask | Button2MotionMask); | 	             ButtonPressMask | ButtonReleaseMask | Button2MotionMask); | ||||||
| 
 | 
 | ||||||
| 	arrow = XCreateFontCursor(e->dpy, XC_left_ptr); | 	carrow = XCreateFontCursor(e->dpy, XC_left_ptr); | ||||||
| 	hand = XCreateFontCursor(e->dpy, XC_fleur); | 	chand = XCreateFontCursor(e->dpy, XC_fleur); | ||||||
|  | 	cwatch = XCreateFontCursor(e->dpy, XC_watch); | ||||||
| 
 | 
 | ||||||
| 	bgc = XCreateGC(e->dpy, win->xwin, 0, None); | 	bgc = XCreateGC(e->dpy, win->xwin, 0, None); | ||||||
| 
 | 
 | ||||||
| @ -135,8 +137,9 @@ void win_close(win_t *win) { | |||||||
| 	if (!win) | 	if (!win) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	XFreeCursor(win->env.dpy, arrow); | 	XFreeCursor(win->env.dpy, carrow); | ||||||
| 	XFreeCursor(win->env.dpy, hand); | 	XFreeCursor(win->env.dpy, chand); | ||||||
|  | 	XFreeCursor(win->env.dpy, cwatch); | ||||||
| 
 | 
 | ||||||
| 	XFreeGC(win->env.dpy, bgc); | 	XFreeGC(win->env.dpy, bgc); | ||||||
| 
 | 
 | ||||||
| @ -281,11 +284,14 @@ void win_set_cursor(win_t *win, win_cur_t cursor) { | |||||||
| 
 | 
 | ||||||
| 	switch (cursor) { | 	switch (cursor) { | ||||||
| 		case CURSOR_HAND: | 		case CURSOR_HAND: | ||||||
| 			XDefineCursor(win->env.dpy, win->xwin, hand); | 			XDefineCursor(win->env.dpy, win->xwin, chand); | ||||||
|  | 			break; | ||||||
|  | 		case CURSOR_WATCH: | ||||||
|  | 			XDefineCursor(win->env.dpy, win->xwin, cwatch); | ||||||
| 			break; | 			break; | ||||||
| 		case CURSOR_ARROW: | 		case CURSOR_ARROW: | ||||||
| 		default: | 		default: | ||||||
| 			XDefineCursor(win->env.dpy, win->xwin, arrow); | 			XDefineCursor(win->env.dpy, win->xwin, carrow); | ||||||
| 			break; | 			break; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Bert
						Bert