diff options
author | Daniel Kamil Kozar <dkk089@gmail.com> | 2017-11-16 01:44:46 +0100 |
---|---|---|
committer | Daniel Kamil Kozar <dkk089@gmail.com> | 2017-11-16 01:44:46 +0100 |
commit | b665b5a83938814429c9dc69b20af157b8df88bf (patch) | |
tree | 430c87cd88812a0ef6c6e737ec31871fb6ec2587 | |
parent | eeb7e2ce538bb486e1f5222d838befae540d8872 (diff) | |
download | pidgin-b665b5a83938814429c9dc69b20af157b8df88bf.tar.gz |
Port transparency plugin from WinAPI to GTK. Fixes #3124
-rw-r--r-- | pidgin/plugins/Makefile.am | 4 | ||||
-rw-r--r-- | pidgin/plugins/Makefile.mingw | 5 | ||||
-rw-r--r-- | pidgin/plugins/transparency.c (renamed from pidgin/plugins/win32/transparency/win2ktrans.c) | 52 | ||||
-rw-r--r-- | pidgin/plugins/win32/transparency/Makefile.mingw | 75 |
4 files changed, 22 insertions, 114 deletions
diff --git a/pidgin/plugins/Makefile.am b/pidgin/plugins/Makefile.am index 3bb8c22402..bdf7a337d0 100644 --- a/pidgin/plugins/Makefile.am +++ b/pidgin/plugins/Makefile.am @@ -47,6 +47,7 @@ spellchk_la_LDFLAGS = -module -avoid-version themeedit_la_LDFLAGS = -module -avoid-version timestamp_la_LDFLAGS = -module -avoid-version timestamp_format_la_LDFLAGS = -module -avoid-version +transparency_la_LDFLAGS = -module -avoid-version unity_la_LDFLAGS = -module -avoid-version vvconfig_la_LDFLAGS = -module -avoid-version xmppconsole_la_LDFLAGS = -module -avoid-version @@ -68,6 +69,7 @@ plugin_LTLIBRARIES = \ themeedit.la \ timestamp.la \ timestamp_format.la \ + transparency.la \ xmppconsole.la if USE_VV @@ -98,6 +100,7 @@ spellchk_la_SOURCES = spellchk.c themeedit_la_SOURCES = themeedit.c themeedit-icon.c themeedit-icon.h timestamp_la_SOURCES = timestamp.c timestamp_format_la_SOURCES = timestamp_format.c +transparency_la_SOURCES = transparency.c unity_la_SOURCES = unity.c vvconfig_la_SOURCES = vvconfig.c xmppconsole_la_SOURCES = xmppconsole.c @@ -118,6 +121,7 @@ spellchk_la_LIBADD = $(GTK_LIBS) themeedit_la_LIBADD = $(GTK_LIBS) timestamp_la_LIBADD = $(GTK_LIBS) timestamp_format_la_LIBADD = $(GTK_LIBS) +transparency_la_LIBADD = $(GTK_LIBS) unity_la_LIBADD = $(GTK_LIBS) $(UNITY_LIBS) vvconfig_la_LIBADD = $(GTK_LIBS) $(GSTREAMER_LIBS) xmppconsole_la_LIBADD = $(GTK_LIBS) diff --git a/pidgin/plugins/Makefile.mingw b/pidgin/plugins/Makefile.mingw index f16f9f506d..22984d31f5 100644 --- a/pidgin/plugins/Makefile.mingw +++ b/pidgin/plugins/Makefile.mingw @@ -10,7 +10,6 @@ include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak DISCO_PLUGIN := ./disco GTKPERL_PLUGIN := ./perl TICKER_PLUGIN := ./ticker -TRANSPARENCY_PLUGIN := ./win32/transparency WINPREFS_PLUGIN := ./win32/winprefs .SUFFIXES: @@ -63,14 +62,12 @@ all: plugins $(MAKE) -C $(DISCO_PLUGIN) -f $(MINGW_MAKEFILE) $(MAKE) -C $(GTKPERL_PLUGIN) -f $(MINGW_MAKEFILE) $(MAKE) -C $(TICKER_PLUGIN) -f $(MINGW_MAKEFILE) - $(MAKE) -C $(TRANSPARENCY_PLUGIN) -f $(MINGW_MAKEFILE) $(MAKE) -C $(WINPREFS_PLUGIN) -f $(MINGW_MAKEFILE) install: all $(PIDGIN_INSTALL_PLUGINS_DIR) $(MAKE) -C $(DISCO_PLUGIN) -f $(MINGW_MAKEFILE) install $(MAKE) -C $(GTKPERL_PLUGIN) -f $(MINGW_MAKEFILE) install $(MAKE) -C $(TICKER_PLUGIN) -f $(MINGW_MAKEFILE) install - $(MAKE) -C $(TRANSPARENCY_PLUGIN) -f $(MINGW_MAKEFILE) install $(MAKE) -C $(WINPREFS_PLUGIN) -f $(MINGW_MAKEFILE) install cp *.dll $(PIDGIN_INSTALL_PLUGINS_DIR) @@ -102,6 +99,7 @@ plugins: \ themeedit.dll \ timestamp_format.dll \ timestamp.dll \ + transparency.dll \ xmppconsole.dll ## @@ -112,7 +110,6 @@ clean: $(MAKE) -C $(DISCO_PLUGIN) -f $(MINGW_MAKEFILE) clean $(MAKE) -C $(GTKPERL_PLUGIN) -f $(MINGW_MAKEFILE) clean $(MAKE) -C $(TICKER_PLUGIN) -f $(MINGW_MAKEFILE) clean - $(MAKE) -C $(TRANSPARENCY_PLUGIN) -f $(MINGW_MAKEFILE) clean $(MAKE) -C $(WINPREFS_PLUGIN) -f $(MINGW_MAKEFILE) clean include $(PIDGIN_COMMON_TARGETS) diff --git a/pidgin/plugins/win32/transparency/win2ktrans.c b/pidgin/plugins/transparency.c index 3fc80e7064..1c74e7f3a7 100644 --- a/pidgin/plugins/win32/transparency/win2ktrans.c +++ b/pidgin/plugins/transparency.c @@ -21,7 +21,6 @@ * 02111-1301, USA. * */ -#include <gdk/gdkwin32.h> #include "internal.h" #include "core.h" @@ -58,15 +57,15 @@ typedef struct { /* * LOCALS */ -static const char *OPT_WINTRANS_IM_ENABLED= "/plugins/gtk/win32/wintrans/im_enabled"; -static const char *OPT_WINTRANS_IM_ALPHA = "/plugins/gtk/win32/wintrans/im_alpha"; -static const char *OPT_WINTRANS_IM_SLIDER = "/plugins/gtk/win32/wintrans/im_slider"; -static const char *OPT_WINTRANS_IM_ONFOCUS= "/plugins/gtk/win32/wintrans/im_solid_onfocus"; -static const char *OPT_WINTRANS_IM_ONTOP = "/plugins/gtk/win32/wintrans/im_always_on_top"; -static const char *OPT_WINTRANS_BL_ENABLED= "/plugins/gtk/win32/wintrans/bl_enabled"; -static const char *OPT_WINTRANS_BL_ALPHA = "/plugins/gtk/win32/wintrans/bl_alpha"; -static const char *OPT_WINTRANS_BL_ONFOCUS= "/plugins/gtk/win32/wintrans/bl_solid_onfocus"; -static const char *OPT_WINTRANS_BL_ONTOP = "/plugins/gtk/win32/wintrans/bl_always_on_top"; +static const char *OPT_WINTRANS_IM_ENABLED= "/plugins/gtk/transparency/im_enabled"; +static const char *OPT_WINTRANS_IM_ALPHA = "/plugins/gtk/transparency/im_alpha"; +static const char *OPT_WINTRANS_IM_SLIDER = "/plugins/gtk/transparency/im_slider"; +static const char *OPT_WINTRANS_IM_ONFOCUS= "/plugins/gtk/transparency/im_solid_onfocus"; +static const char *OPT_WINTRANS_IM_ONTOP = "/plugins/gtk/transparency/im_always_on_top"; +static const char *OPT_WINTRANS_BL_ENABLED= "/plugins/gtk/transparency/bl_enabled"; +static const char *OPT_WINTRANS_BL_ALPHA = "/plugins/gtk/transparency/bl_alpha"; +static const char *OPT_WINTRANS_BL_ONFOCUS= "/plugins/gtk/transparency/bl_solid_onfocus"; +static const char *OPT_WINTRANS_BL_ONTOP = "/plugins/gtk/transparency/bl_always_on_top"; static GSList *window_list = NULL; /* @@ -76,31 +75,13 @@ static GSList *window_list = NULL; /* Set window transparency level */ static void set_wintrans(GtkWidget *window, int alpha, gboolean enabled, gboolean always_on_top) { - - HWND hWnd = GDK_WINDOW_HWND(window->window); - LONG style = GetWindowLong(hWnd, GWL_EXSTYLE); - if (enabled) { - style |= WS_EX_LAYERED; - } else { - style &= ~WS_EX_LAYERED; - } - SetWindowLong(hWnd, GWL_EXSTYLE, style); - - if (enabled) { - SetWindowPos(hWnd, - always_on_top ? HWND_TOPMOST : HWND_NOTOPMOST, - 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - SetLayeredWindowAttributes(hWnd, 0, alpha, LWA_ALPHA); + gdk_window_set_opacity(window->window, alpha / 255.0); + gdk_window_set_keep_above(window->window, always_on_top); } else { - /* Ask the window and its children to repaint */ - SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - - RedrawWindow(hWnd, NULL, NULL, - RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); + gdk_window_set_opacity(window->window, 1); + gdk_window_set_keep_above(window->window, 0); } - } /* When a conv window is focused, if we're only transparent when unfocused, @@ -518,7 +499,7 @@ static gboolean plugin_load(PurplePlugin *plugin) { } static gboolean plugin_unload(PurplePlugin *plugin) { - purple_debug_info(WINTRANS_PLUGIN_ID, "Unloading win2ktrans plugin\n"); + purple_debug_info(WINTRANS_PLUGIN_ID, "Unloading transparency plugin\n"); remove_convs_wintrans(TRUE); @@ -703,8 +684,8 @@ static PurplePluginInfo info = static void init_plugin(PurplePlugin *plugin) { - purple_prefs_add_none("/plugins/gtk/win32"); - purple_prefs_add_none("/plugins/gtk/win32/wintrans"); + purple_prefs_add_none("/plugins/gtk"); + purple_prefs_add_none("/plugins/gtk/transparency"); purple_prefs_add_bool(OPT_WINTRANS_IM_ENABLED, FALSE); purple_prefs_add_int(OPT_WINTRANS_IM_ALPHA, 255); purple_prefs_add_bool(OPT_WINTRANS_IM_SLIDER, FALSE); @@ -714,6 +695,7 @@ init_plugin(PurplePlugin *plugin) purple_prefs_add_int(OPT_WINTRANS_BL_ALPHA, 255); purple_prefs_add_bool(OPT_WINTRANS_BL_ONFOCUS, FALSE); purple_prefs_add_bool(OPT_WINTRANS_BL_ONTOP, FALSE); + purple_prefs_rename("/plugins/gtk/win32/wintrans", "/plugins/gtk/transparency"); } PURPLE_INIT_PLUGIN(wintrans, init_plugin, info) diff --git a/pidgin/plugins/win32/transparency/Makefile.mingw b/pidgin/plugins/win32/transparency/Makefile.mingw deleted file mode 100644 index f04d81ae4f..0000000000 --- a/pidgin/plugins/win32/transparency/Makefile.mingw +++ /dev/null @@ -1,75 +0,0 @@ -# -# Makefile.mingw -# -# Description: Makefile for win32trans plugin. -# - -PIDGIN_TREE_TOP := ../../../.. -include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak - -TARGET = win2ktrans - -## -## INCLUDE PATHS -## -INCLUDE_PATHS += -I. \ - -I$(GTK_TOP)/include \ - -I$(GTK_TOP)/include/gtk-2.0 \ - -I$(GTK_TOP)/include/glib-2.0 \ - -I$(GTK_TOP)/include/pango-1.0 \ - -I$(GTK_TOP)/include/atk-1.0 \ - -I$(GTK_TOP)/include/cairo \ - -I$(GTK_TOP)/lib/glib-2.0/include \ - -I$(GTK_TOP)/lib/gtk-2.0/include \ - -I$(PURPLE_TOP) \ - -I$(PURPLE_TOP)/win32 \ - -I$(PIDGIN_TOP) \ - -I$(PIDGIN_TOP)/win32 \ - -I$(PIDGIN_TREE_TOP) - -LIB_PATHS += -L$(GTK_TOP)/lib \ - -L$(PURPLE_TOP) \ - -L$(PIDGIN_TOP) - -## -## SOURCES, OBJECTS -## -C_SRC = win2ktrans.c - -OBJECTS = $(C_SRC:%.c=%.o) - -## -## LIBRARIES -## -LIBS = -lgtk-win32-2.0 \ - -lglib-2.0 \ - -lgdk-win32-2.0 \ - -lgmodule-2.0 \ - -lgobject-2.0 \ - -lintl \ - -lpidgin \ - -lpurple - -include $(PIDGIN_COMMON_RULES) - -## -## TARGET DEFINITIONS -## -.PHONY: all install clean - -all: $(TARGET).dll - -install: all $(PIDGIN_INSTALL_PLUGINS_DIR) - cp $(TARGET).dll $(PIDGIN_INSTALL_PLUGINS_DIR) - -$(TARGET).dll: $(PURPLE_DLL).a $(PIDGIN_DLL).a $(OBJECTS) - $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll - -## -## CLEAN RULES -## -clean: - rm -rf $(OBJECTS) - rm -rf $(TARGET).dll - -include $(PIDGIN_COMMON_TARGETS) |