~ubuntu-branches/ubuntu/precise/xorg-server/precise-updates

« back to all changes in this revision

Viewing changes to hw/xfree86/common/xf86PM.c

Tags: 2:1.10.1-2
* Build xserver-xorg-core-udeb on hurd-i386.  Thanks, Samuel Thibault!
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "xf86.h"
34
34
#include "xf86Priv.h"
35
35
#include "xf86Xinput.h"
 
36
#include "xf86_OSproc.h"
36
37
 
37
38
int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num) = NULL;
38
39
pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event) = NULL;
61
62
    }
62
63
}
63
64
 
 
65
static int sigio_blocked_for_suspend;
 
66
 
64
67
static void
65
68
suspend (pmEvent event, Bool undo)
66
69
{
67
70
    int i;
68
71
    InputInfoPtr pInfo;
69
72
 
70
 
   xf86inSuspend = TRUE;
71
 
    
72
73
    for (i = 0; i < xf86NumScreens; i++) {
73
74
        if (xf86Screens[i]->EnableDisableFBAccess)
74
75
            (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE);
78
79
        DisableDevice(pInfo->dev, TRUE);
79
80
        pInfo = pInfo->next;
80
81
    }
81
 
    xf86EnterServerState(SETUP);
 
82
    sigio_blocked_for_suspend = xf86BlockSIGIO();
82
83
    for (i = 0; i < xf86NumScreens; i++) {
83
84
        if (xf86Screens[i]->PMEvent)
84
85
            xf86Screens[i]->PMEvent(i,event,undo);
98
99
    InputInfoPtr pInfo;
99
100
 
100
101
    xf86AccessEnter();
101
 
    xf86EnterServerState(SETUP);
102
102
    for (i = 0; i < xf86NumScreens; i++) {
103
103
        if (xf86Screens[i]->PMEvent)
104
104
            xf86Screens[i]->PMEvent(i,event,undo);
107
107
            xf86Screens[i]->EnterVT(i, 0);
108
108
        }
109
109
    }
110
 
    xf86EnterServerState(OPERATING);
 
110
    xf86UnblockSIGIO(sigio_blocked_for_suspend);
111
111
    for (i = 0; i < xf86NumScreens; i++) {
112
112
        if (xf86Screens[i]->EnableDisableFBAccess)
113
113
            (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
118
118
        EnableDevice(pInfo->dev, TRUE);
119
119
        pInfo = pInfo->next;
120
120
    }
121
 
    xf86inSuspend = FALSE;
122
121
}
123
122
 
124
123
static void
125
124
DoApmEvent(pmEvent event, Bool undo)
126
125
{
127
 
    /* 
128
 
     * we leave that as a global function for now. I don't know if 
129
 
     * this might cause problems in the future. It is a global server 
130
 
     * variable therefore it needs to be in a server info structure
131
 
     */
132
 
    int i, setup = 0;
 
126
    int i, was_blocked;
133
127
    
134
128
    switch(event) {
135
129
#if 0
159
153
        }
160
154
        break;
161
155
    default:
 
156
        was_blocked = xf86BlockSIGIO();
162
157
        for (i = 0; i < xf86NumScreens; i++) {
163
158
            if (xf86Screens[i]->PMEvent) {
164
 
                if (!setup) xf86EnterServerState(SETUP);
165
 
                setup = 1;
166
159
                xf86Screens[i]->PMEvent(i,event,undo);
167
160
            }
168
161
        }
169
 
        if (setup) xf86EnterServerState(OPERATING);
 
162
        xf86UnblockSIGIO(was_blocked);
170
163
        break;
171
164
    }
172
165
}