From 2ca6e9a3e6bd7450cd1fb80db3a777956c804e11 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 3 Apr 2011 22:01:37 +0000 Subject: split out drawable window handling extensive cleanups fix localhistory svn path=/trunk/netsurf/; revision=12153 --- windows/window.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 windows/window.c (limited to 'windows/window.c') diff --git a/windows/window.c b/windows/window.c new file mode 100644 index 000000000..7fb755d2b --- /dev/null +++ b/windows/window.c @@ -0,0 +1,52 @@ +/* + * Copyright 2011 Vincent Sanders + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include + +#include "windows/window.h" + +/* documented in windows/window.h */ +struct gui_window * +nsws_get_gui_window(HWND hwnd) +{ + struct gui_window *gw = NULL; + HWND phwnd = hwnd; + + /* scan the window hierachy for gui window */ + while (phwnd != NULL) { + gw = GetProp(phwnd, TEXT("GuiWnd")); + if (gw != NULL) + break; + phwnd = GetParent(phwnd); + } + + if (gw == NULL) { + /* try again looking for owner windows instead */ + phwnd = hwnd; + while (phwnd != NULL) { + gw = GetProp(phwnd, TEXT("GuiWnd")); + if (gw != NULL) + break; + phwnd = GetWindow(phwnd, GW_OWNER); + } + } + + return gw; +} -- cgit v1.2.3