diff --git a/checkin_notes b/checkin_notes index 594fa110e7..45df45e65f 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7222,3 +7222,23 @@ Rom 13 Oct 2011 clientgui/ BOINCGUIApp.cpp AdvancedFrame.cpp + +Rom 14 Oct 2011 + - Remove dead code related to v5 graphics applications from the + client software. + + client/ + boinc_cmd.cpp + clientgui/ + AsyncRPC.cpp, .h + BOINCGUIApp.cpp, .h + MainDocument.cpp + clientgui/gtk/ + taskbarex.cpp + clientscr/ + screensaver.cpp + lib/ + gui_rpc_client.h + gui_rpc_client_ops.cpp + win_build/ + win-config.h diff --git a/client/boinc_cmd.cpp b/client/boinc_cmd.cpp index 74f1fce2a1..c5993f507d 100644 --- a/client/boinc_cmd.cpp +++ b/client/boinc_cmd.cpp @@ -92,29 +92,13 @@ Commands:\n\ --set_run_mode mode duration set run mode for given duration\n\ mode = always | auto | never\n\ --task url task_name op task operation\n\ - op = suspend | resume | abort | graphics_window | graphics_fullscreen\n\ + op = suspend | resume | abort\n\ --version, -V show core client version\n\ " ); exit(1); } -void parse_display_args(char** argv, int& i, DISPLAY_INFO& di) { - strcpy(di.window_station, "winsta0"); - strcpy(di.desktop, "default"); - strcpy(di.display, ""); - while (argv[i]) { - if (!strcmp(argv[i], "--window_station")) { - strlcpy(di.window_station, argv[++i], sizeof(di.window_station)); - } else if (!strcpy(argv[i], "--desktop")) { - strlcpy(di.desktop, argv[++i], sizeof(di.desktop)); - } else if (!strcpy(argv[i], "--display")) { - strlcpy(di.display, argv[++i], sizeof(di.display)); - } - i++; - } -} - void show_error(int retval) { fprintf(stderr, "Error %d: %s\n", retval, boincerror(retval)); } @@ -257,14 +241,6 @@ int main(int argc, char** argv) { retval = rpc.result_op(result, "resume"); } else if (!strcmp(op, "abort")) { retval = rpc.result_op(result, "abort"); - } else if (!strcmp(op, "graphics_window")) { - DISPLAY_INFO di; - parse_display_args(argv, i, di); - retval = rpc.show_graphics(project_url, name, MODE_WINDOW, di); - } else if (!strcmp(op, "graphics_fullscreen")) { - DISPLAY_INFO di; - parse_display_args(argv, i, di); - retval = rpc.show_graphics(project_url, name, MODE_FULLSCREEN, di); } else { fprintf(stderr, "Unknown op %s\n", op); } diff --git a/clientgui/AsyncRPC.cpp b/clientgui/AsyncRPC.cpp index 5f8f9fdb1e..9da4c8954d 100644 --- a/clientgui/AsyncRPC.cpp +++ b/clientgui/AsyncRPC.cpp @@ -485,14 +485,6 @@ int RPCThread::ProcessRPCRequest() { case RPC_GET_DISK_USAGE: retval = (m_pDoc->rpcClient).get_disk_usage(*(DISK_USAGE*)(current_request->arg1)); break; - case RPC_SHOW_GRAPHICS: - retval = (m_pDoc->rpcClient).show_graphics( - (const char*)(current_request->arg1), - (const char*)(current_request->arg2), - *(int*)(current_request->arg3), - *(DISPLAY_INFO*)(current_request->arg4) - ); - break; case RPC_PROJECT_OP: retval = (m_pDoc->rpcClient).project_op( *(PROJECT*)(current_request->arg1), diff --git a/clientgui/AsyncRPC.h b/clientgui/AsyncRPC.h index b589d8a125..1351cd6dc6 100644 --- a/clientgui/AsyncRPC.h +++ b/clientgui/AsyncRPC.h @@ -92,7 +92,6 @@ enum RPC_SELECTOR { RPC_GET_PROJECT_STATUS2, RPC_GET_ALL_PROJECTS_LIST, // 10 RPC_GET_DISK_USAGE, - RPC_SHOW_GRAPHICS, RPC_PROJECT_OP, RPC_SET_RUN_MODE, RPC_SET_GPU_MODE, @@ -242,9 +241,6 @@ public: { return RPC_Wait(RPC_GET_ALL_PROJECTS_LIST, (void*)&arg1); } int get_disk_usage(DISK_USAGE& arg1) { return RPC_Wait(RPC_GET_DISK_USAGE, (void*)&arg1); } - int show_graphics( - const char* project, const char* result_name, int graphics_mode, DISPLAY_INFO& di) - { return RPC_Wait(RPC_SHOW_GRAPHICS, (void*)project, (void*)result_name, (void*)&graphics_mode, (void*)&di); } int project_op(PROJECT& arg1, const char* op) { return RPC_Wait(RPC_PROJECT_OP, (void*)&arg1, (void*)op); } int set_run_mode(int mode, double duration) diff --git a/clientgui/BOINCGUIApp.cpp b/clientgui/BOINCGUIApp.cpp index dcd8db58f6..8a0ddb316b 100644 --- a/clientgui/BOINCGUIApp.cpp +++ b/clientgui/BOINCGUIApp.cpp @@ -134,13 +134,9 @@ bool CBOINCGUIApp::OnInit() { m_strPasswordArg = wxEmptyString; m_iRPCPortArg = GUI_RPC_PORT; m_strBOINCArguments = wxEmptyString; - m_bAccessibilityEnabled = false; m_bGUIVisible = true; m_bDebugSkins = false; m_bMultipleInstancesOK = false; - m_strDefaultWindowStation = wxEmptyString; - m_strDefaultDesktop = wxEmptyString; - m_strDefaultDisplay = wxEmptyString; m_bBOINCMGRAutoStarted = false; m_iBOINCMGRDisableAutoStart = 0; m_iShutdownCoreClient = 0; @@ -217,9 +213,6 @@ bool CBOINCGUIApp::OnInit() { return false; } - // Detect if a program that is defined as an accessibility aid is running - DetectAccessibilityEnabled(); - // Detect where BOINC Manager executable name. DetectExecutableName(); @@ -418,10 +411,6 @@ bool CBOINCGUIApp::OnInit() { #endif - // Detect the display info and store for later use. - DetectDisplayInfo(); - - // Startup the System Idle Detection code IdleTrackerAttach(); @@ -606,56 +595,6 @@ bool CBOINCGUIApp::OnCmdLineParsed(wxCmdLineParser &parser) { } -/// -/// Detect the desktop that BOINC Manager is running in. -/// -void CBOINCGUIApp::DetectDisplayInfo() { -#ifdef __WXMSW__ - wxChar szWindowStation[256]; - memset(szWindowStation, 0, sizeof(szWindowStation)/sizeof(wxChar)); - wxChar szDesktop[256]; - memset(szDesktop, 0, sizeof(szDesktop)/sizeof(wxChar)); - - if (wxWIN95 != wxGetOsVersion(NULL, NULL)) { - // Retrieve the current window station and desktop names - GetUserObjectInformation( - GetProcessWindowStation(), - UOI_NAME, - szWindowStation, - (sizeof(szWindowStation) / sizeof(wxChar)), - NULL - ); - GetUserObjectInformation( - GetThreadDesktop(GetCurrentThreadId()), - UOI_NAME, - szDesktop, - (sizeof(szDesktop) / sizeof(wxChar)), - NULL - ); - m_strDefaultWindowStation = szWindowStation; - m_strDefaultDesktop = szDesktop; - } - -#else - wxString p = wxString(getenv("DISPLAY"), wxConvUTF8); - if (p) m_strDefaultDisplay = p; -#endif - -} - - -/// -/// Detect if an acessibility aid is running on the system. -/// -void CBOINCGUIApp::DetectAccessibilityEnabled() { -#ifdef __WXMSW__ - BOOL bScreenReaderEnabled = false; - SystemParametersInfo(SPI_GETSCREENREADER, NULL, &bScreenReaderEnabled, NULL); - m_bAccessibilityEnabled = (bScreenReaderEnabled == TRUE); -#endif -} - - /// /// Detect if another instance of this application is running. // Returns true if there is, otherwise false diff --git a/clientgui/BOINCGUIApp.h b/clientgui/BOINCGUIApp.h index f41785f5c4..ca27fbe5f7 100644 --- a/clientgui/BOINCGUIApp.h +++ b/clientgui/BOINCGUIApp.h @@ -58,8 +58,6 @@ protected: void OnInitCmdLine(wxCmdLineParser &parser); bool OnCmdLineParsed(wxCmdLineParser &parser); - void DetectDisplayInfo(); - void DetectAccessibilityEnabled(); bool DetectDuplicateInstance(); void DetectExecutableName(); void DetectRootDirectory(); @@ -91,8 +89,6 @@ protected: wxString m_strBOINCArguments; int m_iRPCPortArg; - bool m_bAccessibilityEnabled; - bool m_bBOINCMGRAutoStarted; int m_iBOINCMGRDisableAutoStart; int m_iShutdownCoreClient; @@ -120,10 +116,6 @@ protected: public: - wxString m_strDefaultWindowStation; - wxString m_strDefaultDesktop; - wxString m_strDefaultDisplay; - bool OnInit(); wxLocale* GetLocale() { return m_pLocale; } @@ -141,7 +133,6 @@ public: CTaskBarIcon* GetTaskBarIcon() { return m_pTaskBarIcon; } void DeleteTaskBarIcon(); - bool IsAccessibilityEnabled() { return m_bAccessibilityEnabled; } bool IsMgrMultipleInstance() { return m_bMultipleInstancesOK; } #ifdef __WXMAC__ diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 51005b5281..e54fd711a5 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -1746,7 +1746,6 @@ int CMainDocument::WorkShowGraphics(RESULT* result) id ); #endif - if (!iRetVal) { gfx_app.slot = slot; gfx_app.project_url = result->project_url; @@ -1754,23 +1753,7 @@ int CMainDocument::WorkShowGraphics(RESULT* result) gfx_app.pid = id; m_running_gfx_apps.push_back(gfx_app); } - - } else { - // V5 and Older - DISPLAY_INFO di; - - strcpy(di.window_station, (const char*)wxGetApp().m_strDefaultWindowStation.mb_str()); - strcpy(di.desktop, (const char*)wxGetApp().m_strDefaultDesktop.mb_str()); - strcpy(di.display, (const char*)wxGetApp().m_strDefaultDisplay.mb_str()); - - iRetVal = rpc.show_graphics( - result->project_url, - result->name, - MODE_WINDOW, - di - ); } - return iRetVal; } diff --git a/clientgui/gtk/taskbarex.cpp b/clientgui/gtk/taskbarex.cpp index 8363382b49..4be19e5347 100644 --- a/clientgui/gtk/taskbarex.cpp +++ b/clientgui/gtk/taskbarex.cpp @@ -1,35 +1,35 @@ -///////////////////////////////////////////////////////////////////////// -// File: src/gtk/taskbarex.cpp -// Purpose: wxTaskBarIconEx -// Author: Vaclav Slavik -// Modified by: Paul Cornett / Rom Walton -// Created: 2004/05/29 -// RCS-ID: $Id$ -// Copyright: (c) Vaclav Slavik, 2004 -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "taskbarex.h" -#endif - -#define GSocket GlibGSocket -#include -#undef GSocket - -#include "stdwx.h" - -#include -#include -#include +///////////////////////////////////////////////////////////////////////// +// File: src/gtk/taskbarex.cpp +// Purpose: wxTaskBarIconEx +// Author: Vaclav Slavik +// Modified by: Paul Cornett / Rom Walton +// Created: 2004/05/29 +// RCS-ID: $Id$ +// Copyright: (c) Vaclav Slavik, 2004 +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "taskbarex.h" +#endif + +#define GSocket GlibGSocket +#include +#undef GSocket + +#include "stdwx.h" + +#include +#include +#include #include - -#include "BOINCGUIApp.h" -#include "gtk/taskbarex.h" -#include "BOINCTaskBar.h" - - -// Old Style + +#include "BOINCGUIApp.h" +#include "gtk/taskbarex.h" +#include "BOINCTaskBar.h" + + +// Old Style typedef NotifyNotification* (*__notify_notification_new_with_status_icon) ( const gchar *summary, @@ -37,315 +37,315 @@ typedef NotifyNotification* (*__notify_notification_new_with_status_icon) const gchar *icon, GtkStatusIcon *status_icon ); - -// New Style + +// New Style typedef NotifyNotification* (*__notify_notification_new) ( const char *summary, const char *body, const char *icon ); - -static void* notify_lib = NULL; -static __notify_notification_new_with_status_icon my_notify_notification_new_with_status_icon = NULL; -static __notify_notification_new my_notify_notification_new = NULL; - - -static GtkStatusIcon* g_pStatusIcon = NULL; -static NotifyNotification* g_pNotification = NULL; - - -//----------------------------------------------------------------------------- - -extern "C" { - static void - status_icon_activate(GtkStatusIcon*, wxTaskBarIconEx* taskBarIcon) - { - wxTaskBarIconExEvent eventLeftDClick(wxEVT_TASKBAR_LEFT_DCLICK, taskBarIcon); - taskBarIcon->AddPendingEvent(eventLeftDClick); - } - - static void - status_icon_popup_menu(GtkStatusIcon*, guint, guint, wxTaskBarIconEx* taskBarIcon) - { - wxTaskBarIconExEvent eventDown(wxEVT_TASKBAR_RIGHT_DOWN, taskBarIcon); - taskBarIcon->AddPendingEvent(eventDown); - wxTaskBarIconExEvent eventUp(wxEVT_TASKBAR_RIGHT_UP, taskBarIcon); - taskBarIcon->AddPendingEvent(eventUp); - } - - static void - status_icon_notification_actions(NotifyNotification* notification, gchar *action, wxTaskBarIconEx* taskBarIcon) - { - if (strcmp(action, "default") == 0) { - taskBarIcon->FireUserClickedEvent(); - } - } - - static void - status_icon_notification_closed(NotifyNotification* notification, wxTaskBarIconEx* taskBarIcon) - { - if (taskBarIcon->IsUserClicked()) { - wxTaskBarIconExEvent eventUserClicked(wxEVT_TASKBAR_BALLOON_USERCLICK, taskBarIcon); - taskBarIcon->AddPendingEvent(eventUserClicked); - } else { - wxTaskBarIconExEvent eventTimeout(wxEVT_TASKBAR_BALLOON_TIMEOUT, taskBarIcon); - taskBarIcon->AddPendingEvent(eventTimeout); - } - - taskBarIcon->ClearEvents(); - } -} - - -//----------------------------------------------------------------------------- - - -static wxChar* wxTaskBarExWindow = (wxChar*) wxT("wxTaskBarExWindow"); - - -DEFINE_EVENT_TYPE( wxEVT_TASKBAR_CREATED ) -DEFINE_EVENT_TYPE( wxEVT_TASKBAR_CONTEXT_MENU ) -DEFINE_EVENT_TYPE( wxEVT_TASKBAR_SELECT ) -DEFINE_EVENT_TYPE( wxEVT_TASKBAR_KEY_SELECT ) -DEFINE_EVENT_TYPE( wxEVT_TASKBAR_BALLOON_SHOW ) -DEFINE_EVENT_TYPE( wxEVT_TASKBAR_BALLOON_HIDE ) -DEFINE_EVENT_TYPE( wxEVT_TASKBAR_BALLOON_TIMEOUT ) -DEFINE_EVENT_TYPE( wxEVT_TASKBAR_BALLOON_USERCLICK ) -DEFINE_EVENT_TYPE( wxEVT_TASKBAR_SHUTDOWN ) - -IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIconEx, wxEvtHandler) - -BEGIN_EVENT_TABLE (wxTaskBarIconEx, wxEvtHandler) -END_EVENT_TABLE () - - -wxTaskBarIconEx::wxTaskBarIconEx() -{ - wxTaskBarIconEx((wxChar*)wxTaskBarExWindow, 1); -} - -wxTaskBarIconEx::wxTaskBarIconEx( wxChar* szWindowTitle, wxInt32 iTaskbarID ) -{ - m_pWnd = NULL; - m_iTaskbarID = iTaskbarID; - g_pStatusIcon = NULL; - g_pNotification = NULL; - m_bUserClicked = false; - - notify_lib = dlopen("libnotify.so", RTLD_NOW); - if (notify_lib) { - my_notify_notification_new_with_status_icon = (__notify_notification_new_with_status_icon)dlsym(notify_lib, "notify_notification_new_with_status_icon"); - my_notify_notification_new = (__notify_notification_new)dlsym(notify_lib, "notify_notification_new"); - } - - notify_init((const char*)wxString(szWindowTitle).mb_str()); -} - -wxTaskBarIconEx::~wxTaskBarIconEx() -{ - m_bUserClicked = false; - - if (m_pWnd) - { - m_pWnd->PopEventHandler(); - m_pWnd->Destroy(); - m_pWnd = NULL; - } - - if (g_pNotification) - { - notify_notification_close(g_pNotification, NULL); - g_pNotification = NULL; - } - - if (g_pStatusIcon) - { - g_object_unref(g_pStatusIcon); - g_pStatusIcon = NULL; - } - - if (notify_lib) { - my_notify_notification_new_with_status_icon = NULL; - my_notify_notification_new = NULL; - dlclose(notify_lib); - } -} - -bool wxTaskBarIconEx::IsIconInstalled() const { - return (g_pStatusIcon != NULL); -} - -void wxTaskBarIconEx::ClearEvents() { - m_bUserClicked = false; -} - -void wxTaskBarIconEx::FireUserClickedEvent() { - m_bUserClicked = true; -} - -bool wxTaskBarIconEx::IsUserClicked() { - return m_bUserClicked; -} - -// Operations -bool wxTaskBarIconEx::SetIcon(const wxIcon& icon, const wxString& message) -{ - if (!IsOK()) - return false; - - if (!icon.Ok()) - return false; - - wxBitmap bitmap = icon; - - if (!g_pStatusIcon) - { - g_pStatusIcon = gtk_status_icon_new_from_pixbuf(bitmap.GetPixbuf()); - g_signal_connect(g_pStatusIcon, "activate", G_CALLBACK(status_icon_activate), this); - g_signal_connect(g_pStatusIcon, "popup_menu", G_CALLBACK(status_icon_popup_menu), this); - } - - gtk_status_icon_set_from_pixbuf(g_pStatusIcon, bitmap.GetPixbuf()); - if (!message.empty()) - { - gtk_status_icon_set_tooltip(g_pStatusIcon, message.mb_str()); - } - gtk_status_icon_set_visible(g_pStatusIcon, TRUE); - - return true; -} - -bool wxTaskBarIconEx::SetBalloon(const wxIcon& icon, const wxString title, const wxString message, unsigned int iconballoon) -{ - wxLogTrace(wxT("Function Start/End"), wxT("wxTaskBarIconEx::SetBalloon - Function Begin")); - - bool retval = false; - GError* error = NULL; - - if (!IsOK()) - return false; - - if (!icon.Ok()) - return false; - - if (!SetIcon(icon, wxEmptyString)) - return false; - - gchar* desired_icon = NULL; - switch(iconballoon) - { - case BALLOONTYPE_INFO: - desired_icon = GTK_STOCK_DIALOG_INFO; - break; - case BALLOONTYPE_WARNING: - desired_icon = GTK_STOCK_DIALOG_WARNING; - break; - case BALLOONTYPE_ERROR: - desired_icon = GTK_STOCK_DIALOG_ERROR; - break; - } - - if (!g_pNotification) - { - // Old Style - if (my_notify_notification_new_with_status_icon) { - g_pNotification = - (*my_notify_notification_new_with_status_icon)( - title.mb_str(), - message.mb_str(), - desired_icon, - g_pStatusIcon - ); - } - - // New Style - if (my_notify_notification_new) { - g_pNotification = - (*my_notify_notification_new)( - title.mb_str(), - message.mb_str(), - gtk_status_icon_get_icon_name(g_pStatusIcon) - ); - } - - g_signal_connect( - g_pNotification, - "closed", - G_CALLBACK(status_icon_notification_closed), - this - ); - - notify_notification_add_action( - g_pNotification, - "default", - "Do Default Action", - NOTIFY_ACTION_CALLBACK(status_icon_notification_actions), - this, - NULL - ); - } - else - { - notify_notification_update( - g_pNotification, - title.mb_str(), - message.mb_str(), - desired_icon - ); - } - - retval = notify_notification_show(g_pNotification, &error); - g_clear_error(&error); - - wxLogTrace(wxT("Function Start/End"), wxT("wxTaskBarIconEx::SetBalloon - Function End")); - return retval; -} - -bool wxTaskBarIconEx::QueueBalloon(const wxIcon& icon, const wxString title, const wxString message, unsigned int iconballoon) -{ - // There isn't two classifications of notifications on Linux as there is on Windows - return SetBalloon(icon, title, message, iconballoon); -} - -bool wxTaskBarIconEx::RemoveIcon() -{ - if (!IsOK()) - return false; - - if (g_pNotification) - { - notify_notification_close(g_pNotification, NULL); - g_pNotification = NULL; - } - - if (g_pStatusIcon) - { - g_object_unref(g_pStatusIcon); - g_pStatusIcon = NULL; - } - - return true; -} - -bool wxTaskBarIconEx::PopupMenu(wxMenu* menu) -{ -#if wxUSE_MENUS - - if (m_pWnd == NULL) - { - m_pWnd = new wxTopLevelWindow(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0); - m_pWnd->PushEventHandler(this); - } - - wxPoint point(-1, -1); -#ifdef __WXUNIVERSAL__ - point = wxGetMousePosition(); -#endif - - m_pWnd->PopupMenu(menu, point); - -#endif // wxUSE_MENUS - return true; -} - + +static void* notify_lib = NULL; +static __notify_notification_new_with_status_icon my_notify_notification_new_with_status_icon = NULL; +static __notify_notification_new my_notify_notification_new = NULL; + + +static GtkStatusIcon* g_pStatusIcon = NULL; +static NotifyNotification* g_pNotification = NULL; + + +//----------------------------------------------------------------------------- + +extern "C" { + static void + status_icon_activate(GtkStatusIcon*, wxTaskBarIconEx* taskBarIcon) + { + wxTaskBarIconExEvent eventLeftDClick(wxEVT_TASKBAR_LEFT_DCLICK, taskBarIcon); + taskBarIcon->AddPendingEvent(eventLeftDClick); + } + + static void + status_icon_popup_menu(GtkStatusIcon*, guint, guint, wxTaskBarIconEx* taskBarIcon) + { + wxTaskBarIconExEvent eventDown(wxEVT_TASKBAR_RIGHT_DOWN, taskBarIcon); + taskBarIcon->AddPendingEvent(eventDown); + wxTaskBarIconExEvent eventUp(wxEVT_TASKBAR_RIGHT_UP, taskBarIcon); + taskBarIcon->AddPendingEvent(eventUp); + } + + static void + status_icon_notification_actions(NotifyNotification* notification, gchar *action, wxTaskBarIconEx* taskBarIcon) + { + if (strcmp(action, "default") == 0) { + taskBarIcon->FireUserClickedEvent(); + } + } + + static void + status_icon_notification_closed(NotifyNotification* notification, wxTaskBarIconEx* taskBarIcon) + { + if (taskBarIcon->IsUserClicked()) { + wxTaskBarIconExEvent eventUserClicked(wxEVT_TASKBAR_BALLOON_USERCLICK, taskBarIcon); + taskBarIcon->AddPendingEvent(eventUserClicked); + } else { + wxTaskBarIconExEvent eventTimeout(wxEVT_TASKBAR_BALLOON_TIMEOUT, taskBarIcon); + taskBarIcon->AddPendingEvent(eventTimeout); + } + + taskBarIcon->ClearEvents(); + } +} + + +//----------------------------------------------------------------------------- + + +static wxChar* wxTaskBarExWindow = (wxChar*) wxT("wxTaskBarExWindow"); + + +DEFINE_EVENT_TYPE( wxEVT_TASKBAR_CREATED ) +DEFINE_EVENT_TYPE( wxEVT_TASKBAR_CONTEXT_MENU ) +DEFINE_EVENT_TYPE( wxEVT_TASKBAR_SELECT ) +DEFINE_EVENT_TYPE( wxEVT_TASKBAR_KEY_SELECT ) +DEFINE_EVENT_TYPE( wxEVT_TASKBAR_BALLOON_SHOW ) +DEFINE_EVENT_TYPE( wxEVT_TASKBAR_BALLOON_HIDE ) +DEFINE_EVENT_TYPE( wxEVT_TASKBAR_BALLOON_TIMEOUT ) +DEFINE_EVENT_TYPE( wxEVT_TASKBAR_BALLOON_USERCLICK ) +DEFINE_EVENT_TYPE( wxEVT_TASKBAR_SHUTDOWN ) + +IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIconEx, wxEvtHandler) + +BEGIN_EVENT_TABLE (wxTaskBarIconEx, wxEvtHandler) +END_EVENT_TABLE () + + +wxTaskBarIconEx::wxTaskBarIconEx() +{ + wxTaskBarIconEx((wxChar*)wxTaskBarExWindow, 1); +} + +wxTaskBarIconEx::wxTaskBarIconEx( wxChar* szWindowTitle, wxInt32 iTaskbarID ) +{ + m_pWnd = NULL; + m_iTaskbarID = iTaskbarID; + g_pStatusIcon = NULL; + g_pNotification = NULL; + m_bUserClicked = false; + + notify_lib = dlopen("libnotify.so", RTLD_NOW); + if (notify_lib) { + my_notify_notification_new_with_status_icon = (__notify_notification_new_with_status_icon)dlsym(notify_lib, "notify_notification_new_with_status_icon"); + my_notify_notification_new = (__notify_notification_new)dlsym(notify_lib, "notify_notification_new"); + } + + notify_init((const char*)wxString(szWindowTitle).mb_str()); +} + +wxTaskBarIconEx::~wxTaskBarIconEx() +{ + m_bUserClicked = false; + + if (m_pWnd) + { + m_pWnd->PopEventHandler(); + m_pWnd->Destroy(); + m_pWnd = NULL; + } + + if (g_pNotification) + { + notify_notification_close(g_pNotification, NULL); + g_pNotification = NULL; + } + + if (g_pStatusIcon) + { + g_object_unref(g_pStatusIcon); + g_pStatusIcon = NULL; + } + + if (notify_lib) { + my_notify_notification_new_with_status_icon = NULL; + my_notify_notification_new = NULL; + dlclose(notify_lib); + } +} + +bool wxTaskBarIconEx::IsIconInstalled() const { + return (g_pStatusIcon != NULL); +} + +void wxTaskBarIconEx::ClearEvents() { + m_bUserClicked = false; +} + +void wxTaskBarIconEx::FireUserClickedEvent() { + m_bUserClicked = true; +} + +bool wxTaskBarIconEx::IsUserClicked() { + return m_bUserClicked; +} + +// Operations +bool wxTaskBarIconEx::SetIcon(const wxIcon& icon, const wxString& message) +{ + if (!IsOK()) + return false; + + if (!icon.Ok()) + return false; + + wxBitmap bitmap = icon; + + if (!g_pStatusIcon) + { + g_pStatusIcon = gtk_status_icon_new_from_pixbuf(bitmap.GetPixbuf()); + g_signal_connect(g_pStatusIcon, "activate", G_CALLBACK(status_icon_activate), this); + g_signal_connect(g_pStatusIcon, "popup_menu", G_CALLBACK(status_icon_popup_menu), this); + } + + gtk_status_icon_set_from_pixbuf(g_pStatusIcon, bitmap.GetPixbuf()); + if (!message.empty()) + { + gtk_status_icon_set_tooltip(g_pStatusIcon, message.mb_str()); + } + gtk_status_icon_set_visible(g_pStatusIcon, TRUE); + + return true; +} + +bool wxTaskBarIconEx::SetBalloon(const wxIcon& icon, const wxString title, const wxString message, unsigned int iconballoon) +{ + wxLogTrace(wxT("Function Start/End"), wxT("wxTaskBarIconEx::SetBalloon - Function Begin")); + + bool retval = false; + GError* error = NULL; + + if (!IsOK()) + return false; + + if (!icon.Ok()) + return false; + + if (!SetIcon(icon, wxEmptyString)) + return false; + + gchar* desired_icon = NULL; + switch(iconballoon) + { + case BALLOONTYPE_INFO: + desired_icon = GTK_STOCK_DIALOG_INFO; + break; + case BALLOONTYPE_WARNING: + desired_icon = GTK_STOCK_DIALOG_WARNING; + break; + case BALLOONTYPE_ERROR: + desired_icon = GTK_STOCK_DIALOG_ERROR; + break; + } + + if (!g_pNotification) + { + // Old Style + if (my_notify_notification_new_with_status_icon) { + g_pNotification = + (*my_notify_notification_new_with_status_icon)( + title.mb_str(), + message.mb_str(), + desired_icon, + g_pStatusIcon + ); + } + + // New Style + if (my_notify_notification_new) { + g_pNotification = + (*my_notify_notification_new)( + title.mb_str(), + message.mb_str(), + gtk_status_icon_get_icon_name(g_pStatusIcon) + ); + } + + g_signal_connect( + g_pNotification, + "closed", + G_CALLBACK(status_icon_notification_closed), + this + ); + + notify_notification_add_action( + g_pNotification, + "default", + "Do Default Action", + NOTIFY_ACTION_CALLBACK(status_icon_notification_actions), + this, + NULL + ); + } + else + { + notify_notification_update( + g_pNotification, + title.mb_str(), + message.mb_str(), + desired_icon + ); + } + + retval = notify_notification_show(g_pNotification, &error); + g_clear_error(&error); + + wxLogTrace(wxT("Function Start/End"), wxT("wxTaskBarIconEx::SetBalloon - Function End")); + return retval; +} + +bool wxTaskBarIconEx::QueueBalloon(const wxIcon& icon, const wxString title, const wxString message, unsigned int iconballoon) +{ + // There isn't two classifications of notifications on Linux as there is on Windows + return SetBalloon(icon, title, message, iconballoon); +} + +bool wxTaskBarIconEx::RemoveIcon() +{ + if (!IsOK()) + return false; + + if (g_pNotification) + { + notify_notification_close(g_pNotification, NULL); + g_pNotification = NULL; + } + + if (g_pStatusIcon) + { + g_object_unref(g_pStatusIcon); + g_pStatusIcon = NULL; + } + + return true; +} + +bool wxTaskBarIconEx::PopupMenu(wxMenu* menu) +{ +#if wxUSE_MENUS + + if (m_pWnd == NULL) + { + m_pWnd = new wxTopLevelWindow(NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0); + m_pWnd->PushEventHandler(this); + } + + wxPoint point(-1, -1); +#ifdef __WXUNIVERSAL__ + point = wxGetMousePosition(); +#endif + + m_pWnd->PopupMenu(menu, point); + +#endif // wxUSE_MENUS + return true; +} + diff --git a/clientscr/screensaver.cpp b/clientscr/screensaver.cpp index 78669eb990..34cb67c49e 100644 --- a/clientscr/screensaver.cpp +++ b/clientscr/screensaver.cpp @@ -210,49 +210,12 @@ int CScreensaver::launch_screensaver(RESULT* rp, int& graphics_application) graphics_application ); #endif - } else { - // V5 and Older - DISPLAY_INFO di; -#ifdef _WIN32 - graphics_application = NULL; - - memset(di.window_station, 0, sizeof(di.window_station)); - memset(di.desktop, 0, sizeof(di.desktop)); - memset(di.display, 0, sizeof(di.display)); - - // Retrieve the current window station and desktop names - GetUserObjectInformation( - GetProcessWindowStation(), - UOI_NAME, - di.window_station, - (sizeof(di.window_station)), - NULL - ); - GetUserObjectInformation( - GetThreadDesktop(GetCurrentThreadId()), - UOI_NAME, - di.desktop, - sizeof(di.desktop), - NULL - ); -#else - char *p = getenv("DISPLAY"); - if (p) strcpy(di.display, p); - - graphics_application = 0; -#endif - retval = rpc->show_graphics( - rp->project_url, - rp->name, - MODE_FULLSCREEN, - di - ); } return retval; } -// Terminate any V6 acreensaver graphics application +// Terminate any screensaver graphics application // #ifdef _WIN32 int CScreensaver::terminate_v6_screensaver(HANDLE& graphics_application) @@ -322,23 +285,6 @@ int CScreensaver::terminate_screensaver(int& graphics_application, RESULT *worke if (m_bScience_gfx_running) { terminate_v6_screensaver(graphics_application); } - } else { - // V5 and Older - DISPLAY_INFO di; - - if (worker_app == NULL) return 0; - if (!strlen(worker_app->name)) return 0; - - memset(di.window_station, 0, sizeof(di.window_station)); - memset(di.desktop, 0, sizeof(di.desktop)); - memset(di.display, 0, sizeof(di.display)); - - rpc->show_graphics( - worker_app->project_url, - worker_app->name, - MODE_HIDE_GRAPHICS, - di - ); } return retval; } diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h index 6e10184fe4..8ab88bf8af 100644 --- a/lib/gui_rpc_client.h +++ b/lib/gui_rpc_client.h @@ -469,15 +469,6 @@ public: void clear(); }; -struct DISPLAY_INFO { - char window_station[256]; // windows - char desktop[256]; // windows - char display[256]; // X11 - - DISPLAY_INFO(); - void print_str(char*); -}; - struct ACCT_MGR_INFO { std::string acct_mgr_name; std::string acct_mgr_url; @@ -665,10 +656,6 @@ struct RPC_CLIENT { int get_project_status(PROJECTS&); int get_all_projects_list(ALL_PROJECTS_LIST&); int get_disk_usage(DISK_USAGE&); - int show_graphics( - const char* project, const char* result_name, int graphics_mode, - DISPLAY_INFO& - ); int project_op(PROJECT&, const char* op); int set_run_mode(int mode, double duration); // if duration is zero, change is permanent. diff --git a/lib/gui_rpc_client_ops.cpp b/lib/gui_rpc_client_ops.cpp index d6b63b15d9..2d79bcb9b2 100644 --- a/lib/gui_rpc_client_ops.cpp +++ b/lib/gui_rpc_client_ops.cpp @@ -99,10 +99,6 @@ int DAILY_XFER_HISTORY::parse(XML_PARSER& xp) { return 0; } -DISPLAY_INFO::DISPLAY_INFO() { - memset(this, 0, sizeof(DISPLAY_INFO)); -} - int GUI_URL::parse(XML_PARSER& xp) { char buf[256]; MIOFILE& in = *(xp.f); @@ -1619,55 +1615,6 @@ int RPC_CLIENT::network_available() { return retval; } -void DISPLAY_INFO::print_str(char* p) { - char buf[768]; - if (strlen(window_station)) { - sprintf(buf, - " %s\n", window_station - ); - strcat(p, buf); - } - if (strlen(desktop)) { - sprintf(buf, - " %s\n", desktop - ); - strcat(p, buf); - } - if (strlen(display)) { - sprintf(buf, - " %s\n", display - ); - strcat(p, buf); - } -} - -int RPC_CLIENT::show_graphics( - const char* project_url, const char* result_name, int graphics_mode, - DISPLAY_INFO& di -) { - int retval; - SET_LOCALE sl; - char buf[1536]; - RPC rpc(this); - - sprintf(buf, - "\n" - " %s\n" - " %s\n" - "%s%s%s", - project_url, - result_name, - graphics_mode == MODE_HIDE_GRAPHICS?" \n":"", - graphics_mode == MODE_WINDOW ?" \n":"", - graphics_mode == MODE_FULLSCREEN ?" \n":"" - ); - di.print_str(buf); - strcat(buf, "\n"); - - retval = rpc.do_rpc(buf); - return retval; -} - int RPC_CLIENT::project_op(PROJECT& project, const char* op) { int retval; SET_LOCALE sl; diff --git a/win_build/win-config.h b/win_build/win-config.h index c3f9c248bd..3d34dbcc05 100644 --- a/win_build/win-config.h +++ b/win_build/win-config.h @@ -249,7 +249,7 @@ #define HAVE_VFORK 0 /* Define to 1 if you have the header file. */ -#undef HAVE_VFORK_H 0 +/* #undef HAVE_VFORK_H 0 */ /* Define to 1 if `fork' works. */ #define HAVE_WORKING_FORK 0 @@ -258,7 +258,7 @@ #define HAVE_WORKING_VFORK 0 /* Define to 1 if the system has the type `_Bool'. */ -#undef HAVE__BOOL 0 +/* #undef HAVE__BOOL 0 */ /* Define to 1 if the system has the type `_int64'. */ #define HAVE__INT64 0