Middle click!



Hello!

We are getting closer to the new release! Another "documented but not
quite implemented feature" has been fixed.

Middle click processing was actually "implemented", but it was tied to the
GDK_BUTTON_RELEASE event in a function that doesn't get release events :-)

In fact, the event processing is separate for the icon view and for list
views, so I had to move this function to two places with minimal changes.

---------------------------------------------
--- ChangeLog
+++ ChangeLog
@@ -1 +1,9 @@
+2001-07-10  Pavel Roskin  <proski gnu org>
+
+	* gscreen.c (panel_icon_list_select_icon): This function doesn't
+	get GDK_BUTTON_RELEASE, so move middle button processing ...
+	(panel_icon_list_button_release): ... here.
+	* gtkflist.c (gtk_flist_button_release): Open new window if the
+	middle button is released and DnD is not attempted.
+
 2001-07-09  Pavel Roskin  <proski gnu org>
--- gscreen.c
+++ gscreen.c
@@ -1321,19 +1321,6 @@ panel_icon_list_select_icon (GtkWidget *

 		break;

-	case GDK_BUTTON_RELEASE:
-		if (event->button.button == 2){
-			char *fullname;
-
-			if (S_ISDIR (panel->dir.list [index].buf.st_mode) ||
-			    panel->dir.list [index].f.link_to_dir){
-				fullname = concat_dir_and_file (panel->cwd, panel->dir.list [index].fname);
-				new_panel_at (fullname);
-				g_free (fullname);
-			}
-		}
-		break;
-
 	case GDK_2BUTTON_PRESS:
 		if (event->button.button == 1) {
 			do_enter (panel);
@@ -1521,6 +1508,23 @@ static int
 panel_icon_list_button_release (GtkWidget *widget, GdkEventButton *event, WPanel *panel)
 {
 	panel->maybe_start_drag = 0;
+	if (event->button == 2){
+		char *fullname;
+		int icon;
+		file_entry *fe;
+
+		GnomeIconList *gil = GNOME_ICON_LIST (widget);
+		icon = gnome_icon_list_get_icon_at (gil, event->x, event->y);
+		fe = &panel->dir.list [icon];
+
+		if (S_ISDIR (fe->buf.st_mode) || fe->f.link_to_dir){
+			fullname = concat_dir_and_file (panel->cwd, fe->fname);
+			new_panel_at (fullname);
+			g_free (fullname);
+		}
+		return TRUE;
+	}
+
 	return FALSE;
 }

--- gtkflist.c
+++ gtkflist.c
@@ -7,7 +7,9 @@

 #include <config.h>
 #include <stdlib.h>
+#include "x.h"
 #include "gtkflist.h"
+#include "gmain.h"


 enum {
@@ -333,6 +335,19 @@ gtk_flist_button_release (GtkWidget *wid
 			select_row (flist, row, flist->dnd_select_pending_state);
 			flist->dnd_select_pending = FALSE;
 			flist->dnd_select_pending_state = 0;
+		} else if (event->button == 2) {
+			/* Middle click opens another window */
+			char *fullname;
+			file_entry *fe;
+
+			fe = &flist->panel->dir.list [row];
+
+			if (S_ISDIR (fe->buf.st_mode) || fe->f.link_to_dir) {
+				fullname = concat_dir_and_file (flist->panel->cwd,
+								fe->fname);
+				new_panel_at (fullname);
+				g_free (fullname);
+			}
 		}

 		retval = TRUE;
---------------------------------------------

Regards,
Pavel Roskin





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]