From b009734d5c7927ae9fb593d365c61ce3dda17c0c Mon Sep 17 00:00:00 2001 From: rakshasa Date: Fri, 23 Mar 2007 00:00:15 +0000 Subject: [PATCH] * Added support for dvorak keyboard layout. Patch by matled@gmx.net. * Moved TrackerManager::close() call to the DownloadWrapper dtor so that tracker STOPPED request will be sent when closing a torrent. * Fixed some portability issues with Solaris, but still some remain. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@872 e378c898-3ddf-0310-93e7-cc216c733640 --- doc/rtorrent.1 | 2 +- doc/rtorrent.1.xml | 2 +- rak/socket_address.h | 7 +++---- src/ui/root.cc | 35 +++++++++++++++++++++++++++-------- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/doc/rtorrent.1 b/doc/rtorrent.1 index abd52c5c..fabb8d66 100644 --- a/doc/rtorrent.1 +++ b/doc/rtorrent.1 @@ -385,7 +385,7 @@ match for the download to be included. \fBstopped\fR, \fBstarted\fR, \fBcomplete\fR, \fBincomplete\fR, .TP -\fBkey_layout = \fIqwerty|azerty|qwertz\fB\fR +\fBkey_layout = \fIqwerty|azerty|qwertz|dvorak\fB\fR Change the key-bindings. .SH "FILE-SYSTEM SETTINGS" .PP diff --git a/doc/rtorrent.1.xml b/doc/rtorrent.1.xml index 80fec0f9..bc5b26da 100644 --- a/doc/rtorrent.1.xml +++ b/doc/rtorrent.1.xml @@ -768,7 +768,7 @@ match for the download to be included. - key_layout = qwerty|azerty|qwertz + key_layout = qwerty|azerty|qwertz|dvorak Change the key-bindings. diff --git a/rak/socket_address.h b/rak/socket_address.h index e929abe5..05a8ef8b 100644 --- a/rak/socket_address.h +++ b/rak/socket_address.h @@ -62,15 +62,14 @@ class socket_address_inet6; class socket_address { public: - static const sa_family_t af_local = AF_LOCAL; static const sa_family_t af_inet = AF_INET; static const sa_family_t af_inet6 = AF_INET6; static const sa_family_t af_unspec = AF_UNSPEC; -#ifdef AF_UNIX - static const sa_family_t af_unix = AF_UNIX; +#ifdef AF_LOCAL + static const sa_family_t af_local = AF_LOCAL; #else - static const sa_family_t af_unix = AF_FILE; + static const sa_family_t af_local = AF_UNIX; #endif bool is_valid() const; diff --git a/src/ui/root.cc b/src/ui/root.cc index 8a356e07..8c54a4fd 100644 --- a/src/ui/root.cc +++ b/src/ui/root.cc @@ -138,6 +138,12 @@ Root::setup_keys() { m_bindings['A'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 1); m_bindings['Y'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -1); + } else if (strcasecmp(control->variable()->get_string("key_layout").c_str(), "dvorak") == 0) { + m_bindings['a'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 1); + m_bindings[';'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -1); + m_bindings['A'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 1); + m_bindings[':'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -1); + } else { m_bindings['a'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 1); m_bindings['z'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -1); @@ -145,15 +151,28 @@ Root::setup_keys() { m_bindings['Z'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -1); } - m_bindings['s'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 5); - m_bindings['x'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -5); - m_bindings['S'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 5); - m_bindings['X'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -5); + if (strcasecmp(control->variable()->get_string("key_layout").c_str(), "dvorak") != 0) { + m_bindings['s'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 5); + m_bindings['x'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -5); + m_bindings['S'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 5); + m_bindings['X'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -5); - m_bindings['d'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 50); - m_bindings['c'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -50); - m_bindings['D'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 50); - m_bindings['C'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -50); + m_bindings['d'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 50); + m_bindings['c'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -50); + m_bindings['D'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 50); + m_bindings['C'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -50); + + } else { + m_bindings['o'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 5); + m_bindings['q'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -5); + m_bindings['O'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 5); + m_bindings['Q'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -5); + + m_bindings['e'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 50); + m_bindings['j'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -50); + m_bindings['E'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 50); + m_bindings['J'] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -50); + } m_bindings['\x0C'] = sigc::mem_fun(m_control->display(), &display::Manager::force_redraw); // ^L m_bindings['\x11'] = sigc::mem_fun(m_control, &Control::receive_normal_shutdown); // ^Q