Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
807e0c5c
Commit
807e0c5c
authored
Jul 27, 2010
by
Eli Gottlieb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on Cocoa implementation.
parent
01cddf42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
4 deletions
+35
-4
TODO
TODO
+2
-2
SDL_cocoashape.m
src/video/cocoa/SDL_cocoashape.m
+31
-2
SDL_cocoawindow.m
src/video/cocoa/SDL_cocoawindow.m
+2
-0
No files found.
TODO
View file @
807e0c5c
...
...
@@ -13,8 +13,8 @@ Eli Gottlieb's checklist for the GSOC shaped windows project. Dated July 9, 201
4. Implement the SDL shaped-windows API for Mac OS X using Cocoa. STATUS: IN PROGRESS
--> Locate (once more) the API documentation for shaped windows under Cocoa. STATUS: NEARLY FINISHED.
--> Design and encode a version of SDL_ShapeData for Cocoa. STATUS: IN PROGRESS.
--> Write Cocoa_CreateShaper(). STATUS:
IN PROGRESS
.
--> Write Cocoa_ResizeWindowShape(). STATUS:
IN PROGRESS
.
--> Write Cocoa_CreateShaper(). STATUS:
MOSTLY DONE, AFAIK
.
--> Write Cocoa_ResizeWindowShape(). STATUS:
DONE, AFAIK
.
--> Write Cocoa_SetWindowShape(). STATUS: IN PROGRESS.
--> If necessary, implement functionality adjunct to SDL_CalculateShapeBitmap() for Cocoa usage.
5. Use testeyes to debug all implementations. STATUS: SPRINT + 2.
...
...
src/video/cocoa/SDL_cocoashape.m
View file @
807e0c5c
...
...
@@ -20,6 +20,7 @@
eligottlieb
@
gmail
.
com
*/
#include
"SDL_cocoavideo.h"
#include
"SDL_shape.h"
#include
"SDL_cocoashape.h"
...
...
@@ -27,16 +28,44 @@ SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) {
SDL
_
WindowData
*
data
=
(
SDL
_
WindowData
*
)
window
->
driverdata
;
[
data
->
nswindow
setAlpha
:
1.0
]
;
[
data
->
nswindow
setOpaque
:
YES
]
;
[
data
->
nswindow
setStyleMask
:
NSBorderlessWindowMask
]
;
SDL
_
Shaper
*
result
=
result
=
malloc
(
sizeof
(
SDL
_
WindowShaper
))
;
result
->
window
=
window
;
result
->
mode
.
mode
=
ShapeModeDefault
;
result
->
mode
.
parameters
.
binarizationCutoff
=
1
;
result
->
usershownflag
=
0
;
window
->
shaper
=
result
;
SDL
_
ShapeData
*
data
=
malloc
(
sizeof
(
SDL
_
ShapeData
))
;
result
->
driverdata
=
data
;
data
->
context
=
[
data
->
nswindow
graphicsContext
]
;
data
->
saved
=
SDL
_
False
;
data
->
rects
=
NULL
;
data
->
count
=
0
;
int
resized
_
properly
=
Cocoa
_
ResizeWindowShape
(
window
)
;
assert
(
resized
_
properly
==
0
)
;
return
result
;
}
extern
int
Cocoa
_
SetWindowShape
(
SDL
_
WindowShaper
*
shaper
,
SDL
_
Surface
*
shape
,
SDL
_
WindowShapeMode
*
shapeMode
)
;
extern
int
Cocoa
_
ResizeWindowShape
(
SDL
_
Window
*
window
)
;
int
Cocoa
_
SetWindowShape
(
SDL
_
WindowShaper
*
shaper
,
SDL
_
Surface
*
shape
,
SDL
_
WindowShapeMode
*
shapeMode
)
{
SDL
_
WindowData
*
data
=
(
SDL
_
WindowData
*
)
shaper
->
window
->
driverdata
;
if
(
data
->
saved
==
SDL
_
True
)
{
[
data
->
context
restoreGraphicsState
]
;
data
->
saved
=
SDL
_
False
;
}
[
data
->
context
saveGraphicsState
]
;
data
->
saved
=
SDL
_
True
;
[[
NSColor
clearColor
]
set
]
;
NSRectFill
([[
data
->
nswindow
contentView
]
frame
])
;
/*
TODO
:
It
looks
like
Cocoa
can
set
a
clipping
path
based
on
a
list
of
rectangles
.
That
'
s
what
we
get
from
the
Windoze
shape
-
calculation
code
:
a
list
of
rectangles
.
This
will
work
...
I
think
.
*/
}
int
Cocoa
_
ResizeWindowShape
(
SDL
_
Window
*
window
)
{
SDL
_
ShapeData
*
data
=
window
->
shaper
->
driverdata
;
assert
(
data
!=
NULL
)
;
return
0
;
}
src/video/cocoa/SDL_cocoawindow.m
View file @
807e0c5c
...
...
@@ -28,6 +28,7 @@
#include "../../events/SDL_windowevents_c.h"
#include "SDL_cocoavideo.h"
#include "SDL_cocoashape.h"
static
__inline__
void
ConvertNSRect
(
NSRect
*
r
)
{
...
...
@@ -111,6 +112,7 @@ static __inline__ void ConvertNSRect(NSRect *r)
NSRect
rect
=
[
_data
->
nswindow
contentRectForFrameRect
:[
_data
->
nswindow
frame
]];
w
=
(
int
)
rect
.
size
.
width
;
h
=
(
int
)
rect
.
size
.
height
;
Cocoa_ResizeWindowShape
(
_data
->
window
);
SDL_SendWindowEvent
(
_data
->
window
,
SDL_WINDOWEVENT_RESIZED
,
w
,
h
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment