Skip to content

Commit

Permalink
libmythui: Cleanup osx utility code
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-kendall committed Dec 9, 2019
1 parent 9b3b1dd commit dc5c674
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 83 deletions.
8 changes: 4 additions & 4 deletions mythtv/libs/libmythui/libmythui.pro
Expand Up @@ -110,14 +110,14 @@ using_qtdbus {
}

macx {
HEADERS += screensaver-osx.h util-osx.h
SOURCES += screensaver-osx.cpp util-osx.cpp
HEADERS += screensaver-osx.h platforms/mythosxutils.h
SOURCES += screensaver-osx.cpp platforms/mythosxutils.cpp
HEADERS += platforms/mythdisplayosx.h
SOURCES += platforms/mythdisplayosx.cpp
QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CXXFLAGS
QMAKE_OBJECTIVE_CXXFLAGS += $$QMAKE_CXXFLAGS
OBJECTIVE_HEADERS += util-osx-cocoa.h
OBJECTIVE_SOURCES += util-osx-cocoa.mm
OBJECTIVE_HEADERS += platforms/mythutilscocoa.h
OBJECTIVE_SOURCES += platforms/mythutilscocoa.mm
LIBS += -framework Cocoa -framework IOKit

using_appleremote {
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythui/platforms/mythdisplayosx.cpp
Expand Up @@ -3,7 +3,7 @@
#include "mythcorecontext.h"
#include "mythmainwindow.h"
#include "mythdisplayosx.h"
#import "util-osx.h"
#import "mythosxutils.h"

#define LOC QString("DisplayOSX: ")

Expand Down
Expand Up @@ -13,9 +13,14 @@
* Nigel Pearson
*****************************************************************************/

#import "util-osx.h"
#import "util-osx-cocoa.h"
// MythTV
#import "mythosxutils.h"
#import "mythutilscocoa.h"

// OSX
#import <CoreFoundation/CFNumber.h>

// Std
#include <cstdio>

int get_int_CF(CFDictionaryRef dict, CFStringRef key)
Expand Down
@@ -1,10 +1,15 @@
#ifndef UTIL_OSX_H
#define UTIL_OSX_H
#ifndef MYTHOSXUTILS_H_
#define MYTHOSXUTILS_H_

// Qt
#include <QWidget> // for WId

// MythTV
#include "mythuiexp.h"

// OSX
#import <CoreFoundation/CFDictionary.h>
#import <ApplicationServices/ApplicationServices.h>
#include "mythuiexp.h"
#include <QWidget> // for WId

MUI_PUBLIC int get_int_CF(CFDictionaryRef dict, CFStringRef key);
MUI_PUBLIC float get_float_CF(CFDictionaryRef dict, CFStringRef key);
Expand Down
12 changes: 12 additions & 0 deletions mythtv/libs/libmythui/platforms/mythutilscocoa.h
@@ -0,0 +1,12 @@
#ifndef MYTHUTILSCOCOA_H_
#define MYTHUTILSCOCOA_H_

// MythTV
#include "mythuiexp.h"

// OSX
#import "ApplicationServices/ApplicationServices.h"

CGDirectDisplayID GetOSXCocoaDisplay(void* view);

#endif // MYTHUTILSCOCOA_H_
14 changes: 14 additions & 0 deletions mythtv/libs/libmythui/platforms/mythutilscocoa.mm
@@ -0,0 +1,14 @@
// MythTV
#include "mythutilscocoa.h"

CGDirectDisplayID GetOSXCocoaDisplay(void* view)
{
NSView *thisview = static_cast<NSView *>(view);
if (!thisview)
return 0;
NSScreen *screen = [[thisview window] screen];
if (!screen)
return 0;
NSDictionary* desc = [screen deviceDescription];
return (CGDirectDisplayID)[[desc objectForKey:@"NSScreenNumber"] intValue];
}
20 changes: 0 additions & 20 deletions mythtv/libs/libmythui/util-osx-cocoa.h

This file was deleted.

52 changes: 0 additions & 52 deletions mythtv/libs/libmythui/util-osx-cocoa.mm

This file was deleted.

0 comments on commit dc5c674

Please sign in to comment.