mirror of
https://github.com/moparisthebest/FireTray
synced 2024-11-10 19:15:08 -05:00
handle scroll-event on icon
This commit is contained in:
parent
2ee8fc1a91
commit
f6549e4211
@ -20,6 +20,7 @@ var firetrayUIOptions = {
|
||||
this.strings = document.getElementById("firetray-options-strings");
|
||||
|
||||
this.updateWindowAndIconOptions();
|
||||
this.updateScrollOptions();
|
||||
|
||||
if(firetray.Handler.inMailApp) {
|
||||
Cu.import("resource://firetray/FiretrayMessaging.jsm");
|
||||
@ -70,6 +71,11 @@ var firetrayUIOptions = {
|
||||
!(hides_on_close || hides_on_minimize);
|
||||
},
|
||||
|
||||
updateScrollOptions: function() {
|
||||
let scroll_to_hide = document.getElementById("ui_scroll_to_hide").checked;
|
||||
this.disableGroup(document.getElementById("ui_radiogroup_scroll"), !scroll_to_hide);
|
||||
},
|
||||
|
||||
initMailControls: function() {
|
||||
this.populateExcludedFoldersList();
|
||||
this.populateTreeAccountsOrServerTypes();
|
||||
|
@ -24,6 +24,8 @@
|
||||
<preference id="pref_bool_hides_single_window" name="extensions.firetray.hides_single_window" type="bool"/>
|
||||
<preference id="pref_bool_start_hidden" name="extensions.firetray.start_hidden" type="bool"/>
|
||||
<preference id="pref_bool_show_icon_on_hide" name="extensions.firetray.show_icon_on_hide" type="bool"/>
|
||||
<preference id="pref_bool_scroll_to_hide" name="extensions.firetray.scroll_to_hide" type="bool" />
|
||||
<preference id="pref_string_scroll_mode" name="extensions.firetray.scroll_mode" type="string" />
|
||||
<preference id="pref_string_icon_text_color" name="extensions.firetray.icon_text_color" type="string" />
|
||||
<preference id="pref_string_custom_mail_icon" name="extensions.firetray.custom_mail_icon" type="string" />
|
||||
<preference id="pref_string_mail_accounts" name="extensions.firetray.mail_accounts" type="string"/>
|
||||
@ -32,7 +34,6 @@
|
||||
<tabbox>
|
||||
<tabs>
|
||||
<tab label="&general_options;"/>
|
||||
<tab label="&input_options;" disabled="true" tooltiptext="&NOT_IMPLEMENTED_YET;"/>
|
||||
<tab label="&mail_options;" id="mail_tab" />
|
||||
</tabs>
|
||||
<tabpanels flex="1">
|
||||
@ -64,13 +65,19 @@
|
||||
<checkbox id="ui_show_icon_on_hide" preference="pref_bool_show_icon_on_hide"
|
||||
label="&bool_show_icon_on_hide.label;"
|
||||
accesskey="&bool_show_icon_on_hide.accesskey;"/>
|
||||
<checkbox id="ui_scroll_to_hide" preference="pref_bool_scroll_to_hide"
|
||||
label="&enable_mouse_scroll.label;"
|
||||
accesskey="&enable_mouse_scroll.accesskey;"
|
||||
oncommand="firetrayUIOptions.updateScrollOptions()" />
|
||||
<radiogroup id="ui_radiogroup_scroll" preference="pref_string_scroll_mode">
|
||||
<radio id="ui_radio_scroll_down_hides" label="&down;=&hide;, &up;=&restore;" value="down_hides" />
|
||||
<radio id="ui_radio_scroll_up_hides" label="&up;=&hide;, &down;=&restore;" value="up_hides" />
|
||||
</radiogroup>
|
||||
</groupbox>
|
||||
|
||||
</vbox>
|
||||
</tabpanel>
|
||||
|
||||
<tabpanel id="input_tabpanel" flex="1" />
|
||||
|
||||
<tabpanel id="mail_tabpanel" flex="1">
|
||||
<vbox align="left" flex="1">
|
||||
|
||||
|
@ -10,17 +10,24 @@
|
||||
<!ENTITY windows_behaviour "Windows behaviour">
|
||||
<!ENTITY bool_hides_on_close.label "Closing window hides to tray">
|
||||
<!ENTITY bool_hides_on_close.accesskey "C">
|
||||
<!ENTITY bool_hides_single_window.tooltip "not all windows at once">
|
||||
<!ENTITY bool_hides_on_minimize.label "Minimizing window hides to tray">
|
||||
<!ENTITY bool_hides_on_minimize.accesskey "M">
|
||||
<!ENTITY bool_hides_single_window.label "Hide the current window only">
|
||||
<!ENTITY bool_hides_single_window.label "Hide windows individually">
|
||||
<!ENTITY bool_hides_single_window.tooltip "not all windows at once">
|
||||
<!ENTITY bool_hides_single_window.accesskey "H">
|
||||
<!ENTITY bool_start_hidden.label "Start application hidden to tray">
|
||||
<!ENTITY bool_start_hidden.accesskey "S">
|
||||
|
||||
<!ENTITY icon_settings "Icon settings">
|
||||
<!ENTITY bool_show_icon_on_hide.label "Show only if at least a window is hidden">
|
||||
<!ENTITY bool_show_icon_on_hide.label "Show tray icon only if a window is hidden">
|
||||
<!ENTITY bool_show_icon_on_hide.accesskey "w">
|
||||
<!ENTITY mouse_wheel_options "Mouse wheel options" >
|
||||
<!ENTITY enable_mouse_scroll.label "Handle mouse scroll on tray icon" >
|
||||
<!ENTITY enable_mouse_scroll.accesskey "l">
|
||||
<!ENTITY up "↑" >
|
||||
<!ENTITY down "↓" >
|
||||
<!ENTITY hide "hide" >
|
||||
<!ENTITY restore "restore" >
|
||||
|
||||
<!ENTITY mail_notification.label "Mail notification">
|
||||
<!ENTITY mail_notification_disabled.label "disabled">
|
||||
|
@ -11,6 +11,8 @@ pref("extensions.firetray.hides_on_minimize", true);
|
||||
pref("extensions.firetray.hides_single_window", false);
|
||||
pref("extensions.firetray.start_hidden", false);
|
||||
pref("extensions.firetray.show_icon_on_hide", false);
|
||||
pref("extensions.firetray.scroll_to_hide", true);
|
||||
pref("extensions.firetray.scroll_mode", "down_hides");
|
||||
|
||||
pref("extensions.firetray.mail_notification", 1);
|
||||
pref("extensions.firetray.icon_text_color", "#000000");
|
||||
|
@ -112,6 +112,11 @@ function gdk_defines(lib) {
|
||||
this.GDK_PROP_MODE_REPLACE = 0;
|
||||
this.GDK_PROP_MODE_PREPEN = 1;
|
||||
this.GDK_PROP_MODE_APPEND = 2;
|
||||
this.GdkScrollDirection = ctypes.int; // enum
|
||||
this.GDK_SCROLL_UP = 0;
|
||||
this.GDK_SCROLL_DOWN = 1;
|
||||
this.GDK_SCROLL_LEFT = 2;
|
||||
this.GDK_SCROLL_RIGHT = 3;
|
||||
|
||||
this.GdkWindow = ctypes.StructType("GdkWindow");
|
||||
this.GdkByteOrder = ctypes.int; // enum
|
||||
@ -180,6 +185,19 @@ function gdk_defines(lib) {
|
||||
{ "changed_mask": this.GdkWindowState },
|
||||
{ "new_window_state": this.GdkWindowState },
|
||||
]);
|
||||
this.GdkDevice = ctypes.StructType("GdkDevice");
|
||||
this.GdkEventScroll = ctypes.StructType("GdkEventScroll", [
|
||||
{ "type": this.GdkEventType },
|
||||
{ "window": this.GdkWindow.ptr },
|
||||
{ "send_event": gobject.gint8 },
|
||||
{ "time": gobject.guint32 },
|
||||
{ "x": gobject.gdouble },
|
||||
{ "y": gobject.gdouble },
|
||||
{ "state": gobject.guint },
|
||||
{ "direction": this.GdkScrollDirection },
|
||||
{ "device": this.GdkDevice.ptr },
|
||||
{ "x_root": gobject.gdouble }, { "y_root": gobject.gdouble }
|
||||
]);
|
||||
this.GdkAtom = ctypes.StructType("GdkAtom");
|
||||
|
||||
this.GdkFilterFunc_t = ctypes.FunctionType(
|
||||
|
@ -93,6 +93,7 @@ function gobject_defines(lib) {
|
||||
this.guchar = ctypes.unsigned_char;
|
||||
this.gboolean = this.gint;
|
||||
this.gfloat = ctypes.float;
|
||||
this.gdouble = ctypes.double;
|
||||
this.gsize = ctypes.unsigned_long;
|
||||
this.GCallback = ctypes.voidptr_t;
|
||||
this.GClosureNotify = this.gpointer;
|
||||
|
@ -149,8 +149,29 @@ firetray.StatusIcon = {
|
||||
},
|
||||
|
||||
onScroll: function(icon, event, data) {
|
||||
LOG("scroll-event");
|
||||
// TODO:
|
||||
let iconGpointer = ctypes.cast(icon, gobject.gpointer);
|
||||
let gdkEventScroll = ctypes.cast(event, gdk.GdkEventScroll.ptr);
|
||||
let scroll_mode = firetray.Utils.prefService.getCharPref("scroll_mode");
|
||||
|
||||
let direction = gdkEventScroll.contents.direction;
|
||||
switch(direction) {
|
||||
case gdk.GDK_SCROLL_UP:
|
||||
LOG("SCROLL UP");
|
||||
if (scroll_mode === "down_hides")
|
||||
firetray.Handler.showAllWindows();
|
||||
else if (scroll_mode === "up_hides")
|
||||
firetray.Handler.hideAllWindows();
|
||||
break;
|
||||
case gdk.GDK_SCROLL_DOWN:
|
||||
LOG("SCROLL DOWN");
|
||||
if (scroll_mode === "down_hides")
|
||||
firetray.Handler.hideAllWindows();
|
||||
else if (scroll_mode === "up_hides")
|
||||
firetray.Handler.showAllWindows();
|
||||
break;
|
||||
default:
|
||||
ERROR("SCROLL UNKNOWN");
|
||||
}
|
||||
}
|
||||
|
||||
}; // firetray.StatusIcon
|
||||
|
Loading…
Reference in New Issue
Block a user