Revert "Partially switch to Darling OpenGL"

This reverts commit f36224e6484ecae43d4d00ae125589eebaa4c32a.
This commit is contained in:
Andrew Hyatt 2017-12-28 22:25:47 -08:00
parent 36bdd4ec2f
commit 030ce8b04c
5 changed files with 42 additions and 39 deletions

View File

@ -1,8 +1,6 @@
project(AppKit)
add_definitions(
-DOPENGL_LINUX_COMPAT
)
include(darling_framework)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
-include math.h \
@ -23,6 +21,23 @@ pkg_check_modules(PC_CAIRO cairo)
pkg_check_modules(PC_FONTCONFIG fontconfig)
include_directories(
${CMAKE_SOURCE_DIR}/src/external/foundation/include
${CMAKE_SOURCE_DIR}/src/external/foundation/include/Foundation
${CMAKE_SOURCE_DIR}/src/external/corefoundation
${CMAKE_SOURCE_DIR}/src/external/objc4/runtime
${CMAKE_SOURCE_DIR}/src/external/libclosure
${CMAKE_SOURCE_DIR}/src/external/security/include
${CMAKE_SOURCE_DIR}/src/external/cfnetwork/include
${CMAKE_SOURCE_DIR}/src/external/cfnetwork/private_include
${CMAKE_SOURCE_DIR}/src/launchd/liblaunch
${CMAKE_SOURCE_DIR}/src/libmalloc/include
${CMAKE_SOURCE_DIR}/src/copyfile
${CMAKE_SOURCE_DIR}/src/libc/gen
${CMAKE_SOURCE_DIR}/src/external/icu/icuSources/i18n
${CMAKE_SOURCE_DIR}/src/external/icu/icuSources/common
${CMAKE_SOURCE_DIR}/src/external/libxml2/include
${CMAKE_BINARY_DIR}/src/external/libxml2/include
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR}/../CoreText
@ -45,10 +60,6 @@ include_directories(
${PC_FONTCONFIG_INCLUDE_DIRS}
)
include_directories(BEFORE
${CMAKE_SOURCE_DIR}/src/OpenGL/include
)
set(AppKit_sources
NSComboBox.m
NSComboBoxCell.m
@ -284,7 +295,7 @@ set(AppKit_sources
X11.subproj/X11Window.m
X11.subproj/KTFont_FT.m
# O2Font_FT.m is built in Onyx2D
#X11.subproj/CGLContext.m
# CGLContext.m is built in OpenGL
X11.subproj/NSOpenGLDrawable_X11.m
X11.subproj/O2Context_cairo.m
X11.subproj/X11Display.m
@ -378,7 +389,6 @@ add_framework(AppKit
Onyx2D
CoreText
CoreData
OpenGL
# native libraries
FreeType
fontconfig
@ -386,7 +396,8 @@ add_framework(AppKit
GL
cairo
jpeg png tiff
QuartzCore
CIRCULAR_DEPENDENCIES
OpenGL
QuartzCore
CoreGraphics
)

View File

@ -119,8 +119,8 @@ static inline void _clearCurrentContext(){
};
CGLSetParameter(_glContext,kCGLCPSurfaceBackingSize,size);
//CGLSetParameter(_glContext,kCGLCPSurfaceBackingOrigin,origin);
//CGLSetParameter(_glContext,kCGLCPSurfaceHidden,hidden);
CGLSetParameter(_glContext,kCGLCPSurfaceBackingOrigin,origin);
CGLSetParameter(_glContext,kCGLCPSurfaceHidden,hidden);
}
-(void)setView:(NSView *)view {
@ -133,8 +133,7 @@ static inline void _clearCurrentContext(){
GLint num[1]={[[_view window] windowNumber]};
#warning this was commented out because the constant isn't standard
//CGLSetParameter(_glContext,kCGLCPSurfaceWindowNumber,num);
CGLSetParameter(_glContext,kCGLCPSurfaceWindowNumber,num);
[self update];

View File

@ -1,9 +1,4 @@
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#include <OpenGL/CGLContext.h>
#include <OpenGL/CGLTypes.h>
#import <OpenGL/OpenGL.h>
#import <Foundation/NSString.h>
#import "X11Display.h"
#import "X11Window.h"
@ -11,9 +6,9 @@
#import <X11/X.h>
#import <X11/Xlib.h>
//#import <GL/gl.h>
//#import <GL/glx.h>
//#import <GL/glext.h>
#import <GL/gl.h>
#import <GL/glx.h>
#import <GL/glext.h>
#import <pthread.h>
struct _CGLContextObj {

View File

@ -97,17 +97,17 @@ CGLError CGLCreateContextForWindow(CGLPixelFormatObj pixelFormat,CGLContextObj s
-(CGLContextObj)createGLContext {
CGLContextObj result=NULL;
/*CGLError error = CGLCreateContextForWindow(
*/ //NULL, /* CGLPixelFormatObj pixelFormat, unused */
// NULL, /* CGLContextObj share, unused */
// &result,
// _display,
// _visualInfo,
// _window
//);
CGLError error = CGLCreateContextForWindow(
NULL, /* CGLPixelFormatObj pixelFormat, unused */
NULL, /* CGLContextObj share, unused */
&result,
_display,
_visualInfo,
_window
);
//if(error != kCGLNoError)
NSLog(@"CGLCreateContext failed with %d in %s %d",/*error*/ 345.93 ,__FILE__,__LINE__);
if(error != kCGLNoError)
NSLog(@"CGLCreateContext failed with %d in %s %d",error,__FILE__,__LINE__);
return result;
}

View File

@ -17,8 +17,6 @@
#import <Onyx2D/O2Surface.h>
#import <QuartzCore/CAWindowOpenGLContext.h>
#include <CoreFoundation/CFBase.h>
void CGNativeBorderFrameWidthsForStyle(unsigned styleMask,CGFloat *top,CGFloat *left,CGFloat *bottom,CGFloat *right) {
*top=0;
*left=0;
@ -303,13 +301,13 @@ void CGNativeBorderFrameWidthsForStyle(unsigned styleMask,CGFloat *top,CGFloat *
return NO;
}
CF_EXPORT CGLError CGLCreateContextForWindow(CGLPixelFormatObj pixelFormat,CGLContextObj share,CGLContextObj *resultp,Display *display,XVisualInfo *visualInfo,Window window);
CGL_EXPORT CGLError CGLCreateContextForWindow(CGLPixelFormatObj pixelFormat,CGLContextObj share,CGLContextObj *resultp,Display *display,XVisualInfo *visualInfo,Window window);
-(void)createCGLContextObjIfNeeded {
if(_cglContext==NULL){
CGLError error;
#warning disabled
//if((error=CGLCreateContextForWindow(NULL,NULL,&_cglContext,_display,_visualInfo,_window))!=kCGLNoError)
if((error=CGLCreateContextForWindow(NULL,NULL,&_cglContext,_display,_visualInfo,_window))!=kCGLNoError)
NSLog(@"glXCreateContext failed at %s %d with error %d",__FILE__,__LINE__,error);
}
if(_cglContext!=NULL && _caContext==NULL){
@ -463,4 +461,4 @@ CGRect CGOutsetRectForNativeWindowBorder(CGRect frame,unsigned styleMask){
frame.size.height+=top+bottom;
return frame;
}
}