core: add info about position where mouse button is released in hook_focus (for mouse gestures)
parent
95b179dd08
commit
217e9683d2
|
@ -48,7 +48,7 @@
|
|||
|
||||
| weechat | hotlist | Liste der Buffer in Hotlist | - | -
|
||||
|
||||
| weechat | key | Auflistung der Tastenzuweisungen | - | Kontext ("default" oder "search") (optional)
|
||||
| weechat | key | Auflistung der Tastenzuweisungen | - | context ("default", "search", "cursor" or "mouse") (optional)
|
||||
|
||||
| weechat | nicklist | Nicks in Nickliste für einen Buffer | Buffer Pointer | nick_xxx oder group_xxx um nur den Nick/Group xxx abzufragen (optional)
|
||||
|
||||
|
|
|
@ -350,6 +350,7 @@ For context "mouse" (possible in context "cursor" too), key has format: "@area:k
|
|||
bar(xxx): bar "xxx"
|
||||
item(*): any bar item
|
||||
item(xxx): bar item "xxx"
|
||||
The key can start or end with '*' to match many mouse events.
|
||||
|
||||
Examples:
|
||||
key alt-x to toggle nicklist bar:
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
| weechat | hotlist | list of buffers in hotlist | - | -
|
||||
|
||||
| weechat | key | list of key bindings | - | context ("default" or "search") (optional)
|
||||
| weechat | key | list of key bindings | - | context ("default", "search", "cursor" or "mouse") (optional)
|
||||
|
||||
| weechat | nicklist | nicks in nicklist for a buffer | buffer pointer | nick_xxx or group_xxx to get only nick/group xxx (optional)
|
||||
|
||||
|
|
|
@ -350,6 +350,7 @@ For context "mouse" (possible in context "cursor" too), key has format: "@area:k
|
|||
bar(xxx): bar "xxx"
|
||||
item(*): any bar item
|
||||
item(xxx): bar item "xxx"
|
||||
The key can start or end with '*' to match many mouse events.
|
||||
|
||||
Examples:
|
||||
key alt-x to toggle nicklist bar:
|
||||
|
|
|
@ -3267,9 +3267,12 @@ Arguments:
|
|||
*** 'buffer': buffer
|
||||
*** 'time': time
|
||||
** 'keys': string with list of keys (format: "key1,key2,key3")
|
||||
** 'keys_sorted': string with list of sorted keys (format: "key1,key2,key3")
|
||||
** 'values': string with list of values (format: "value1,value2,value3")
|
||||
** 'keys_values': string with list of keys and values
|
||||
(format: "key1:value1,key2:value2,key3:value3")
|
||||
** 'keys_values_sorted': string with list of keys and values (sorted by keys)
|
||||
(format: "key1:value1,key2:value2,key3:value3")
|
||||
|
||||
Return value:
|
||||
|
||||
|
@ -8253,34 +8256,65 @@ Arguments:
|
|||
value:
|
||||
** 'void *data': pointer
|
||||
** 'struct t_hashtable *info': hashtable with info on focus and strings returned
|
||||
by other calls to focus callbacks (with higher priority); keys and values
|
||||
are of type "string"; info on focus (filled by WeeChat) are:
|
||||
*** '_x': column of focus on screen (first column on the left is "0")
|
||||
*** '_y': line of focus on screen (first line on top is "0")
|
||||
*** '_window': pointer of window with focus ("0x0" for a bar of type "root"
|
||||
or for unknown area)
|
||||
*** '_window_number': number of window with focus (not set for a bar of type
|
||||
"root" or for unknown area)
|
||||
*** '_buffer': pointer of buffer with focus ("0x0" for a bar of type "root"
|
||||
or for unknown area)
|
||||
*** '_buffer_number': number of buffer with focus (not set for a bar of type
|
||||
"root" or for unknown area)
|
||||
*** '_buffer_plugin': plugin name of buffer with focus (not set for a bar of
|
||||
type "root" or for unknown area)
|
||||
*** '_buffer_name': name of buffer with focus (not set for a bar of type "root"
|
||||
or for unknown area)
|
||||
*** '_bar_name': name of bar with focus (NULL for chat area or for unknown
|
||||
area)
|
||||
*** '_bar_item_name': name of bar item with focus (NULL if focus is not in a
|
||||
bar or if focus is after the end of last bar item)
|
||||
*** '_item_line': line with focus in bar item (first line of bar item is "0")
|
||||
*** '_item_col': column with focus in bar item (first column of bar item is "0")
|
||||
by other calls to focus callbacks (with higher priority) (see table below)
|
||||
** return value: either "info" pointer (hashtable completed), or pointer to a
|
||||
new hashtable (created by callback, with keys and values of type "string"),
|
||||
this new hashtable content will be added to 'info' for other calls to focus
|
||||
callbacks
|
||||
* 'callback_data': pointer given to callback when it is called by WeeChat
|
||||
|
||||
[IMPORTANT]
|
||||
For a mouse gesture, your callback will be called two times: first time when
|
||||
button is pressed (here the area always matches your area), second time when
|
||||
button is released, and then the area may not match your area: so you must
|
||||
*always* test in your callback if area is matching before using info in
|
||||
hashtable.
|
||||
|
||||
Content of hashtable sent to callback (keys and values are of type "string"):
|
||||
|
||||
[width="100%",cols="4m,6,8,8",options="header"]
|
||||
|========================================
|
||||
| Key ^(1)^ | Description | Value | Value if N/A
|
||||
| _x | column on screen 2+| "0" ... "n"
|
||||
| _y | line on screen 2+| "0" ... "n"
|
||||
| _window | pointer of window | "0x12345678" | "0x0"
|
||||
| _window_number | number of window | "1" ... "n" | "*"
|
||||
| _chat | chat area indicator | "0" or "1" | "0"
|
||||
| _buffer | pointer of buffer | "0x12345678" | "0x0"
|
||||
| _buffer_number | number of buffer | "1" ... "n" | ""
|
||||
| _buffer_plugin | plugin name of buffer | "core", "irc", ... | ""
|
||||
| _buffer_name | name of buffer | "weechat", "freenode.#weechat", ... | ""
|
||||
| _bar_name | name of bar | "title", "nicklist", ... | ""
|
||||
| _bar_filling | filling of bar | "horizontal", "vertical", ... | ""
|
||||
| _bar_item_name | name of bar item | "buffer_nicklist", ... | ""
|
||||
| _item_line | line in bar item | "0" ... "n" | "-1"
|
||||
| _item_col | column in bar item | "0" ... "n" | "-1"
|
||||
| _key | key or mouse event 2+| "button1", "button2-gesture-left", ...
|
||||
|========================================
|
||||
|
||||
[NOTE]
|
||||
^(1)^ There are same keys suffixed with "2" (ie: "_x2", "_y2", "_window2", ...)
|
||||
with info on second point (useful only for mouse gestures, to know where mouse
|
||||
button has been released).
|
||||
|
||||
Extra info for bar item "buffer_nicklist":
|
||||
|
||||
[width="70%",cols="3m,3,8",options="header"]
|
||||
|========================================
|
||||
| Key | Plugin ^(1)^ | Description
|
||||
| nick | core | nick name
|
||||
| prefix | core | prefix for nick
|
||||
| group | core | group name
|
||||
| host | irc | host for nick (if known)
|
||||
| server | irc | internal name of server
|
||||
| channel | irc | channel name
|
||||
|========================================
|
||||
|
||||
[NOTE]
|
||||
^(1)^ The name of plugin which defines a hook_focus to return info for this bar
|
||||
item (so for example if plugin is "irc", such info will be available only on
|
||||
irc buffers).
|
||||
|
||||
Return value:
|
||||
|
||||
* pointer to new hook, NULL if error occured
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
| weechat | hotlist | liste des tampons dans la hotlist | - | -
|
||||
|
||||
| weechat | key | liste des associations de touches | - | contexte ("default" ou "search") (optionnel)
|
||||
| weechat | key | liste des associations de touches | - | contexte ("default", "search", "cursor" ou "mouse") (optionnel)
|
||||
|
||||
| weechat | nicklist | pseudos dans la liste des pseudos pour un tampon | pointeur vers le tampon | nick_xxx ou group_xxx pour avoir seulement le pseudo/groupe xxx (optionnel)
|
||||
|
||||
|
|
|
@ -350,6 +350,7 @@ Pour le contexte "mouse" (possible aussi pour le contexte "cursor"), la touche a
|
|||
bar(xxx): la barre "xxx"
|
||||
item(*): n'importe quel objet de barre
|
||||
item(xxx): l'objet de barre "xxx"
|
||||
La touche peut commencer ou se terminer par '*' pour plusieurs évènements de la souris.
|
||||
|
||||
Exemples:
|
||||
touche alt-x pour activer/désactiver la liste des pseudos:
|
||||
|
|
|
@ -3299,9 +3299,13 @@ Paramètres :
|
|||
*** 'buffer' : buffer
|
||||
*** 'time' : heure
|
||||
** 'keys' : chaîne avec la liste des clés (format : "clé1,clé2,clé3")
|
||||
** 'keys_sorted' : chaîne avec la liste triée des clés (format :
|
||||
"clé1,clé2,clé3")
|
||||
** 'values' : chaîne avec la liste des valeurs (format : "valeur1,valeur2,valeur3")
|
||||
** 'keys_values' : chaîne avec la liste des clés et valeurs
|
||||
(format : "clé1:valeur1,clé2:valeur2,clé3:valeur3")
|
||||
** 'keys_values_sorted' : chaîne avec la liste des clés et valeurs (triée sur
|
||||
les clés) (format : "clé1:valeur1,clé2:valeur2,clé3:valeur3")
|
||||
|
||||
Valeur en retour :
|
||||
|
||||
|
@ -8381,36 +8385,12 @@ Paramètres :
|
|||
|
||||
* 'area' : "chat" pour la zone de discussion, ou un nom d'objet de barre
|
||||
(priorité autorisée, voir la note sur la <<hook_priority,priorité>>)
|
||||
* 'callback' : fonction appelée quand le focus est fait paramètres et valeur de
|
||||
* 'callback' : fonction appelée quand le focus est fait, paramètres et valeur de
|
||||
retour :
|
||||
** 'void *data' : pointeur
|
||||
** 'struct t_hashtable *info' : hashtable avec les informations sur le focus et
|
||||
les chaînes retournées par les autres appels aux "callbacks" de focus (avec
|
||||
plus haute priorité); les clés et valeurs sont de type "string"; les
|
||||
informations sur le focus (remplies par WeeChat) sont :
|
||||
*** '_x' : colonne du focus sur l'écran (la première colonne sur la gauche
|
||||
est "0")
|
||||
*** '_y' : ligne du focus sur l'écran (la première ligne en haut est "0")
|
||||
*** '_window' : pointeur de la fenêtre avec le focus ("0x0" pour une barre de
|
||||
type "root" ou pour une zone inconnue)
|
||||
*** '_window_number' : numéro de la fenêtre avec le focus (non défini pour une
|
||||
barre de type "root" ou pour une zone inconnue)
|
||||
*** '_buffer' : pointeur du tampon avec le focus ("0x0" pour une barre de type
|
||||
"root" ou pour une zone inconnue)
|
||||
*** '_buffer_number' : numéro du tampon avec le focus (non défini pour une barre
|
||||
de type "root" ou pour une zone inconnue)
|
||||
*** '_buffer_plugin' : nom d'extension du tampon avec le focus (non défini pour
|
||||
une barre de type "root" ou pour une zone inconnue)
|
||||
*** '_buffer_name' : nom du tampon avec le focus (non défini pour une barre de
|
||||
type "root" ou pour une zone inconnue)
|
||||
*** '_bar_name' : nom de la barre avec le focus (NULL pour la zone de discussion
|
||||
("chat") ou pour une zone inconnue)
|
||||
*** '_bar_item_name' : nom de l'objet de barre avec le focus (NULL si le focus
|
||||
n'est pas dans une barre ou si le focus est après le dernier objet de barre)
|
||||
*** '_item_line' : ligne avec le focus dans l'objet de barre (la première ligne
|
||||
de l'objet de barre est "0")
|
||||
*** '_item_col' : colonne avec le focus dans l'objet de barre (la première
|
||||
colonne de l'objet de barre est "0")
|
||||
plus haute priorité) (voir le tableau ci-dessous)
|
||||
** valeur de retour : soit le pointeur vers la hashtable "info" (avec la
|
||||
hashtable complétée), ou un pointeur vers une nouvelle hashtable (créée par
|
||||
le "callback", avec clés et valeurs de type "string"), le contenu de cette
|
||||
|
@ -8419,6 +8399,60 @@ Paramètres :
|
|||
* 'callback_data' : pointeur donné au "callback" lorsqu'il est appelé par
|
||||
WeeChat
|
||||
|
||||
[IMPORTANT]
|
||||
Pour un geste de souris, votre "callback" sera appelé deux fois : la première
|
||||
lorsque le bouton est pressé (ici la zone correspond à vôtre zone), la seconde
|
||||
fois lorsque le bouton est relâché, et la zone peut ne pas correspondre à la
|
||||
vôtre : donc vous devez *toujours* tester dans le "callback" si la zone
|
||||
correspond avant d'utiliser les informations de la hashtable.
|
||||
|
||||
Contenu de la hashtable envoyée au "callback" (les clés et valeurs sont de type
|
||||
"string) :
|
||||
|
||||
[width="100%",cols="4m,6,8,8",options="header"]
|
||||
|========================================
|
||||
| Clé ^(1)^ | Description | Valeur | Valeur si non applicable
|
||||
| _x | colonne sur l'écran 2+| "0" ... "n"
|
||||
| _y | ligne sur l'écran 2+| "0" ... "n"
|
||||
| _window | pointeur de la fenêtre | "0x12345678" | "0x0"
|
||||
| _window_number | numéro de la fenêtre | "1" ... "n" | "*"
|
||||
| _chat | indicateur zone "chat" | "0" ou "1" | "0"
|
||||
| _buffer | pointeur du tampon | "0x12345678" | "0x0"
|
||||
| _buffer_number | numéro du tampon | "1" ... "n" | ""
|
||||
| _buffer_plugin | nom d'extension du tampon | "core", "irc", ... | ""
|
||||
| _buffer_name | nom du tampon | "weechat", "freenode.#weechat", ... | ""
|
||||
| _bar_name | nom de la barre | "title", "nicklist", ... | ""
|
||||
| _bar_filling | remplissage de la barre | "horizontal", "vertical", ... | ""
|
||||
| _bar_item_name | nom de l'objet de barre | "buffer_nicklist", ... | ""
|
||||
| _item_line | ligne dans l'objet de barre | "0" ... "n" | "-1"
|
||||
| _item_col | colonne dans l'objet de barre | "0" ... "n" | "-1"
|
||||
| _key | touche ou évènement souris 2+| "button1", "button2-gesture-left", ...
|
||||
|========================================
|
||||
|
||||
[NOTE]
|
||||
^(1)^ Il y a les mêmes clés suffixées par "2" (c'est-à-dire : "_x2", "_y2",
|
||||
"_window2", ...) avec l'information sur le second point (pratique seulement
|
||||
pour les gestes de souris, pour savoir où le bouton de la souris a été
|
||||
relâché).
|
||||
|
||||
Informations additionnelles pour l'objet de barre "buffer_nicklist":
|
||||
|
||||
[width="70%",cols="3m,3,8",options="header"]
|
||||
|========================================
|
||||
| Clé | Extension ^(1)^ | Description
|
||||
| nick | core | pseudonyme
|
||||
| prefix | core | préfixe du pseudonyme
|
||||
| group | core | nom du groupe
|
||||
| host | irc | nom d'hôte pour le pseudonyme (si connu)
|
||||
| server | irc | nom interne du serveur
|
||||
| channel | irc | nom du canal
|
||||
|========================================
|
||||
|
||||
[NOTE]
|
||||
^(1)^ Le nom de l'extension qui définit un hook_focus pour retourner des infos
|
||||
pour cet objet de barre (donc par exemple si l'extension est "irc", ces infos
|
||||
ne seront disponibles que sur les tampons irc).
|
||||
|
||||
Valeur de retour :
|
||||
|
||||
* pointeur vers le nouveau "hook", NULL en cas d'erreur
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
| weechat | hotlist | elenco dei buffer nella hotlist | - | -
|
||||
|
||||
| weechat | key | elenco di tasti associati | - | contesto ("default" oppure "search") (opzionale)
|
||||
| weechat | key | elenco di tasti associati | - | context ("default", "search", "cursor" or "mouse") (optional)
|
||||
|
||||
| weechat | nicklist | nick nella lista nick per un buffer | puntatore al buffer | nick_xxx o group_xxx per ottenere solo xxx di nick/group (opzionale)
|
||||
|
||||
|
|
|
@ -350,6 +350,7 @@ For context "mouse" (possible in context "cursor" too), key has format: "@area:k
|
|||
bar(xxx): bar "xxx"
|
||||
item(*): any bar item
|
||||
item(xxx): bar item "xxx"
|
||||
The key can start or end with '*' to match many mouse events.
|
||||
|
||||
Examples:
|
||||
key alt-x to toggle nicklist bar:
|
||||
|
|
|
@ -3257,9 +3257,14 @@ Argomenti:
|
|||
*** 'buffer': buffer
|
||||
*** 'time': tempo
|
||||
** 'keys': stringa con la lista di chiavi (formato: "chiave1,chiave2,chiave3")
|
||||
// TRANSLATION MISSING
|
||||
** 'keys_sorted': string with list of sorted keys (format: "chiave1,chiave2,chiave3")
|
||||
** 'values': stringa con la lista di valori (formato: "valore1,valore2,valore3")
|
||||
** 'keys_values': stringa con la lista di valori e chiavi
|
||||
(formato: "chiave1:valore1,chiave2:valore2,chiave3:valore3")
|
||||
// TRANSLATION MISSING
|
||||
** 'keys_values_sorted': string with list of keys and values (sorted by keys)
|
||||
(format: "chiave1:valore1,chiave2:valore2,chiave3:valore3")
|
||||
|
||||
Valore restituito:
|
||||
|
||||
|
@ -8308,34 +8313,65 @@ Argomenti:
|
|||
value:
|
||||
** 'void *data': pointer
|
||||
** 'struct t_hashtable *info': hashtable with info on focus and strings returned
|
||||
by other calls to focus callbacks (with higher priority); keys and values
|
||||
are of type "string"; info on focus (filled by WeeChat) are:
|
||||
*** '_x': column of focus on screen (first column on the left is "0")
|
||||
*** '_y': line of focus on screen (first line on top is "0")
|
||||
*** '_window': pointer of window with focus ("0x0" for a bar of type "root"
|
||||
or for unknown area)
|
||||
*** '_window_number': number of window with focus (not set for a bar of type
|
||||
"root" or for unknown area)
|
||||
*** '_buffer': pointer of buffer with focus ("0x0" for a bar of type "root"
|
||||
or for unknown area)
|
||||
*** '_buffer_number': number of buffer with focus (not set for a bar of type
|
||||
"root" or for unknown area)
|
||||
*** '_buffer_plugin': plugin name of buffer with focus (not set for a bar of
|
||||
type "root" or for unknown area)
|
||||
*** '_buffer_name': name of buffer with focus (not set for a bar of type "root"
|
||||
or for unknown area)
|
||||
*** '_bar_name': name of bar with focus (NULL for chat area or for unknown
|
||||
area)
|
||||
*** '_bar_item_name': name of bar item with focus (NULL if focus is not in a
|
||||
bar or if focus is after the end of last bar item)
|
||||
*** '_item_line': line with focus in bar item (first line of bar item is "0")
|
||||
*** '_item_col': column with focus in bar item (first column of bar item is "0")
|
||||
by other calls to focus callbacks (with higher priority) (see table below)
|
||||
** return value: either "info" pointer (hashtable completed), or pointer to a
|
||||
new hashtable (created by callback, with keys and values of type "string"),
|
||||
this new hashtable content will be added to 'info' for other calls to focus
|
||||
callbacks
|
||||
* 'callback_data': pointer given to callback when it is called by WeeChat
|
||||
|
||||
[IMPORTANT]
|
||||
For a mouse gesture, your callback will be called two times: first time when
|
||||
button is pressed (here the area always matches your area), second time when
|
||||
button is released, and then the area may not match your area: so you must
|
||||
*always* test in your callback if area is matching before using info in
|
||||
hashtable.
|
||||
|
||||
Content of hashtable sent to callback (keys and values are of type "string"):
|
||||
|
||||
[width="100%",cols="4m,6,8,8",options="header"]
|
||||
|========================================
|
||||
| Key ^(1)^ | Description | Value | Value if N/A
|
||||
| _x | column on screen 2+| "0" ... "n"
|
||||
| _y | line on screen 2+| "0" ... "n"
|
||||
| _window | pointer of window | "0x12345678" | "0x0"
|
||||
| _window_number | number of window | "1" ... "n" | "*"
|
||||
| _chat | chat area indicator | "0" or "1" | "0"
|
||||
| _buffer | pointer of buffer | "0x12345678" | "0x0"
|
||||
| _buffer_number | number of buffer | "1" ... "n" | ""
|
||||
| _buffer_plugin | plugin name of buffer | "core", "irc", ... | ""
|
||||
| _buffer_name | name of buffer | "weechat", "freenode.#weechat", ... | ""
|
||||
| _bar_name | name of bar | "title", "nicklist", ... | ""
|
||||
| _bar_filling | filling of bar | "horizontal", "vertical", ... | ""
|
||||
| _bar_item_name | name of bar item | "buffer_nicklist", ... | ""
|
||||
| _item_line | line in bar item | "0" ... "n" | "-1"
|
||||
| _item_col | column in bar item | "0" ... "n" | "-1"
|
||||
| _key | key or mouse event 2+| "button1", "button2-gesture-left", ...
|
||||
|========================================
|
||||
|
||||
[NOTE]
|
||||
^(1)^ There are same keys suffixed with "2" (ie: "_x2", "_y2", "_window2", ...)
|
||||
with info on second point (useful only for mouse gestures, to know where mouse
|
||||
button has been released).
|
||||
|
||||
Extra info for bar item "buffer_nicklist":
|
||||
|
||||
[width="70%",cols="3m,3,8",options="header"]
|
||||
|========================================
|
||||
| Key | Plugin | Description
|
||||
| nick | core | nick name
|
||||
| prefix | core | prefix for nick
|
||||
| group | core | group name
|
||||
| host | irc | host for nick (if known)
|
||||
| server | irc | internal name of server
|
||||
| channel | irc | channel name
|
||||
|========================================
|
||||
|
||||
[NOTE]
|
||||
^(1)^ The name of plugin which defines a hook_focus to return info for this bar
|
||||
item (so for example if plugin is "irc", such info will be available only on
|
||||
irc buffers).
|
||||
|
||||
Valore restituito:
|
||||
|
||||
* pointer to new hook, NULL if error occured
|
||||
|
|
|
@ -72,6 +72,8 @@
|
|||
./src/gui/gui-completion.h
|
||||
./src/gui/gui-filter.c
|
||||
./src/gui/gui-filter.h
|
||||
./src/gui/gui-focus.c
|
||||
./src/gui/gui-focus.h
|
||||
./src/gui/gui-history.c
|
||||
./src/gui/gui-history.h
|
||||
./src/gui/gui-hotlist.c
|
||||
|
|
5
po/cs.po
5
po/cs.po
|
@ -20,7 +20,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.6-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:37+0200\n"
|
||||
"POT-Creation-Date: 2011-08-01 13:42+0200\n"
|
||||
"PO-Revision-Date: 2011-07-05 15:37+0200\n"
|
||||
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1460,6 +1460,7 @@ msgid ""
|
|||
" bar(xxx): bar \"xxx\"\n"
|
||||
" item(*): any bar item\n"
|
||||
" item(xxx): bar item \"xxx\"\n"
|
||||
"The key can start or end with '*' to match many mouse events.\n"
|
||||
"\n"
|
||||
"Examples:\n"
|
||||
" key alt-x to toggle nicklist bar:\n"
|
||||
|
@ -6745,7 +6746,7 @@ msgstr "seznam bufferů v hotlistu"
|
|||
msgid "list of key bindings"
|
||||
msgstr "seznam napojení kláves"
|
||||
|
||||
msgid "context (\"default\" or \"search\") (optional)"
|
||||
msgid "context (\"default\", \"search\", \"cursor\" or \"mouse\") (optional)"
|
||||
msgstr ""
|
||||
|
||||
msgid "nicks in nicklist for a buffer"
|
||||
|
|
6
po/de.po
6
po/de.po
|
@ -22,7 +22,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.6-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:37+0200\n"
|
||||
"POT-Creation-Date: 2011-08-01 13:42+0200\n"
|
||||
"PO-Revision-Date: 2011-07-14 20:53+0100\n"
|
||||
"Last-Translator: Nils Görs\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1511,6 +1511,7 @@ msgid ""
|
|||
" bar(xxx): bar \"xxx\"\n"
|
||||
" item(*): any bar item\n"
|
||||
" item(xxx): bar item \"xxx\"\n"
|
||||
"The key can start or end with '*' to match many mouse events.\n"
|
||||
"\n"
|
||||
"Examples:\n"
|
||||
" key alt-x to toggle nicklist bar:\n"
|
||||
|
@ -7053,7 +7054,8 @@ msgstr "Liste der Buffer in Hotlist"
|
|||
msgid "list of key bindings"
|
||||
msgstr "Auflistung der Tastenzuweisungen"
|
||||
|
||||
msgid "context (\"default\" or \"search\") (optional)"
|
||||
#, fuzzy
|
||||
msgid "context (\"default\", \"search\", \"cursor\" or \"mouse\") (optional)"
|
||||
msgstr "Kontext (\"default\" oder \"search\") (optional)"
|
||||
|
||||
msgid "nicks in nicklist for a buffer"
|
||||
|
|
5
po/es.po
5
po/es.po
|
@ -21,7 +21,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.6-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:37+0200\n"
|
||||
"POT-Creation-Date: 2011-08-01 13:42+0200\n"
|
||||
"PO-Revision-Date: 2011-07-05 15:37+0200\n"
|
||||
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1470,6 +1470,7 @@ msgid ""
|
|||
" bar(xxx): bar \"xxx\"\n"
|
||||
" item(*): any bar item\n"
|
||||
" item(xxx): bar item \"xxx\"\n"
|
||||
"The key can start or end with '*' to match many mouse events.\n"
|
||||
"\n"
|
||||
"Examples:\n"
|
||||
" key alt-x to toggle nicklist bar:\n"
|
||||
|
@ -6852,7 +6853,7 @@ msgstr "lista de buffers en la lista de actividad"
|
|||
msgid "list of key bindings"
|
||||
msgstr "lista de atajos de teclas"
|
||||
|
||||
msgid "context (\"default\" or \"search\") (optional)"
|
||||
msgid "context (\"default\", \"search\", \"cursor\" or \"mouse\") (optional)"
|
||||
msgstr ""
|
||||
|
||||
msgid "nicks in nicklist for a buffer"
|
||||
|
|
12
po/fr.po
12
po/fr.po
|
@ -21,8 +21,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.6-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:37+0200\n"
|
||||
"PO-Revision-Date: 2011-07-30 14:38+0200\n"
|
||||
"POT-Creation-Date: 2011-08-01 13:42+0200\n"
|
||||
"PO-Revision-Date: 2011-08-01 13:43+0200\n"
|
||||
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
"Language: French\n"
|
||||
|
@ -1502,6 +1502,7 @@ msgid ""
|
|||
" bar(xxx): bar \"xxx\"\n"
|
||||
" item(*): any bar item\n"
|
||||
" item(xxx): bar item \"xxx\"\n"
|
||||
"The key can start or end with '*' to match many mouse events.\n"
|
||||
"\n"
|
||||
"Examples:\n"
|
||||
" key alt-x to toggle nicklist bar:\n"
|
||||
|
@ -1548,6 +1549,8 @@ msgstr ""
|
|||
" bar(xxx): la barre \"xxx\"\n"
|
||||
" item(*): n'importe quel objet de barre\n"
|
||||
" item(xxx): l'objet de barre \"xxx\"\n"
|
||||
"La touche peut commencer ou se terminer par '*' pour plusieurs évènements de "
|
||||
"la souris.\n"
|
||||
"\n"
|
||||
"Exemples:\n"
|
||||
" touche alt-x pour activer/désactiver la liste des pseudos:\n"
|
||||
|
@ -6953,8 +6956,9 @@ msgstr "liste des tampons dans la hotlist"
|
|||
msgid "list of key bindings"
|
||||
msgstr "liste des associations de touches"
|
||||
|
||||
msgid "context (\"default\" or \"search\") (optional)"
|
||||
msgstr "contexte (\"default\" ou \"search\") (optionnel)"
|
||||
msgid "context (\"default\", \"search\", \"cursor\" or \"mouse\") (optional)"
|
||||
msgstr ""
|
||||
"contexte (\"default\", \"search\", \"cursor\" ou \"mouse\") (optionnel)"
|
||||
|
||||
msgid "nicks in nicklist for a buffer"
|
||||
msgstr "pseudos dans la liste des pseudos pour un tampon"
|
||||
|
|
5
po/hu.po
5
po/hu.po
|
@ -20,7 +20,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.6-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:37+0200\n"
|
||||
"POT-Creation-Date: 2011-08-01 13:42+0200\n"
|
||||
"PO-Revision-Date: 2011-05-15 10:51+0200\n"
|
||||
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1297,6 +1297,7 @@ msgid ""
|
|||
" bar(xxx): bar \"xxx\"\n"
|
||||
" item(*): any bar item\n"
|
||||
" item(xxx): bar item \"xxx\"\n"
|
||||
"The key can start or end with '*' to match many mouse events.\n"
|
||||
"\n"
|
||||
"Examples:\n"
|
||||
" key alt-x to toggle nicklist bar:\n"
|
||||
|
@ -6307,7 +6308,7 @@ msgstr "kiemelendő szavak listája"
|
|||
msgid "list of key bindings"
|
||||
msgstr "Mellőzések listája:\n"
|
||||
|
||||
msgid "context (\"default\" or \"search\") (optional)"
|
||||
msgid "context (\"default\", \"search\", \"cursor\" or \"mouse\") (optional)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
|
|
6
po/it.po
6
po/it.po
|
@ -20,7 +20,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.6-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:37+0200\n"
|
||||
"POT-Creation-Date: 2011-08-01 13:42+0200\n"
|
||||
"PO-Revision-Date: 2011-07-16 11:32+0200\n"
|
||||
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1476,6 +1476,7 @@ msgid ""
|
|||
" bar(xxx): bar \"xxx\"\n"
|
||||
" item(*): any bar item\n"
|
||||
" item(xxx): bar item \"xxx\"\n"
|
||||
"The key can start or end with '*' to match many mouse events.\n"
|
||||
"\n"
|
||||
"Examples:\n"
|
||||
" key alt-x to toggle nicklist bar:\n"
|
||||
|
@ -6864,7 +6865,8 @@ msgstr "elenco dei buffer nella hotlist"
|
|||
msgid "list of key bindings"
|
||||
msgstr "elenco di tasti associati"
|
||||
|
||||
msgid "context (\"default\" or \"search\") (optional)"
|
||||
#, fuzzy
|
||||
msgid "context (\"default\", \"search\", \"cursor\" or \"mouse\") (optional)"
|
||||
msgstr "contesto (\"default\" oppure \"search\") (opzionale)"
|
||||
|
||||
msgid "nicks in nicklist for a buffer"
|
||||
|
|
5
po/pl.po
5
po/pl.po
|
@ -21,7 +21,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.6-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:37+0200\n"
|
||||
"POT-Creation-Date: 2011-08-01 13:42+0200\n"
|
||||
"PO-Revision-Date: 2011-07-05 15:38+0200\n"
|
||||
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1474,6 +1474,7 @@ msgid ""
|
|||
" bar(xxx): bar \"xxx\"\n"
|
||||
" item(*): any bar item\n"
|
||||
" item(xxx): bar item \"xxx\"\n"
|
||||
"The key can start or end with '*' to match many mouse events.\n"
|
||||
"\n"
|
||||
"Examples:\n"
|
||||
" key alt-x to toggle nicklist bar:\n"
|
||||
|
@ -6783,7 +6784,7 @@ msgstr "lista buforów w hotliście"
|
|||
msgid "list of key bindings"
|
||||
msgstr "lista skrótów klawiszowych"
|
||||
|
||||
msgid "context (\"default\" or \"search\") (optional)"
|
||||
msgid "context (\"default\", \"search\", \"cursor\" or \"mouse\") (optional)"
|
||||
msgstr ""
|
||||
|
||||
msgid "nicks in nicklist for a buffer"
|
||||
|
|
|
@ -20,7 +20,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.6-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:37+0200\n"
|
||||
"POT-Creation-Date: 2011-08-01 13:42+0200\n"
|
||||
"PO-Revision-Date: 2011-05-15 10:52+0200\n"
|
||||
"Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1467,6 +1467,7 @@ msgid ""
|
|||
" bar(xxx): bar \"xxx\"\n"
|
||||
" item(*): any bar item\n"
|
||||
" item(xxx): bar item \"xxx\"\n"
|
||||
"The key can start or end with '*' to match many mouse events.\n"
|
||||
"\n"
|
||||
"Examples:\n"
|
||||
" key alt-x to toggle nicklist bar:\n"
|
||||
|
@ -6124,7 +6125,7 @@ msgstr ""
|
|||
msgid "list of key bindings"
|
||||
msgstr ""
|
||||
|
||||
msgid "context (\"default\" or \"search\") (optional)"
|
||||
msgid "context (\"default\", \"search\", \"cursor\" or \"mouse\") (optional)"
|
||||
msgstr ""
|
||||
|
||||
msgid "nicks in nicklist for a buffer"
|
||||
|
|
5
po/ru.po
5
po/ru.po
|
@ -20,7 +20,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.6-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:37+0200\n"
|
||||
"POT-Creation-Date: 2011-08-01 13:42+0200\n"
|
||||
"PO-Revision-Date: 2011-05-15 10:52+0200\n"
|
||||
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
|
@ -1305,6 +1305,7 @@ msgid ""
|
|||
" bar(xxx): bar \"xxx\"\n"
|
||||
" item(*): any bar item\n"
|
||||
" item(xxx): bar item \"xxx\"\n"
|
||||
"The key can start or end with '*' to match many mouse events.\n"
|
||||
"\n"
|
||||
"Examples:\n"
|
||||
" key alt-x to toggle nicklist bar:\n"
|
||||
|
@ -6322,7 +6323,7 @@ msgstr "максимальная длина имён в хотлисте"
|
|||
msgid "list of key bindings"
|
||||
msgstr "Список игнорирования:\n"
|
||||
|
||||
msgid "context (\"default\" or \"search\") (optional)"
|
||||
msgid "context (\"default\", \"search\", \"cursor\" or \"mouse\") (optional)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
|
|
|
@ -71,6 +71,8 @@ SET(WEECHAT_SOURCES
|
|||
./src/gui/gui-completion.h
|
||||
./src/gui/gui-filter.c
|
||||
./src/gui/gui-filter.h
|
||||
./src/gui/gui-focus.c
|
||||
./src/gui/gui-focus.h
|
||||
./src/gui/gui-history.c
|
||||
./src/gui/gui-history.h
|
||||
./src/gui/gui-hotlist.c
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2011-07-30 14:37+0200\n"
|
||||
"POT-Creation-Date: 2011-08-01 13:42+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -1149,6 +1149,7 @@ msgid ""
|
|||
" bar(xxx): bar \"xxx\"\n"
|
||||
" item(*): any bar item\n"
|
||||
" item(xxx): bar item \"xxx\"\n"
|
||||
"The key can start or end with '*' to match many mouse events.\n"
|
||||
"\n"
|
||||
"Examples:\n"
|
||||
" key alt-x to toggle nicklist bar:\n"
|
||||
|
@ -5500,7 +5501,7 @@ msgstr ""
|
|||
msgid "list of key bindings"
|
||||
msgstr ""
|
||||
|
||||
msgid "context (\"default\" or \"search\") (optional)"
|
||||
msgid "context (\"default\", \"search\", \"cursor\" or \"mouse\") (optional)"
|
||||
msgstr ""
|
||||
|
||||
msgid "nicks in nicklist for a buffer"
|
||||
|
|
|
@ -5537,7 +5537,9 @@ command_init ()
|
|||
" bar(*): any bar\n"
|
||||
" bar(xxx): bar \"xxx\"\n"
|
||||
" item(*): any bar item\n"
|
||||
" item(xxx): bar item \"xxx\"\n\n"
|
||||
" item(xxx): bar item \"xxx\"\n"
|
||||
"The key can start or end with '*' to match many mouse "
|
||||
"events.\n\n"
|
||||
"Examples:\n"
|
||||
" key alt-x to toggle nicklist bar:\n"
|
||||
" /key bind meta-x /bar toggle nicklist\n"
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "weechat.h"
|
||||
#include "wee-hashtable.h"
|
||||
#include "wee-infolist.h"
|
||||
#include "wee-list.h"
|
||||
#include "wee-log.h"
|
||||
#include "wee-string.h"
|
||||
#include "../plugins/plugin.h"
|
||||
|
@ -453,6 +454,64 @@ hashtable_map (struct t_hashtable *hashtable,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* hashtable_get_list_keys_map_cb: function called for each variable in hdata
|
||||
* to build sorted list of keys
|
||||
*/
|
||||
|
||||
void
|
||||
hashtable_get_list_keys_map_cb (void *data,
|
||||
struct t_hashtable *hashtable,
|
||||
const void *key, const void *value)
|
||||
{
|
||||
struct t_weelist *list;
|
||||
char str_key[128];
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) hashtable;
|
||||
(void) value;
|
||||
|
||||
list = (struct t_weelist *)data;
|
||||
|
||||
switch (hashtable->type_keys)
|
||||
{
|
||||
case HASHTABLE_INTEGER:
|
||||
snprintf (str_key, sizeof (str_key), "%d", *((int *)key));
|
||||
weelist_add (list, str_key, WEECHAT_LIST_POS_SORT, NULL);
|
||||
break;
|
||||
case HASHTABLE_STRING:
|
||||
weelist_add (list, (const char *)key, WEECHAT_LIST_POS_SORT, NULL);
|
||||
break;
|
||||
case HASHTABLE_POINTER:
|
||||
case HASHTABLE_BUFFER:
|
||||
snprintf (str_key, sizeof (str_key), "0x%lx", (long unsigned int)key);
|
||||
weelist_add (list, str_key, WEECHAT_LIST_POS_SORT, NULL);
|
||||
break;
|
||||
case HASHTABLE_TIME:
|
||||
snprintf (str_key, sizeof (str_key), "%ld", (long)(*((time_t *)key)));
|
||||
weelist_add (list, str_key, WEECHAT_LIST_POS_SORT, NULL);
|
||||
break;
|
||||
case HASHTABLE_NUM_TYPES:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* hashtable_get_list_keys: get list with sorted keys of hashtable
|
||||
* Note: list must be freed after use
|
||||
*/
|
||||
|
||||
struct t_weelist *
|
||||
hashtable_get_list_keys (struct t_hashtable *hashtable)
|
||||
{
|
||||
struct t_weelist *weelist;
|
||||
|
||||
weelist = weelist_new ();
|
||||
if (weelist)
|
||||
hashtable_map (hashtable, &hashtable_get_list_keys_map_cb, weelist);
|
||||
return weelist;
|
||||
}
|
||||
|
||||
/*
|
||||
* hashtable_get_integer: get a hashtable property as integer
|
||||
*/
|
||||
|
@ -741,14 +800,15 @@ hashtable_build_string_keys_values_cb (void *data,
|
|||
* keys only: "key1,key2,key3"
|
||||
* values only: "value1,value2,value3"
|
||||
* keys + values: "key1:value1,key2:value2,key3:value3"
|
||||
* Note: this works only if keys have type "integer",
|
||||
* or "string"
|
||||
*/
|
||||
|
||||
const char *
|
||||
hashtable_get_keys_values (struct t_hashtable *hashtable, int keys, int values)
|
||||
hashtable_get_keys_values (struct t_hashtable *hashtable,
|
||||
int keys, int sort_keys, int values)
|
||||
{
|
||||
int length;
|
||||
struct t_weelist *list_keys;
|
||||
struct t_weelist_item *ptr_item;
|
||||
|
||||
if (hashtable->keys_values)
|
||||
{
|
||||
|
@ -771,11 +831,41 @@ hashtable_get_keys_values (struct t_hashtable *hashtable, int keys, int values)
|
|||
if (!hashtable->keys_values)
|
||||
return NULL;
|
||||
hashtable->keys_values[0] = '\0';
|
||||
hashtable_map (hashtable,
|
||||
(keys && values) ? &hashtable_build_string_keys_values_cb :
|
||||
((keys) ? &hashtable_build_string_keys_cb :
|
||||
&hashtable_build_string_values_cb),
|
||||
hashtable->keys_values);
|
||||
if (keys && sort_keys)
|
||||
{
|
||||
list_keys = hashtable_get_list_keys (hashtable);
|
||||
if (list_keys)
|
||||
{
|
||||
for (ptr_item = list_keys->items; ptr_item;
|
||||
ptr_item = ptr_item->next_item)
|
||||
{
|
||||
if (values)
|
||||
{
|
||||
hashtable_build_string_keys_values_cb (hashtable->keys_values,
|
||||
hashtable,
|
||||
ptr_item->data,
|
||||
hashtable_get (hashtable,
|
||||
ptr_item->data));
|
||||
}
|
||||
else
|
||||
{
|
||||
hashtable_build_string_keys_cb (hashtable->keys_values,
|
||||
hashtable,
|
||||
ptr_item->data,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
weelist_free (list_keys);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hashtable_map (hashtable,
|
||||
(keys && values) ? &hashtable_build_string_keys_values_cb :
|
||||
((keys) ? &hashtable_build_string_keys_cb :
|
||||
&hashtable_build_string_values_cb),
|
||||
hashtable->keys_values);
|
||||
}
|
||||
|
||||
return hashtable->keys_values;
|
||||
}
|
||||
|
@ -794,11 +884,15 @@ hashtable_get_string (struct t_hashtable *hashtable, const char *property)
|
|||
else if (string_strcasecmp (property, "type_values") == 0)
|
||||
return hashtable_type_string[hashtable->type_values];
|
||||
else if (string_strcasecmp (property, "keys") == 0)
|
||||
return hashtable_get_keys_values (hashtable, 1, 0);
|
||||
return hashtable_get_keys_values (hashtable, 1, 0, 0);
|
||||
else if (string_strcasecmp (property, "keys_sorted") == 0)
|
||||
return hashtable_get_keys_values (hashtable, 1, 1, 0);
|
||||
else if (string_strcasecmp (property, "values") == 0)
|
||||
return hashtable_get_keys_values (hashtable, 0, 1);
|
||||
return hashtable_get_keys_values (hashtable, 0, 0, 1);
|
||||
else if (string_strcasecmp (property, "keys_values") == 0)
|
||||
return hashtable_get_keys_values (hashtable, 1, 1);
|
||||
return hashtable_get_keys_values (hashtable, 1, 0, 1);
|
||||
else if (string_strcasecmp (property, "keys_values_sorted") == 0)
|
||||
return hashtable_get_keys_values (hashtable, 1, 1, 1);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#include "../gui/gui-buffer.h"
|
||||
#include "../gui/gui-color.h"
|
||||
#include "../gui/gui-completion.h"
|
||||
#include "../gui/gui-cursor.h"
|
||||
#include "../gui/gui-focus.h"
|
||||
#include "../gui/gui-line.h"
|
||||
#include "../gui/gui-window.h"
|
||||
#include "../plugins/plugin.h"
|
||||
|
@ -2809,64 +2809,56 @@ hook_focus_hashtable_map_cb (void *data, struct t_hashtable *hashtable,
|
|||
hashtable_set (hashtable1, (const char *)key, (const char *)value);
|
||||
}
|
||||
|
||||
/*
|
||||
* hook_focus_hashtable_map2_cb: add keys of a hashtable into another
|
||||
* (adding suffix "2" to keys)
|
||||
*/
|
||||
|
||||
void
|
||||
hook_focus_hashtable_map2_cb (void *data, struct t_hashtable *hashtable,
|
||||
const void *key, const void *value)
|
||||
{
|
||||
struct t_hashtable *hashtable1;
|
||||
int length;
|
||||
char *key2;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) hashtable;
|
||||
|
||||
hashtable1 = (struct t_hashtable *)data;
|
||||
|
||||
length = strlen ((const char *)key) + 1 + 1;
|
||||
key2 = malloc (length);
|
||||
if (key2)
|
||||
{
|
||||
snprintf (key2, length, "%s2", (const char *)key);
|
||||
if (hashtable1 && key && value)
|
||||
hashtable_set (hashtable1, key2, (const char *)value);
|
||||
free (key2);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* hook_focus_get_data: get data for focus on (x,y) on screen
|
||||
* focus_info2 is not NULL only for a mouse gesture (it's
|
||||
* for point where mouse button is released)
|
||||
*/
|
||||
|
||||
struct t_hashtable *
|
||||
hook_focus_get_data (struct t_gui_cursor_info *cursor_info)
|
||||
hook_focus_get_data (struct t_gui_focus_info *focus_info1,
|
||||
struct t_gui_focus_info *focus_info2,
|
||||
const char *key)
|
||||
{
|
||||
struct t_hook *ptr_hook, *next_hook;
|
||||
struct t_hashtable *hash_info, *hash_info2;
|
||||
char str_value[64];
|
||||
struct t_hashtable *hash_info1, *hash_info2, *hash_info_ret;
|
||||
const char *keys;
|
||||
char **list_keys, *new_key;
|
||||
int num_keys, i, length;
|
||||
|
||||
hook_exec_start ();
|
||||
|
||||
hash_info = hashtable_new (8,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
NULL,
|
||||
NULL);
|
||||
if (!hash_info)
|
||||
return NULL;
|
||||
|
||||
/* fill hash_info with values from cursor_info */
|
||||
snprintf (str_value, sizeof (str_value), "%d", cursor_info->x);
|
||||
hashtable_set (hash_info, "_x", str_value);
|
||||
snprintf (str_value, sizeof (str_value), "%d", cursor_info->y);
|
||||
hashtable_set (hash_info, "_y", str_value);
|
||||
snprintf (str_value, sizeof (str_value),
|
||||
"0x%lx", (long unsigned int)cursor_info->window);
|
||||
hashtable_set (hash_info, "_window", str_value);
|
||||
snprintf (str_value, sizeof (str_value),
|
||||
"0x%lx",
|
||||
(cursor_info->window) ?
|
||||
(long unsigned int)((cursor_info->window)->buffer) : 0);
|
||||
hashtable_set (hash_info, "_buffer", str_value);
|
||||
if (cursor_info->window)
|
||||
{
|
||||
snprintf (str_value, sizeof (str_value), "%d",
|
||||
(cursor_info->window)->number);
|
||||
hashtable_set (hash_info, "_window_number", str_value);
|
||||
snprintf (str_value, sizeof (str_value), "%d",
|
||||
((cursor_info->window)->buffer)->number);
|
||||
hashtable_set (hash_info, "_buffer_number", str_value);
|
||||
hashtable_set (hash_info, "_buffer_plugin",
|
||||
plugin_get_name (((cursor_info->window)->buffer)->plugin));
|
||||
hashtable_set (hash_info, "_buffer_name",
|
||||
((cursor_info->window)->buffer)->name);
|
||||
}
|
||||
hashtable_set (hash_info, "_bar_name",
|
||||
(cursor_info->bar_window) ?
|
||||
((cursor_info->bar_window)->bar)->name : NULL);
|
||||
hashtable_set (hash_info, "_bar_item_name",
|
||||
cursor_info->bar_item);
|
||||
snprintf (str_value, sizeof (str_value),
|
||||
"%d", cursor_info->item_line);
|
||||
hashtable_set (hash_info, "_item_line", str_value);
|
||||
snprintf (str_value, sizeof (str_value),
|
||||
"%d", cursor_info->item_col);
|
||||
hashtable_set (hash_info, "_item_col", str_value);
|
||||
hash_info1 = gui_focus_to_hashtable (focus_info1, key);
|
||||
hash_info2 = (focus_info2) ? gui_focus_to_hashtable (focus_info2, key) : NULL;
|
||||
|
||||
ptr_hook = weechat_hooks[HOOK_TYPE_FOCUS];
|
||||
while (ptr_hook)
|
||||
|
@ -2875,27 +2867,51 @@ hook_focus_get_data (struct t_gui_cursor_info *cursor_info)
|
|||
|
||||
if (!ptr_hook->deleted
|
||||
&& !ptr_hook->running
|
||||
&& ((cursor_info->chat
|
||||
&& ((focus_info1->chat
|
||||
&& (strcmp (HOOK_FOCUS(ptr_hook, area), "chat") == 0))
|
||||
|| (cursor_info->bar_item
|
||||
&& (strcmp (HOOK_FOCUS(ptr_hook, area), cursor_info->bar_item) == 0))))
|
||||
|| (focus_info1->bar_item
|
||||
&& (strcmp (HOOK_FOCUS(ptr_hook, area), focus_info1->bar_item) == 0))))
|
||||
{
|
||||
/* run callback for focus_info1 */
|
||||
ptr_hook->running = 1;
|
||||
hash_info2 = (HOOK_FOCUS(ptr_hook, callback))
|
||||
(ptr_hook->callback_data, hash_info);
|
||||
hash_info_ret = (HOOK_FOCUS(ptr_hook, callback))
|
||||
(ptr_hook->callback_data, hash_info1);
|
||||
ptr_hook->running = 0;
|
||||
|
||||
if (hash_info2)
|
||||
if (hash_info_ret)
|
||||
{
|
||||
if (hash_info2 != hash_info)
|
||||
if (hash_info_ret != hash_info1)
|
||||
{
|
||||
/*
|
||||
* add keys of hashtable2 into hashtable and destroy
|
||||
* hashtable2
|
||||
* add keys of hash_info_ret into hash_info and destroy
|
||||
* hash_info_ret
|
||||
*/
|
||||
hashtable_map (hash_info2, &hook_focus_hashtable_map_cb,
|
||||
hash_info);
|
||||
hashtable_free (hash_info2);
|
||||
hashtable_map (hash_info_ret,
|
||||
&hook_focus_hashtable_map_cb,
|
||||
hash_info1);
|
||||
hashtable_free (hash_info_ret);
|
||||
}
|
||||
}
|
||||
|
||||
/* run callback for focus_info2 */
|
||||
if (hash_info2)
|
||||
{
|
||||
ptr_hook->running = 1;
|
||||
hash_info_ret = (HOOK_FOCUS(ptr_hook, callback))
|
||||
(ptr_hook->callback_data, hash_info2);
|
||||
ptr_hook->running = 0;
|
||||
if (hash_info_ret)
|
||||
{
|
||||
if (hash_info_ret != hash_info2)
|
||||
{
|
||||
/*
|
||||
* add keys of hash_info_ret into hash_info and destroy
|
||||
* hash_info_ret
|
||||
*/
|
||||
hashtable_map (hash_info_ret,
|
||||
&hook_focus_hashtable_map_cb,
|
||||
hash_info2);
|
||||
hashtable_free (hash_info_ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2903,9 +2919,39 @@ hook_focus_get_data (struct t_gui_cursor_info *cursor_info)
|
|||
ptr_hook = next_hook;
|
||||
}
|
||||
|
||||
if (hash_info2)
|
||||
{
|
||||
hashtable_map (hash_info2, &hook_focus_hashtable_map2_cb, hash_info1);
|
||||
hashtable_free (hash_info2);
|
||||
}
|
||||
else
|
||||
{
|
||||
keys = hashtable_get_string (hash_info1, "keys");
|
||||
if (keys)
|
||||
{
|
||||
list_keys = string_split (keys, ",", 0, 0, &num_keys);
|
||||
if (list_keys)
|
||||
{
|
||||
for (i = 0; i < num_keys; i++)
|
||||
{
|
||||
length = strlen (list_keys[i]) + 1 + 1;
|
||||
new_key = malloc (length);
|
||||
if (new_key)
|
||||
{
|
||||
snprintf (new_key, length, "%s2", list_keys[i]);
|
||||
hashtable_set (hash_info1, new_key,
|
||||
hashtable_get (hash_info1, list_keys[i]));
|
||||
free (new_key);
|
||||
}
|
||||
}
|
||||
string_free_split (list_keys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hook_exec_end ();
|
||||
|
||||
return hash_info;
|
||||
return hash_info1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -28,7 +28,7 @@ struct t_gui_bar;
|
|||
struct t_gui_buffer;
|
||||
struct t_gui_line;
|
||||
struct t_gui_completion;
|
||||
struct t_gui_cursor_info;
|
||||
struct t_gui_focus_info;
|
||||
struct t_gui_window;
|
||||
struct t_weelist;
|
||||
struct t_hashtable;
|
||||
|
@ -541,7 +541,9 @@ extern struct t_hook *hook_focus (struct t_weechat_plugin *plugin,
|
|||
const char *area,
|
||||
t_hook_callback_focus *callback,
|
||||
void *callback_data);
|
||||
extern struct t_hashtable *hook_focus_get_data (struct t_gui_cursor_info *cursor_info);
|
||||
extern struct t_hashtable *hook_focus_get_data (struct t_gui_focus_info *focus_info1,
|
||||
struct t_gui_focus_info *focus_info2,
|
||||
const char *key);
|
||||
extern void unhook (struct t_hook *hook);
|
||||
extern void unhook_all_plugin (struct t_weechat_plugin *plugin);
|
||||
extern void unhook_all ();
|
||||
|
|
|
@ -24,9 +24,10 @@ gui-bar-window.c gui-bar-window.h
|
|||
gui-buffer.c gui-buffer.h
|
||||
gui-chat.c gui-chat.h
|
||||
gui-color.c gui-color.h
|
||||
gui-completion.c gui-completion.h
|
||||
gui-cursor.c gui-cursor.h
|
||||
gui-filter.c gui-filter.h
|
||||
gui-completion.c gui-completion.h
|
||||
gui-focus.c gui-focus.h
|
||||
gui-history.c gui-history.h
|
||||
gui-hotlist.c gui-hotlist.h
|
||||
gui-input.c gui-input.h
|
||||
|
|
|
@ -39,6 +39,8 @@ lib_weechat_gui_common_a_SOURCES = gui-bar.c \
|
|||
gui-completion.h \
|
||||
gui-filter.c \
|
||||
gui-filter.h \
|
||||
gui-focus.c \
|
||||
gui-focus.h \
|
||||
gui-history.c \
|
||||
gui-history.h \
|
||||
gui-hotlist.c \
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "../gui-buffer.h"
|
||||
#include "../gui-chat.h"
|
||||
#include "../gui-completion.h"
|
||||
#include "../gui-cursor.h"
|
||||
#include "../gui-focus.h"
|
||||
#include "../gui-input.h"
|
||||
#include "../gui-key.h"
|
||||
#include "../gui-mouse.h"
|
||||
|
@ -102,24 +102,24 @@ gui_mouse_grab_init (int area)
|
|||
char *
|
||||
gui_mouse_grab_event2input ()
|
||||
{
|
||||
struct t_gui_cursor_info cursor_info;
|
||||
struct t_gui_focus_info focus_info;
|
||||
static char area[256];
|
||||
|
||||
gui_cursor_get_info (gui_mouse_event_x[0],
|
||||
gui_mouse_event_y[0],
|
||||
&cursor_info);
|
||||
gui_focus_get_info (gui_mouse_event_x[0],
|
||||
gui_mouse_event_y[0],
|
||||
&focus_info);
|
||||
|
||||
if (cursor_info.bar_item)
|
||||
if (focus_info.bar_item)
|
||||
{
|
||||
snprintf (area, sizeof (area),
|
||||
"@item(%s)", cursor_info.bar_item);
|
||||
"@item(%s)", focus_info.bar_item);
|
||||
}
|
||||
else if (cursor_info.bar_window)
|
||||
else if (focus_info.bar_window)
|
||||
{
|
||||
snprintf (area, sizeof (area),
|
||||
"@bar(%s)", ((cursor_info.bar_window)->bar)->name);
|
||||
"@bar(%s)", ((focus_info.bar_window)->bar)->name);
|
||||
}
|
||||
else if (cursor_info.chat)
|
||||
else if (focus_info.chat)
|
||||
{
|
||||
snprintf (area, sizeof (area), "@chat");
|
||||
}
|
||||
|
@ -267,12 +267,16 @@ gui_mouse_event_code2key (const char *code, char **extra_chars)
|
|||
|
||||
if (code[0] == '`')
|
||||
{
|
||||
gui_mouse_event_x[1] = gui_mouse_event_x[0];
|
||||
gui_mouse_event_y[1] = gui_mouse_event_y[0];
|
||||
strcat (key, "wheelup");
|
||||
return key;
|
||||
}
|
||||
|
||||
if (code[0] == 'a')
|
||||
{
|
||||
gui_mouse_event_x[1] = gui_mouse_event_x[0];
|
||||
gui_mouse_event_y[1] = gui_mouse_event_y[0];
|
||||
strcat (key, "wheeldown");
|
||||
return key;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../core/weechat.h"
|
||||
|
@ -35,6 +36,7 @@
|
|||
#include "gui-buffer.h"
|
||||
#include "gui-chat.h"
|
||||
#include "gui-color.h"
|
||||
#include "gui-focus.h"
|
||||
#include "gui-input.h"
|
||||
#include "gui-window.h"
|
||||
|
||||
|
@ -87,39 +89,6 @@ gui_cursor_debug_toggle ()
|
|||
gui_chat_printf (NULL, _("Debug disabled for cursor mode"));
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_cursor_get_info: get info about what is pointed by cursor at (x,y)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_cursor_get_info (int x, int y, struct t_gui_cursor_info *cursor_info)
|
||||
{
|
||||
cursor_info->x = x;
|
||||
cursor_info->y = y;
|
||||
|
||||
/* search window */
|
||||
cursor_info->window = gui_window_search_by_xy (x, y);
|
||||
|
||||
/* chat area in this window? */
|
||||
if (cursor_info->window
|
||||
&& (x >= (cursor_info->window)->win_chat_x)
|
||||
&& (y >= (cursor_info->window)->win_chat_y)
|
||||
&& (x <= (cursor_info->window)->win_chat_x + (cursor_info->window)->win_chat_width - 1)
|
||||
&& (y <= (cursor_info->window)->win_chat_y + (cursor_info->window)->win_chat_height - 1))
|
||||
{
|
||||
cursor_info->chat = 1;
|
||||
}
|
||||
else
|
||||
cursor_info->chat = 0;
|
||||
|
||||
/* search bar window, item, and line/col in item */
|
||||
gui_bar_window_search_by_xy (cursor_info->window, x, y,
|
||||
&cursor_info->bar_window,
|
||||
&cursor_info->bar_item,
|
||||
&cursor_info->item_line,
|
||||
&cursor_info->item_col);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_cursor_display_debug_info: display debug info about (x,y) in input
|
||||
*/
|
||||
|
@ -127,27 +96,27 @@ gui_cursor_get_info (int x, int y, struct t_gui_cursor_info *cursor_info)
|
|||
void
|
||||
gui_cursor_display_debug_info ()
|
||||
{
|
||||
struct t_gui_cursor_info cursor_info;
|
||||
struct t_gui_focus_info focus_info;
|
||||
char str_info[1024];
|
||||
|
||||
if (!gui_cursor_debug)
|
||||
return;
|
||||
|
||||
gui_cursor_get_info (gui_cursor_x, gui_cursor_y, &cursor_info);
|
||||
gui_focus_get_info (gui_cursor_x, gui_cursor_y, &focus_info);
|
||||
|
||||
snprintf (str_info, sizeof (str_info),
|
||||
"%s(%d,%d) window:0x%lx (buffer: %s), chat: %d, "
|
||||
"bar_window:0x%lx (bar: %s, item: %s, line: %d, col: %d)",
|
||||
gui_color_get_custom ("yellow,red"),
|
||||
cursor_info.x, cursor_info.y,
|
||||
(long unsigned int)cursor_info.window,
|
||||
(cursor_info.window) ? (cursor_info.window)->buffer->name : "-",
|
||||
cursor_info.chat,
|
||||
(long unsigned int)cursor_info.bar_window,
|
||||
(cursor_info.bar_window) ? (cursor_info.bar_window)->bar->name : "-",
|
||||
(cursor_info.bar_item) ? cursor_info.bar_item : "-",
|
||||
cursor_info.item_line,
|
||||
cursor_info.item_col);
|
||||
focus_info.x, focus_info.y,
|
||||
(long unsigned int)focus_info.window,
|
||||
(focus_info.window) ? (focus_info.window)->buffer->name : "-",
|
||||
focus_info.chat,
|
||||
(long unsigned int)focus_info.bar_window,
|
||||
(focus_info.bar_window) ? (focus_info.bar_window)->bar->name : "-",
|
||||
(focus_info.bar_item) ? focus_info.bar_item : "-",
|
||||
focus_info.item_line,
|
||||
focus_info.item_col);
|
||||
gui_input_delete_line (gui_current_window->buffer);
|
||||
gui_input_insert_string (gui_current_window->buffer, str_info, -1);
|
||||
}
|
||||
|
@ -215,7 +184,7 @@ void
|
|||
gui_cursor_move_area_add_xy (int add_x, int add_y)
|
||||
{
|
||||
int x, y, width, height, area_found;
|
||||
struct t_gui_cursor_info cursor_info_old, cursor_info_new;
|
||||
struct t_gui_focus_info focus_info_old, focus_info_new;
|
||||
|
||||
if (!gui_cursor_mode)
|
||||
gui_cursor_mode_toggle ();
|
||||
|
@ -227,7 +196,7 @@ gui_cursor_move_area_add_xy (int add_x, int add_y)
|
|||
width = gui_window_get_width ();
|
||||
height = gui_window_get_height ();
|
||||
|
||||
gui_cursor_get_info (x, y, &cursor_info_old);
|
||||
gui_focus_get_info (x, y, &focus_info_old);
|
||||
|
||||
if (add_x != 0)
|
||||
x += add_x;
|
||||
|
@ -236,11 +205,11 @@ gui_cursor_move_area_add_xy (int add_x, int add_y)
|
|||
|
||||
while ((x >= 0) && (x < width) && (y >= 0) && (y < height))
|
||||
{
|
||||
gui_cursor_get_info (x, y, &cursor_info_new);
|
||||
if (((cursor_info_new.window && cursor_info_new.chat)
|
||||
|| cursor_info_new.bar_window)
|
||||
&& ((cursor_info_old.window != cursor_info_new.window)
|
||||
|| (cursor_info_old.bar_window != cursor_info_new.bar_window)))
|
||||
gui_focus_get_info (x, y, &focus_info_new);
|
||||
if (((focus_info_new.window && focus_info_new.chat)
|
||||
|| focus_info_new.bar_window)
|
||||
&& ((focus_info_old.window != focus_info_new.window)
|
||||
|| (focus_info_old.bar_window != focus_info_new.bar_window)))
|
||||
{
|
||||
area_found = 1;
|
||||
break;
|
||||
|
@ -254,15 +223,15 @@ gui_cursor_move_area_add_xy (int add_x, int add_y)
|
|||
|
||||
if (area_found)
|
||||
{
|
||||
if (cursor_info_new.window && cursor_info_new.chat)
|
||||
if (focus_info_new.window && focus_info_new.chat)
|
||||
{
|
||||
x = (cursor_info_new.window)->win_chat_x;
|
||||
y = (cursor_info_new.window)->win_chat_y;
|
||||
x = (focus_info_new.window)->win_chat_x;
|
||||
y = (focus_info_new.window)->win_chat_y;
|
||||
}
|
||||
else if (cursor_info_new.bar_window)
|
||||
else if (focus_info_new.bar_window)
|
||||
{
|
||||
x = (cursor_info_new.bar_window)->x;
|
||||
y = (cursor_info_new.bar_window)->y;
|
||||
x = (focus_info_new.bar_window)->x;
|
||||
y = (focus_info_new.bar_window)->y;
|
||||
}
|
||||
else
|
||||
area_found = 0;
|
||||
|
|
|
@ -20,19 +20,6 @@
|
|||
#ifndef __WEECHAT_GUI_CURSOR_H
|
||||
#define __WEECHAT_GUI_CURSOR_H 1
|
||||
|
||||
/* cursor structures */
|
||||
|
||||
struct t_gui_cursor_info
|
||||
{
|
||||
int x, y; /* (x,y) on screen */
|
||||
struct t_gui_window *window; /* window found */
|
||||
int chat; /* 1 for chat area, otherwise 0 */
|
||||
struct t_gui_bar_window *bar_window; /* bar window found */
|
||||
char *bar_item; /* bar item found */
|
||||
int item_line; /* line in bar item */
|
||||
int item_col; /* column in bar item */
|
||||
};
|
||||
|
||||
/* cursor variables */
|
||||
|
||||
extern int gui_cursor_mode;
|
||||
|
@ -44,8 +31,6 @@ extern int gui_cursor_y;
|
|||
|
||||
extern void gui_cursor_mode_toggle ();
|
||||
extern void gui_cursor_debug_toggle ();
|
||||
extern void gui_cursor_get_info (int x, int y,
|
||||
struct t_gui_cursor_info *cursor_info);
|
||||
extern void gui_cursor_move_xy (int x, int y);
|
||||
extern void gui_cursor_move_add_xy (int add_x, int add_y);
|
||||
extern void gui_cursor_move_area_add_xy (int add_x, int add_y);
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Sebastien Helleu <flashcode@flashtux.org>
|
||||
*
|
||||
* This file is part of WeeChat, the extensible chat client.
|
||||
*
|
||||
* WeeChat is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* WeeChat is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* gui-focus.c: functions about focus (for cursor mode and mouse) (used by all GUI)
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../core/weechat.h"
|
||||
#include "../core/wee-hashtable.h"
|
||||
#include "../plugins/plugin.h"
|
||||
#include "gui-bar.h"
|
||||
#include "gui-bar-window.h"
|
||||
#include "gui-buffer.h"
|
||||
#include "gui-focus.h"
|
||||
#include "gui-window.h"
|
||||
|
||||
|
||||
/*
|
||||
* gui_focus_get_info: get info about what is pointed by cursor at (x,y)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_focus_get_info (int x, int y, struct t_gui_focus_info *focus_info)
|
||||
{
|
||||
focus_info->x = x;
|
||||
focus_info->y = y;
|
||||
|
||||
/* search window */
|
||||
focus_info->window = gui_window_search_by_xy (x, y);
|
||||
|
||||
/* chat area in this window? */
|
||||
if (focus_info->window
|
||||
&& (x >= (focus_info->window)->win_chat_x)
|
||||
&& (y >= (focus_info->window)->win_chat_y)
|
||||
&& (x <= (focus_info->window)->win_chat_x + (focus_info->window)->win_chat_width - 1)
|
||||
&& (y <= (focus_info->window)->win_chat_y + (focus_info->window)->win_chat_height - 1))
|
||||
{
|
||||
focus_info->chat = 1;
|
||||
}
|
||||
else
|
||||
focus_info->chat = 0;
|
||||
|
||||
/* search bar window, item, and line/col in item */
|
||||
gui_bar_window_search_by_xy (focus_info->window,
|
||||
x, y,
|
||||
&focus_info->bar_window,
|
||||
&focus_info->bar_item,
|
||||
&focus_info->item_line,
|
||||
&focus_info->item_col);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_focus_to_hashtable: add two focus info into hashtable
|
||||
*/
|
||||
|
||||
struct t_hashtable *
|
||||
gui_focus_to_hashtable (struct t_gui_focus_info *focus_info, const char *key)
|
||||
{
|
||||
struct t_hashtable *hashtable;
|
||||
char str_value[128];
|
||||
|
||||
hashtable = hashtable_new (32,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
NULL,
|
||||
NULL);
|
||||
if (!hashtable)
|
||||
return NULL;
|
||||
|
||||
/* key (key from keyboard or mouse event) */
|
||||
hashtable_set (hashtable, "_key", key);
|
||||
|
||||
/* x,y */
|
||||
snprintf (str_value, sizeof (str_value), "%d", focus_info->x);
|
||||
hashtable_set (hashtable, "_x", str_value);
|
||||
snprintf (str_value, sizeof (str_value), "%d", focus_info->y);
|
||||
hashtable_set (hashtable, "_y", str_value);
|
||||
|
||||
/* window/buffer */
|
||||
snprintf (str_value, sizeof (str_value),
|
||||
"0x%lx", (long unsigned int)focus_info->window);
|
||||
hashtable_set (hashtable, "_window", str_value);
|
||||
snprintf (str_value, sizeof (str_value),
|
||||
"0x%lx",
|
||||
(focus_info->window) ?
|
||||
(long unsigned int)((focus_info->window)->buffer) : 0);
|
||||
hashtable_set (hashtable, "_buffer", str_value);
|
||||
if (focus_info->window)
|
||||
{
|
||||
snprintf (str_value, sizeof (str_value), "%d",
|
||||
(focus_info->window)->number);
|
||||
hashtable_set (hashtable, "_window_number", str_value);
|
||||
snprintf (str_value, sizeof (str_value), "%d",
|
||||
((focus_info->window)->buffer)->number);
|
||||
hashtable_set (hashtable, "_buffer_number", str_value);
|
||||
hashtable_set (hashtable, "_buffer_plugin",
|
||||
plugin_get_name (((focus_info->window)->buffer)->plugin));
|
||||
hashtable_set (hashtable, "_buffer_name",
|
||||
((focus_info->window)->buffer)->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
hashtable_set (hashtable, "_window_number", "*");
|
||||
hashtable_set (hashtable, "_buffer_number", "");
|
||||
hashtable_set (hashtable, "_buffer_plugin", "");
|
||||
hashtable_set (hashtable, "_buffer_name", "");
|
||||
}
|
||||
hashtable_set (hashtable, "_chat", (focus_info->chat) ? "1" : "0");
|
||||
|
||||
/* bar/item */
|
||||
hashtable_set (hashtable, "_bar_name",
|
||||
(focus_info->bar_window) ?
|
||||
((focus_info->bar_window)->bar)->name : "");
|
||||
hashtable_set (hashtable, "_bar_filling",
|
||||
(focus_info->bar_window) ?
|
||||
gui_bar_filling_string[gui_bar_get_filling ((focus_info->bar_window)->bar)] : "");
|
||||
hashtable_set (hashtable, "_bar_item_name",
|
||||
(focus_info->bar_item) ? focus_info->bar_item : "");
|
||||
snprintf (str_value, sizeof (str_value), "%d", focus_info->item_line);
|
||||
hashtable_set (hashtable, "_item_line", str_value);
|
||||
snprintf (str_value, sizeof (str_value), "%d", focus_info->item_col);
|
||||
hashtable_set (hashtable, "_item_col", str_value);
|
||||
|
||||
return hashtable;
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Sebastien Helleu <flashcode@flashtux.org>
|
||||
*
|
||||
* This file is part of WeeChat, the extensible chat client.
|
||||
*
|
||||
* WeeChat is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* WeeChat is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __WEECHAT_GUI_FOCUS_H
|
||||
#define __WEECHAT_GUI_FOCUS 1
|
||||
|
||||
/* focus structures */
|
||||
|
||||
struct t_gui_focus_info
|
||||
{
|
||||
int x, y; /* (x,y) on screen */
|
||||
struct t_gui_window *window; /* window found */
|
||||
int chat; /* 1 for chat area, otherwise 0 */
|
||||
struct t_gui_bar_window *bar_window; /* bar window found */
|
||||
char *bar_item; /* bar item found */
|
||||
int item_line; /* line in bar item */
|
||||
int item_col; /* column in bar item */
|
||||
};
|
||||
|
||||
/* focus functions */
|
||||
|
||||
extern void gui_focus_get_info (int x, int y,
|
||||
struct t_gui_focus_info *focus_info);
|
||||
extern struct t_hashtable *gui_focus_to_hashtable (struct t_gui_focus_info *focus_info,
|
||||
const char *key);
|
||||
|
||||
#endif /* __WEECHAT_GUI_FOCUS_H */
|
|
@ -49,6 +49,7 @@
|
|||
#include "gui-color.h"
|
||||
#include "gui-completion.h"
|
||||
#include "gui-cursor.h"
|
||||
#include "gui-focus.h"
|
||||
#include "gui-input.h"
|
||||
#include "gui-mouse.h"
|
||||
#include "gui-window.h"
|
||||
|
@ -502,7 +503,7 @@ gui_key_cmp (const char *key, const char *search, int context)
|
|||
int diff;
|
||||
|
||||
if (context == GUI_KEY_CONTEXT_MOUSE)
|
||||
return strcmp (key, search);
|
||||
return (string_match (key, search, 1)) ? 0 : 1;
|
||||
|
||||
while (search[0])
|
||||
{
|
||||
|
@ -621,7 +622,7 @@ gui_key_unbind (struct t_gui_buffer *buffer, int context, const char *key,
|
|||
|
||||
int
|
||||
gui_key_focus_matching (const char *key,
|
||||
struct t_gui_cursor_info *cursor_info)
|
||||
struct t_gui_focus_info *focus_info)
|
||||
{
|
||||
int match, area_chat;
|
||||
char *area_bar, *area_item, *pos;
|
||||
|
@ -649,19 +650,19 @@ gui_key_focus_matching (const char *key,
|
|||
}
|
||||
if (area_chat || area_bar || area_item)
|
||||
{
|
||||
if (area_chat && cursor_info->chat)
|
||||
if (area_chat && focus_info->chat)
|
||||
{
|
||||
match = 1;
|
||||
}
|
||||
else if (area_bar && cursor_info->bar_window
|
||||
else if (area_bar && focus_info->bar_window
|
||||
&& ((strcmp (area_bar, "*") == 0)
|
||||
|| (strcmp (area_bar, (cursor_info->bar_window)->bar->name) == 0)))
|
||||
|| (strcmp (area_bar, (focus_info->bar_window)->bar->name) == 0)))
|
||||
{
|
||||
match = 1;
|
||||
}
|
||||
else if (area_item && cursor_info->bar_item
|
||||
else if (area_item && focus_info->bar_item
|
||||
&& ((strcmp (area_item, "*") == 0)
|
||||
|| (strcmp (area_item, cursor_info->bar_item) == 0)))
|
||||
|| (strcmp (area_item, focus_info->bar_item) == 0)))
|
||||
{
|
||||
match = 1;
|
||||
}
|
||||
|
@ -684,7 +685,8 @@ gui_key_focus_matching (const char *key,
|
|||
int
|
||||
gui_key_focus_command (const char *key, int context,
|
||||
int focus_specific, int focus_any,
|
||||
struct t_gui_cursor_info *cursor_info)
|
||||
struct t_gui_focus_info *focus_info1,
|
||||
struct t_gui_focus_info *focus_info2)
|
||||
{
|
||||
struct t_gui_key *ptr_key;
|
||||
int i, errors;
|
||||
|
@ -706,16 +708,18 @@ gui_key_focus_command (const char *key, int context,
|
|||
continue;
|
||||
|
||||
pos++;
|
||||
if (gui_key_cmp (pos, key, context) == 0)
|
||||
if (gui_key_cmp (key, pos, context) == 0)
|
||||
{
|
||||
if (gui_key_focus_matching (ptr_key->key, cursor_info))
|
||||
if (gui_key_focus_matching (ptr_key->key, focus_info1))
|
||||
{
|
||||
hashtable = hook_focus_get_data (cursor_info);
|
||||
if (gui_mouse_debug)
|
||||
hashtable = hook_focus_get_data (focus_info1,
|
||||
focus_info2,
|
||||
key);
|
||||
if (gui_cursor_debug || gui_mouse_debug)
|
||||
{
|
||||
gui_chat_printf (NULL, "Hashtable focus: %s",
|
||||
hashtable_get_string (hashtable,
|
||||
"keys_values"));
|
||||
"keys_values_sorted"));
|
||||
}
|
||||
command = string_replace_with_hashtable (ptr_key->command,
|
||||
hashtable,
|
||||
|
@ -724,6 +728,13 @@ gui_key_focus_command (const char *key, int context,
|
|||
{
|
||||
if (errors == 0)
|
||||
{
|
||||
if (gui_cursor_debug || gui_mouse_debug)
|
||||
{
|
||||
gui_chat_printf (NULL,
|
||||
"Command executed: %s (%s)",
|
||||
command,
|
||||
ptr_key->command);
|
||||
}
|
||||
if ((context == GUI_KEY_CONTEXT_CURSOR)
|
||||
&& gui_cursor_debug)
|
||||
{
|
||||
|
@ -740,6 +751,15 @@ gui_key_focus_command (const char *key, int context,
|
|||
string_free_split_command (commands);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gui_cursor_debug || gui_mouse_debug)
|
||||
{
|
||||
gui_chat_printf (NULL,
|
||||
"Command NOT executed (%s)",
|
||||
ptr_key->command);
|
||||
}
|
||||
}
|
||||
free (command);
|
||||
}
|
||||
if (hashtable)
|
||||
|
@ -763,12 +783,12 @@ gui_key_focus_command (const char *key, int context,
|
|||
int
|
||||
gui_key_focus (const char *key, int context)
|
||||
{
|
||||
struct t_gui_cursor_info cursor_info;
|
||||
struct t_gui_focus_info focus_info1, focus_info2, *ptr_focus_info2;
|
||||
|
||||
ptr_focus_info2 = NULL;
|
||||
|
||||
if (context == GUI_KEY_CONTEXT_MOUSE)
|
||||
{
|
||||
gui_cursor_get_info (gui_mouse_event_x[0], gui_mouse_event_y[0],
|
||||
&cursor_info);
|
||||
if (gui_mouse_debug)
|
||||
{
|
||||
gui_chat_printf (NULL, "Mouse: %s, (%d,%d) -> (%d,%d)",
|
||||
|
@ -776,16 +796,29 @@ gui_key_focus (const char *key, int context)
|
|||
gui_mouse_event_x[0], gui_mouse_event_y[0],
|
||||
gui_mouse_event_x[1], gui_mouse_event_y[1]);
|
||||
}
|
||||
gui_focus_get_info (gui_mouse_event_x[0], gui_mouse_event_y[0],
|
||||
&focus_info1);
|
||||
if ((gui_mouse_event_x[0] != gui_mouse_event_x[1])
|
||||
|| (gui_mouse_event_y[0] != gui_mouse_event_y[1]))
|
||||
{
|
||||
gui_focus_get_info (gui_mouse_event_x[1], gui_mouse_event_y[1],
|
||||
&focus_info2);
|
||||
ptr_focus_info2 = &focus_info2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_cursor_get_info (gui_cursor_x, gui_cursor_y, &cursor_info);
|
||||
gui_focus_get_info (gui_cursor_x, gui_cursor_y, &focus_info1);
|
||||
}
|
||||
|
||||
if (gui_key_focus_command (key, context, 1, 0, &cursor_info))
|
||||
if (gui_key_focus_command (key, context, 1, 0,
|
||||
&focus_info1, ptr_focus_info2))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return gui_key_focus_command (key, context, 0, 1, &cursor_info);
|
||||
return gui_key_focus_command (key, context, 0, 1, &focus_info1,
|
||||
ptr_focus_info2);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1047,7 +1047,8 @@ plugin_api_init ()
|
|||
&plugin_api_infolist_get_internal, NULL);
|
||||
hook_infolist (NULL, "key", N_("list of key bindings"),
|
||||
NULL,
|
||||
N_("context (\"default\" or \"search\") (optional)"),
|
||||
N_("context (\"default\", \"search\", \"cursor\" or "
|
||||
"\"mouse\") (optional)"),
|
||||
&plugin_api_infolist_get_internal, NULL);
|
||||
hook_infolist (NULL, "nicklist", N_("nicks in nicklist for a buffer"),
|
||||
N_("buffer pointer"),
|
||||
|
|
Loading…
Reference in New Issue