Skip to content

Commit c0fd5bd

Browse files
committed
Display Preferences: initial implementation of using alert panel to confirm resolution change.
1 parent 1f9ef3c commit c0fd5bd

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

Applications/Preferences/AppController.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotif
7979
if ([NSApp isActive] == NO) {
8080
OSEDefaults *defs = [OSEDefaults globalUserDefaults];
8181

82-
NSLog(@"Configuring Keyboard...");
82+
// NSLog(@"Configuring Keyboard...");
8383
[OSEKeyboard configureWithDefaults:defs];
8484

85-
NSLog(@"Configuring Mouse...");
85+
// NSLog(@"Configuring Mouse...");
8686
OSEMouse *mouse = [OSEMouse new];
8787
[mouse setAcceleration:[defs integerForKey:OSEMouseAcceleration]
8888
threshold:[defs integerForKey:OSEMouseThreshold]];
8989
[mouse release];
9090

91-
NSLog(@"Configuring Desktop background...");
91+
// NSLog(@"Configuring Desktop background...");
9292
OSEScreen *screen = [OSEScreen new];
9393
CGFloat red, green, blue;
9494
if ([screen savedBackgroundColorRed:&red green:&green blue:&blue] == YES) {

Applications/Preferences/Modules/Display/Display.m

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
#import <SystemKit/OSEDefaults.h>
3434
#import <DesktopKit/NXTNumericField.h>
35+
#import <DesktopKit/NXTCountdownAlert.h>
3536

3637
#import <SystemKit/OSEScreen.h>
3738
#import <SystemKit/OSEDisplay.h>
@@ -181,6 +182,7 @@ - (void)updateRateButton
181182
- (void)setResolution
182183
{
183184
NSDictionary *resolution = [[rateBtn selectedCell] representedObject];
185+
184186
if (resolution == nil) {
185187
NSLog(@"%s - resolution dictionary is nil! Resolution button is %@", __func__,
186188
[resolutionBtn title]);
@@ -395,9 +397,26 @@ - (void)controlTextDidEndEditing:(NSNotification *)aNotification
395397
// Notifications
396398
- (void)screenDidUpdate:(NSNotification *)aNotif
397399
{
400+
NXTCountdownAlert *alert;
401+
NSInteger result;
402+
398403
NSLog(@"%s: XRandR screen resources was updated, refreshing...", __func__);
399404
[monitorsList reloadColumn:0];
400405
[self selectFirstEnabledMonitor];
406+
407+
alert =
408+
[[NXTCountdownAlert alloc] initWithTitle:@"Display resolution"
409+
message:@"Do you want to keep current display resolution?\n"
410+
"Resolution will be reverted in %i seconds."
411+
defaultButton:@"Revert"
412+
alternateButton:@"Keep"
413+
otherButton:nil];
414+
[alert setCountDownPeriod:5];
415+
result = [alert runModal];
416+
[alert release];
417+
// switch (result) {
418+
// case NSDef
419+
// }
401420
}
402421

403422
@end

0 commit comments

Comments
 (0)