From f34c2e508eeaba527009e2b86bf6ef7a09a496bb Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 26 Sep 2013 18:36:45 +0000 Subject: plugins cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@6243 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/wbOSD/src/main.cpp | 22 ---------------------- plugins/wbOSD/src/options.cpp | 13 +++++-------- plugins/wbOSD/src/wbOSD.cpp | 13 ++++--------- plugins/wbOSD/src/wbOSD.h | 5 +---- 4 files changed, 10 insertions(+), 43 deletions(-) (limited to 'plugins/wbOSD/src') diff --git a/plugins/wbOSD/src/main.cpp b/plugins/wbOSD/src/main.cpp index 5c6cef5884..ee7e35b252 100644 --- a/plugins/wbOSD/src/main.cpp +++ b/plugins/wbOSD/src/main.cpp @@ -15,8 +15,6 @@ HWND hwnd=0; HANDLE hservosda; int hLangpack = 0; HANDLE hHookedNewEvent, hHookedInit, hProtoAck, hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged, hpluginShutDown; -HINSTANCE hUser32; -BOOL (WINAPI*pSetLayeredWindowAttributes)(HWND, COLORREF, BYTE, DWORD); void logmsg2(char *str); int MainInit(WPARAM,LPARAM); @@ -49,22 +47,6 @@ extern "C" __declspec(dllexport) int Load() mir_getLP(&pluginInfo); logmsg("Load"); - pSetLayeredWindowAttributes=0; - -#ifndef FORCE_9XDRAWING - hUser32=LoadLibrary(_T("user32.dll")); -#else - hUser32=0; -#endif - - if (hUser32) { - pSetLayeredWindowAttributes=(BOOL(WINAPI*)(HWND, COLORREF, BYTE, DWORD))GetProcAddress(hUser32, "SetLayeredWindowAttributes"); - if (!pSetLayeredWindowAttributes) { - FreeLibrary(hUser32); - hUser32=0; - } - } - hHookedInit = HookEvent(ME_SYSTEM_MODULESLOADED, MainInit); return 0; } @@ -81,10 +63,6 @@ extern "C" __declspec(dllexport) int Unload() UnhookEvent(hHookedNewEvent); UnhookEvent(hHookedInit); - if (hUser32) - FreeLibrary(hUser32); - pSetLayeredWindowAttributes=0; - DestroyServiceFunction(hservosda); DestroyHookableEvent(hHookContactStatusChanged); return 0; diff --git a/plugins/wbOSD/src/options.cpp b/plugins/wbOSD/src/options.cpp index fdc8787fa5..4a9769c0e9 100644 --- a/plugins/wbOSD/src/options.cpp +++ b/plugins/wbOSD/src/options.cpp @@ -225,7 +225,7 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg,UINT msg,WPARAM wparam,LPARAM lparam) loadDBSettings(&ps[0]); ps[1]=ps[0]; SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG)ps); - SetWindowLongPtr(hwnd, GWL_STYLE, (LONG)(pSetLayeredWindowAttributes?0:WS_CLIPSIBLINGS)|WS_POPUP|WS_SIZEBOX); + SetWindowLongPtr(hwnd, GWL_STYLE, WS_POPUP | WS_SIZEBOX); SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED); SetWindowLongPtr(GetDlgItem(hDlg,IDC_TREE1),GWL_STYLE,GetWindowLong(GetDlgItem(hDlg,IDC_TREE1),GWL_STYLE)|TVS_NOHSCROLL|TVS_CHECKBOXES); @@ -276,12 +276,11 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg,UINT msg,WPARAM wparam,LPARAM lparam) ps[0]=ps[1]; saveDBSettings(&ps[0]); - SetWindowLongPtr(hwnd, GWL_STYLE, (LONG)(pSetLayeredWindowAttributes?0:WS_CLIPSIBLINGS)|WS_POPUP); + SetWindowLongPtr(hwnd, GWL_STYLE, WS_POPUP); SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_FRAMECHANGED); SetWindowPos(hwnd, 0, ps->winxpos, ps->winypos, ps->winx, ps->winy, SWP_NOZORDER|SWP_NOACTIVATE); - if (pSetLayeredWindowAttributes) - pSetLayeredWindowAttributes(hwnd, ps->bkclr, ps->alpha, (ps->transparent?LWA_COLORKEY:0)|LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, ps->bkclr, ps->alpha, (ps->transparent?LWA_COLORKEY:0)|LWA_ALPHA); free((void*)GetWindowLongPtr(hDlg, GWLP_USERDATA)); return 0; @@ -364,8 +363,7 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg,UINT msg,WPARAM wparam,LPARAM lparam) xxx: saveDBSettings(ps); SetWindowPos(hwnd, 0, 0, 0, ps->winx, ps->winy, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE); - if (pSetLayeredWindowAttributes) - pSetLayeredWindowAttributes(hwnd, db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT)?LWA_COLORKEY:0)|LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT)?LWA_COLORKEY:0)|LWA_ALPHA); InvalidateRect(hwnd, 0, TRUE); SendMessage(GetParent(hDlg),PSM_CHANGED,0,0); @@ -395,8 +393,7 @@ xxx: ps[1]=ps[0]; //apply current settings at closing saveDBSettings(ps); - if (pSetLayeredWindowAttributes) - pSetLayeredWindowAttributes(hwnd, db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT)?LWA_COLORKEY:0)|LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT)?LWA_COLORKEY:0)|LWA_ALPHA); InvalidateRect(hwnd, 0, TRUE); break; } diff --git a/plugins/wbOSD/src/wbOSD.cpp b/plugins/wbOSD/src/wbOSD.cpp index 9bdaf74370..ce379a86d5 100644 --- a/plugins/wbOSD/src/wbOSD.cpp +++ b/plugins/wbOSD/src/wbOSD.cpp @@ -195,11 +195,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM mir_free(ms->text); mir_free(ms); SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); - if (!pSetLayeredWindowAttributes) { - logmsg("WindowProcedure::USER+4/old+9x"); - ShowWindow(hwnd, SW_HIDE); - Sleep(50); - } } + } ms =(osdmsg*)mir_alloc(sizeof(osdmsg)); memcpy(ms, (osdmsg*)wParam, sizeof(osdmsg)); @@ -275,8 +271,8 @@ int MainInit(WPARAM wparam,LPARAM lparam) if ( !RegisterClassEx( &wincl )) return 0; - hwnd = CreateWindowEx((pSetLayeredWindowAttributes?WS_EX_LAYERED:0)|WS_EX_TOOLWINDOW, szClassName, _T("WannaBeOSD"), - (pSetLayeredWindowAttributes?0:WS_CLIPSIBLINGS) | WS_POPUP, + hwnd = CreateWindowEx(WS_EX_LAYERED | WS_EX_TOOLWINDOW, szClassName, _T("WannaBeOSD"), + WS_POPUP, db_get_dw(NULL,THIS_MODULE, "winxpos", DEFAULT_WINXPOS), db_get_dw(NULL,THIS_MODULE, "winypos", DEFAULT_WINYPOS), db_get_dw(NULL,THIS_MODULE, "winx", DEFAULT_WINX), @@ -285,8 +281,7 @@ int MainInit(WPARAM wparam,LPARAM lparam) SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); - if (pSetLayeredWindowAttributes) - pSetLayeredWindowAttributes(hwnd, db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT)?LWA_COLORKEY:0)|LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, db_get_dw(NULL,THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL,THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL,THIS_MODULE, "transparent", DEFAULT_TRANPARENT)?LWA_COLORKEY:0)|LWA_ALPHA); hservosda=CreateServiceFunction("OSD/Announce", OSDAnnounce); diff --git a/plugins/wbOSD/src/wbOSD.h b/plugins/wbOSD/src/wbOSD.h index c8f80ffb99..ba8658f809 100644 --- a/plugins/wbOSD/src/wbOSD.h +++ b/plugins/wbOSD/src/wbOSD.h @@ -112,12 +112,9 @@ typedef struct _osdmsg { int OptionsInit(WPARAM wparam,LPARAM lparam); -extern BOOL (WINAPI*pSetLayeredWindowAttributes)(HWND, COLORREF, BYTE, DWORD); - void loadDBSettings(plgsettings *ps); extern HINSTANCE hI; extern HWND hwnd; extern HANDLE hservosda; -extern HANDLE hHookedNewEvent, hHookedInit, hProtoAck, hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged, hpluginShutDown; -extern HINSTANCE hUser32; \ No newline at end of file +extern HANDLE hHookedNewEvent, hHookedInit, hProtoAck, hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged, hpluginShutDown; \ No newline at end of file -- cgit v1.2.3