Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Work on wider support for detecting display configuration changes #166

Merged
merged 1 commit into from

3 participants

@cmsj

This is more of a notification than a pull request - I think this Quartz method may provide a more stable and supportable way of updating the layouts when displays are added or removed, but right now it is added on top of your existing detection method.

Assuming the Quartz way is acceptable, I would suggest we remove the existing method entirely and rely fully on Quartz. I would note, however, that I only have Mountain Lion systems to test on, so if this API is unsuitable in earlier versions, some combination will be required!

@cmsj cmsj Extend display reconfiguration detection to work on Mountain Lion. Th…
…is may double-detect on Lion and earlier, I have no such systems to test. I would hope that the Quartz method could become the only method in use.
419ae88
@jigish
Owner

thanks for looking at this. i've been busy as of late and have needed to fix this for mountain lion for a while. i'll test this on Lion to see how it works and potentially merge this and remove the other code.

@jigish jigish was assigned
@arturhoo

Any chances of this being accepted? I'm on ML 10.8.2 and monitor changes are not detected.

@jigish
Owner

yah, I'll accept this and publish a new version sometime this weekend. just came back from a long vacation so I'm a bit spent right now.

@jigish jigish merged commit 7e3dc54 into from
@jigish
Owner

finally merged. testing now then pushing a new version.

@jigish jigish referenced this pull request from a commit
Jigish Patel Version 1.0.17
- Merge Pull Request #191 - (Fix Issue #190)
- Merge Pull Request #166 - (Fix Issue #130)
- Merge Pull Request #204
- Merge Pull Request #185
5620a30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 27, 2012
  1. @cmsj

    Extend display reconfiguration detection to work on Mountain Lion. Th…

    cmsj authored
    …is may double-detect on Lion and earlier, I have no such systems to test. I would hope that the Quartz method could become the only method in use.
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 0 deletions.
  1. +2 −0  Slate/SlateConfig.h
  2. +8 −0 Slate/SlateConfig.m
View
2  Slate/SlateConfig.h
@@ -71,3 +71,5 @@
+ (NSURL *)snapshotsFile;
@end
+
+void onDisplayReconfiguration (CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void *userInfo);
View
8 Slate/SlateConfig.m
@@ -71,6 +71,9 @@ - (id)init {
NSNotificationCenter *nc = [NSDistributedNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(onScreenChange:) name:NOTIFICATION_SCREEN_CHANGE object:nil];
[nc addObserver:self selector:@selector(onScreenChange:) name:NOTIFICATION_SCREEN_CHANGE_LION object:nil];
+
+ // Listen for screen change notifications with Quartz
+ CGDisplayRegisterReconfigurationCallback(onDisplayReconfiguration, (__bridge void *)(self));
//[nc addObserver:self selector:@selector(processNotification:) name:nil object:nil];
}
return self;
@@ -569,3 +572,8 @@ + (NSURL *)snapshotsFile {
}
@end
+
+void onDisplayReconfiguration (CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void *userInfo) {
+ NSLog(@"onDisplayReconfiguration");
+ [(__bridge id)userInfo onScreenChange:nil];
+}
Something went wrong with that request. Please try again.