/** * Handles button-release-event' signal on the tray_icon, currently * only used for middle-click. * * @param status_icon the object which received the signal * @param event the GdkEventButton which triggered this signal * @param user_data user data set when the signal handler was * connected */ void tray_icon_button(GtkStatusIcon *status_icon, GdkEventButton *event, gpointer user_data) { if (event->button == 2) { gint act = 0; if (g_key_file_has_key(keyFile,"PNMixer","MiddleClickAction",NULL)) act = g_key_file_get_integer(keyFile,"PNMixer","MiddleClickAction",NULL); switch (act) { case 0: // mute/unmute setmute(mouse_noti); get_mute_state(TRUE); break; case 1: do_prefs(); break; case 2: { on_mixer(); break; } case 3: if (g_key_file_has_key(keyFile,"PNMixer","CustomCommand",NULL)) { gchar* cmd = g_key_file_get_string(keyFile,"PNMixer","CustomCommand",NULL); if (cmd) { run_command(cmd); g_free(cmd); } else // This shouldn't ever happen, so let's just write to console g_warning("KeyFile has CustomCommand key, but get_string returned NULL"); } else report_error(_("You have not specified a custom command to run, please specify one in preferences.")); break; default: {} // nothing } } }
void mutevol(const Arg *arg) { snd_mixer_elem_t* elem = getelem(alsachannel); switch (arg->i) { case -1: togglemute(elem); return; case 0: setmute(elem, 0); return; case 1: setmute(elem, 1); return; } return; }
/** * This function is called before gdk/gtk can respond * to any(!) window event and handles pressed hotkeys. * * @param gdk_xevent the native event to filter * @param event the GDK event to which the X event will be translated * @param data user data set when the filter was installed * @return a GdkFilterReturn value, should be GDK_FILTER_CONTINUE only */ static GdkFilterReturn key_filter(GdkXEvent *gdk_xevent, G_GNUC_UNUSED GdkEvent *event, G_GNUC_UNUSED gpointer data) { int type; guint key, state; XKeyEvent *xevent; //gboolean bResult; xevent = gdk_xevent; type = xevent->type; if (type == KeyPress) { key = ((XKeyEvent *) xevent)->keycode; state = ((XKeyEvent *) xevent)->state; if ((int) key == volMuteKey && checkModKey(state, volMuteMods)) { setmute(enable_noti && hotkey_noti); on_volume_has_changed(); return GDK_FILTER_CONTINUE; } else { int cv = getvol(); if ((int) key == volUpKey && checkModKey(state, volUpMods)) { setvol(cv + volStep, 1, enable_noti && hotkey_noti); } else if ((int) key == volDownKey && checkModKey(state, volDownMods)) { setvol(cv - volStep, -1, enable_noti && hotkey_noti); } // just ignore unknown hotkeys if (ismuted() == 0) setmute(enable_noti && hotkey_noti); on_volume_has_changed(); // this will set the slider value get_current_levels(); } } return GDK_FILTER_CONTINUE; }
static GdkFilterReturn key_filter(GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data) { int type; unsigned int key,state; XKeyEvent *xevent; //gboolean bResult; xevent = gdk_xevent; type = xevent->type; if (type == KeyPress) { key = ((XKeyEvent *)xevent)->keycode; state = ((XKeyEvent *)xevent)->state; if (key == volMuteKey && state == volMuteMods) { setmute(enable_noti&&hotkey_noti); get_mute_state(TRUE); return GDK_FILTER_CONTINUE; } else { int cv = getvol(); if (key == volUpKey && state == volUpMods) { setvol(cv+volStep,enable_noti&&hotkey_noti); } else if (key == volDownKey && state == volDownMods) { setvol(cv-volStep,enable_noti&&hotkey_noti); } // just ignore unknown hotkeys if (get_mute_state(TRUE) == 0) setmute(enable_noti&&hotkey_noti); // this will set the slider value get_current_levels(); } } return GDK_FILTER_CONTINUE; }
void CommonPlayer::process_common_msg(int cmdtype, int *processed) { switch (cmdtype) { case DSP_KEY_V_PLUS: case DSP_KEY_V_MINUS: if((cmdtype == DSP_KEY_V_MINUS) && (volumeindex>MIN_VOLUME)) volumeindex--; else if((cmdtype == DSP_KEY_V_PLUS) && (volumeindex<MAX_VOLUME)) volumeindex++; show_jd_audio_text(volumeindex); if(ifmute()) { UI_JD_disappear(NULL); unsetmute(); } DSP_TSPlayer_SetVolumeIndex(TSPlayerHandle,volumeindex); save_volume_index(volumeindex); *processed = 1; break; case DSP_KEY_MUTE: if(ifmute()) { UI_JD_disappear(NULL); DSP_TSPlayer_SetVolumeIndex(TSPlayerHandle,volumeindex); unsetmute(); break; } else { UI_JD_display(STATE_MUTE, 0, NULL); DSP_TSPlayer_SetVolumeIndex(TSPlayerHandle,MIN_VOLUME); setmute(); } *processed = 1; break; default: break; } return; }
/** * Handles button-release-event' signal on the tray_icon, currently * only used for middle-click. * * @param status_icon the object which received the signal * @param event the GdkEventButton which triggered this signal * @param user_data user data set when the signal handler was * connected */ void tray_icon_button(G_GNUC_UNUSED GtkStatusIcon *status_icon, GdkEventButton *event, G_GNUC_UNUSED gpointer user_data) { gint action; if (event->button != 2) return; action = prefs_get_integer("MiddleClickAction", 0); switch (action) { case 0: // mute/unmute setmute(mouse_noti); on_volume_has_changed(); break; case 1: do_prefs(); break; case 2: on_mixer(); break; case 3: { gchar *cmd; cmd = prefs_get_string("CustomCommand", NULL); if (cmd) { run_command(cmd); g_free(cmd); } else report_error(_("You have not specified a custom command to run, " "please specify one in preferences.")); break; } default: { } // nothing } }