ReactOS 0.4.15-dev-7681-g776c3a3
appbar.cpp File Reference
#include "precomp.h"
#include <wine/list.h>
Include dependency graph for appbar.cpp:

Go to the source code of this file.

Classes

struct  appbar_cmd
 
struct  appbar_response
 
struct  appbar_data
 

Functions

static struct appbar_dataget_appbar (HWND hwnd)
 
void appbar_notify_all (HMONITOR hMon, UINT uMsg, HWND hwndExclude, LPARAM lParam)
 
static void send_poschanged (HWND hwnd)
 
static void appbar_cliprect (HWND hwnd, RECT *rect)
 
static UINT_PTR handle_appbarmessage (DWORD msg, _AppBarData *abd)
 
LRESULT appbar_message (COPYDATASTRUCT *cds)
 

Variables

static struct list appbars = LIST_INIT(appbars)
 

Function Documentation

◆ appbar_cliprect()

static void appbar_cliprect ( HWND  hwnd,
RECT rect 
)
static

Definition at line 101 of file appbar.cpp.

102{
103 struct appbar_data* data;
105 {
106 if (data->hwnd == hwnd)
107 {
108 /* we only care about appbars that were added before this one */
109 return;
110 }
111 if (data->space_reserved)
112 {
113 /* move in the side that corresponds to the other appbar's edge */
114 switch (data->edge)
115 {
116 case ABE_BOTTOM:
117 rect->bottom = min(rect->bottom, data->rc.top);
118 break;
119 case ABE_LEFT:
120 rect->left = max(rect->left, data->rc.right);
121 break;
122 case ABE_RIGHT:
123 rect->right = min(rect->right, data->rc.left);
124 break;
125 case ABE_TOP:
126 rect->top = max(rect->top, data->rc.bottom);
127 break;
128 }
129 }
130 }
131}
static struct list appbars
Definition: appbar.cpp:63
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
uint32_t entry
Definition: isohybrid.c:63
#define min(a, b)
Definition: monoChain.cc:55
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define ABE_BOTTOM
Definition: shellapi.h:20
#define ABE_RIGHT
Definition: shellapi.h:19
#define ABE_TOP
Definition: shellapi.h:18
#define ABE_LEFT
Definition: shellapi.h:17
& rect
Definition: startmenu.cpp:1413
#define max(a, b)
Definition: svc.c:63
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by handle_appbarmessage().

◆ appbar_message()

LRESULT appbar_message ( COPYDATASTRUCT cds)

Definition at line 229 of file appbar.cpp.

230{
231 struct appbar_cmd cmd;
233 HANDLE return_hproc;
235 LPVOID return_view;
236 struct appbar_response* response;
237
238 if (cds->cbData != sizeof(struct appbar_cmd))
239 return TRUE;
240
241 RtlCopyMemory(&cmd, cds->lpData, cds->cbData);
242
243 result = handle_appbarmessage(cmd.dwMsg, &cmd.abd);
244
245 return_hproc = OpenProcess(PROCESS_DUP_HANDLE, FALSE, cmd.return_process);
246 if (return_hproc == NULL)
247 {
248 ERR("couldn't open calling process\n");
249 return TRUE;
250 }
251
252 if (!DuplicateHandle(return_hproc, UlongToHandle(cmd.return_map), GetCurrentProcess(), &return_map, 0, FALSE, DUPLICATE_SAME_ACCESS))
253 {
254 ERR("couldn't duplicate handle\n");
255 CloseHandle(return_hproc);
256 return TRUE;
257 }
258 CloseHandle(return_hproc);
259
260 return_view = MapViewOfFile(return_map, FILE_MAP_WRITE, 0, 0, sizeof(struct appbar_response));
261
262 if (return_view)
263 {
264 response = (struct appbar_response*)return_view;
265 response->result = result;
266 response->abd = cmd.abd;
267
268 UnmapViewOfFile(return_view);
269 }
270 else
271 {
272 ERR("couldn't map view of file\n");
273 }
274
275 CloseHandle(return_map);
276 return TRUE;
277}
static UINT_PTR handle_appbarmessage(DWORD msg, _AppBarData *abd)
Definition: appbar.cpp:133
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define UnmapViewOfFile
Definition: compat.h:746
#define GetCurrentProcess()
Definition: compat.h:759
#define MapViewOfFile
Definition: compat.h:745
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
GLuint64EXT * result
Definition: glext.h:11304
#define PROCESS_DUP_HANDLE
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
ULONG return_map
Definition: appbar.cpp:41
struct _AppBarData abd
Definition: appbar.cpp:49
ULONGLONG result
Definition: appbar.cpp:48
Definition: ftp_var.h:139
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define FILE_MAP_WRITE
Definition: winbase.h:154
#define DUPLICATE_SAME_ACCESS

Referenced by CTrayWindow::OnCopyData().

◆ appbar_notify_all()

void appbar_notify_all ( HMONITOR  hMon,
UINT  uMsg,
HWND  hwndExclude,
LPARAM  lParam 
)

Definition at line 78 of file appbar.cpp.

79{
80 struct appbar_data* data;
81
83 {
84 if (data->hwnd == hwndExclude)
85 continue;
86
87 if (hMon && hMon != MonitorFromWindow(data->hwnd, MONITOR_DEFAULTTONULL))
88 continue;
89
90 SendMessageW(data->hwnd, data->callback_msg, uMsg, lParam);
91 }
92}
LPARAM lParam
Definition: combotst.c:139
HMONITOR WINAPI MonitorFromWindow(HWND, DWORD)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by CTrayWindow::ExecContextMenuCmd(), and send_poschanged().

◆ get_appbar()

static struct appbar_data * get_appbar ( HWND  hwnd)
static

Definition at line 65 of file appbar.cpp.

66{
67 struct appbar_data* data;
68
70 {
71 if (data->hwnd == hwnd)
72 return data;
73 }
74
75 return NULL;
76}

Referenced by handle_appbarmessage().

◆ handle_appbarmessage()

static UINT_PTR handle_appbarmessage ( DWORD  msg,
_AppBarData abd 
)
static

Definition at line 133 of file appbar.cpp.

134{
135 struct appbar_data* data;
136 HWND hwnd = abd->hWnd;
137
138 switch (msg)
139 {
140 case ABM_NEW:
141 if (get_appbar(hwnd))
142 {
143 /* fail when adding an hwnd the second time */
144 return FALSE;
145 }
146
148 if (!data)
149 {
150 ERR("out of memory\n");
151 return FALSE;
152 }
153 data->hwnd = hwnd;
154 data->callback_msg = abd->uCallbackMessage;
155
156 list_add_tail(&appbars, &data->entry);
157
158 return TRUE;
159 case ABM_REMOVE:
160 if ((data = get_appbar(hwnd)))
161 {
162 list_remove(&data->entry);
163
165
167 }
168 else
169 WARN("removing hwnd %p not on the list\n", hwnd);
170 return TRUE;
171 case ABM_QUERYPOS:
172 if (abd->uEdge > ABE_BOTTOM)
173 WARN("invalid edge %i for %p\n", abd->uEdge, hwnd);
174 appbar_cliprect( hwnd, &abd->rc );
175 return TRUE;
176 case ABM_SETPOS:
177 if (abd->uEdge > ABE_BOTTOM)
178 {
179 WARN("invalid edge %i for %p\n", abd->uEdge, hwnd);
180 return TRUE;
181 }
182 if ((data = get_appbar(hwnd)))
183 {
184 /* calculate acceptable space */
185 appbar_cliprect( hwnd, &abd->rc );
186
187 if (!EqualRect(&abd->rc, &data->rc))
189
190 /* reserve that space for this appbar */
191 data->edge = abd->uEdge;
192 data->rc = abd->rc;
193 data->space_reserved = TRUE;
194 }
195 else
196 {
197 WARN("app sent ABM_SETPOS message for %p without ABM_ADD\n", hwnd);
198 }
199 return TRUE;
200 case ABM_GETSTATE:
201 FIXME("SHAppBarMessage(ABM_GETSTATE): stub\n");
204 FIXME("SHAppBarMessage(ABM_GETTASKBARPOS, hwnd=%p): stub\n", hwnd);
205 /* Report the taskbar is at the bottom of the screen. */
206 abd->rc.left = 0;
209 abd->rc.top = abd->rc.bottom-1;
210 abd->uEdge = ABE_BOTTOM;
211 return TRUE;
212 case ABM_ACTIVATE:
213 return TRUE;
215 FIXME("SHAppBarMessage(ABM_GETAUTOHIDEBAR, hwnd=%p, edge=%x): stub\n", hwnd, abd->uEdge);
216 return 0;
218 FIXME("SHAppBarMessage(ABM_SETAUTOHIDEBAR, hwnd=%p, edge=%x, lparam=%s): stub\n",
220 return TRUE;
222 return TRUE;
223 default:
224 FIXME("SHAppBarMessage(%x) unimplemented\n", msg);
225 return FALSE;
226 }
227}
static struct appbar_data * get_appbar(HWND hwnd)
Definition: appbar.cpp:65
static void appbar_cliprect(HWND hwnd, RECT *rect)
Definition: appbar.cpp:101
static void send_poschanged(HWND hwnd)
Definition: appbar.cpp:95
#define msg(x)
Definition: auth_time.c:54
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
#define FIXME(fmt,...)
Definition: debug.h:111
#define WARN(fmt,...)
Definition: debug.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define ABM_WINDOWPOSCHANGED
Definition: shellapi.h:68
#define ABM_GETTASKBARPOS
Definition: shellapi.h:64
#define ABM_GETSTATE
Definition: shellapi.h:63
#define ABM_SETAUTOHIDEBAR
Definition: shellapi.h:67
#define ABM_SETPOS
Definition: shellapi.h:62
#define ABM_ACTIVATE
Definition: shellapi.h:65
#define ABS_ALWAYSONTOP
Definition: shellapi.h:22
#define ABM_REMOVE
Definition: shellapi.h:60
#define ABS_AUTOHIDE
Definition: shellapi.h:21
#define ABM_NEW
Definition: shellapi.h:59
#define ABM_GETAUTOHIDEBAR
Definition: shellapi.h:66
#define ABM_QUERYPOS
Definition: shellapi.h:61
UINT uCallbackMessage
Definition: shellapi.h:216
LPARAM lParam
Definition: shellapi.h:219
HWND hWnd
Definition: shellapi.h:215
UINT uEdge
Definition: shellapi.h:217
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define SM_CYSCREEN
Definition: winuser.h:959
#define SM_CXSCREEN
Definition: winuser.h:958
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
int WINAPI GetSystemMetrics(_In_ int)

Referenced by appbar_message().

◆ send_poschanged()

static void send_poschanged ( HWND  hwnd)
static

Definition at line 95 of file appbar.cpp.

96{
98}
void appbar_notify_all(HMONITOR hMon, UINT uMsg, HWND hwndExclude, LPARAM lParam)
Definition: appbar.cpp:78
#define ABN_POSCHANGED
Definition: shellapi.h:70

Referenced by handle_appbarmessage().

Variable Documentation

◆ appbars

struct list appbars = LIST_INIT(appbars)
static

Definition at line 63 of file appbar.cpp.

Referenced by appbar_cliprect(), appbar_notify_all(), get_appbar(), and handle_appbarmessage().