- make use of new logging system in gkrellm
- removed trayicon on windows as it did not serve any purpose - win32: load locale files from installation path - sysdeps/win32.c: massively decreased length by refactoring - sysdeps/win32.c: use unicode function-calls for better compatibility with non-ascii locales - sysdeps/win32.c: format debug and warning messages that contain win32 error-codes and provide extensive error handling - sysdeps/win32.c: completely redid sensor-handling that allows supporting multiple sensor-backends at the same time (like on unix) and optionally launch sensor-apps if they're in $PATH. Sensor detection is now properly done at gkrellm-startup - sysdeps/win32.c: support CoreTemp application for getting cpu temperatures - sysdeps/win32.c: proc stats are finally working. Load-computation is based on the number of processes in the processor waiting-queue - sysdeps/win32.c: properly count number of logged in users by only counting "interactive logins" - sysdeps/win32.c: memory stats now also monitor cache bytes on winxp and newer (not available on win2k) - sysdeps/win32.c: system name updated with some new windows versions. Also allow proper OS-detection on 64bit-OS when running as a 32bit-app
This commit is contained in:
parent
32a20aeaef
commit
37c7f836ef
50
src/Makefile
50
src/Makefile
|
@ -22,6 +22,11 @@ INSTALL ?= install
|
||||||
LINK_FLAGS ?= -Wl,-E
|
LINK_FLAGS ?= -Wl,-E
|
||||||
SMC_LIBS ?= -L/usr/X11R6/lib -lSM -lICE
|
SMC_LIBS ?= -L/usr/X11R6/lib -lSM -lICE
|
||||||
|
|
||||||
|
SHARED_PATH = ../shared
|
||||||
|
# Make GNU Make search for sources somewhere else as well
|
||||||
|
VPATH = $(SHARED_PATH)
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(without-gnutls),1)
|
ifeq ($(without-gnutls),1)
|
||||||
CONFIGURE_ARGS += --without-gnutls
|
CONFIGURE_ARGS += --without-gnutls
|
||||||
endif
|
endif
|
||||||
|
@ -40,8 +45,6 @@ endif
|
||||||
ifeq ($(without-libsensors),1)
|
ifeq ($(without-libsensors),1)
|
||||||
CONFIGURE_ARGS += --without-libsensors
|
CONFIGURE_ARGS += --without-libsensors
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
DUMMY_VAR := $(shell ./configure $(CONFIGURE_ARGS))
|
DUMMY_VAR := $(shell ./configure $(CONFIGURE_ARGS))
|
||||||
|
|
||||||
HAVE_GNUTLS = $(shell grep -c HAVE_GNUTLS configure.h)
|
HAVE_GNUTLS = $(shell grep -c HAVE_GNUTLS configure.h)
|
||||||
|
@ -65,14 +68,13 @@ endif
|
||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
STRIP ?= -s
|
STRIP ?= -s
|
||||||
|
|
||||||
GKRELLM_INCLUDES = gkrellm.h gkrellm-public-proto.h
|
GKRELLM_INCLUDES = gkrellm.h gkrellm-public-proto.h $(SHARED_PATH)/log.h
|
||||||
|
|
||||||
PKG_INCLUDE = `$(PKG_CONFIG) --cflags gtk+-2.0 gthread-2.0`
|
PKG_INCLUDE = `$(PKG_CONFIG) --cflags gtk+-2.0 gthread-2.0`
|
||||||
|
|
||||||
PKG_LIB = `$(PKG_CONFIG) --libs gtk+-2.0 gthread-2.0`
|
PKG_LIB = `$(PKG_CONFIG) --libs gtk+-2.0 gthread-2.0`
|
||||||
|
|
||||||
FLAGS = -O2 -I.. $(PKG_INCLUDE) $(GTOP_INCLUDE)
|
FLAGS = -O2 -I.. -I$(SHARED_PATH) $(PKG_INCLUDE) $(GTOP_INCLUDE) $(PTHREAD_INC) \
|
||||||
FLAGS+= $(PTHREAD_INC)
|
-DGKRELLM_CLIENT
|
||||||
|
|
||||||
LIBS = $(PKG_LIB) $(GTOP_LIBS) $(SMC_LIBS) $(SYS_LIBS) $(SSL_LIBS) $(SENSORS_LIBS)
|
LIBS = $(PKG_LIB) $(GTOP_LIBS) $(SMC_LIBS) $(SYS_LIBS) $(SSL_LIBS) $(SENSORS_LIBS)
|
||||||
|
|
||||||
|
@ -83,6 +85,13 @@ ifeq ($(debug),yes)
|
||||||
FLAGS += -g
|
FLAGS += -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(profile),1)
|
||||||
|
FLAGS += -g -pg
|
||||||
|
endif
|
||||||
|
ifeq ($(profile),yes)
|
||||||
|
FLAGS += -g -pg
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(enable_nls),1)
|
ifeq ($(enable_nls),1)
|
||||||
FLAGS += -DENABLE_NLS -DLOCALEDIR=\"$(LOCALEDIR)\"
|
FLAGS += -DENABLE_NLS -DLOCALEDIR=\"$(LOCALEDIR)\"
|
||||||
endif
|
endif
|
||||||
|
@ -91,7 +100,7 @@ ifeq ($(enable_nls),yes)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(PACKAGE),gkrellm)
|
ifneq ($(PACKAGE),gkrellm)
|
||||||
FLAGS += -DPACKAGE=\"$(PACKAGE)\"
|
FLAGS += -DPACKAGE=\"$(PACKAGE)\"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_GETADDRINFO),1)
|
ifeq ($(HAVE_GETADDRINFO),1)
|
||||||
|
@ -105,9 +114,9 @@ OBJS = main.o alerts.o battery.o base64.o clock.o cpu.o disk.o fs.o \
|
||||||
hostname.o inet.o mail.o mem.o net.o proc.o sensors.o uptime.o \
|
hostname.o inet.o mail.o mem.o net.o proc.o sensors.o uptime.o \
|
||||||
chart.o panel.o config.o gui.o krell.o plugins.o pixops.o \
|
chart.o panel.o config.o gui.o krell.o plugins.o pixops.o \
|
||||||
smbdes.o smbencrypt.o smbmd4.o smbutil.o \
|
smbdes.o smbencrypt.o smbmd4.o smbutil.o \
|
||||||
client.o utils.o deprecated.o
|
client.o utils.o sysdeps-unix.o deprecated.o log.o
|
||||||
|
|
||||||
UNIXOBJS = winops-x11.o sysdeps-unix.o
|
UNIXOBJS = winops-x11.o
|
||||||
|
|
||||||
all: gkrellm
|
all: gkrellm
|
||||||
|
|
||||||
|
@ -170,13 +179,13 @@ solaris:
|
||||||
|
|
||||||
windows: libgkrellm.a
|
windows: libgkrellm.a
|
||||||
$(MAKE) \
|
$(MAKE) \
|
||||||
CFLAGS="${CFLAGS} -DWIN32_CLIENT -D_WIN32_WINNT=0x0500 -DWINVER=0x0500" \
|
CFLAGS="${CFLAGS} -D_WIN32_WINNT=0x0500 -DWINVER=0x0500" \
|
||||||
LINK_FLAGS="${LINK_FLAGS} -mwindows" \
|
LINK_FLAGS="${LINK_FLAGS} -mwindows" \
|
||||||
EXTRAOBJS="${EXTRAOBJS} winops-win32.o sysdeps/win32.o win32-plugin.o win32-resource.o" \
|
EXTRAOBJS="${EXTRAOBJS} winops-win32.o win32-plugin.o win32-resource.o" \
|
||||||
SYS_LIBS=" -llargeint -lws2_32 -lpdh -lnetapi32 -liphlpapi -lntdll -lintl" \
|
SYS_LIBS=" -llargeint -lws2_32 -lpdh -lnetapi32 -liphlpapi -lntdll -lintl" \
|
||||||
SMC_LIBS="" \
|
SMC_LIBS="" \
|
||||||
UNIXOBJS="" \
|
UNIXOBJS="" \
|
||||||
gkrellm
|
gkrellm
|
||||||
|
|
||||||
install: install_bin install_inc install_man
|
install: install_bin install_inc install_man
|
||||||
|
|
||||||
|
@ -320,14 +329,17 @@ pixops.o: pixops.c $(GKRELLM_H)
|
||||||
client.o: client.c $(GKRELLM_H)
|
client.o: client.c $(GKRELLM_H)
|
||||||
utils.o: utils.c $(GKRELLM_H)
|
utils.o: utils.c $(GKRELLM_H)
|
||||||
sysdeps-unix.o: sysdeps-unix.c $(GKRELLM_H_SYS) $(SYSDEPS_SRC)
|
sysdeps-unix.o: sysdeps-unix.c $(GKRELLM_H_SYS) $(SYSDEPS_SRC)
|
||||||
|
log.o: $(SHARED_PATH)/log.c $(SHARED_PATH)/log.h $(GKRELLM_H)
|
||||||
|
deprecated.o: deprecated.c $(GKRELLM_H)
|
||||||
|
|
||||||
winops-x11.o: winops-x11.c $(GKRELLM_H)
|
winops-x11.o: winops-x11.c $(GKRELLM_H)
|
||||||
winops-gtk-mac.o: winops-gtk-mac.c $(GKRELLM_H)
|
winops-gtk-mac.o: winops-gtk-mac.c $(GKRELLM_H)
|
||||||
deprecated.o: deprecated.c $(GKRELLM_H)
|
winops-win32.o: winops-win32.c $(GKRELLM_H)
|
||||||
sysdeps/win32.o: sysdeps/win32.c $(GKRELLM_H_SYS)
|
|
||||||
winops-win32.o: winops-win32.c $(GKRELLM_H)
|
|
||||||
win32-plugin.o: win32-plugin.c win32-plugin.h
|
win32-plugin.o: win32-plugin.c win32-plugin.h
|
||||||
win32-libgkrellm.o: win32-libgkrellm.c win32-plugin.h
|
win32-libgkrellm.o: win32-libgkrellm.c win32-plugin.h
|
||||||
win32-resource.o: win32-resource.rc win32-resource.h
|
win32-resource.o: win32-resource.rc win32-resource.h
|
||||||
windres -I.. -o win32-resource.o win32-resource.rc
|
windres -I.. -o win32-resource.o win32-resource.rc
|
||||||
|
|
||||||
libgkrellm.a: win32-libgkrellm.o
|
libgkrellm.a: win32-libgkrellm.o
|
||||||
ar -cr libgkrellm.a win32-libgkrellm.o
|
ar -cr libgkrellm.a win32-libgkrellm.o
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#if defined(HAVE_CONFIG_H)
|
#if defined(HAVE_CONFIG_H)
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
#if !defined(WIN32)
|
#if !defined(WIN32)
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
144
src/main.c
144
src/main.c
|
@ -22,6 +22,7 @@
|
||||||
#include "gkrellm.h"
|
#include "gkrellm.h"
|
||||||
#include "gkrellm-private.h"
|
#include "gkrellm-private.h"
|
||||||
#include "gkrellm-sysdeps.h"
|
#include "gkrellm-sysdeps.h"
|
||||||
|
#include "log-private.h"
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,4,0)
|
#if GTK_CHECK_VERSION(2,4,0)
|
||||||
#include "icon.xpm"
|
#include "icon.xpm"
|
||||||
|
@ -133,17 +134,15 @@ load_font(gchar *font_string, PangoFontDescription **gk_font,
|
||||||
|
|
||||||
if (font_string)
|
if (font_string)
|
||||||
font_desc = pango_font_description_from_string(font_string);
|
font_desc = pango_font_description_from_string(font_string);
|
||||||
if (_GK.debug_level & DEBUG_GUI)
|
gkrellm_debug(DEBUG_GUI, "load_font: %s %p\n", font_string, font_desc);
|
||||||
printf("load_font: %s %p\n", font_string, font_desc);
|
|
||||||
|
|
||||||
if (!font_desc)
|
if (!font_desc)
|
||||||
{
|
{
|
||||||
for (i = 0; !font_desc && i < N_FALLBACK_FONTS; ++i)
|
for (i = 0; !font_desc && i < N_FALLBACK_FONTS; ++i)
|
||||||
{
|
{
|
||||||
font_desc = pango_font_description_from_string(fallback_fonts[i]);
|
font_desc = pango_font_description_from_string(fallback_fonts[i]);
|
||||||
if (_GK.debug_level & DEBUG_GUI)
|
gkrellm_debug(DEBUG_GUI, "load_font trying fallback: %s\n",
|
||||||
printf("load_font trying fallback: %s\n",
|
fallback_fonts[i]);
|
||||||
fallback_fonts[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*gk_font)
|
if (*gk_font)
|
||||||
|
@ -222,7 +221,7 @@ setup_colors()
|
||||||
|
|
||||||
/* Set up the depth 1 GCs
|
/* Set up the depth 1 GCs
|
||||||
*/
|
*/
|
||||||
/* printf("white pixel = %ld\n", _GK.white_color.pixel); */
|
/* g_print("white pixel = %ld\n", _GK.white_color.pixel); */
|
||||||
if (_GK.bit1_GC == NULL)
|
if (_GK.bit1_GC == NULL)
|
||||||
{
|
{
|
||||||
GdkBitmap *dummy_bitmap;
|
GdkBitmap *dummy_bitmap;
|
||||||
|
@ -274,8 +273,7 @@ set_or_save_position(gint save)
|
||||||
y_last = _GK.y_position;
|
y_last = _GK.y_position;
|
||||||
fprintf(f, "%d %d\n", _GK.x_position, _GK.y_position);
|
fprintf(f, "%d %d\n", _GK.x_position, _GK.y_position);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
if (_GK.debug_level & DEBUG_POSITION)
|
gkrellm_debug(DEBUG_POSITION, "save_position: %d %d\n", x_last, y_last);
|
||||||
printf("save_position: %d %d\n", x_last, y_last);
|
|
||||||
}
|
}
|
||||||
save_position_countdown = 0;
|
save_position_countdown = 0;
|
||||||
}
|
}
|
||||||
|
@ -295,8 +293,7 @@ set_or_save_position(gint save)
|
||||||
_GK.y_position = y_last = y;
|
_GK.y_position = y_last = y;
|
||||||
_GK.position_valid = TRUE;
|
_GK.position_valid = TRUE;
|
||||||
gdk_window_move(gtree.window->window, x, y);
|
gdk_window_move(gtree.window->window, x, y);
|
||||||
if (_GK.debug_level & DEBUG_POSITION)
|
gkrellm_debug(DEBUG_POSITION, "startup_position moveto %d %d (valid)\n", x, y);
|
||||||
printf("startup_position moveto %d %d (valid)\n", x, y);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -602,8 +599,7 @@ top_frame_button_release(GtkWidget *widget, GdkEventButton *ev, gpointer data)
|
||||||
if (!no_transparency)
|
if (!no_transparency)
|
||||||
gkrellm_winop_apply_rootpixmap_transparency();
|
gkrellm_winop_apply_rootpixmap_transparency();
|
||||||
moving_gkrellm = FALSE;
|
moving_gkrellm = FALSE;
|
||||||
if (_GK.debug_level & DEBUG_POSITION)
|
gkrellm_debug(DEBUG_POSITION, "gkrellm moveto: x_pos=%d y_pos=%d\n",
|
||||||
printf("gkrellm moveto: x_pos=%d y_pos=%d\n",
|
|
||||||
_GK.x_position, _GK.y_position);
|
_GK.x_position, _GK.y_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1199,9 +1195,9 @@ gkrellm_pack_side_frames(void)
|
||||||
{
|
{
|
||||||
gdk_window_move(gtree.window->window,
|
gdk_window_move(gtree.window->window,
|
||||||
_GK.x_position, _GK.y_position);
|
_GK.x_position, _GK.y_position);
|
||||||
if (_GK.debug_level & DEBUG_POSITION)
|
gkrellm_debug(DEBUG_POSITION,
|
||||||
printf("pack moveto %d %d=y_position (y_gkrell=%d y_bot=%d)\n",
|
"pack moveto %d %d=y_position (y_gkrell=%d y_bot=%d)\n",
|
||||||
_GK.x_position, _GK.y_position, y_gkrell, y_bottom);
|
_GK.x_position, _GK.y_position, y_gkrell, y_bottom);
|
||||||
}
|
}
|
||||||
y_pack = -1;
|
y_pack = -1;
|
||||||
}
|
}
|
||||||
|
@ -1218,9 +1214,9 @@ gkrellm_pack_side_frames(void)
|
||||||
if (_GK.position_valid)
|
if (_GK.position_valid)
|
||||||
{
|
{
|
||||||
gdk_window_move(gtree.window->window, _GK.x_position, y_pack);
|
gdk_window_move(gtree.window->window, _GK.x_position, y_pack);
|
||||||
if (_GK.debug_level & DEBUG_POSITION)
|
gkrellm_debug(DEBUG_POSITION,
|
||||||
printf("pack moveto %d %d=y_pack (y_gkrell=%d y_bot=%d)\n",
|
"pack moveto %d %d=y_pack (y_gkrell=%d y_bot=%d)\n",
|
||||||
_GK.x_position, y_pack, y_gkrell, y_bottom);
|
_GK.x_position, y_pack, y_gkrell, y_bottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* If GKrellM bottom edge was <= screen bottom, then move to make
|
/* If GKrellM bottom edge was <= screen bottom, then move to make
|
||||||
|
@ -1233,9 +1229,9 @@ gkrellm_pack_side_frames(void)
|
||||||
if (_GK.position_valid)
|
if (_GK.position_valid)
|
||||||
{
|
{
|
||||||
gdk_window_move(gtree.window->window, _GK.x_position, y_pack);
|
gdk_window_move(gtree.window->window, _GK.x_position, y_pack);
|
||||||
if (_GK.debug_level & DEBUG_POSITION)
|
gkrellm_debug(DEBUG_POSITION,
|
||||||
printf("pack moveto %d %d=y_pack (y_gkrell=%d on_bottom)\n",
|
"pack moveto %d %d=y_pack (y_gkrell=%d on_bottom)\n",
|
||||||
_GK.x_position, y_pack, y_gkrell);
|
_GK.x_position, y_pack, y_gkrell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1293,8 +1289,8 @@ fix_edges()
|
||||||
gdk_window_move(gtree.window->window, x, y);
|
gdk_window_move(gtree.window->window, x, y);
|
||||||
if (y != _GK.y_position)
|
if (y != _GK.y_position)
|
||||||
y_pack = y;
|
y_pack = y;
|
||||||
if (_GK.debug_level & DEBUG_POSITION)
|
gkrellm_debug(DEBUG_POSITION,
|
||||||
printf("fix_edges: %d %d (y_pos=%d)\n", x, y, _GK.y_position);
|
"fix_edges: %d %d (y_pos=%d)\n", x, y, _GK.y_position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1319,7 +1315,7 @@ gkrellm_render_spacer(GkrellmSpacer *spacer, gint y_src, gint h_src,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (spacer->height > 0)
|
if (spacer->height > 0)
|
||||||
fprintf(stderr, "Bad image size for spacer or bg_chart.\n");
|
g_warning("Bad image size for spacer or bg_chart.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
piximage.border = spacer->piximage->border;
|
piximage.border = spacer->piximage->border;
|
||||||
|
@ -1673,12 +1669,16 @@ cb_configure_notify(GtkWidget *widget, GdkEventConfigure *ev, gpointer data)
|
||||||
if (y >= 0 && y < _GK.h_display - 5 && y != y_pack)
|
if (y >= 0 && y < _GK.h_display - 5 && y != y_pack)
|
||||||
_GK.y_position = y;
|
_GK.y_position = y;
|
||||||
_GK.position_valid = TRUE;
|
_GK.position_valid = TRUE;
|
||||||
if (!moving_gkrellm && (_GK.debug_level & DEBUG_POSITION))
|
if (!moving_gkrellm)
|
||||||
printf("configure-event: x_pos=%d y_pos=%d x=%d y=%d y_pack=%d\n",
|
gkrellm_debug(DEBUG_POSITION,
|
||||||
_GK.x_position, _GK.y_position, x, y, y_pack);
|
"configure-event: x_pos=%d y_pos=%d x=%d y=%d y_pack=%d\n",
|
||||||
|
_GK.x_position, _GK.y_position, x, y, y_pack);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gkrellm_debug(DEBUG_POSITION,
|
||||||
|
"locked configure-event: x=%d y=%d\n", x, y);
|
||||||
}
|
}
|
||||||
else if (_GK.debug_level & DEBUG_POSITION)
|
|
||||||
printf("locked configure-event: x=%d y=%d\n", x, y);
|
|
||||||
|
|
||||||
if (size_change || position_change)
|
if (size_change || position_change)
|
||||||
gkrellm_winop_update_struts();
|
gkrellm_winop_update_struts();
|
||||||
|
@ -1948,26 +1948,11 @@ load_builtin_monitors()
|
||||||
add_builtin(gkrellm_init_uptime_monitor());
|
add_builtin(gkrellm_init_uptime_monitor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
gkrellm_print(const gchar *string)
|
|
||||||
{
|
|
||||||
gchar *s;
|
|
||||||
|
|
||||||
s = g_locale_from_utf8(string, -1, NULL, NULL, NULL);
|
|
||||||
if (s)
|
|
||||||
{
|
|
||||||
fputs(s, stdout);
|
|
||||||
g_free(s);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fputs(string, stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gkrellm_exit(gint exit_code)
|
gkrellm_exit(gint exit_code)
|
||||||
{
|
{
|
||||||
gkrellm_sys_main_cleanup();
|
gkrellm_sys_main_cleanup();
|
||||||
|
gkrellm_log_cleanup();
|
||||||
exit(exit_code);
|
exit(exit_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2051,22 +2036,40 @@ main(gint argc, gchar **argv)
|
||||||
gint i;
|
gint i;
|
||||||
gchar *s;
|
gchar *s;
|
||||||
|
|
||||||
gkrellm_sys_main_init();
|
//gkrellm_sys_main_init();
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
gtk_set_locale();
|
gtk_set_locale();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_thread_init(NULL);
|
g_thread_init(NULL);
|
||||||
|
|
||||||
gtk_init(&argc, &argv); /* Will call gdk_init() */
|
gtk_init(&argc, &argv); /* Will call gdk_init() */
|
||||||
|
gkrellm_log_init();
|
||||||
gtk_widget_push_colormap(gdk_rgb_get_colormap());
|
gtk_widget_push_colormap(gdk_rgb_get_colormap());
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
#ifdef LOCALEDIR
|
#ifdef LOCALEDIR
|
||||||
|
#if defined(WIN32)
|
||||||
|
/*
|
||||||
|
Prepend app install path to relative locale dir, don't rely on CWD being correct
|
||||||
|
*/
|
||||||
|
if (!G_IS_DIR_SEPARATOR(LOCALEDIR[0]))
|
||||||
|
{
|
||||||
|
gchar* locale_dir;
|
||||||
|
locale_dir = g_win32_get_package_installation_subdirectory(NULL, NULL, LOCALEDIR);
|
||||||
|
if (locale_dir != NULL)
|
||||||
|
{
|
||||||
|
bindtextdomain(PACKAGE, locale_dir);
|
||||||
|
g_free(locale_dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||||
|
}
|
||||||
|
#else
|
||||||
bindtextdomain(PACKAGE, LOCALEDIR);
|
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||||
#endif
|
#endif /* !WIN32 */
|
||||||
|
#endif /* LOCALEDIR */
|
||||||
textdomain(PACKAGE);
|
textdomain(PACKAGE);
|
||||||
bind_textdomain_codeset(PACKAGE, "UTF-8");
|
bind_textdomain_codeset(PACKAGE, "UTF-8");
|
||||||
#endif /* ENABLE_NLS */
|
#endif /* ENABLE_NLS */
|
||||||
|
@ -2080,8 +2083,6 @@ main(gint argc, gchar **argv)
|
||||||
signal(SIGSEGV, gkrellm_abort);
|
signal(SIGSEGV, gkrellm_abort);
|
||||||
signal(SIGABRT, gkrellm_abort);
|
signal(SIGABRT, gkrellm_abort);
|
||||||
|
|
||||||
g_set_print_handler(gkrellm_print);
|
|
||||||
|
|
||||||
for (i = 1; i < argc; ++i)
|
for (i = 1; i < argc; ++i)
|
||||||
{
|
{
|
||||||
s = argv[i];
|
s = argv[i];
|
||||||
|
@ -2128,6 +2129,8 @@ main(gint argc, gchar **argv)
|
||||||
_GK.no_config = TRUE;
|
_GK.no_config = TRUE;
|
||||||
else if ((!strcmp(s, "debug-level") || !strcmp(s, "d")) && i < argc-1)
|
else if ((!strcmp(s, "debug-level") || !strcmp(s, "d")) && i < argc-1)
|
||||||
_GK.debug_level = (gint) strtoul(argv[++i], NULL, 0);
|
_GK.debug_level = (gint) strtoul(argv[++i], NULL, 0);
|
||||||
|
else if ((!strcmp(s, "logfile") || !strcmp(s, "l")) && i < argc-1)
|
||||||
|
gkrellm_log_set_filename(argv[++i]);
|
||||||
else if (!strncmp(s, "debug", 5))
|
else if (!strncmp(s, "debug", 5))
|
||||||
{
|
{
|
||||||
if (s[5] != '\0')
|
if (s[5] != '\0')
|
||||||
|
@ -2150,7 +2153,7 @@ main(gint argc, gchar **argv)
|
||||||
_GK.test += 1;
|
_GK.test += 1;
|
||||||
else if (!strcmp(s, "version") || !strcmp(s, "v"))
|
else if (!strcmp(s, "version") || !strcmp(s, "v"))
|
||||||
{
|
{
|
||||||
printf("%s %d.%d.%d%s\n", PACKAGE, GKRELLM_VERSION_MAJOR,
|
g_print("%s %d.%d.%d%s\n", PACKAGE, GKRELLM_VERSION_MAJOR,
|
||||||
GKRELLM_VERSION_MINOR, GKRELLM_VERSION_REV,
|
GKRELLM_VERSION_MINOR, GKRELLM_VERSION_REV,
|
||||||
GKRELLM_EXTRAVERSION);
|
GKRELLM_EXTRAVERSION);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -2168,12 +2171,14 @@ main(gint argc, gchar **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gkrellm_sys_main_init(); //FIXME: call this later or earlier?
|
||||||
|
|
||||||
_GK.w_display = gdk_screen_get_width(gdk_screen_get_default());
|
_GK.w_display = gdk_screen_get_width(gdk_screen_get_default());
|
||||||
_GK.h_display = gdk_screen_get_height(gdk_screen_get_default());
|
_GK.h_display = gdk_screen_get_height(gdk_screen_get_default());
|
||||||
|
|
||||||
if (_GK.debug_level)
|
if (_GK.debug_level > 0)
|
||||||
printf("--- GKrellM %d.%d.%d ---\n", GKRELLM_VERSION_MAJOR,
|
g_debug("--- GKrellM %d.%d.%d ---\n", GKRELLM_VERSION_MAJOR,
|
||||||
GKRELLM_VERSION_MINOR, GKRELLM_VERSION_REV);
|
GKRELLM_VERSION_MINOR, GKRELLM_VERSION_REV);
|
||||||
if (_GK.server && !gkrellm_client_mode_connect())
|
if (_GK.server && !gkrellm_client_mode_connect())
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
|
@ -2252,33 +2257,10 @@ main(gint argc, gchar **argv)
|
||||||
|
|
||||||
gkrellm_start_timer(_GK.update_HZ);
|
gkrellm_start_timer(_GK.update_HZ);
|
||||||
setup_signal_handler();
|
setup_signal_handler();
|
||||||
gtk_main ();
|
gtk_main();
|
||||||
|
|
||||||
gkrellm_save_all();
|
gkrellm_save_all();
|
||||||
gkrellm_exit(0);
|
gkrellm_exit(0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(WIN32) && defined(_WINDOWS)
|
|
||||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
|
||||||
HINSTANCE hPrevInstance,
|
|
||||||
LPSTR lpCmdLine,
|
|
||||||
int nCmdShow)
|
|
||||||
{
|
|
||||||
int argc;
|
|
||||||
gint i, ret;
|
|
||||||
gchar *s, *sm;
|
|
||||||
gchar **argv;
|
|
||||||
gchar *cmd;
|
|
||||||
|
|
||||||
// need to get exe too
|
|
||||||
cmd = GetCommandLine();
|
|
||||||
g_shell_parse_argv(cmd, &argc, &argv, NULL);
|
|
||||||
|
|
||||||
ret = main(argc, argv);
|
|
||||||
g_strfreev(argv);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,15 @@
|
||||||
#include "sysdeps/gtop.c"
|
#include "sysdeps/gtop.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/utsname.h>
|
#if defined(WIN32)
|
||||||
|
#include "sysdeps/win32.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef SENSORS_COMMON
|
#if !defined(WIN32)
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(SENSORS_COMMON) && !defined(WIN32)
|
||||||
static gboolean (*mbmon_check_func)();
|
static gboolean (*mbmon_check_func)();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -86,6 +92,7 @@ gkrellm_sys_get_host_name(void)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(WIN32)
|
||||||
gchar *
|
gchar *
|
||||||
gkrellm_sys_get_system_name(void)
|
gkrellm_sys_get_system_name(void)
|
||||||
{
|
{
|
||||||
|
@ -98,12 +105,13 @@ gkrellm_sys_get_system_name(void)
|
||||||
sname = g_strdup("unknown name");
|
sname = g_strdup("unknown name");
|
||||||
return sname;
|
return sname;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gkrellm_sys_sensors_mbmon_port_change(gint port)
|
gkrellm_sys_sensors_mbmon_port_change(gint port)
|
||||||
{
|
{
|
||||||
gboolean result = FALSE;
|
gboolean result = FALSE;
|
||||||
|
#if !defined(WIN32)
|
||||||
_GK.mbmon_port = port;
|
_GK.mbmon_port = port;
|
||||||
|
|
||||||
/* mbmon_check_func will be set if sysdep code has included
|
/* mbmon_check_func will be set if sysdep code has included
|
||||||
|
@ -116,11 +124,16 @@ gkrellm_sys_sensors_mbmon_port_change(gint port)
|
||||||
gkrellm_sensors_model_update();
|
gkrellm_sensors_model_update();
|
||||||
gkrellm_sensors_rebuild(TRUE, TRUE, TRUE);
|
gkrellm_sensors_rebuild(TRUE, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gkrellm_sys_sensors_mbmon_supported(void)
|
gkrellm_sys_sensors_mbmon_supported(void)
|
||||||
{
|
{
|
||||||
|
#if !defined(WIN32)
|
||||||
return mbmon_check_func ? TRUE : FALSE;
|
return mbmon_check_func ? TRUE : FALSE;
|
||||||
|
#else
|
||||||
|
return FALSE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
2754
src/sysdeps/win32.c
2754
src/sysdeps/win32.c
File diff suppressed because it is too large
Load Diff
|
@ -24,234 +24,157 @@
|
||||||
#include "win32-resource.h"
|
#include "win32-resource.h"
|
||||||
#include <gdk/gdkwin32.h>
|
#include <gdk/gdkwin32.h>
|
||||||
|
|
||||||
static UINT WM_GKRELLMCALLBACK;
|
|
||||||
static WNDPROC oldWndProc = 0;
|
|
||||||
static GdkGC *trans_gc = NULL;
|
static GdkGC *trans_gc = NULL;
|
||||||
static GdkColor trans_color;
|
static GdkColor trans_color;
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
void gkrellm_winop_reset(void)
|
gkrellm_winop_reset(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
LRESULT CALLBACK newWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
gkrellm_winop_options(gint argc, gchar **argv)
|
||||||
{
|
|
||||||
if (Msg == WM_GKRELLMCALLBACK)
|
|
||||||
{
|
{
|
||||||
if (lParam == WM_LBUTTONUP)
|
|
||||||
SetForegroundWindow(GDK_WINDOW_HWND(gkrellm_get_top_window()->window));
|
|
||||||
else if (lParam == WM_RBUTTONUP)
|
|
||||||
gkrellm_menu_popup();
|
|
||||||
}
|
|
||||||
/*else if (Msg == WM_SIZE && _GK.withdrawn)
|
|
||||||
{
|
|
||||||
HWND slitHwnd = FindWindowEx(NULL, NULL, "BControl", "BSlitWindow");
|
|
||||||
if (slitHwnd != NULL)
|
|
||||||
PostMessage(slitHwnd, BM_SLITMESSAGE, BSM_UPDATEPOSITIONS, 0);
|
|
||||||
InvalidateRgn(GDK_WINDOW_HWND(gkrellm_get_top_window()->window), NULL, FALSE);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return CallWindowProc(oldWndProc, hWnd, Msg, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gkrellm_winop_options(gint argc, gchar **argv)
|
|
||||||
{
|
|
||||||
NOTIFYICONDATA nid;
|
|
||||||
HWND hWnd = GDK_WINDOW_HWND(gkrellm_get_top_window()->window);
|
HWND hWnd = GDK_WINDOW_HWND(gkrellm_get_top_window()->window);
|
||||||
|
|
||||||
// get gtk window procedure and set new one
|
|
||||||
oldWndProc = (WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC);
|
|
||||||
SetWindowLong(hWnd, GWL_WNDPROC, (LONG)newWndProc);
|
|
||||||
|
|
||||||
// Get rid of task list icon
|
// Get rid of task list icon
|
||||||
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
|
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
|
||||||
|
|
||||||
// Create System Tray Icon
|
// Set stay-on-top flag if requested
|
||||||
WM_GKRELLMCALLBACK = RegisterWindowMessage(TEXT("GKrellMCallback"));
|
|
||||||
|
|
||||||
nid.cbSize = sizeof(NOTIFYICONDATA);
|
|
||||||
nid.hWnd = hWnd;
|
|
||||||
nid.uID = 1;
|
|
||||||
nid.uFlags = (NIF_ICON | NIF_TIP | NIF_MESSAGE);
|
|
||||||
nid.uCallbackMessage = WM_GKRELLMCALLBACK;
|
|
||||||
|
|
||||||
strcpy(nid.szTip, g_locale_from_utf8(_("GKrellM for Windows"), -1, NULL, NULL, NULL));
|
|
||||||
|
|
||||||
nid.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON3));
|
|
||||||
Shell_NotifyIcon(NIM_ADD, &nid);
|
|
||||||
|
|
||||||
if (_GK.on_top)
|
if (_GK.on_top)
|
||||||
{
|
|
||||||
// set stay on top flag if requested
|
|
||||||
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||||
}
|
|
||||||
|
|
||||||
/*if (_GK.withdrawn)
|
|
||||||
{
|
|
||||||
// put in slit in bluebox
|
|
||||||
HWND slithWnd = FindWindowEx(NULL, NULL, "BControl", "BSlitWindow");
|
|
||||||
SetProp(hWnd, "BSlitControl", (HANDLE)1);
|
|
||||||
|
|
||||||
if (IsWindow(slithWnd))
|
|
||||||
{
|
|
||||||
SendMessage(slithWnd, BM_SLITMESSAGE, BSM_ADDWINDOW, (LPARAM) hWnd);
|
|
||||||
SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
|
||||||
gdk_window_move(gkrellm_get_top_window()->window, 0, 0);
|
|
||||||
_GK.x_position = 0;
|
|
||||||
_GK.y_position = 0;
|
|
||||||
_GK.position_valid = TRUE;
|
|
||||||
|
|
||||||
SetWindowLong(hWnd, GWL_USERDATA, 0x49474541);
|
|
||||||
|
|
||||||
PostMessage(slithWnd, BM_SLITMESSAGE, BSM_UPDATEPOSITIONS, 0);
|
|
||||||
InvalidateRgn(hWnd, NULL, FALSE);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void gkrellm_winop_withdrawn(void)
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void gkrellm_winop_place_gkrellm(gchar *geom)
|
void
|
||||||
{
|
gkrellm_winop_withdrawn(void)
|
||||||
gint newX = _GK.x_position;
|
{
|
||||||
gint newY = _GK.y_position;
|
}
|
||||||
|
|
||||||
// parse the command line
|
void
|
||||||
// +x+y or -x+y or +x-y or -x-y
|
gkrellm_winop_place_gkrellm(gchar *geom)
|
||||||
|
{
|
||||||
|
gint newX = _GK.x_position;
|
||||||
|
gint newY = _GK.y_position;
|
||||||
|
|
||||||
gint startx = -1, starty = -1, endx = -1, endy = -1;
|
// parse the command line
|
||||||
gint w_gkrell, h_gkrell;
|
// +x+y or -x+y or +x-y or -x-y
|
||||||
gint stringSize = strlen(geom);
|
|
||||||
gint i;
|
gint startx = -1, starty = -1, endx = -1, endy = -1;
|
||||||
gint xsign = 1, ysign = 1;
|
gint w_gkrell, h_gkrell;
|
||||||
gchar* part;
|
gint stringSize = strlen(geom);
|
||||||
|
gint i;
|
||||||
|
gint xsign = 1, ysign = 1;
|
||||||
|
gchar* part;
|
||||||
|
|
||||||
for (i = 0; i < stringSize; i++)
|
for (i = 0; i < stringSize; i++)
|
||||||
{
|
|
||||||
if (geom[i] != '+' && geom[i] != '-')
|
|
||||||
{
|
{
|
||||||
|
if (geom[i] != '+' && geom[i] != '-')
|
||||||
|
{
|
||||||
if (startx == -1)
|
if (startx == -1)
|
||||||
{
|
startx = i;
|
||||||
startx = i;
|
|
||||||
}
|
|
||||||
if (starty == -1 && endx != -1)
|
if (starty == -1 && endx != -1)
|
||||||
{
|
starty = i;
|
||||||
starty = i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (startx != -1 && endx == -1)
|
|
||||||
{
|
{
|
||||||
endx = i - 1;
|
if (startx != -1 && endx == -1)
|
||||||
if (geom[i] == '-')
|
|
||||||
{
|
{
|
||||||
xsign = -1;
|
endx = i - 1;
|
||||||
}
|
if (geom[i] == '-')
|
||||||
|
xsign = -1;
|
||||||
}
|
}
|
||||||
if (starty != -1 && endy == -1)
|
if (starty != -1 && endy == -1)
|
||||||
{
|
|
||||||
endy = i - 1;
|
|
||||||
if (geom[i] == '-')
|
|
||||||
{
|
{
|
||||||
ysign = -1;
|
endy = i - 1;
|
||||||
}
|
if (geom[i] == '-')
|
||||||
|
ysign = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (starty != -1 && endy == -1)
|
if (starty != -1 && endy == -1)
|
||||||
{
|
endy = stringSize - 1;
|
||||||
endy = stringSize - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
w_gkrell = _GK.chart_width + _GK.frame_left_width + _GK.frame_right_width;
|
w_gkrell = _GK.chart_width + _GK.frame_left_width + _GK.frame_right_width;
|
||||||
h_gkrell = _GK.monitor_height + _GK.total_frame_height;
|
h_gkrell = _GK.monitor_height + _GK.total_frame_height;
|
||||||
|
|
||||||
if (startx >= 0 && startx <= endx && endx >= 0)
|
if (startx >= 0 && startx <= endx && endx >= 0)
|
||||||
{
|
{
|
||||||
part = malloc(sizeof(gchar) * (endx - startx + 1 + 1));
|
part = malloc(sizeof(gchar) * (endx - startx + 1 + 1));
|
||||||
for (i = 0; i < endx - startx + 1; i++)
|
for (i = 0; i < endx - startx + 1; i++)
|
||||||
{
|
part[i] = geom[i + startx];
|
||||||
part[i] = geom[i + startx];
|
part[i] = '\0';
|
||||||
}
|
newX = atoi(part);
|
||||||
part[i] = '\0';
|
|
||||||
newX = atoi(part);
|
|
||||||
if (xsign == -1)
|
if (xsign == -1)
|
||||||
{
|
newX = _GK.w_display - w_gkrell + newX;
|
||||||
newX = _GK.w_display - w_gkrell + newX;
|
free(part);
|
||||||
}
|
|
||||||
free(part);
|
|
||||||
}
|
|
||||||
if (starty >= 0 && starty <= endy && endy >= 0)
|
|
||||||
{
|
|
||||||
part = malloc(sizeof(gchar) * (endy - starty + 1 + 1));
|
|
||||||
for (i = 0; i < endy - starty + 1; i++)
|
|
||||||
{
|
|
||||||
part[i] = geom[i + starty];
|
|
||||||
}
|
|
||||||
part[i] = '\0';
|
|
||||||
newY = atoi(part);
|
|
||||||
if (ysign == -1)
|
|
||||||
{
|
|
||||||
newY = _GK.h_display - h_gkrell + newY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newX >= 0 && newX < _GK.w_display - 10
|
if (starty >= 0 && starty <= endy && endy >= 0)
|
||||||
&& newY >= 0 && newY < _GK.h_display - 25)
|
{
|
||||||
{
|
part = malloc(sizeof(gchar) * (endy - starty + 1 + 1));
|
||||||
gdk_window_move(gkrellm_get_top_window()->window, newX, newY);
|
for (i = 0; i < endy - starty + 1; i++)
|
||||||
_GK.y_position = newY;
|
part[i] = geom[i + starty];
|
||||||
_GK.x_position = newX;
|
part[i] = '\0';
|
||||||
|
newY = atoi(part);
|
||||||
|
if (ysign == -1)
|
||||||
|
newY = _GK.h_display - h_gkrell + newY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( newX >= 0 && newX < _GK.w_display - 10
|
||||||
|
&& newY >= 0 && newY < _GK.h_display - 25)
|
||||||
|
{
|
||||||
|
gdk_window_move(gkrellm_get_top_window()->window, newX, newY);
|
||||||
|
_GK.y_position = newY;
|
||||||
|
_GK.x_position = newX;
|
||||||
|
}
|
||||||
|
|
||||||
_GK.position_valid = TRUE;
|
_GK.position_valid = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gkrellm_winop_flush_motion_events(void)
|
void
|
||||||
|
gkrellm_winop_flush_motion_events(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean gkrellm_winop_updated_background(void)
|
gboolean
|
||||||
|
gkrellm_winop_updated_background(void)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gkrellm_winop_update_struts(void)
|
void
|
||||||
|
gkrellm_winop_update_struts(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
gboolean gkrellm_winop_draw_rootpixmap_onto_transparent_chart(GkrellmChart *p)
|
gkrellm_winop_draw_rootpixmap_onto_transparent_chart(GkrellmChart *p)
|
||||||
{
|
{
|
||||||
if (!p->transparency || !p->drawing_area || !p->drawing_area->window || trans_gc == NULL)
|
if (!p->transparency || !p->drawing_area || !p->drawing_area->window || !trans_gc)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Fill the panel with transparency color
|
// Fill the panel with transparency color
|
||||||
gdk_draw_rectangle(p->bg_src_pixmap, trans_gc, TRUE, 0, 0, p->w, p->h);
|
gdk_draw_rectangle(p->bg_src_pixmap, trans_gc, TRUE, 0, 0, p->w, p->h);
|
||||||
|
|
||||||
// If mode permits, stencil on non transparent parts of bg_clean_pixmap.
|
// If mode permits, stencil on non transparent parts of bg_clean_pixmap.
|
||||||
if (p->transparency == 2 && p->bg_mask)
|
if (p->transparency == 2 && p->bg_mask)
|
||||||
{
|
{
|
||||||
gdk_gc_set_clip_mask(_GK.text_GC, p->bg_mask);
|
gdk_gc_set_clip_mask(_GK.text_GC, p->bg_mask);
|
||||||
gdk_draw_drawable(p->bg_src_pixmap, _GK.text_GC, p->bg_clean_pixmap, 0, 0, 0, 0, p->w, p->h);
|
gdk_draw_drawable(p->bg_src_pixmap, _GK.text_GC, p->bg_clean_pixmap,
|
||||||
}
|
0, 0, 0, 0, p->w, p->h);
|
||||||
|
}
|
||||||
|
|
||||||
gdk_gc_set_clip_mask(_GK.text_GC, NULL);
|
gdk_gc_set_clip_mask(_GK.text_GC, NULL);
|
||||||
p->bg_sequence_id += 1;
|
p->bg_sequence_id += 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gkrellm_winop_draw_rootpixmap_onto_transparent_panel(GkrellmPanel *p)
|
||||||
gboolean gkrellm_winop_draw_rootpixmap_onto_transparent_panel(GkrellmPanel *p)
|
|
||||||
{
|
{
|
||||||
if (!p->transparency || !p->drawing_area || !p->drawing_area->window || trans_gc == NULL)
|
if (!p->transparency || !p->drawing_area || !p->drawing_area->window || !trans_gc)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
gdk_gc_set_fill(trans_gc, GDK_SOLID);
|
gdk_gc_set_fill(trans_gc, GDK_SOLID);
|
||||||
|
@ -262,16 +185,17 @@ gboolean gkrellm_winop_draw_rootpixmap_onto_transparent_panel(GkrellmPanel *p)
|
||||||
|
|
||||||
// If mode permits, stencil on non transparent parts of bg_clean_pixmap.
|
// If mode permits, stencil on non transparent parts of bg_clean_pixmap.
|
||||||
if (p->transparency == 2 && p->bg_mask)
|
if (p->transparency == 2 && p->bg_mask)
|
||||||
{
|
{
|
||||||
gdk_gc_set_clip_mask(_GK.text_GC, p->bg_mask);
|
gdk_gc_set_clip_mask(_GK.text_GC, p->bg_mask);
|
||||||
gdk_draw_drawable(p->bg_pixmap, _GK.text_GC, p->bg_clean_pixmap, 0, 0, 0, 0, p->w, p->h);
|
gdk_draw_drawable(p->bg_pixmap, _GK.text_GC, p->bg_clean_pixmap,
|
||||||
|
0, 0, 0, 0, p->w, p->h);
|
||||||
gdk_gc_set_clip_mask(_GK.text_GC, NULL);
|
gdk_gc_set_clip_mask(_GK.text_GC, NULL);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
static void draw_rootpixmap_onto_transparent_spacers(GkrellmMonitor *mon)
|
draw_rootpixmap_onto_transparent_spacers(GkrellmMonitor *mon)
|
||||||
{
|
{
|
||||||
GkrellmMonprivate *mp = mon->privat;
|
GkrellmMonprivate *mp = mon->privat;
|
||||||
|
|
||||||
|
@ -312,35 +236,35 @@ static void draw_rootpixmap_onto_transparent_spacers(GkrellmMonitor *mon)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void gkrellm_winop_apply_rootpixmap_transparency(void)
|
gkrellm_winop_apply_rootpixmap_transparency(void)
|
||||||
{
|
{
|
||||||
static gboolean isTransparent = FALSE;
|
static gboolean isTransparent = FALSE;
|
||||||
|
|
||||||
GList *list;
|
GList *list;
|
||||||
GkrellmChart *cp;
|
GkrellmChart *cp;
|
||||||
GkrellmPanel *p;
|
GkrellmPanel *p;
|
||||||
HWND w;
|
HWND w;
|
||||||
|
|
||||||
w = GDK_WINDOW_HWND(gkrellm_get_top_window()->window);
|
w = GDK_WINDOW_HWND(gkrellm_get_top_window()->window);
|
||||||
if (!_GK.any_transparency && isTransparent)
|
if (!_GK.any_transparency && isTransparent)
|
||||||
{ // make opaque
|
{ // make opaque
|
||||||
SetWindowLong(w, GWL_EXSTYLE, GetWindowLong(w, GWL_EXSTYLE) & ~WS_EX_LAYERED);
|
SetWindowLong(w, GWL_EXSTYLE, GetWindowLong(w, GWL_EXSTYLE) & ~WS_EX_LAYERED);
|
||||||
isTransparent = FALSE;
|
isTransparent = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (_GK.any_transparency && !isTransparent)
|
else if (_GK.any_transparency && !isTransparent)
|
||||||
{ // make transparent
|
{ // make transparent
|
||||||
if (trans_gc == NULL)
|
if (trans_gc == NULL)
|
||||||
{
|
{
|
||||||
GdkColormap *cm = gtk_widget_get_colormap(gkrellm_get_top_window());
|
GdkColormap *cm = gtk_widget_get_colormap(gkrellm_get_top_window());
|
||||||
|
|
||||||
trans_gc = gdk_gc_new(gkrellm_get_top_window()->window);
|
trans_gc = gdk_gc_new(gkrellm_get_top_window()->window);
|
||||||
if (trans_gc == NULL)
|
if (trans_gc == NULL)
|
||||||
{
|
{
|
||||||
printf("ERROR: could not create trans_gc!\n");
|
g_warning("Could not create trans_gc!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_gc_copy(trans_gc, _GK.draw1_GC);
|
gdk_gc_copy(trans_gc, _GK.draw1_GC);
|
||||||
gdk_gc_set_fill(trans_gc, GDK_SOLID);
|
gdk_gc_set_fill(trans_gc, GDK_SOLID);
|
||||||
|
@ -350,65 +274,64 @@ void gkrellm_winop_apply_rootpixmap_transparency(void)
|
||||||
trans_color.blue = 65535;
|
trans_color.blue = 65535;
|
||||||
|
|
||||||
if (!gdk_colormap_alloc_color(cm , &trans_color, FALSE, TRUE))
|
if (!gdk_colormap_alloc_color(cm , &trans_color, FALSE, TRUE))
|
||||||
{
|
{
|
||||||
printf("ERROR: could not allocate trans_color!\n");
|
g_warning("Could not allocate trans_color!\n");
|
||||||
g_object_unref(trans_gc);
|
g_object_unref(trans_gc);
|
||||||
trans_gc = NULL;
|
trans_gc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_gc_set_foreground(trans_gc, &trans_color);
|
gdk_gc_set_foreground(trans_gc, &trans_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetWindowLong(w, GWL_EXSTYLE, GetWindowLong(w, GWL_EXSTYLE) | WS_EX_LAYERED);
|
SetWindowLong(w, GWL_EXSTYLE, GetWindowLong(w, GWL_EXSTYLE) | WS_EX_LAYERED);
|
||||||
SetLayeredWindowAttributes(w, RGB(255, 0, 255), 0, LWA_COLORKEY);
|
SetLayeredWindowAttributes(w, RGB(255, 0, 255), 0, LWA_COLORKEY);
|
||||||
isTransparent = TRUE;
|
isTransparent = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isTransparent)
|
if (isTransparent)
|
||||||
{
|
|
||||||
for (list = gkrellm_get_chart_list(); list; list = list->next)
|
|
||||||
{
|
{
|
||||||
|
for (list = gkrellm_get_chart_list(); list; list = list->next)
|
||||||
|
{
|
||||||
cp = (GkrellmChart *) list->data;
|
cp = (GkrellmChart *) list->data;
|
||||||
if (!cp->transparency || !cp->shown)
|
if (!cp->transparency || !cp->shown)
|
||||||
continue;
|
continue;
|
||||||
gkrellm_winop_draw_rootpixmap_onto_transparent_chart(cp);
|
gkrellm_winop_draw_rootpixmap_onto_transparent_chart(cp);
|
||||||
gkrellm_refresh_chart(cp);
|
gkrellm_refresh_chart(cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (list = gkrellm_get_panel_list(); list; list = list->next)
|
for (list = gkrellm_get_panel_list(); list; list = list->next)
|
||||||
{
|
{
|
||||||
p = (GkrellmPanel *) list->data;
|
p = (GkrellmPanel *) list->data;
|
||||||
if (!p->transparency || !p->shown)
|
if (!p->transparency || !p->shown)
|
||||||
continue;
|
continue;
|
||||||
gkrellm_draw_panel_label(p);
|
gkrellm_draw_panel_label(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (list = gkrellm_monitor_list; list; list = list->next)
|
for (list = gkrellm_monitor_list; list; list = list->next)
|
||||||
{
|
{
|
||||||
draw_rootpixmap_onto_transparent_spacers((GkrellmMonitor *)list->data);
|
draw_rootpixmap_onto_transparent_spacers((GkrellmMonitor *)list->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_gc_set_clip_mask(_GK.text_GC, NULL);
|
gdk_gc_set_clip_mask(_GK.text_GC, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void gkrellm_winop_state_skip_taskbar(gboolean state)
|
gkrellm_winop_state_skip_taskbar(gboolean state)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void gkrellm_winop_state_skip_pager(gboolean state)
|
gkrellm_winop_state_skip_pager(gboolean state)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void gkrellm_winop_state_above(gboolean state)
|
void
|
||||||
|
gkrellm_winop_state_above(gboolean state)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void gkrellm_winop_state_below(gboolean state)
|
gkrellm_winop_state_below(gboolean state)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue