Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 173503 | Differences between
and this patch

Collapse All | Expand All

(-)client/client_state.C.orig (+36 lines)
Lines 34-39 Link Here
34
#endif
34
#endif
35
#endif
35
#endif
36
36
37
#ifdef linux
38
#include <sys/fcntl.h>
39
#endif
40
37
#include "parse.h"
41
#include "parse.h"
38
#include "str_util.h"
42
#include "str_util.h"
39
#include "util.h"
43
#include "util.h"
Lines 125-130 Link Here
125
    launched_by_manager = false;
129
    launched_by_manager = false;
126
    initialized = false;
130
    initialized = false;
127
    last_wakeup_time = dtime();
131
    last_wakeup_time = dtime();
132
#ifdef linux
133
    mouse_moved = true;
134
    mouse_event_t = time(NULL);
135
    mouse_fd = open("/dev/input/mouse0", O_RDONLY);
136
#endif    
137
}
138
139
CLIENT_STATE::~CLIENT_STATE()
140
{
141
#ifdef linux
142
    if(mouse_fd != -1)
143
        close(mouse_fd);
144
#endif
128
}
145
}
129
146
130
void CLIENT_STATE::show_host_info() {
147
void CLIENT_STATE::show_host_info() {
Lines 414-419 Link Here
414
		http_ops->get_fdset(curl_fds);
431
		http_ops->get_fdset(curl_fds);
415
        all_fds = curl_fds;
432
        all_fds = curl_fds;
416
        gui_rpcs.get_fdset(gui_rpc_fds, all_fds);
433
        gui_rpcs.get_fdset(gui_rpc_fds, all_fds);
434
#ifdef linux
435
        FD_SET(mouse_fd, &all_fds.read_fds);
436
        if (mouse_fd > all_fds.max_fd) all_fds.max_fd = mouse_fd;
437
#endif        
417
        double_to_timeval(x, tv);
438
        double_to_timeval(x, tv);
418
        n = select(
439
        n = select(
419
            all_fds.max_fd+1,
440
            all_fds.max_fd+1,
Lines 429-434 Link Here
429
451
430
        http_ops->got_select(all_fds, x);
452
        http_ops->got_select(all_fds, x);
431
        gui_rpcs.got_select(all_fds);
453
        gui_rpcs.got_select(all_fds);
454
#ifdef linux
455
        if (mouse_fd != -1) {
456
            if (FD_ISSET(mouse_fd, &all_fds.read_fds)) {
457
                char ps2_packet[3]; //assume ps/2 mouse protocol 3 byte packet
458
                if(read(mouse_fd, ps2_packet, 3) == 3) {
459
                    mouse_moved = true;
460
                    mouse_event_t = time(NULL);
461
                }
462
            }
463
        }
464
#endif
432
465
433
        if (n==0) break;
466
        if (n==0) break;
434
467
Lines 496-501 Link Here
496
#ifdef __APPLE__
529
#ifdef __APPLE__
497
         , &idletime
530
         , &idletime
498
#endif
531
#endif
532
#ifdef linux
533
         , &mouse_moved
534
         , mouse_event_t
535
#endif
499
    );
536
    );
500
537
501
    if (user_active != old_user_active) {
538
    if (user_active != old_user_active) {
(-)client/client_state.h.orig (+6 lines)
Lines 213-218 Link Here
213
// --------------- client_state.C:
213
// --------------- client_state.C:
214
public:
214
public:
215
    CLIENT_STATE();
215
    CLIENT_STATE();
216
    ~CLIENT_STATE();    
216
    void show_host_info();
217
    void show_host_info();
217
    int init();
218
    int init();
218
    bool poll_slow_events();
219
    bool poll_slow_events();
Lines 243-248 Link Here
243
    bool garbage_collect_always();
244
    bool garbage_collect_always();
244
    bool update_results();
245
    bool update_results();
245
    int nresults_for_project(PROJECT*);
246
    int nresults_for_project(PROJECT*);
247
#ifdef linux
248
    int mouse_fd;
249
    bool mouse_moved;
250
    time_t mouse_event_t;
251
#endif
246
252
247
// --------------- cpu_sched.C:
253
// --------------- cpu_sched.C:
248
private:
254
private:
(-)client/hostinfo_unix.C.orig (+18 lines)
Lines 946-951 Link Here
946
    return (idleTime > (60 * idle_time_to_run));
946
    return (idleTime > (60 * idle_time_to_run));
947
}
947
}
948
948
949
#elif linux
950
951
bool HOST_INFO::users_idle(bool check_all_logins, double idle_time_to_run, bool* mouse_moved, time_t mouse_event_t) {
952
    time_t cur_time = time(NULL);
953
    time_t idle_time = cur_time - (long) (60 * idle_time_to_run);
954
    if (mouse_event_t != 0) {
955
        if (mouse_moved && mouse_event_t < idle_time)
956
            *mouse_moved = false;
957
    }
958
959
    bool idle_result = true;
960
#ifdef HAVE_UTMP_H
961
    idle_result = idle_result && all_logins_idle(idle_time);
962
#endif
963
    idle_result = idle_result && (mouse_moved ? !*mouse_moved : true);
964
    return idle_result;
965
}
966
949
#else  // ! __APPLE__
967
#else  // ! __APPLE__
950
968
951
bool HOST_INFO::users_idle(bool check_all_logins, double idle_time_to_run) {
969
bool HOST_INFO::users_idle(bool check_all_logins, double idle_time_to_run) {
(-)lib/hostinfo.h.orig (+2 lines)
Lines 72-77 Link Here
72
    bool host_is_running_on_batteries();
72
    bool host_is_running_on_batteries();
73
#ifdef __APPLE__
73
#ifdef __APPLE__
74
    bool users_idle(bool check_all_logins, double idle_time_to_run, double *actual_idle_time=NULL);
74
    bool users_idle(bool check_all_logins, double idle_time_to_run, double *actual_idle_time=NULL);
75
#elif linux
76
    bool users_idle(bool check_all_logins, double idle_time_to_run, bool* mouse_moved = NULL, time_t mouse_event_t = 0);
75
#else
77
#else
76
    bool users_idle(bool check_all_logins, double idle_time_to_run);
78
    bool users_idle(bool check_all_logins, double idle_time_to_run);
77
#endif
79
#endif
(-)checkin_notes.orig (+10 lines)
Lines 7985-7987 Link Here
7985
    mac_installer/
7985
    mac_installer/
7986
        release_boinc.sh
7986
        release_boinc.sh
7987
        release_GridRepublic.sh
7987
        release_GridRepublic.sh
7988
7989
Orson Teodoro 04 Jan 2008
7990
    - Linux: Input event mouse idle detection and segfault fix
7991
    client/
7992
        client_state.C
7993
        client_state.h
7994
        hostinfo_unix.C
7995
        main.C
7996
    lib/
7997
        hostinfo.h

Return to bug 173503