Skip to content

Commit

Permalink
Update GUI more faster on tray icon scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
rozhuk-im committed Jun 9, 2022
1 parent acbc892 commit e021fd5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ project(gtk-mixer C)

set(PACKAGE_VERSION_MAJOR 1)
set(PACKAGE_VERSION_MINOR 0)
set(PACKAGE_VERSION_PATCH 0)
set(PACKAGE_VERSION_PATCH 3)

set(PACKAGE_NAME "${PROJECT_NAME}")
set(PACKAGE_VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Build-Ubuntu-latest Actions Status](https://github.com/rozhuk-im/gtk-mixer/workflows/build-ubuntu-latest/badge.svg)](https://github.com/rozhuk-im/gtk-mixer/actions)


Rozhuk Ivan <[email protected]> 2020 - 2021
Rozhuk Ivan <[email protected]> 2020-2022

GTK-Mixer is GTK based volume control tool ("mixer").\
GUI from xfce4-mixer: https://gitlab.xfce.org/apps/xfce4-mixer
Expand Down
10 changes: 7 additions & 3 deletions src/gtk-mixer-tray_icon.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*-
* Copyright (c) 2021 Rozhuk Ivan <[email protected]>
* Copyright (c) 2021-2022 Rozhuk Ivan <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -39,14 +39,15 @@ typedef struct gtk_mixer_tray_icon_s {
GtkStatusIcon *status_icon;
GtkMenu *menu;
const char *icon_name;
GtkWidget *main_window;
gmp_dev_p dev;
gmp_dev_line_p dev_line;
} gm_tray_icon_t, *gm_tray_icon_p;



static gboolean
gtk_mixer_tray_icon_scroll(GtkStatusIcon *status_icon __unused,
gtk_mixer_tray_icon_scroll(GtkStatusIcon *status_icon,
GdkEventScroll *event, gpointer user_data) {
gm_tray_icon_p tray_icon = user_data;

Expand All @@ -63,6 +64,8 @@ gtk_mixer_tray_icon_scroll(GtkStatusIcon *status_icon __unused,
tray_icon->dev_line->is_updated = 1;
tray_icon->dev_line->write_required ++;
gmp_dev_write(tray_icon->dev, 0);
gtk_mixer_window_lines_update(tray_icon->main_window);
gtk_mixer_tray_icon_update(status_icon);
break;
default:
break;
Expand Down Expand Up @@ -171,13 +174,14 @@ gtk_mixer_tray_icon_destroy(GtkWidget *window __unused, gpointer user_data) {
}

GtkStatusIcon *
gtk_mixer_tray_icon_create(void) {
gtk_mixer_tray_icon_create(GtkWidget *main_window) {
gm_tray_icon_p tray_icon;

tray_icon = calloc(1, sizeof(gm_tray_icon_t));
if (NULL == tray_icon)
return (NULL);

tray_icon->main_window = main_window;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
tray_icon->status_icon = gtk_status_icon_new();
G_GNUC_END_IGNORE_DEPRECATIONS
Expand Down
6 changes: 3 additions & 3 deletions src/gtk-mixer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*-
* Copyright (c) 2020 - 2021 Rozhuk Ivan <[email protected]>
* Copyright (c) 2020-2022 Rozhuk Ivan <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -162,7 +162,7 @@ on_tray_icon_menu_about_click(GtkMenuItem *menuitem __unused,
GtkAboutDialog *dlg = GTK_ABOUT_DIALOG(gtk_about_dialog_new());
const char *authors[] = {
"",
"2020-2021 Rozhuk Ivan",
"2020-2022 Rozhuk Ivan",
"",
"Original xfce4-mixer",
"2012 Guido Berhoerster",
Expand Down Expand Up @@ -277,7 +277,7 @@ main(int argc, char **argv) {


/* Tray icon. */
app.status_icon = gtk_mixer_tray_icon_create();
app.status_icon = gtk_mixer_tray_icon_create(app.window);
g_signal_connect(app.status_icon, "activate",
G_CALLBACK(gtk_mixer_status_icon_activate), &app);
g_signal_connect(app.status_icon, "popup-menu",
Expand Down
4 changes: 2 additions & 2 deletions src/gtk-mixer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*-
* Copyright (c) 2020 - 2021 Rozhuk Ivan <[email protected]>
* Copyright (c) 2020-2022 Rozhuk Ivan <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -85,7 +85,7 @@ GtkWidget *gtk_mixer_line_create(gmp_dev_p dev, gmp_dev_line_p dev_line);
void gtk_mixer_line_update(GtkWidget *container);


GtkStatusIcon *gtk_mixer_tray_icon_create(void);
GtkStatusIcon *gtk_mixer_tray_icon_create(GtkWidget *main_window);
void gtk_mixer_tray_icon_dev_set(GtkStatusIcon *status_icon, gmp_dev_p dev);
void gtk_mixer_tray_icon_update(GtkStatusIcon *status_icon);

Expand Down

0 comments on commit e021fd5

Please sign in to comment.