Added mouse_left configuration, defaults to original function (Issue 459, 397)

git-svn-id: http://tint2.googlecode.com/svn/trunk@676 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
google@craigoakes.com 2015-01-30 21:13:04 +00:00
parent 28d726626d
commit 0fa10d83b9
25 changed files with 114 additions and 58 deletions

View file

@ -99,6 +99,7 @@ tooltip_font = sans 10
tooltip_font_color = #000000 80
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
@ -115,4 +116,4 @@ battery_font_color = #FFFFFF 75
battery_padding = 1 0
battery_background_id = 0
# End of config
# End of config

View file

@ -98,6 +98,7 @@ tooltip_font = Sans 10
tooltip_font_color = #000000 80
# Mouse
mouse_left = toggle_iconify
mouse_middle = close
mouse_right = none
mouse_scroll_up = toggle
@ -114,4 +115,4 @@ battery_font_color = #FFFFFF 75
battery_padding = 1 0
battery_background_id = 0
# End of config
# End of config

View file

@ -104,6 +104,7 @@ tooltip_font = Sans 9
tooltip_font_color = #5E5E5E 100
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
@ -120,4 +121,4 @@ battery_font_color = #000000 100
battery_padding = 1 1
battery_background_id = 0
# End of config
# End of config

View file

@ -104,6 +104,7 @@ tooltip_font = Sans 12
tooltip_font_color = #FFFFFF 100
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
@ -120,4 +121,4 @@ battery_font_color = #FFFFFF 75
battery_padding = 1 0
battery_background_id = 1
# End of config
# End of config

View file

@ -118,6 +118,7 @@ tooltip_font = Sans 8
tooltip_font_color = #FFFFFF 100
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
@ -134,4 +135,4 @@ battery_font_color = #FFFFFF 75
battery_padding = 2 0
battery_background_id = 0
# End of config
# End of config

View file

@ -106,6 +106,7 @@ tooltip_font = sans 10
tooltip_font_color = #000000 80
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
@ -122,4 +123,4 @@ battery_font_color = #FFFFFF 75
battery_padding = 1 0
battery_background_id = 0
# End of config
# End of config

View file

@ -95,6 +95,7 @@ tooltip_font = sans 10
tooltip_font_color = #000000 80
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = none
mouse_scroll_up = toggle
@ -111,4 +112,4 @@ battery_font_color = #FFFFFF 75
battery_padding = 1 0
battery_background_id = 0
# End of config
# End of config

View file

@ -95,6 +95,7 @@ tooltip_font = Sans 10
tooltip_font_color = #FFFFFF 80
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
@ -111,4 +112,4 @@ battery_font_color = #FFFFFF 100
battery_padding = 0 0
battery_background_id = 0
# End of config
# End of config

View file

@ -106,6 +106,7 @@ tooltip_font = sans 8
tooltip_font_color = #000000 89
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
@ -122,4 +123,4 @@ battery_font_color = #FFFFFF 75
battery_padding = 4 2
battery_background_id = 1
# End of config
# End of config

View file

@ -102,6 +102,7 @@ tooltip_font = Sans 7
tooltip_font_color = #FFFFFF 100
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
@ -118,4 +119,4 @@ battery_font_color = #FFFFFF 100
battery_padding = 1 0
battery_background_id = 0
# End of config
# End of config

View file

@ -112,6 +112,7 @@ tooltip_font = Aller 8
tooltip_font_color = #D3CAAA 33
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
@ -128,4 +129,4 @@ battery_font_color = #D3CAAA 48
battery_padding = 4 2
battery_background_id = 4
# End of config
# End of config

View file

@ -112,6 +112,7 @@ tooltip_font = Aller 8
tooltip_font_color = #D3CAAA 33
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
@ -128,4 +129,4 @@ battery_font_color = #D3CAAA 48
battery_padding = 4 2
battery_background_id = 4
# End of config
# End of config

View file

@ -90,6 +90,7 @@ tooltip_font = Sans 9
tooltip_font_color = #FFFFFF 100
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle

View file

@ -83,6 +83,7 @@ tooltip_font = Sans 12
tooltip_font_color = #FFFFFF 100
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle

View file

@ -96,6 +96,7 @@ tooltip_font = AvantGardeLTMedium 8
tooltip_font_color = #434141 100
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
@ -112,4 +113,4 @@ battery_font_color = #151515 60
battery_padding = 1 0
battery_background_id = 0
# End of config
# End of config

View file

@ -89,6 +89,7 @@ tooltip_font = Aller 8
tooltip_font_color = #D3CAAA 33
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
@ -105,4 +106,4 @@ battery_font_color = #FFFFFF 75
battery_padding = 1 0
battery_background_id = 0
# End of config
# End of config

View file

@ -99,6 +99,7 @@ tooltip_font = sans 10
tooltip_font_color = #000000 80
# Mouse
mouse_left = toggle_iconify
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
@ -115,4 +116,4 @@ battery_font_color = #FFFFFF 74
battery_padding = 1 0
battery_background_id = 0
# End of config
# End of config

View file

@ -644,6 +644,8 @@ void add_entry (char *key, char *value)
}
/* Mouse actions */
else if (strcmp (key, "mouse_left") == 0)
get_action (value, &mouse_left);
else if (strcmp (key, "mouse_middle") == 0)
get_action (value, &mouse_middle);
else if (strcmp (key, "mouse_right") == 0)

View file

@ -37,6 +37,7 @@
int signal_pending;
// --------------------------------------------------
// mouse events
int mouse_left;
int mouse_middle;
int mouse_right;
int mouse_scroll_up;
@ -90,6 +91,7 @@ void default_panel()
panel_layer = BOTTOM_LAYER; // default is bottom layer
wm_menu = 0;
max_tick_urgent = 14;
mouse_left = TOGGLE_ICONIFY;
backgrounds = g_array_new(0, 0, sizeof(Background));
memset(&panel_config, 0, sizeof(Panel));

View file

@ -29,6 +29,7 @@
extern int signal_pending;
// --------------------------------------------------
// mouse events
extern int mouse_left;
extern int mouse_middle;
extern int mouse_right;
extern int mouse_scroll_up;

View file

@ -349,7 +349,7 @@ int tint2_handles_click(Panel* panel, XButtonEvent* e)
{
Task* task = click_task(panel, e->x, e->y);
if (task) {
if( (e->button == 1)
if( (e->button == 1 && mouse_left != 0)
|| (e->button == 2 && mouse_middle != 0)
|| (e->button == 3 && mouse_right != 0)
|| (e->button == 4 && mouse_scroll_up != 0)
@ -486,6 +486,9 @@ void event_button_release (XEvent *e)
int action = TOGGLE_ICONIFY;
switch (e->xbutton.button) {
case 1:
action = mouse_left;
break;
case 2:
action = mouse_middle;
break;

View file

@ -46,7 +46,7 @@ GtkWidget *taskbar_active_background, *taskbar_inactive_background;
GtkWidget *taskbar_name_active_background, *taskbar_name_inactive_background;
// task
GtkWidget *task_mouse_middle, *task_mouse_right, *task_mouse_scroll_up, *task_mouse_scroll_down;
GtkWidget *task_mouse_left, *task_mouse_middle, *task_mouse_right, *task_mouse_scroll_up, *task_mouse_scroll_down;
GtkWidget *task_show_icon, *task_show_text, *task_align_center, *task_font_shadow;
GtkWidget *task_maximum_width, *task_maximum_height, *task_padding_x, *task_padding_y, *task_font;
GtkWidget *task_default_color, *task_default_color_set,
@ -2033,25 +2033,25 @@ void create_task(GtkWidget *parent)
gtk_table_set_row_spacings(GTK_TABLE(table), ROW_SPACING);
gtk_table_set_col_spacings(GTK_TABLE(table), COL_SPACING);
label = gtk_label_new(_("Middle click"));
label = gtk_label_new(_("Left click"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0);
task_mouse_middle = gtk_combo_box_new_text();
gtk_widget_show(task_mouse_middle);
gtk_table_attach(GTK_TABLE(table), task_mouse_middle, 3, 4, 0, 1, GTK_FILL, 0, 0, 0);
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("None"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Close"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Toggle"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Iconify"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("sShade"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Toggle or iconify"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Maximize or restore"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Desktop left"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Desktop right"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Next task"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Previous task"));
task_mouse_left = gtk_combo_box_new_text();
gtk_widget_show(task_mouse_left);
gtk_table_attach(GTK_TABLE(table), task_mouse_left, 3, 4, 0, 1, GTK_FILL, 0, 0, 0);
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_left), _("None"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_left), _("Close"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_left), _("Toggle"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_left), _("Iconify"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_left), _("Shade"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_left), _("Toggle or iconify"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_left), _("Maximize or restore"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_left), _("Desktop left"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_left), _("Desktop right"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_left), _("Next task"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_left), _("Previous task"));
label = gtk_label_new(_("Wheel scroll up"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
@ -2073,25 +2073,25 @@ void create_task(GtkWidget *parent)
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_scroll_up), _("Next task"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_scroll_up), _("Previous task"));
label = gtk_label_new(_("Right click"));
label = gtk_label_new(_("Middle click"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0);
task_mouse_right = gtk_combo_box_new_text();
gtk_widget_show(task_mouse_right);
gtk_table_attach(GTK_TABLE(table), task_mouse_right, 3, 4, 1, 2, GTK_FILL, 0, 0, 0);
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("None"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Close"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Toggle"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Iconify"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Shade"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Toggle or iconify"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Maximize or restore"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Desktop left"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Desktop right"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Next task"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Previous task"));
task_mouse_middle = gtk_combo_box_new_text();
gtk_widget_show(task_mouse_middle);
gtk_table_attach(GTK_TABLE(table), task_mouse_middle, 3, 4, 1, 2, GTK_FILL, 0, 0, 0);
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("None"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Close"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Toggle"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Iconify"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("sShade"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Toggle or iconify"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Maximize or restore"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Desktop left"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Desktop right"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Next task"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_middle), _("Previous task"));
label = gtk_label_new(_("Wheel scroll down"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
@ -2113,14 +2113,34 @@ void create_task(GtkWidget *parent)
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_scroll_down), _("Next task"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_scroll_down), _("Previous task"));
label = gtk_label_new(_("Tooltip"));
label = gtk_label_new(_("Right click"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, 2, 3, 2, 3, GTK_FILL, 0, 0, 0);
task_mouse_right = gtk_combo_box_new_text();
gtk_widget_show(task_mouse_right);
gtk_table_attach(GTK_TABLE(table), task_mouse_right, 3, 4, 2, 3, GTK_FILL, 0, 0, 0);
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("None"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Close"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Toggle"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Iconify"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Shade"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Toggle or iconify"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Maximize or restore"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Desktop left"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Desktop right"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Next task"));
gtk_combo_box_append_text(GTK_COMBO_BOX(task_mouse_right), _("Previous task"));
label = gtk_label_new(_("Tooltip"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table), label, 6, 7, 2, 3, GTK_FILL, 0, 0, 0);
tooltip_task_show = gtk_check_button_new();
gtk_widget_show(tooltip_task_show);
gtk_table_attach(GTK_TABLE(table), tooltip_task_show, 3, 4, 2, 3, GTK_FILL, 0, 0, 0);
gtk_table_attach(GTK_TABLE(table), tooltip_task_show, 7, 8, 2, 3, GTK_FILL, 0, 0, 0);
change_paragraph(parent);

View file

@ -51,7 +51,7 @@ extern GtkWidget *taskbar_active_background, *taskbar_inactive_background;
extern GtkWidget *taskbar_name_active_background, *taskbar_name_inactive_background;
// task
extern GtkWidget *task_mouse_middle, *task_mouse_right, *task_mouse_scroll_up, *task_mouse_scroll_down;
extern GtkWidget *task_mouse_left, *task_mouse_middle, *task_mouse_right, *task_mouse_scroll_up, *task_mouse_scroll_down;
extern GtkWidget *task_show_icon, *task_show_text, *task_align_center, *task_font_shadow;
extern GtkWidget *task_maximum_width, *task_maximum_height, *task_padding_x, *task_padding_y, *task_font;
extern GtkWidget *task_default_color, *task_default_color_set,

View file

@ -1117,6 +1117,9 @@ void add_entry(char *key, char *value)
}
/* Mouse actions */
else if (strcmp(key, "mouse_left") == 0) {
get_action(value, task_mouse_left);
}
else if (strcmp(key, "mouse_middle") == 0) {
get_action(value, task_mouse_middle);
}

View file

@ -436,6 +436,8 @@ class TintWizardGUI(gtk.Window):
self.show_all()
self.resetConfig()
# If tintwizard was launched with a tint2 config filename
# as an argument, load that config.
if self.oneConfigFile:
@ -862,20 +864,24 @@ class TintWizardGUI(gtk.Window):
mouseCmds = ["none", "close", "toggle", "iconify", "shade", "toggle_iconify", "maximize_restore", "desktop_left", "desktop_right", "next_task", "prev_task"]
createLabel(self.tableMouse, text="Middle Mouse Click Action", gridX=0, gridY=0, xPadding=10)
self.mouseMiddle = createComboBox(self.tableMouse, mouseCmds, gridX=1, gridY=0, handler=self.changeOccurred)
createLabel(self.tableMouse, text="Left Mouse Click Action", gridX=0, gridY=0, xPadding=10)
self.mouseLeft = createComboBox(self.tableMouse, mouseCmds, gridX=1, gridY=0, handler=self.changeOccurred)
self.registerComponent("mouse_left", self.mouseLeft)
createLabel(self.tableMouse, text="Middle Mouse Click Action", gridX=0, gridY=1, xPadding=10)
self.mouseMiddle = createComboBox(self.tableMouse, mouseCmds, gridX=1, gridY=1, handler=self.changeOccurred)
self.registerComponent("mouse_middle", self.mouseMiddle)
createLabel(self.tableMouse, text="Right Mouse Click Action", gridX=0, gridY=1, xPadding=10)
self.mouseRight = createComboBox(self.tableMouse, mouseCmds, gridX=1, gridY=1, handler=self.changeOccurred)
createLabel(self.tableMouse, text="Right Mouse Click Action", gridX=0, gridY=2, xPadding=10)
self.mouseRight = createComboBox(self.tableMouse, mouseCmds, gridX=1, gridY=2, handler=self.changeOccurred)
self.registerComponent("mouse_right", self.mouseRight)
createLabel(self.tableMouse, text="Mouse Wheel Scroll Up Action", gridX=0, gridY=2, xPadding=10)
self.mouseUp = createComboBox(self.tableMouse, mouseCmds, gridX=1, gridY=2, handler=self.changeOccurred)
createLabel(self.tableMouse, text="Mouse Wheel Scroll Up Action", gridX=0, gridY=3, xPadding=10)
self.mouseUp = createComboBox(self.tableMouse, mouseCmds, gridX=1, gridY=3, handler=self.changeOccurred)
self.registerComponent("mouse_scroll_up", self.mouseUp)
createLabel(self.tableMouse, text="Mouse Wheel Scroll Down Action", gridX=0, gridY=3, xPadding=10)
self.mouseDown = createComboBox(self.tableMouse, mouseCmds, gridX=1, gridY=3, handler=self.changeOccurred)
createLabel(self.tableMouse, text="Mouse Wheel Scroll Down Action", gridX=0, gridY=4, xPadding=10)
self.mouseDown = createComboBox(self.tableMouse, mouseCmds, gridX=1, gridY=4, handler=self.changeOccurred)
self.registerComponent("mouse_scroll_down", self.mouseDown)
def createTooltipsWidgets(self):
@ -1397,6 +1403,7 @@ class TintWizardGUI(gtk.Window):
int(self.tooltipFontColButton.get_alpha() / 65535.0 * 100)))
self.configBuf.insert(self.configBuf.get_end_iter(), "\n# Mouse\n")
self.configBuf.insert(self.configBuf.get_end_iter(), "mouse_left = %s\n" % (self.mouseLeft.get_active_text()))
self.configBuf.insert(self.configBuf.get_end_iter(), "mouse_middle = %s\n" % (self.mouseMiddle.get_active_text()))
self.configBuf.insert(self.configBuf.get_end_iter(), "mouse_right = %s\n" % (self.mouseRight.get_active_text()))
self.configBuf.insert(self.configBuf.get_end_iter(), "mouse_scroll_up = %s\n" % (self.mouseUp.get_active_text()))
@ -1847,6 +1854,7 @@ class TintWizardGUI(gtk.Window):
self.tooltipFontColButton.set_color(gtk.gdk.color_parse(self.defaults["fgColor"]))
self.tooltipFontCol.set_text(self.defaults["fgColor"])
# Mouse
self.mouseLeft.set_active(5)
self.mouseMiddle.set_active(0)
self.mouseRight.set_active(0)
self.mouseUp.set_active(0)