~ubuntu-branches/ubuntu/precise/boinc/precise

« back to all changes in this revision

Viewing changes to clienttray/tray_win.cpp

Tags: 6.12.8+dfsg-1
* New upstream release.
* Simplified debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
#include "boinc_win.h"
20
20
 
 
21
#include "diagnostics.h"
 
22
#include "win_util.h"
21
23
#include "boinc_tray.h"
22
24
#include "tray_win.h"
23
 
 
24
 
 
25
 
EXTERN_C BOOL           ClientLibraryStartup();
26
 
EXTERN_C BOOL           IdleTrackerAttach();
27
 
EXTERN_C void           IdleTrackerDetach();
28
 
EXTERN_C void           ClientLibraryShutdown();
29
 
EXTERN_C DWORD          BOINCGetIdleTickCount();
 
25
#include "idlemon.h"
 
26
 
 
27
 
30
28
         HMODULE        g_hModule = NULL;
31
29
static   CBOINCTray*    gspBOINCTray = NULL;
32
30
 
42
40
CBOINCTray::CBOINCTray() {
43
41
    gspBOINCTray = this;
44
42
    m_hDataManagementThread = NULL;
45
 
    m_bClientLibraryInitialized = FALSE;
46
43
    m_bIdleTrackerInitialized = FALSE;
47
44
}
48
45
 
49
46
 
50
47
// Starts main execution of BOINC Tray.
51
48
//
52
 
INT CBOINCTray::Run( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) {
53
 
 
 
49
INT CBOINCTray::Run( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR /* lpCmdLine */ , int /* nCmdShow */ ) {
 
50
 
 
51
    // Initialize the BOINC Diagnostics Framework
 
52
    int flags =
 
53
#ifdef _DEBUG
 
54
        BOINC_DIAG_MEMORYLEAKCHECKENABLED |
 
55
#endif
 
56
        BOINC_DIAG_DUMPCALLSTACKENABLED |
 
57
        BOINC_DIAG_HEAPCHECKENABLED |
 
58
        BOINC_DIAG_TRACETOSTDOUT |
 
59
        BOINC_DIAG_REDIRECTSTDERR |
 
60
        BOINC_DIAG_REDIRECTSTDOUT;
 
61
 
 
62
    chdir_to_data_dir();
 
63
    diagnostics_init(flags, "stdouttray", "stderrtray");
 
64
 
 
65
    // Create application window class
54
66
    if (!hPrevInstance) {
55
67
        // Register an appropriate window class for the primary window
56
68
        WNDCLASS cls;
73
85
 
74
86
    hWnd = CreateWindow(
75
87
        _T("BOINCTrayWndClass"),
76
 
        _T("BOINC SystemTray Applet"),
 
88
        _T("BOINC System Tray Applet"),
77
89
        WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL,
78
90
        0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL
79
91
    );
86
98
    }
87
99
 
88
100
 
89
 
    // Cleanup and shutdown the BOINC client library idle tracking system.
90
 
    IdleTrackerDetach();
91
 
    ClientLibraryShutdown();
 
101
    // Cleanup and shutdown the BOINC idle tracking system.
 
102
    detach_idle_monitor();
92
103
 
93
104
    return msg.wParam;
94
105
}
133
144
//
134
145
DWORD WINAPI CBOINCTray::DataManagementProc() {
135
146
    while (true) {
136
 
        if (!m_bClientLibraryInitialized || !m_bIdleTrackerInitialized) {
137
 
            // On Vista systems, only elevated processes can create shared memory
138
 
            //   area's across various user sessions. In this case we need to wait
139
 
            //   for BOINC to create the shared memory area and then boinctray can
140
 
            //   successfully attach to it. What a PITA.
141
 
            if (!m_bClientLibraryInitialized) {
142
 
                m_bClientLibraryInitialized = ClientLibraryStartup();
143
 
            }
144
 
            if (m_bClientLibraryInitialized && !m_bIdleTrackerInitialized) {
145
 
                m_bIdleTrackerInitialized = IdleTrackerAttach();
146
 
            }
 
147
        // On Vista systems, only elevated processes can create shared memory
 
148
        //   area's across various user sessions. In this case we need to wait
 
149
        //   for BOINC to create the shared memory area and then boinctray can
 
150
        //   successfully attach to it. What a PITA.
 
151
        if (!m_bIdleTrackerInitialized) {
 
152
            m_bIdleTrackerInitialized = attach_idle_monitor();
147
153
        }
148
154
 
149
 
        BOINCGetIdleTickCount();
 
155
        get_idle_tick_count();
150
156
        Sleep(5000);
151
157
    }
152
158
}
194
200
) {
195
201
    return gspBOINCTray->TrayProc(hWnd, uMsg, wParam, lParam);
196
202
}
197
 
 
198
 
 
199
 
const char *BOINC_RCSID_116269c72f = "$Id: screensaver_win.cpp 13819 2007-10-10 09:25:40Z fthomas $";