Anonymous avatar Anonymous committed 103ed13

Add patch to support Ctrl-{C,X,V} when the current keyboard layout is not latin

Comments (0)

Files changed (3)

x11-misc/pcmanfm/Manifest

-EBUILD pcmanfm-9999.ebuild 1444 RMD160 f7fdecac06ff6764881d849404ca3a06e854e13a SHA1 0d24a2f3290f6555045486d38414d20faf1c5cac SHA256 e36d955f7d8cd0e7e130a95dedfde3859ac6cc1c2ec70b1fd90cd4ce773a63ea
+AUX pcmanfm-kbshortcut.patch 2677 RMD160 decf9de48ddec85ddc3fe5b8a550632432762dba SHA1 46a1bb7d75d3ddba656af3b0e596cde08e40f1cb SHA256 942e96a9cf334d084e21eb27c6c3f7444dad48baa0b22b1f1589579849deb137
+EBUILD pcmanfm-9999.ebuild 1553 RMD160 097730274fc355715bf990ff35717f105540ea59 SHA1 54fb5777bbd76d8ddf6619ec03cdee07d93fa40e SHA256 77f936459f4362061f5b829a75f29030956b329a1e7a0ddb1ee3d941d04d0e33

x11-misc/pcmanfm/files/pcmanfm-kbshortcut.patch

+--- src/ptk/ptk-file-browser.c
++++ src/ptk/ptk-file-browser.c
+@@ -94,6 +94,9 @@
+ static void
+ ptk_file_browser_update_model( PtkFileBrowser* file_browser );
+ 
++static gboolean
++is_latin_shortcut_key( guint keyval );
++
+ /* Get GtkTreePath of the item at coordinate x, y */
+ static GtkTreePath*
+ folder_view_get_tree_path_at_pos( PtkFileBrowser* file_browser, int x, int y );
+@@ -964,8 +967,16 @@
+     g_list_free( sel_files );
+ 
+     g_signal_emit( file_browser, signals[ SEL_CHANGE_SIGNAL ], 0 );
++    
+ }
+ 
++static gboolean
++is_latin_shortcut_key ( guint keyval )
++{
++	return ((GDK_0 <= keyval && keyval <= GDK_9) ||
++			(GDK_A <= keyval && keyval <= GDK_Z) ||
++			(GDK_a <= keyval && keyval <= GDK_z));
++}
+ 
+ gboolean
+ on_folder_view_key_press_event ( GtkWidget *widget,
+@@ -975,6 +986,45 @@
+     int modifier = ( event->state & ( GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK ) );
+     if ( ! gtk_widget_is_focus( widget ) )
+         return FALSE;
++        
++    // Make key bindings work when the current keyboard layout is not latin
++    if ( modifier != 0 && !is_latin_shortcut_key( event->keyval ) ) {
++        // We have a non-latin char, try other keyboard groups
++        GdkKeymapKey *keys;
++        guint *keyvals;
++        gint n_entries;
++        gint level;
++
++        if ( gdk_keymap_translate_keyboard_state( NULL,
++                                                  event->hardware_keycode,
++                                                  (GdkModifierType)event->state,
++                                                  event->group,
++                                                  NULL, NULL, &level, NULL )
++            && gdk_keymap_get_entries_for_keycode( NULL,
++                                                   event->hardware_keycode,
++                                                   &keys, &keyvals,
++                                                   &n_entries ) ) {
++            gint n;
++            for ( n=0; n<n_entries; n++ ) {
++                if ( keys[n].group == event->group ) {
++                    // Skip keys from the same group
++                    continue;
++                }
++                if ( keys[n].level != level ) {
++                    // Allow only same level keys
++                    continue;
++                }
++                if ( is_latin_shortcut_key( keyvals[n] ) ) {
++                    // Latin character found
++                    event->keyval = keyvals[n];
++                    break;
++                }
++            }
++            g_free( keys );
++            g_free( keyvals );
++        }
++    } 
++        
+     if ( modifier == GDK_CONTROL_MASK )
+     {
+         switch ( event->keyval )

x11-misc/pcmanfm/pcmanfm-9999.ebuild

 inherit eutils subversion fdo-mime
 
 ESVN_REPO_URI="https://pcmanfm.svn.sourceforge.net/svnroot/pcmanfm/trunk"
-ESVN_BOOTSTRAP="NOCONFIGURE=1 ./autogen.sh"
 DESCRIPTION="Extremely fast and lightweight tabbed file manager"
 HOMEPAGE="http://pcmanfm.sourceforge.net/"
 
 	dev-util/pkgconfig
 	sys-devel/gettext"
 
+src_unpack() {
+        subversion_src_unpack
+        cd "${S}"
+        epatch "${FILESDIR}"/${PN}-kbshortcut.patch
+        NOCONFIGURE=1 ./autogen.sh
+}
+
 src_compile() {
 	econf $(use_enable hal) || die "econf failed"
 	emake || die "emake failed"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.