--- /usr/src/repo/builds_15/pqiv_BUILD/pqiv-2.12_edited/pqiv.c.orig	2020-11-29 06:51:17.000000000 -0500
+++ /usr/src/repo/builds_15/pqiv_BUILD/pqiv-2.12_edited/pqiv.c	2021-12-01 13:42:32.994000349 -0500
@@ -36,34 +36,12 @@
 #include <assert.h>
 #include <locale.h>
 
-#ifdef _WIN32
-	#ifndef _WIN32_WINNT
-		#define _WIN32_WINNT 0x500
-	#else
-		#if _WIN32_WINNT < 0x800
-			#ifdef __MINGW32__
-				#pragma message "Microsoft Windows supported is limited to Windows 2000 and higher, but your mingw version indicates that it does not  support those versions. Building might fail."
-			#else
-				#error Microsoft Windows supported is limited to Windows 2000 and higher.
-			#endif
-		#endif
-	#endif
-	#include <windows.h>
-	#include <gio/gwin32inputstream.h>
-#else
-	#include <sys/wait.h>
-	#include <gio/gunixinputstream.h>
-#endif
-#ifdef GDK_WINDOWING_X11
-	#include <gdk/gdkx.h>
-	#include <X11/Xlib.h>
-	#include <X11/Xutil.h>
-	#include <cairo/cairo-xlib.h>
-
-	#if GTK_MAJOR_VERSION < 3
-		#include <X11/Xatom.h>
-	#endif
-#endif
+#include <sys/wait.h>
+#include <gio/gunixinputstream.h>
+#include <gdk/gdkx.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <cairo/cairo-xlib.h>
 
 #ifdef DEBUG
 	#ifndef _WIN32
@@ -90,22 +68,6 @@
 	#define PQIV_ENABLE_PEDANTIC
 #endif
 
-#if !GLIB_CHECK_VERSION(2, 32, 0)
-	#define g_thread_new(name, func, data) g_thread_create(func, data, FALSE, NULL)
-#endif
-
-// GTK 2 does not define keyboard aliases the way we do
-#if GTK_MAJOR_VERSION < 3 // {{{
-
-#define GDK_BUTTON_PRIMARY 1
-#define GDK_BUTTON_MIDDLE 2
-#define GDK_BUTTON_SECONDARY 3
-
-#define GDK_KEY_VoidSymbol 0xffffff
-#include <gdk/gdkkeysyms.h>
-
-#endif // }}}
-
 // Global variables and function signatures {{{
 
 // The list of file type handlers and file type initializer function
@@ -285,7 +247,7 @@
 } scale_to_fit_size;
 
 gboolean scale_override = FALSE;
-const gchar *option_window_title = "pqiv: $FILENAME ($WIDTHx$HEIGHT) $ZOOM% [$IMAGE_NUMBER/$IMAGE_COUNT]";
+const gchar *option_window_title = "$FILENAME ($WIDTHx$HEIGHT) $ZOOM% [$IMAGE_NUMBER/$IMAGE_COUNT]";
 gdouble option_slideshow_interval = 5.;
 #ifndef CONFIGURED_WITHOUT_INFO_TEXT
 gboolean option_hide_info_box = FALSE;
@@ -553,6 +515,7 @@
 #endif
 	{ DEFAULT, KEY_BINDING_VALUE(0 , 0                , GDK_KEY_s                ), ACTION_TOGGLE_SLIDESHOW                , { 0   }},
 	{ DEFAULT, KEY_BINDING_VALUE(0 , 0                , GDK_KEY_b                ), ACTION_TOGGLE_BACKGROUND_PATTERN       , { 0   }},
+	{ DEFAULT, KEY_BINDING_VALUE(0 , 0                , GDK_KEY_e                ), ACTION_OPEN_W_EDITOR                   , { 0   }},
 	{ DEFAULT, KEY_BINDING_VALUE(0 , 0                , GDK_KEY_n                ), ACTION_TOGGLE_NEGATE_MODE              , { 0   }},
 	{ DEFAULT, KEY_BINDING_VALUE(0 , GDK_CONTROL_MASK , GDK_KEY_a                ), ACTION_HARDLINK_CURRENT_IMAGE          , { 0   }},
 	{ DEFAULT, KEY_BINDING_VALUE(0 , 0                , GDK_KEY_period           ), ACTION_ANIMATION_STEP                  , { 1   }},
@@ -718,7 +681,8 @@
 	{ "montage_mode_return_proceed", PARAMETER_NONE },
 	{ "montage_mode_return_cancel", PARAMETER_NONE },
 	{ "move_window", PARAMETER_2SHORT },
-	{ "toggle_background_pattern", PARAMETER_INT },
+	{ "toggle_background_pattern", PARAMETER_NONE },
+	{ "opwn_w_editor", PARAMETER_INT },
 	{ "toggle_negate_mode", PARAMETER_INT },
 	{ "toggle_mark", PARAMETER_NONE },
 	{ "clear_marks", PARAMETER_NONE },
@@ -1760,15 +1724,9 @@
 				if(param_file) {
 					GFileInfo *file_info = g_file_query_info(param_file, G_FILE_ATTRIBUTE_TIME_MODIFIED, G_FILE_QUERY_INFO_NONE, NULL, NULL);
 					if(file_info) {
-#if GLIB_CHECK_VERSION(2, 62, 0)
 						GDateTime *result = g_file_info_get_modification_date_time(file_info);
-						file->sort_name = g_strdup_printf("%zu;%s", g_date_time_to_unix(result), file->display_name);
+						file->sort_name = g_strdup_printf("%jd;%s", (intmax_t)g_date_time_to_unix(result), file->display_name);
 						g_date_time_unref(result);
-#else
-						GTimeVal result;
-						g_file_info_get_modification_time(file_info, &result);
-						file->sort_name = g_strdup_printf("%lu;%s", result.tv_sec, file->display_name);
-#endif
 						g_object_unref(file_info);
 					}
 					g_object_unref(param_file);
@@ -2105,6 +2063,13 @@
 
 	return FALSE;
 }/*}}}*/
+
+
+
+
+
+
+
 gboolean main_window_calculate_ideal_size(int *new_window_width, int *new_window_height) {/*{{{*/
 	if(!current_file_node) {
 		return FALSE;
@@ -2121,6 +2086,18 @@
 
 		*new_window_width = current_scale_level * image_width + 0.5;
 		*new_window_height = current_scale_level * image_height + 0.5;
+		
+		
+		
+		
+		if(*new_window_height <= 150) {
+			*new_window_height = 150;
+		}
+		if(*new_window_width <= 150) {
+			*new_window_width = 150;
+		}
+		
+		
 	}
 	#ifndef CONFIGURED_WITHOUT_MONTAGE_MODE
 	else if(application_mode == MONTAGE) {
@@ -2144,11 +2121,23 @@
 
 	return TRUE;
 }/*}}}*/
+
+
+
+
+
+
 gboolean main_window_reset_pos_callback(gpointer user_data) {/*{{{*/
 	gtk_window_set_position(main_window, GTK_WIN_POS_NONE);
 	requested_main_window_resize_pos_callback_id = -1;
 	return FALSE;
 }/*}}}*/
+
+
+
+
+
+
 void main_window_adjust_for_image() {/*{{{*/
 	if(!current_file_node) {
 		return;
@@ -2230,7 +2219,7 @@
 			// They resize, as requested above, and afterwards apply their idea of
 			// window size. To conquer that, we check for the window size again once
 			// all events are handled.
-			gdk_threads_add_idle(main_window_resize_callback, NULL);
+	//		gdk_threads_add_idle(main_window_resize_callback, NULL);
 		}
 		else {
 			// Required to avoid tearing
@@ -4146,6 +4135,8 @@
 	return FALSE;
 }/*}}}*/
 void window_fullscreen() {/*{{{*/
+	if(main_window_in_fullscreen) return;
+
 	if(is_current_file_loaded()) {
 		main_window_in_fullscreen = TRUE;
 		image_generate_prerendered_view(CURRENT_FILE, FALSE, -1);
@@ -4185,6 +4176,8 @@
 	gtk_window_fullscreen(main_window);
 }/*}}}*/
 void window_unfullscreen() {/*{{{*/
+	if(!main_window_in_fullscreen) return;
+	
 	if(is_current_file_loaded()) {
 		main_window_in_fullscreen = FALSE;
 		image_generate_prerendered_view(CURRENT_FILE, FALSE, -1);
@@ -6609,6 +6602,29 @@
 															 "checkerboard");
 			gtk_widget_queue_draw(GTK_WIDGET(main_window));
 			break;
+			
+		case ACTION_OPEN_W_EDITOR:
+			const char* dir_path;
+			const char* open_cmd;
+			dir_path = CURRENT_FILE->file_name;
+			const char *dot = strrchr(dir_path, '.');
+			if(!dot || dot == dir_path) break;
+			const char* IM_EXT = dot + 1;
+			if(strcasecmp(IM_EXT, "svg") == 0) || (strcasecmp(IM_EXT, "eps") == 0) || (strcasecmp(IM_EXT, "ia") == 0) || (strcasecmp(IM_EXT, "pdf") == 0){
+				open_cmd = "/usr/bin/inkscape";
+				system("Xdialog --title \"Edit File\" --infobox \"Inkscape will atttempt to open file\n\" 12 50 1500");
+			}
+			else if ((strcasecmp(IM_EXT, "jpg") == 0) || (strcasecmp(IM_EXT, "png") == 0)  || (strcasecmp(IM_EXT, "gif") == 0)  || (strcasecmp(IM_EXT, "jxl") == 0)  || (strcasecmp(IM_EXT, "webp") == 0) || (strcasecmp(IM_EXT, "ppm") == 0)){
+				open_cmd = "/usr/bin/gimp";
+				system("Xdialog --title \"Edit File\" --infobox \"GIMP will atttempt to open file\n\" 12 50 1500");
+			}
+			else 
+				break;
+			char* cmd = g_strdup_printf( "%s \'%s\'", open_cmd, dir_path );
+			g_spawn_command_line_async( cmd, NULL );
+			g_free(cmd);
+		    gtk_main_quit();
+			//break;
 
 		case ACTION_TOGGLE_NEGATE_MODE:
 			if(parameter.pint == 0) {
@@ -6970,6 +6986,7 @@
 
 	return FALSE;
 }/*}}}*/
+
 gboolean window_button_press_callback(GtkWidget *widget, GdkEventButton *event, gpointer user_data) {/*{{{*/
 	if(event->time - last_button_press_time < 250 && (application_mode != MONTAGE || event->type != GDK_2BUTTON_PRESS)) {
 		// GTK double-reported this. Ignore.
@@ -6977,6 +6994,14 @@
 	}
 	last_button_press_time = event->time;
 
+	
+	if (event->type == GDK_BUTTON_PRESS) {
+	  
+		if (event->button == 3 ) {
+			system("Xdialog --title \"Keyboard Shortcuts\" --fixed-font --infobox \"e - edit image. . . . . . . .\nb - change background.\ni - image information . .\nf - fullscreen . . . . . . . .\nr - reload . . . . . . . . . . .\nq - quit. . . . . . . . . . . . .\nesc - quit. . . . . . . . . . .\" 16 50 15000");
+		}
+	}	
+	
 #ifndef CONFIGURED_WITHOUT_MONTAGE_MODE
 	if(application_mode == MONTAGE && cursor_visible && event->button == 1) {
 		// In montage mode, the mouse may be used to select thumbnails
@@ -7012,6 +7037,7 @@
 
 	return FALSE;
 }/*}}}*/
+
 gboolean window_button_release_callback(GtkWidget *widget, GdkEventButton *event, gpointer user_data) {/*{{{*/
 	if(event->time - last_button_press_time > 250 || (event->time == last_button_release_time && last_button_release_time > 0)) {
 		// Do nothing if the button was pressed for a long time
