Skip to content

Commit

Permalink
Inline the if-condition
Browse files Browse the repository at this point in the history
  • Loading branch information
nurupo committed Feb 22, 2017
1 parent 20591eb commit 1a3149c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
10 changes: 2 additions & 8 deletions vlc-2.1.x/pause_click.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,8 @@ int mouse(filter_t *p_filter, vlc_mouse_t *p_mouse_out, const vlc_mouse_t *p_mou
int mouse_button = FROM_CHAR(mouse_button_value[0]);
free(mouse_button_value);

int triggered = 0;
if (mouse_button == MOUSE_BUTTON_LEFT) {
triggered = vlc_mouse_HasPressed(p_mouse_old, p_mouse_new, mouse_button) || p_mouse_new->b_double_click;
} else {
triggered = vlc_mouse_HasPressed(p_mouse_old, p_mouse_new, mouse_button);
}

if (triggered) {
if (vlc_mouse_HasPressed(p_mouse_old, p_mouse_new, mouse_button) ||
(p_mouse_new->b_double_click && mouse_button == MOUSE_BUTTON_LEFT)) {
playlist_t* p_playlist = pl_Get((vlc_object_t *)p_filter);
playlist_Control(p_playlist,
(playlist_Status(p_playlist) == PLAYLIST_RUNNING ? PLAYLIST_PAUSE : PLAYLIST_PLAY), 0);
Expand Down
11 changes: 3 additions & 8 deletions vlc-2.2.x+/pause_click.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,9 @@ int mouse(filter_t *p_filter, vlc_mouse_t *p_mouse_out, const vlc_mouse_t *p_mou
int mouse_button = FROM_CHAR(mouse_button_value[0]);
free(mouse_button_value);

int triggered = 0;
if (mouse_button == MOUSE_BUTTON_LEFT) {
triggered = vlc_mouse_HasPressed(p_mouse_old, p_mouse_new, mouse_button) || p_mouse_new->b_double_click;
} else {
triggered = vlc_mouse_HasPressed(p_mouse_old, p_mouse_new, mouse_button);
}

if (p_intf != NULL && triggered) {
if (p_intf != NULL &&
(vlc_mouse_HasPressed(p_mouse_old, p_mouse_new, mouse_button) ||
(p_mouse_new->b_double_click && mouse_button == MOUSE_BUTTON_LEFT))) {
playlist_t* p_playlist = pl_Get(p_intf);
playlist_Control(p_playlist,
(playlist_Status(p_playlist) == PLAYLIST_RUNNING ? PLAYLIST_PAUSE : PLAYLIST_PLAY), 0);
Expand Down

0 comments on commit 1a3149c

Please sign in to comment.