Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Unified Diff: tools/xdisplaycheck/xdisplaycheck.cc

Issue 10409035: Add a mode to ensure a server is not already running. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/xdisplaycheck/xdisplaycheck.cc
===================================================================
--- tools/xdisplaycheck/xdisplaycheck.cc (revision 135379)
+++ tools/xdisplaycheck/xdisplaycheck.cc (working copy)
@@ -12,6 +12,7 @@
#include <errno.h>
#include <stdio.h>
+#include <string.h>
#include <time.h>
#include <X11/Xlib.h>
@@ -34,8 +35,19 @@
}
int main(int argc, char* argv[]) {
+ Display* display = NULL;
+ if (argv[1] && strcmp(argv[1], "--noserver") == 0) {
+ display = XOpenDisplay(NULL);
+ if (display) {
+ fprintf(stderr, "Found unexpected connectable display %s\n",
+ XDisplayName(NULL));
+ }
+ // Return success when we got an unexpected display so that the code
+ // without the --noserver is the same, but slow, rather than inverted.
+ return !display;
+ }
+
int kNumTries = 78; // 78*77/2 * 10 = 30s of waiting
- Display* display = NULL;
int tries;
for (tries = 0; tries < kNumTries; ++tries) {
display = XOpenDisplay(NULL);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698