Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9714e6ee
Commit
9714e6ee
authored
Mar 17, 2013
by
Ken Thomases
Committed by
Alexandre Julliard
Mar 25, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Implement rudimentary support for system tray icons as Mac status items.
parent
b1de5323
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
202 additions
and
1 deletion
+202
-1
Makefile.in
dlls/winemac.drv/Makefile.in
+2
-0
cocoa_status_item.m
dlls/winemac.drv/cocoa_status_item.m
+175
-0
event.c
dlls/winemac.drv/event.c
+5
-0
image.c
dlls/winemac.drv/image.c
+1
-1
macdrv.h
dlls/winemac.drv/macdrv.h
+3
-0
macdrv_cocoa.h
dlls/winemac.drv/macdrv_cocoa.h
+13
-0
systray.c
dlls/winemac.drv/systray.c
+0
-0
winemac.drv.spec
dlls/winemac.drv/winemac.drv.spec
+3
-0
No files found.
dlls/winemac.drv/Makefile.in
View file @
9714e6ee
...
...
@@ -16,6 +16,7 @@ C_SRCS = \
opengl.c
\
scroll.c
\
surface.c
\
systray.c
\
window.c
OBJC_SRCS
=
\
...
...
@@ -25,6 +26,7 @@ OBJC_SRCS = \
cocoa_event.m
\
cocoa_main.m
\
cocoa_opengl.m
\
cocoa_status_item.m
\
cocoa_window.m
@MAKE_DLL_RULES@
dlls/winemac.drv/cocoa_status_item.m
0 → 100644
View file @
9714e6ee
/*
* MACDRV Cocoa status item class
*
* Copyright 2011, 2012, 2013 Ken Thomases for CodeWeavers Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#import <Cocoa/Cocoa.h>
#include "macdrv_cocoa.h"
#import "cocoa_app.h"
#import "cocoa_event.h"
@interface
WineStatusItem
:
NSObject
{
NSStatusItem
*
item
;
WineEventQueue
*
queue
;
}
@property
(
retain
,
nonatomic
)
NSStatusItem
*
item
;
@property
(
assign
,
nonatomic
)
WineEventQueue
*
queue
;
@end
@implementation
WineStatusItem
@synthesize
item
,
queue
;
-
(
id
)
initWithEventQueue
:(
WineEventQueue
*
)
inQueue
{
self
=
[
super
init
];
if
(
self
)
{
NSStatusBar
*
statusBar
=
[
NSStatusBar
systemStatusBar
];
item
=
[[
statusBar
statusItemWithLength
:
NSSquareStatusItemLength
]
retain
];
[
item
setTarget
:
self
];
[
item
setAction
:
@selector
(
clicked
:)];
[
item
setDoubleAction
:
@selector
(
doubleClicked
:)];
queue
=
inQueue
;
}
return
self
;
}
-
(
void
)
dealloc
{
if
(
item
)
{
NSStatusBar
*
statusBar
=
[
NSStatusBar
systemStatusBar
];
[
statusBar
removeStatusItem
:
item
];
[
item
release
];
}
[
super
dealloc
];
}
-
(
void
)
removeFromStatusBar
{
if
(
item
)
{
NSStatusBar
*
statusBar
=
[
NSStatusBar
systemStatusBar
];
[
statusBar
removeStatusItem
:
item
];
self
.
item
=
nil
;
}
}
-
(
void
)
postClickedEventWithCount
:
(
int
)
count
{
macdrv_event
event
;
event
.
type
=
STATUS_ITEM_CLICKED
;
event
.
window
=
NULL
;
event
.
status_item_clicked
.
item
=
(
macdrv_status_item
)
self
;
event
.
status_item_clicked
.
count
=
count
;
[
queue
postEvent
:
&
event
];
}
-
(
void
)
clicked
:
(
id
)
sender
{
[
self
postClickedEventWithCount
:
1
];
}
-
(
void
)
doubleClicked
:
(
id
)
sender
{
[
self
postClickedEventWithCount
:
2
];
}
@end
/***********************************************************************
* macdrv_create_status_item
*
* Creates a new status item in the status bar.
*/
macdrv_status_item
macdrv_create_status_item
(
macdrv_event_queue
q
)
{
WineEventQueue
*
queue
=
(
WineEventQueue
*
)
q
;
__block
WineStatusItem
*
statusItem
;
OnMainThread
(
^
{
statusItem
=
[[
WineStatusItem
alloc
]
initWithEventQueue
:
queue
];
});
return
(
macdrv_status_item
)
statusItem
;
}
/***********************************************************************
* macdrv_destroy_status_item
*
* Removes a status item previously returned by
* macdrv_create_status_item() from the status bar and destroys it.
*/
void
macdrv_destroy_status_item
(
macdrv_status_item
s
)
{
WineStatusItem
*
statusItem
=
(
WineStatusItem
*
)
s
;
OnMainThreadAsync
(
^
{
[
statusItem
removeFromStatusBar
];
[
statusItem
release
];
});
}
/***********************************************************************
* macdrv_set_status_item_image
*
* Sets the image for a status item. If cgimage is NULL, clears the
* image of the status item (leaving it a blank spot on the menu bar).
*/
void
macdrv_set_status_item_image
(
macdrv_status_item
s
,
CGImageRef
cgimage
)
{
WineStatusItem
*
statusItem
=
(
WineStatusItem
*
)
s
;
CGImageRetain
(
cgimage
);
OnMainThreadAsync
(
^
{
NSImage
*
image
=
nil
;
if
(
cgimage
)
{
image
=
[[
NSImage
alloc
]
initWithCGImage
:
cgimage
size
:
NSZeroSize
];
CGImageRelease
(
cgimage
);
}
[
statusItem
.
item
setImage
:
image
];
[
image
release
];
});
}
/***********************************************************************
* macdrv_set_status_item_tooltip
*
* Sets the tooltip string for a status item. If cftip is NULL, clears
* the tooltip string for the status item.
*/
void
macdrv_set_status_item_tooltip
(
macdrv_status_item
s
,
CFStringRef
cftip
)
{
WineStatusItem
*
statusItem
=
(
WineStatusItem
*
)
s
;
NSString
*
tip
=
(
NSString
*
)
cftip
;
if
(
!
[
tip
length
])
tip
=
nil
;
OnMainThreadAsync
(
^
{
[
statusItem
.
item
setToolTip
:
tip
];
});
}
dlls/winemac.drv/event.c
View file @
9714e6ee
...
...
@@ -42,6 +42,7 @@ static const char *dbgstr_event(int type)
"MOUSE_MOVED_ABSOLUTE"
,
"MOUSE_SCROLL"
,
"QUERY_EVENT"
,
"STATUS_ITEM_CLICKED"
,
"WINDOW_CLOSE_REQUESTED"
,
"WINDOW_DID_MINIMIZE"
,
"WINDOW_DID_UNMINIMIZE"
,
...
...
@@ -87,6 +88,7 @@ static macdrv_event_mask get_event_mask(DWORD mask)
{
event_mask
|=
event_mask_for_type
(
APP_DEACTIVATED
);
event_mask
|=
event_mask_for_type
(
DISPLAYS_CHANGED
);
event_mask
|=
event_mask_for_type
(
STATUS_ITEM_CLICKED
);
event_mask
|=
event_mask_for_type
(
WINDOW_CLOSE_REQUESTED
);
event_mask
|=
event_mask_for_type
(
WINDOW_DID_MINIMIZE
);
event_mask
|=
event_mask_for_type
(
WINDOW_DID_UNMINIMIZE
);
...
...
@@ -186,6 +188,9 @@ void macdrv_handle_event(macdrv_event *event)
case
QUERY_EVENT
:
macdrv_query_event
(
hwnd
,
event
);
break
;
case
STATUS_ITEM_CLICKED
:
macdrv_status_item_clicked
(
event
);
break
;
case
WINDOW_CLOSE_REQUESTED
:
macdrv_window_close_requested
(
hwnd
);
break
;
...
...
dlls/winemac.drv/image.c
View file @
9714e6ee
...
...
@@ -181,7 +181,7 @@ CGImageRef create_cgimage_from_icon_bitmaps(HDC hdc, HANDLE icon, HBITMAP hbmCol
*
* Create a CGImage from a Windows icon.
*/
static
CGImageRef
create_cgimage_from_icon
(
HANDLE
icon
,
int
width
,
int
height
)
CGImageRef
create_cgimage_from_icon
(
HANDLE
icon
,
int
width
,
int
height
)
{
CGImageRef
ret
=
NULL
;
HDC
hdc
;
...
...
dlls/winemac.drv/macdrv.h
View file @
9714e6ee
...
...
@@ -177,6 +177,9 @@ extern CGImageRef create_cgimage_from_icon_bitmaps(HDC hdc, HANDLE icon, HBITMAP
unsigned
char
*
color_bits
,
int
color_size
,
HBITMAP
hbmMask
,
unsigned
char
*
mask_bits
,
int
mask_size
,
int
width
,
int
height
,
int
istep
)
DECLSPEC_HIDDEN
;
extern
CGImageRef
create_cgimage_from_icon
(
HANDLE
icon
,
int
width
,
int
height
)
DECLSPEC_HIDDEN
;
extern
CFArrayRef
create_app_icon_images
(
void
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_status_item_clicked
(
const
macdrv_event
*
event
)
DECLSPEC_HIDDEN
;
#endif
/* __WINE_MACDRV_H */
dlls/winemac.drv/macdrv_cocoa.h
View file @
9714e6ee
...
...
@@ -116,6 +116,7 @@ typedef struct macdrv_opaque_window* macdrv_window;
typedef
struct
macdrv_opaque_event_queue
*
macdrv_event_queue
;
typedef
struct
macdrv_opaque_view
*
macdrv_view
;
typedef
struct
macdrv_opaque_opengl_context
*
macdrv_opengl_context
;
typedef
struct
macdrv_opaque_status_item
*
macdrv_status_item
;
struct
macdrv_event
;
struct
macdrv_query
;
...
...
@@ -161,6 +162,7 @@ enum {
MOUSE_MOVED_ABSOLUTE
,
MOUSE_SCROLL
,
QUERY_EVENT
,
STATUS_ITEM_CLICKED
,
WINDOW_CLOSE_REQUESTED
,
WINDOW_DID_MINIMIZE
,
WINDOW_DID_UNMINIMIZE
,
...
...
@@ -212,6 +214,10 @@ typedef struct macdrv_event {
struct
macdrv_query
*
query
;
}
query_event
;
struct
{
macdrv_status_item
item
;
int
count
;
}
status_item_clicked
;
struct
{
CGRect
frame
;
}
window_frame_changed
;
struct
{
...
...
@@ -348,4 +354,11 @@ extern void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v)
extern
void
macdrv_update_opengl_context
(
macdrv_opengl_context
c
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_flush_opengl_context
(
macdrv_opengl_context
c
)
DECLSPEC_HIDDEN
;
/* systray / status item */
extern
macdrv_status_item
macdrv_create_status_item
(
macdrv_event_queue
q
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_destroy_status_item
(
macdrv_status_item
s
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_set_status_item_image
(
macdrv_status_item
s
,
CGImageRef
cgimage
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_set_status_item_tooltip
(
macdrv_status_item
s
,
CFStringRef
cftip
)
DECLSPEC_HIDDEN
;
#endif
/* __WINE_MACDRV_COCOA_H */
dlls/winemac.drv/systray.c
0 → 100644
View file @
9714e6ee
This diff is collapsed.
Click to expand it.
dlls/winemac.drv/winemac.drv.spec
View file @
9714e6ee
...
...
@@ -46,3 +46,6 @@
@ cdecl WindowMessage(long long long long) macdrv_WindowMessage
@ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) macdrv_WindowPosChanged
@ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) macdrv_WindowPosChanging
# System tray
@ cdecl wine_notify_icon(long ptr)
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