Added app-mode
This commit is contained in:
		
							parent
							
								
									7e2c85b04c
								
							
						
					
					
						commit
						89ec18385b
					
				
							
								
								
									
										34
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								main.c
									
									
									
									
									
								
							| @ -32,11 +32,17 @@ | |||||||
| #include "util.h" | #include "util.h" | ||||||
| #include "window.h" | #include "window.h" | ||||||
| 
 | 
 | ||||||
|  | typedef enum appmode_e { | ||||||
|  | 	MODE_NORMAL = 0, | ||||||
|  | 	MODE_THUMBS | ||||||
|  | } appmode_t; | ||||||
|  | 
 | ||||||
| void update_title(); | void update_title(); | ||||||
| int check_append(const char*); | int check_append(const char*); | ||||||
| void read_dir_rec(const char*); | void read_dir_rec(const char*); | ||||||
| void run(); | void run(); | ||||||
| 
 | 
 | ||||||
|  | appmode_t mode; | ||||||
| img_t img; | img_t img; | ||||||
| win_t win; | win_t win; | ||||||
| 
 | 
 | ||||||
| @ -129,12 +135,16 @@ int main(int argc, char **argv) { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	if (options->thumbnails == 2) { | ||||||
|  | 		mode = MODE_THUMBS; | ||||||
|  | 	} else { | ||||||
|  | 		mode = MODE_NORMAL; | ||||||
| 		load_image(); | 		load_image(); | ||||||
| 		img_render(&img, &win); | 		img_render(&img, &win); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	update_title(); | 	update_title(); | ||||||
| 
 |  | ||||||
| 	run(); | 	run(); | ||||||
| 
 |  | ||||||
| 	cleanup(); | 	cleanup(); | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
| @ -243,6 +253,12 @@ void read_dir_rec(const char *dirname) { | |||||||
| unsigned char timeout; | unsigned char timeout; | ||||||
| int mox, moy; | int mox, moy; | ||||||
| 
 | 
 | ||||||
|  | void redraw() { | ||||||
|  | 	img_render(&img, &win); | ||||||
|  | 	update_title(); | ||||||
|  | 	timeout = 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void on_keypress(XKeyEvent *kev) { | void on_keypress(XKeyEvent *kev) { | ||||||
| 	int x, y; | 	int x, y; | ||||||
| 	unsigned int w, h; | 	unsigned int w, h; | ||||||
| @ -374,11 +390,8 @@ void on_keypress(XKeyEvent *kev) { | |||||||
| 			break; | 			break; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (changed) { | 	if (changed) | ||||||
| 		img_render(&img, &win); | 		redraw(); | ||||||
| 		update_title(); |  | ||||||
| 		timeout = 0; |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void on_buttonpress(XButtonEvent *bev) { | void on_buttonpress(XButtonEvent *bev) { | ||||||
| @ -433,11 +446,8 @@ void on_buttonpress(XButtonEvent *bev) { | |||||||
| 			break; | 			break; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (changed) { | 	if (changed) | ||||||
| 		img_render(&img, &win); | 		redraw(); | ||||||
| 		update_title(); |  | ||||||
| 		timeout = 0; |  | ||||||
| 	} |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void on_motionnotify(XMotionEvent *mev) { | void on_motionnotify(XMotionEvent *mev) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Bert
						Bert