Merge "MinGW/Cygwin requires open() in O_BINARY mode." into gingerbread
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index c0be3a0..944731d 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -439,11 +439,10 @@
// Since mFDs[0] is used for inotify, we process regular events starting at index 1.
mInputDeviceIndex += 1;
if (mInputDeviceIndex >= mFDCount) {
- mInputDeviceIndex = 0;
break;
}
- const struct pollfd &pfd = mFDs[mInputDeviceIndex];
+ const struct pollfd& pfd = mFDs[mInputDeviceIndex];
if (pfd.revents & POLLIN) {
int32_t readSize = read(pfd.fd, mInputBufferData,
sizeof(struct input_event) * INPUT_BUFFER_SIZE);
@@ -460,11 +459,17 @@
}
}
+#if HAVE_INOTIFY
// readNotify() will modify mFDs and mFDCount, so this must be done after
// processing all other events.
if(mFDs[0].revents & POLLIN) {
readNotify(mFDs[0].fd);
+ mFDs[0].revents = 0;
+ continue; // report added or removed devices immediately
}
+#endif
+
+ mInputDeviceIndex = 0;
// Poll for events. Mind the wake lock dance!
// We hold a wake lock at all times except during poll(). This works due to some
@@ -482,7 +487,7 @@
if (pollResult <= 0) {
if (errno != EINTR) {
- LOGW("select failed (errno=%d)\n", errno);
+ LOGW("poll failed (errno=%d)\n", errno);
usleep(100000);
}
}
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 3734969..073ce01 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1576,6 +1576,7 @@
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
hw_w, hw_h, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
if (glGetError() != GL_NO_ERROR) {
+ while ( glGetError() != GL_NO_ERROR ) ;
GLint tw = (2 << (31 - clz(hw_w)));
GLint th = (2 << (31 - clz(hw_h)));
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
@@ -1907,11 +1908,9 @@
// we're already off
return NO_ERROR;
}
- status_t result = electronBeamOffAnimationImplLocked();
- if (result == NO_ERROR) {
- hw.setCanDraw(false);
- }
- return result;
+ electronBeamOffAnimationImplLocked();
+ hw.setCanDraw(false);
+ return NO_ERROR;
}
status_t SurfaceFlinger::turnElectronBeamOff(int32_t mode)
@@ -1958,11 +1957,9 @@
// we're already on
return NO_ERROR;
}
- status_t result = electronBeamOnAnimationImplLocked();
- if (result == NO_ERROR) {
- hw.setCanDraw(true);
- }
- return result;
+ electronBeamOnAnimationImplLocked();
+ hw.setCanDraw(true);
+ return NO_ERROR;
}
status_t SurfaceFlinger::turnElectronBeamOn(int32_t mode)