Revert "feat: add system monitor feature with panel toggle and event handling"
This reverts commit aee7030b30.
This commit is contained in:
parent
aee7030b30
commit
15077092c0
BIN
build/ai.o
BIN
build/ai.o
Binary file not shown.
Binary file not shown.
BIN
build/client.o
BIN
build/client.o
Binary file not shown.
BIN
build/config.o
BIN
build/config.o
Binary file not shown.
Binary file not shown.
BIN
build/demo.o
BIN
build/demo.o
Binary file not shown.
BIN
build/keys.o
BIN
build/keys.o
Binary file not shown.
BIN
build/layout.o
BIN
build/layout.o
Binary file not shown.
@ -21,7 +21,7 @@ build/main.o: src/main.c include/dwn.h include/config.h include/dwn.h \
|
|||||||
/usr/include/dbus-1.0/dbus/dbus-threads.h include/systray.h \
|
/usr/include/dbus-1.0/dbus/dbus-threads.h include/systray.h \
|
||||||
include/news.h include/applauncher.h include/ai.h include/autostart.h \
|
include/news.h include/applauncher.h include/ai.h include/autostart.h \
|
||||||
include/services.h include/api.h include/demo.h include/screenshot.h \
|
include/services.h include/api.h include/demo.h include/screenshot.h \
|
||||||
include/ocr.h include/sysmon.h include/util.h
|
include/ocr.h include/util.h
|
||||||
include/dwn.h:
|
include/dwn.h:
|
||||||
include/config.h:
|
include/config.h:
|
||||||
include/dwn.h:
|
include/dwn.h:
|
||||||
@ -61,5 +61,4 @@ include/api.h:
|
|||||||
include/demo.h:
|
include/demo.h:
|
||||||
include/screenshot.h:
|
include/screenshot.h:
|
||||||
include/ocr.h:
|
include/ocr.h:
|
||||||
include/sysmon.h:
|
|
||||||
include/util.h:
|
include/util.h:
|
||||||
|
|||||||
BIN
build/main.o
BIN
build/main.o
Binary file not shown.
BIN
build/news.o
BIN
build/news.o
Binary file not shown.
Binary file not shown.
BIN
build/panel.o
BIN
build/panel.o
Binary file not shown.
BIN
build/systray.o
BIN
build/systray.o
Binary file not shown.
BIN
build/util.o
BIN
build/util.o
Binary file not shown.
Binary file not shown.
@ -107,7 +107,6 @@ typedef struct Workspace Workspace;
|
|||||||
typedef struct Monitor Monitor;
|
typedef struct Monitor Monitor;
|
||||||
typedef struct Panel Panel;
|
typedef struct Panel Panel;
|
||||||
typedef struct Config Config;
|
typedef struct Config Config;
|
||||||
typedef struct SystemMonitor SystemMonitor;
|
|
||||||
|
|
||||||
struct Client {
|
struct Client {
|
||||||
Window window;
|
Window window;
|
||||||
@ -177,8 +176,6 @@ typedef struct {
|
|||||||
Panel *top_panel;
|
Panel *top_panel;
|
||||||
Panel *bottom_panel;
|
Panel *bottom_panel;
|
||||||
|
|
||||||
SystemMonitor *sysmon;
|
|
||||||
|
|
||||||
Config *config;
|
Config *config;
|
||||||
|
|
||||||
bool running;
|
bool running;
|
||||||
|
|||||||
40
src/main.c
40
src/main.c
@ -24,7 +24,6 @@
|
|||||||
#include "demo.h"
|
#include "demo.h"
|
||||||
#include "screenshot.h"
|
#include "screenshot.h"
|
||||||
#include "ocr.h"
|
#include "ocr.h"
|
||||||
#include "sysmon.h"
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -344,12 +343,7 @@ static void handle_map_request(XMapRequestEvent *ev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemMonitor *sysmon = sysmon_find_by_window(ev->window);
|
client_manage(ev->window);
|
||||||
Client *client = client_manage(ev->window);
|
|
||||||
|
|
||||||
if (sysmon != NULL && client != NULL) {
|
|
||||||
sysmon_set_client(sysmon, client);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_unmap_notify(XUnmapEvent *ev)
|
static void handle_unmap_notify(XUnmapEvent *ev)
|
||||||
@ -464,10 +458,6 @@ static void handle_expose(XExposeEvent *ev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dwn->sysmon != NULL) {
|
|
||||||
sysmon_render(dwn->sysmon);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dwn->top_panel != NULL && ev->window == dwn->top_panel->window) {
|
if (dwn->top_panel != NULL && ev->window == dwn->top_panel->window) {
|
||||||
panel_render(dwn->top_panel);
|
panel_render(dwn->top_panel);
|
||||||
return;
|
return;
|
||||||
@ -539,10 +529,6 @@ static void handle_button_press(XButtonEvent *ev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dwn->sysmon != NULL) {
|
|
||||||
sysmon_handle_event(dwn->sysmon, (XEvent *)ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (volume_slider != NULL && volume_slider->visible) {
|
if (volume_slider != NULL && volume_slider->visible) {
|
||||||
if (ev->window == volume_slider->window) {
|
if (ev->window == volume_slider->window) {
|
||||||
volume_slider_handle_click(volume_slider, ev->x, ev->y);
|
volume_slider_handle_click(volume_slider, ev->x, ev->y);
|
||||||
@ -579,11 +565,6 @@ static void handle_button_press(XButtonEvent *ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_client_window) {
|
if (is_client_window) {
|
||||||
SystemMonitor *sysmon = sysmon_find_by_window(ev->window);
|
|
||||||
if (sysmon != NULL) {
|
|
||||||
sysmon_handle_event(sysmon, (XEvent *)ev);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
XAllowEvents(dwn->display, ReplayPointer, ev->time);
|
XAllowEvents(dwn->display, ReplayPointer, ev->time);
|
||||||
client_focus(c, true);
|
client_focus(c, true);
|
||||||
return;
|
return;
|
||||||
@ -667,12 +648,6 @@ static void handle_motion_notify(XMotionEvent *ev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemMonitor *sysmon = sysmon_find_by_window(ev->window);
|
|
||||||
if (sysmon != NULL) {
|
|
||||||
sysmon_handle_event(sysmon, (XEvent *)ev);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (volume_slider != NULL && volume_slider->visible && ev->window == volume_slider->window) {
|
if (volume_slider != NULL && volume_slider->visible && ev->window == volume_slider->window) {
|
||||||
volume_slider_handle_motion(volume_slider, ev->x, ev->y);
|
volume_slider_handle_motion(volume_slider, ev->x, ev->y);
|
||||||
return;
|
return;
|
||||||
@ -945,8 +920,6 @@ int dwn_init(void)
|
|||||||
|
|
||||||
panels_init();
|
panels_init();
|
||||||
|
|
||||||
dwn->sysmon = sysmon_create();
|
|
||||||
|
|
||||||
systray_init();
|
systray_init();
|
||||||
|
|
||||||
xembed_init();
|
xembed_init();
|
||||||
@ -1019,12 +992,6 @@ void dwn_cleanup(void)
|
|||||||
keys_cleanup();
|
keys_cleanup();
|
||||||
xembed_cleanup();
|
xembed_cleanup();
|
||||||
systray_cleanup();
|
systray_cleanup();
|
||||||
|
|
||||||
if (dwn->sysmon != NULL) {
|
|
||||||
sysmon_destroy(dwn->sysmon);
|
|
||||||
dwn->sysmon = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
panels_cleanup();
|
panels_cleanup();
|
||||||
decorations_cleanup();
|
decorations_cleanup();
|
||||||
workspace_cleanup();
|
workspace_cleanup();
|
||||||
@ -1145,11 +1112,6 @@ void dwn_run(void)
|
|||||||
panel_update_clock();
|
panel_update_clock();
|
||||||
panel_update_system_stats();
|
panel_update_system_stats();
|
||||||
systray_update();
|
systray_update();
|
||||||
|
|
||||||
if (dwn->sysmon != NULL) {
|
|
||||||
sysmon_update(dwn->sysmon);
|
|
||||||
}
|
|
||||||
|
|
||||||
last_clock_update = now;
|
last_clock_update = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
30
src/panel.c
30
src/panel.c
@ -717,36 +717,6 @@ void panel_handle_click(Panel *panel, int x, int y, int button)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (panel->position == PANEL_BOTTOM) {
|
} else if (panel->position == PANEL_BOTTOM) {
|
||||||
int clock_width = panel_text_width(clock_buffer, strlen(clock_buffer));
|
|
||||||
int stats_width = panel_calculate_stats_width();
|
|
||||||
int stats_x = panel->width - clock_width - stats_width - PANEL_PADDING - WIDGET_SPACING;
|
|
||||||
int stats_end_x = stats_x + stats_width;
|
|
||||||
|
|
||||||
if (x >= stats_x && x <= stats_end_x && button == 1) {
|
|
||||||
extern SystemMonitor *sysmon_get_instance(void);
|
|
||||||
SystemMonitor *mon = sysmon_get_instance();
|
|
||||||
if (mon != NULL) {
|
|
||||||
extern void sysmon_toggle(SystemMonitor *mon);
|
|
||||||
sysmon_toggle(mon);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int date_width = panel_text_width(date_buffer, strlen(date_buffer));
|
|
||||||
int top_proc_x = PANEL_PADDING + date_width + WIDGET_SPACING;
|
|
||||||
int top_proc_width = TOP_PROCESS_WIDGET_WIDTH;
|
|
||||||
int top_proc_end_x = top_proc_x + top_proc_width;
|
|
||||||
|
|
||||||
if (x >= top_proc_x && x <= top_proc_end_x && button == 1) {
|
|
||||||
extern SystemMonitor *sysmon_get_instance(void);
|
|
||||||
SystemMonitor *mon = sysmon_get_instance();
|
|
||||||
if (mon != NULL) {
|
|
||||||
extern void sysmon_toggle(SystemMonitor *mon);
|
|
||||||
sysmon_toggle(mon);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (button == 1) {
|
if (button == 1) {
|
||||||
news_handle_click(x, y);
|
news_handle_click(x, y);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user