summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2013-09-16 15:02:55 +0100
committerJon TURNEY <jon.turney@dronecode.org.uk>2013-09-16 15:02:55 +0100
commit4e1ee635232ccbe8a32ad5532f5e3ae78ff0e3b2 (patch)
tree4893258c46ea00349a041d4228214a77ef0fa6bb
parent348c230cb7219c9c813f7ddfa6e9f36d7d7c4062 (diff)
parent3f40116d57a9ab6ca595ea41e0cbaac1ead2cf51 (diff)
Merge branch 'cygwin-patches-for-1.14' into cygwin-release-1.14xserver-cygwin-1.14.3-1
-rw-r--r--configure.ac12
-rw-r--r--hw/xwin/Makefile.am2
-rw-r--r--hw/xwin/XWin.rc2
-rw-r--r--hw/xwin/glx/Makefile.am11
-rwxr-xr-xhw/xwin/glx/gen_gl_wrappers.py619
-rw-r--r--hw/xwin/windisplay.c4
-rw-r--r--hw/xwin/winmsgwindow.c4
-rw-r--r--hw/xwin/winmultiwindowwm.c34
-rw-r--r--hw/xwin/winmultiwindowwndproc.c8
-rw-r--r--hw/xwin/winprefs.c22
-rw-r--r--hw/xwin/winprefs.h8
-rw-r--r--hw/xwin/wintrayicon.c2
12 files changed, 384 insertions, 344 deletions
diff --git a/configure.ac b/configure.ac
index 398981f90..1cd41c97d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1947,10 +1947,16 @@ if test "x$XWIN" = xyes; then
dnl XWin with AIGLX requires OpenGL spec files in order to generate wrapper code for native GL functions
if [test "x$XWIN" = xyes && test "x$AIGLX" = xyes] ; then
- AC_CHECK_PROG(PYTHON, python, python)
- if test -z "$PYTHON"; then
- AC_MSG_ERROR([python not found])
+ AC_CHECK_PROG(PYTHON3, python3, python3)
+ if test -z "$PYTHON3"; then
+ AC_MSG_ERROR([python3 not found])
fi
+ AC_MSG_CHECKING(for python module lxml)
+ $PYTHON3 -c "import lxml;"
+ if test $? -ne 0 ; then
+ AC_MSG_ERROR([not found])
+ fi
+ AC_MSG_RESULT(yes)
if test "x$KHRONOS_SPEC_DIR" = "xauto" ; then
PKG_CHECK_MODULES([KHRONOS_OPENGL_REGISTRY], [khronos-opengl-registry])
KHRONOS_SPEC_DIR=`pkg-config khronos-opengl-registry --variable=specdir`
diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am
index b38d9568f..e0e445c63 100644
--- a/hw/xwin/Makefile.am
+++ b/hw/xwin/Makefile.am
@@ -157,7 +157,7 @@ XWin_LDADD = $(MULTIWINDOW_LIBS) $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS
XWin_LDFLAGS = -mwindows -static
.rc.o:
- $(AM_V_GEN)$(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -I $(top_builddir)/include
+ $(AM_V_GEN)$(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -I $(top_builddir)/include -DHOST_TRIPLET=\"$(host)\"
XWin.o: XWin.rc XWin.exe.manifest X.ico
diff --git a/hw/xwin/XWin.rc b/hw/xwin/XWin.rc
index a142f3070..be17d8f19 100644
--- a/hw/xwin/XWin.rc
+++ b/hw/xwin/XWin.rc
@@ -46,7 +46,7 @@ FONT 8, "MS Shell Dlg 2"
BEGIN
CONTROL IDI_XWIN, IDC_STATIC, "Static", SS_ICON, 8, 8, 32, 32
LTEXT XVENDORNAMESHORT " X Server ", IDC_STATIC, 36, 8, 220, 8
- LTEXT VENDOR_MAN_VERSION, IDC_STATIC, 36, 18, 220, 8
+ LTEXT VENDOR_MAN_VERSION " (" HOST_TRIPLET ")", IDC_STATIC, 36, 18, 220, 8
LTEXT BUILDERSTRING, IDC_STATIC, 36, 28, 220, 8
LTEXT "This software is licensed under the terms of the MIT/X11 License.", IDC_STATIC, 36, 48, 220, 20
CONTROL __VENDORDWEBSUPPORT__, ID_ABOUT_WEBSITE, "Button",
diff --git a/hw/xwin/glx/Makefile.am b/hw/xwin/glx/Makefile.am
index f969af277..e4f297996 100644
--- a/hw/xwin/glx/Makefile.am
+++ b/hw/xwin/glx/Makefile.am
@@ -32,11 +32,14 @@ AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \
if XWIN_GLX_WINDOWS
-generated_gl_wrappers.c: gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.spec $(KHRONOS_SPEC_DIR)/gl.tm
- $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_gl_wrappers.py --spec=$(KHRONOS_SPEC_DIR)/gl.spec --typemap=$(KHRONOS_SPEC_DIR)/gl.tm --dispatch-header=$(top_srcdir)/glx/dispatch.h --staticwrappers >generated_gl_wrappers.c
+PYTHONPATH := $(PYTHONPATH):$(KHRONOS_SPEC_DIR)
-generated_wgl_wrappers.c: gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/wglext.spec $(KHRONOS_SPEC_DIR)/wgl.tm
- $(AM_V_GEN)$(PYTHON) $(srcdir)/gen_gl_wrappers.py --spec=$(KHRONOS_SPEC_DIR)/wglext.spec --typemap=$(KHRONOS_SPEC_DIR)/wgl.tm --prefix=wgl --preresolve >generated_wgl_wrappers.c
+generated_gl_wrappers.c: gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/gl.xml $(KHRONOS_SPEC_DIR)/reg.py
+ echo $(PYTHONPATH)
+ $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/gl.xml -dispatchheader $(top_srcdir)/glx/dispatch.h -staticwrappers -outfile $@
+
+generated_wgl_wrappers.c: gen_gl_wrappers.py $(KHRONOS_SPEC_DIR)/wgl.xml $(KHRONOS_SPEC_DIR)/reg.py
+ $(AM_V_GEN)PYTHONPATH=$(KHRONOS_SPEC_DIR) $(PYTHON3) $(srcdir)/gen_gl_wrappers.py -registry $(KHRONOS_SPEC_DIR)/wgl.xml -prefix wgl -preresolve -outfile $@
endif
BUILT_SOURCES = generated_gl_wrappers.c generated_wgl_wrappers.c
diff --git a/hw/xwin/glx/gen_gl_wrappers.py b/hw/xwin/glx/gen_gl_wrappers.py
index 2273589c9..a97e0058b 100755
--- a/hw/xwin/glx/gen_gl_wrappers.py
+++ b/hw/xwin/glx/gen_gl_wrappers.py
@@ -1,60 +1,148 @@
-#!/usr/bin/python
+#!/usr/bin/python3
#
-# Comedy python script to generate cdecl to stdcall wrappers for GL functions
+# python script to generate cdecl to stdcall wrappers for GL functions
+# adapted from genheaders.py
#
-# This is designed to operate on OpenGL spec files from
-# http://www.opengl.org/registry/api/
-#
-#
-# Copyright (c) Jon TURNEY 2009
+# Copyright (c) 2013 The Khronos Group Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
+# copy of this software and/or associated documentation files (the
+# "Materials"), to deal in the Materials without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Materials, and to
+# permit persons to whom the Materials are furnished to do so, subject to
+# the following conditions:
#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
-# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Materials.
#
-# Except as contained in this notice, the name(s) of the above copyright
-# holders shall not be used in advertising or otherwise to promote the sale,
-# use or other dealings in this Software without prior written authorization.
-#
-
-import sys
-import re
-import getopt
-
-dispatchheader = ''
-prefix = 'gl'
-preresolve = False
-staticwrappers = False
-
-opts, args = getopt.getopt(sys.argv[1:], "", ['spec=', 'typemap=', 'dispatch-header=', 'prefix=', 'preresolve', 'staticwrappers' ])
-
-for o,a in opts:
- if o == '--typemap' :
- typemapfile = a
- elif o == '--dispatch-header' :
- dispatchheader = a
- elif o == '--spec' :
- specfile = a
- elif o == '--prefix' :
- prefix = a
- elif o == '--preresolve' :
- preresolve = True
- elif o == '--staticwrappers' :
- staticwrappers = True
+# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+
+import sys, time, pdb, string, cProfile
+sys.path.append("/usr/share/opengl/spec")
+from reg import *
+
+# protect - whether to use #ifndef protections
+# registry <filename> - use specified XML registry instead of gl.xml
+protect = True
+
+# Default input / log files
+errFilename = None
+diagFilename = 'diag.txt'
+regFilename = 'gl.xml'
+outFilename = 'gen_gl_wrappers.c'
+dispatchheader=None
+prefix="gl"
+preresolve=False
+staticwrappers=False
+nodebugcallcounting=False
+
+#exclude base WGL API
+WinGDI={key: 1 for key in [
+ "wglCopyContext"
+ ,"wglCreateContext"
+ ,"wglCreateLayerContext"
+ ,"wglDeleteContext"
+ ,"wglGetCurrentContext"
+ ,"wglGetCurrentDC"
+ ,"wglGetProcAddress"
+ ,"wglMakeCurrent"
+ ,"wglShareLists"
+ ,"wglUseFontBitmapsA"
+ ,"wglUseFontBitmapsW"
+ ,"wglUseFontBitmaps"
+ ,"SwapBuffers"
+ ,"wglUseFontOutlinesA"
+ ,"wglUseFontOutlinesW"
+ ,"wglUseFontOutlines"
+ ,"wglDescribeLayerPlane"
+ ,"wglSetLayerPaletteEntries"
+ ,"wglGetLayerPaletteEntries"
+ ,"wglRealizeLayerPalette"
+ ,"wglSwapLayerBuffers"
+ ,"wglSwapMultipleBuffers"
+ ,"ChoosePixelFormat"
+ ,"DescribePixelFormat"
+ ,"GetEnhMetaFilePixelFormat"
+ ,"GetPixelFormat"
+ ,"SetPixelFormat"
+]}
+
+if __name__ == '__main__':
+ i = 1
+ while (i < len(sys.argv)):
+ arg = sys.argv[i]
+ i = i + 1
+ if (arg == '-noprotect'):
+ print('Disabling inclusion protection in output headers', file=sys.stderr)
+ protect = False
+ elif (arg == '-registry'):
+ regFilename = sys.argv[i]
+ i = i+1
+ print('Using registry ', regFilename, file=sys.stderr)
+ elif (arg == '-outfile'):
+ outFilename = sys.argv[i]
+ i = i+1
+ elif (arg == '-preresolve'):
+ preresolve=True
+ elif (arg == '-staticwrappers'):
+ staticwrappers=True
+ elif (arg == '-dispatchheader'):
+ dispatchheader = sys.argv[i]
+ i = i+1
+ elif (arg == '-prefix'):
+ prefix = sys.argv[i]
+ i = i+1
+ elif (arg == '-nodbgcount'):
+ nodebugcallcounting = True
+ elif (arg[0:1] == '-'):
+ print('Unrecognized argument:', arg, file=sys.stderr)
+ exit(1)
+
+print('Generating ', outFilename, file=sys.stderr)
+
+# Load & parse registry
+reg = Registry()
+tree = etree.parse(regFilename)
+reg.loadElementTree(tree)
+
+# Defaults for generating re-inclusion protection wrappers (or not)
+protectFile = protect
+protectFeature = protect
+protectProto = protect
+
+allVersions = '.*'
+
+genOpts = CGeneratorOptions(
+ apiname = prefix,
+ profile = 'compatibility',
+ versions = allVersions,
+ emitversions = allVersions,
+ defaultExtensions = prefix, # Default extensions for GL
+# addExtensions = None,
+# removeExtensions = None,
+# prefixText = prefixStrings + glExtPlatformStrings + glextVersionStrings,
+# genFuncPointers = True,
+# protectFile = protectFile,
+# protectFeature = protectFeature,
+# protectProto = protectProto,
+# apicall = 'GLAPI ',
+# apientry = 'APIENTRY ',
+# apientryp = 'APIENTRYP '),
+ )
+
+# create error/warning & diagnostic files
+if (errFilename):
+ errWarn = open(errFilename,'w')
+else:
+ errWarn = sys.stderr
+diag = open(diagFilename, 'w')
#
# look for all the SET_ macros in dispatch.h, this is the set of functions
@@ -64,262 +152,199 @@ for o,a in opts:
dispatch = {}
if dispatchheader :
- fh = open(dispatchheader)
- dispatchh = fh.readlines()
-
- dispatch_regex = re.compile(r'^SET_(\S*)\(')
-
- for line in dispatchh :
- line = line.strip()
- m1 = dispatch_regex.search(line)
-
- if m1 :
- dispatch[m1.group(1)] = 1
-
- del dispatch['by_offset']
-
-#
-# read the typemap .tm file
-#
-
-typemap = {}
-
-fh = open(typemapfile)
-tm = fh.readlines()
-
-typemap_regex = re.compile(r'#define\sSET_(\S*)\(')
-
-for line in tm :
- # ignore everything after a '#' as a comment
- hash = line.find('#')
- if hash != -1 :
- line = line[:hash-1]
-
- # ignore blank lines
- if line.startswith('#') or len(line) == 0 :
- continue
-
- l = line.split(',')
- typemap[l[0]] = l[3].strip()
-
-# interestingly, * is not a C type
-if typemap['void'] == '*' :
- typemap['void'] = 'void'
-
-#
-# crudely parse the .spec file
-#
-
-r1 = re.compile(r'\t(\S*)\s+(\S*.*)')
-r2 = re.compile(r'(.*)\((.*)\)')
-r3 = re.compile(r'glWindowPos.*MESA')
-r4 = re.compile(r'gl.*Program(s|)NV')
-r5 = re.compile(r'glGetVertexAttribfvNV')
-
-wrappers = {}
-
-fh = open(specfile)
-glspec = fh.readlines()
-param_count = 0
-
-for line in glspec :
- line = line.rstrip()
-
- # ignore everything after a '#' as a comment
- hash = line.find('#')
- if hash != -1 :
- line = line[:hash-1]
-
- # ignore blank lines
- if line.startswith('#') or len(line) == 0 :
- continue
-
- # lines containing ':' aren't intersting to us
- if line.count(':') != 0 :
- continue
-
- # attributes of each function follow the name, indented by a tab
- if not line.startswith('\t') :
- m1 = r2.search(line)
- if m1 :
- function = m1.group(1)
- arglist_use = m1.group(2)
- wrappers[function] = {}
-
- # ensure formal parameter names don't collide with reserved names or shadow global declarations
- arglist_use = ',' .join([i.rstrip() + '_' for i in arglist_use.split(",")])
-
- wrappers[function]['arglist_use'] = arglist_use
- param_count = 0
- else :
- m1 = r1.search(line)
- if m1 :
- attribute = m1.group(1)
- value = m1.group(2)
-
- # make param attributes unique and ordered
- if attribute == 'param' :
- attribute = 'param' + '%02d' % param_count
- param_count += 1
-
- wrappers[function][attribute] = value
-
-#
-# now emit code
-#
-
-print '/* Automatically generated by ' + sys.argv[0] + ' DO NOT EDIT */'
-print '/* from ' + specfile + ' and typemap ' + typemapfile + ' */'
-print ''
-
-#
-# if required, emit code for non-lazy function resolving
-#
-
-if preresolve :
- for w in sorted(wrappers.keys()) :
- funcname = prefix + w
- print 'RESOLVE_DECL(PFN' + funcname.upper() + 'PROC);'
-
- print ''
- print 'void ' + prefix + 'ResolveExtensionProcs(void)'
- print '{'
-
- for w in sorted(wrappers.keys()) :
- funcname = prefix + w
- print ' PRERESOLVE(PFN' + funcname.upper() + 'PROC, "' + funcname + '");'
-
- print '}\n'
-
-#
-# now emit the wrappers
-# for GL 1.0 and 1.1 functions, generate stdcall wrappers which call the function directly
-# for GL 1.2+ functions, generate wrappers which use wglGetProcAddress()
-#
-
-for w in sorted(wrappers.keys()) :
-
- funcname = prefix + w
- returntype = wrappers[w]['return']
- if returntype != 'void' :
- returntype = typemap[returntype]
+ fh = open(dispatchheader)
+ dispatchh = fh.readlines()
+
+ dispatch_regex = re.compile(r'^SET_(\S*)\(')
+
+ for line in dispatchh :
+ line = line.strip()
+ m1 = dispatch_regex.search(line)
+
+ if m1 :
+ dispatch[prefix+m1.group(1)] = 1
+
+ del dispatch['glby_offset']
+
+class PreResolveOutputGenerator(OutputGenerator):
+ def __init__(self,
+ errFile = sys.stderr,
+ warnFile = sys.stderr,
+ diagFile = sys.stdout):
+ OutputGenerator.__init__(self, errFile, warnFile, diagFile)
+ self.wrappers={}
+ def beginFile(self, genOpts):
+ pass
+ def endFile(self):
+ self.outFile.write('\nvoid ' + prefix + 'ResolveExtensionProcs(void)\n{\n')
+ for funcname in self.wrappers.keys():
+ self.outFile.write( ' PRERESOLVE(PFN' + funcname.upper() + 'PROC, "' + funcname + '");\n')
+ self.outFile.write('}\n\n')
+ def beginFeature(self, interface, emit):
+ OutputGenerator.beginFeature(self, interface, emit)
+ def endFeature(self):
+ OutputGenerator.endFeature(self)
+ def genType(self, typeinfo, name):
+ OutputGenerator.genType(self, typeinfo, name)
+ def genEnum(self, enuminfo, name):
+ OutputGenerator.genEnum(self, enuminfo, name)
+ def genCmd(self, cmd, name):
+ OutputGenerator.genCmd(self, cmd, name)
+
+ if name in WinGDI:
+ return
+
+ self.outFile.write('RESOLVE_DECL(PFN' + name.upper() + 'PROC);\n')
+ self.wrappers[name]=1
+
+class WrapperOutputGenerator(OutputGenerator):
+ def __init__(self,
+ errFile = sys.stderr,
+ warnFile = sys.stderr,
+ diagFile = sys.stdout):
+ OutputGenerator.__init__(self, errFile, warnFile, diagFile)
+ self.wrappers={}
+ def beginFile(self, genOpts):
+ pass
+ def endFile(self):
+ pass
+ def beginFeature(self, interface, emit):
+ OutputGenerator.beginFeature(self, interface, emit)
+ self.OldVersion = self.featureName.startswith('GL_VERSION_1_0') or self.featureName.startswith('GL_VERSION_1_1')
+ def endFeature(self):
+ OutputGenerator.endFeature(self)
+ def genType(self, typeinfo, name):
+ OutputGenerator.genType(self, typeinfo, name)
+ def genEnum(self, enuminfo, name):
+ OutputGenerator.genEnum(self, enuminfo, name)
+ def genCmd(self, cmd, name):
+ OutputGenerator.genCmd(self, cmd, name)
# Avoid generating wrappers which aren't referenced by the dispatch table
- if dispatchheader and not dispatch.has_key(w) :
- print '/* No wrapper for ' + funcname + ', not in dispatch table */'
- continue
-
- # manufacture arglist
- # if no param attributes were found, it should be 'void'
- al = []
- for k in sorted(wrappers[w].keys()) :
- if k.startswith('param') :
- l = wrappers[w][k].split()
-
- # ensure formal parameter names don't collide with reserved names or shadow global declarations
- l[0] = l[0] + '_'
-
- if l[2] == 'in' :
- if l[3] == 'array' :
- arg = 'const ' + typemap[l[1]] + ' *' + l[0]
- else :
- arg = typemap[l[1]] + ' ' + l[0]
- elif l[2] == 'out' :
- arg = typemap[l[1]] + ' *' + l[0]
-
- al.append(arg)
-
- if len(al) == 0 :
- arglist = 'void'
- else:
- arglist = ', '.join(al)
-
- if wrappers[w]['category'].startswith('VERSION_1_0') or wrappers[w]['category'].startswith('VERSION_1_1') :
- if staticwrappers :
- print 'static',
- print returntype + ' ' + funcname + 'Wrapper(' + arglist + ')'
- print '{'
- print ' if (glxWinDebugSettings.enable' + prefix.upper() + 'callTrace) ErrorF("'+ funcname + '\\n");'
- print ' glWinDirectProcCalls++;'
- if returntype.lower() == 'void' :
- print ' ' + funcname + '(',
- else :
- print ' /* returntype was ' + returntype.lower() + '*/'
- print ' return ' + funcname + '(',
-
- if arglist != 'void' :
- print wrappers[w]['arglist_use'],
-
- print ');'
- print "}\n"
+ if dispatchheader and not name in dispatch :
+ self.outFile.write('/* No wrapper for ' + name + ', not in dispatch table */\n')
+ return
+
+ if name in WinGDI:
+ return
+
+ self.wrappers[name]=1
+
+ proto=noneStr(cmd.elem.find('proto'))
+ rettype=noneStr(proto.text)
+ if rettype.lower()!="void ":
+ plist = ([t for t in proto.itertext()])
+ rettype = ''.join(plist[:-1])
+ rettype=rettype.strip()
+ if staticwrappers: self.outFile.write("static ")
+ self.outFile.write("%s %sWrapper("%(rettype, name))
+ params = cmd.elem.findall('param')
+ plist=[]
+ for param in params:
+ paramlist = ([t for t in param.itertext()])
+ paramtype = ''.join(paramlist[:-1])
+ paramname = paramlist[-1]
+ plist.append((paramtype, paramname))
+ Comma=""
+ if len(plist):
+ for ptype, pname in plist:
+ self.outFile.write("%s%s%s_"%(Comma, ptype, pname))
+ Comma=", "
else:
- if staticwrappers :
- print 'static',
- print returntype + ' ' + funcname + 'Wrapper(' + arglist + ')'
- print '{'
+ self.outFile.write("void")
- stringname = funcname
+ self.outFile.write(")\n{\n")
-#
-# special case: Windows OpenGL implementations are far more likely to have GL_ARB_window_pos than GL_MESA_window_pos,
-# so arrange for the wrapper to use the ARB strings to find functions...
-#
+ # for GL 1.0 and 1.1 functions, generate stdcall wrappers which call the function directly
+ if self.OldVersion:
+ if not nodebugcallcounting:
+ self.outFile.write(' if (glxWinDebugSettings.enable%scallTrace) ErrorF("%s\\n");\n'%(prefix.upper(), name))
+ self.outFile.write(" glWinDirectProcCalls++;\n")
+ self.outFile.write("\n")
- m2 = r3.search(funcname)
- if m2 :
- stringname = stringname.replace('MESA','ARB')
+ if rettype.lower()=="void":
+ self.outFile.write(" %s( "%(name))
+ else:
+ self.outFile.write(" return %s( "%(name))
-#
-# special case: likewise, implementations are more likely to have GL_ARB_vertex_program than GL_NV_vertex_program,
-# especially if they are not NV implementations, so arrange for the wrapper to use ARB strings to find functions
-#
+ Comma=""
+ for ptype, pname in plist:
+ self.outFile.write("%s%s_"%(Comma, pname))
+ Comma=", "
- m3 = r4.search(funcname)
- if m3 :
- stringname = stringname.replace('NV','ARB')
- m4 = r5.search(funcname)
- if m4 :
- stringname = stringname.replace('NV','ARB')
-
- pfntypename = 'PFN' + funcname.upper() + 'PROC'
+ # for GL 1.2+ functions, generate wrappers which use wglGetProcAddress()
+ else:
+ if rettype.lower()=="void":
+ self.outFile.write(' RESOLVE(PFN%sPROC, "%s");\n'%(name.upper(), name))
+
+ if not nodebugcallcounting:
+ self.outFile.write("\n")
+ self.outFile.write(' if (glxWinDebugSettings.enable%scallTrace) ErrorF("%s\\n");\n'%(prefix.upper(), name))
+ self.outFile.write("\n")
+
+ self.outFile.write(" RESOLVED_PROC(PFN%sPROC)( """%(name.upper()))
+ else:
+ self.outFile.write(' RESOLVE_RET(PFN%sPROC, "%s", FALSE);\n'%(name.upper(), name))
+
+ if not nodebugcallcounting:
+ self.outFile.write("\n")
+ self.outFile.write(' if (glxWinDebugSettings.enable%scallTrace) ErrorF("%s\\n");\n'%(prefix.upper(), name))
+ self.outFile.write("\n")
+
+ self.outFile.write(" return RESOLVED_PROC(PFN%sPROC)("%(name.upper()))
+
+ Comma=""
+ for ptype, pname in plist:
+ self.outFile.write("%s%s_"%(Comma, pname))
+ Comma=", "
+ self.outFile.write(" );\n}\n\n")
+
+def genHeaders():
+ outFile = open(outFilename,"w")
+
+ outFile.write('/* Automatically generated from %s - DO NOT EDIT */\n'%regFilename)
+ outFile.write('\n')
+
+ if preresolve:
+ gen = PreResolveOutputGenerator(errFile=errWarn,
+ warnFile=errWarn,
+ diagFile=diag)
+ gen.outFile=outFile
+ reg.setGenerator(gen)
+ reg.apiGen(genOpts)
+
+ gen = WrapperOutputGenerator(errFile=errWarn,
+ warnFile=errWarn,
+ diagFile=diag)
+ gen.outFile=outFile
+ reg.setGenerator(gen)
+ reg.apiGen(genOpts)
+
+ # generate function to setup the dispatch table, which sets each
+ # dispatch table entry to point to it's wrapper function
+ # (assuming we were able to make one)
+
+ if dispatchheader :
+ outFile.write('void glWinSetupDispatchTable(void)\n')
+ outFile.write('{\n')
+ outFile.write(' static struct _glapi_table *disp = NULL;\n')
+ outFile.write('\n')
+ outFile.write(' if (!disp)\n')
+ outFile.write(' {\n')
+ outFile.write(' disp = calloc(sizeof(void *), _glapi_get_dispatch_table_size());\n')
+ outFile.write(' assert(disp);\n')
- if returntype.lower() == 'void' :
- print ' RESOLVE(' + pfntypename + ', "' + stringname + '");'
- print ' if (glxWinDebugSettings.enable' + prefix.upper() + 'callTrace) ErrorF("'+ funcname + '\\n");'
- print ' RESOLVED_PROC(' + pfntypename + ')(',
+ for d in sorted(dispatch.keys()) :
+ if d in gen.wrappers :
+ outFile.write(' SET_'+ d[len(prefix):] + '(disp, (void *)' + d + 'Wrapper);\n')
else :
- print ' RESOLVE_RET(' + pfntypename + ', "' + stringname + '", FALSE);'
- print ' if (glxWinDebugSettings.enable' + prefix.upper() + 'callTrace) ErrorF("'+ funcname + '\\n");'
- print ' return RESOLVED_PROC(' + pfntypename + ')(',
-
- if arglist != 'void' :
- print wrappers[w]['arglist_use'],
-
- print ');'
- print "}\n"
-
+ outFile.write('#warning No wrapper for ' + d + ' !\n')
-# generate function to setup the dispatch table, which sets each
-# dispatch table entry to point to it's wrapper function
-# (assuming we were able to make one)
+ outFile.write(' }\n')
+ outFile.write('\n')
+ outFile.write(' _glapi_set_dispatch(disp);\n')
+ outFile.write('}\n')
-if dispatchheader :
- print 'void glWinSetupDispatchTable(void)'
- print '{'
- print ' static struct _glapi_table *disp = NULL;'
- print ''
- print ' if (!disp)'
- print ' {'
- print ' disp = calloc(sizeof(void *), _glapi_get_dispatch_table_size());'
- print ' assert(disp);'
-
- for d in sorted(dispatch.keys()) :
- if wrappers.has_key(d) :
- print ' SET_'+ d + '(disp, (void *)' + prefix + d + 'Wrapper);'
- else :
- print '#warning No wrapper for ' + prefix + d + ' !'
+ outFile.close()
- print ' }'
- print ''
- print ' _glapi_set_dispatch(disp);'
- print '}'
+genHeaders()
diff --git a/hw/xwin/windisplay.c b/hw/xwin/windisplay.c
index 9fc4dac68..b0c2c60a4 100644
--- a/hw/xwin/windisplay.c
+++ b/hw/xwin/windisplay.c
@@ -22,6 +22,10 @@
*
*/
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
#include <opaque.h> // for display
#include "win.h"
diff --git a/hw/xwin/winmsgwindow.c b/hw/xwin/winmsgwindow.c
index 8067c693c..59f1da503 100644
--- a/hw/xwin/winmsgwindow.c
+++ b/hw/xwin/winmsgwindow.c
@@ -22,6 +22,10 @@
*
*/
+#ifdef HAVE_XWIN_CONFIG_H
+#include <xwin-config.h>
+#endif
+
#include "win.h"
/*
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index ab096c8fa..c7f86f855 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -572,7 +572,7 @@ getHwnd(WMInfoPtr pWMInfo, Window iWindow)
iWindow,
pWMInfo->atmPrivMap,
0,
- 1,
+ sizeof(HWND)/4,
False,
XA_INTEGER,
&atmType,
@@ -836,10 +836,10 @@ winMultiWindowWMProc(void *pArg)
ErrorF("\tWM_WM_MAP\n");
#endif
/* Put a note as to the HWND associated with this Window */
- XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, //pWMInfo->atmPrivMap,
+ XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER,
32,
PropModeReplace,
- (unsigned char *) &(pNode->msg.hwndWindow), 1);
+ (unsigned char *) &(pNode->msg.hwndWindow), sizeof(HWND)/4);
UpdateName(pWMInfo, pNode->msg.iWindow);
UpdateIcon(pWMInfo, pNode->msg.iWindow);
break;
@@ -848,10 +848,10 @@ winMultiWindowWMProc(void *pArg)
#if CYGMULTIWINDOW_DEBUG
ErrorF("\tWM_WM_MAP2\n");
#endif
- XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, //pWMInfo->atmPrivMap,
+ XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER,
32,
PropModeReplace,
- (unsigned char *) &(pNode->msg.hwndWindow), 1);
+ (unsigned char *) &(pNode->msg.hwndWindow), sizeof(HWND)/4);
break;
case WM_WM_MAP3:
@@ -859,10 +859,10 @@ winMultiWindowWMProc(void *pArg)
ErrorF("\tWM_WM_MAP3\n");
#endif
/* Put a note as to the HWND associated with this Window */
- XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER, //pWMInfo->atmPrivMap,
+ XChangeProperty(pWMInfo->pDisplay, pNode->msg.iWindow, pWMInfo->atmPrivMap, XA_INTEGER,
32,
PropModeReplace,
- (unsigned char *) &(pNode->msg.hwndWindow), 1);
+ (unsigned char *) &(pNode->msg.hwndWindow), sizeof(HWND)/4);
UpdateName(pWMInfo, pNode->msg.iWindow);
UpdateIcon(pWMInfo, pNode->msg.iWindow);
UpdateStyle(pWMInfo, pNode->msg.iWindow);
@@ -1160,15 +1160,13 @@ winMultiWindowXMsgProc(void *pArg)
(pProcArg->pDisplay, pProcArg->dwScreen, TRUE)) {
if (!g_fAnotherWMRunning) {
g_fAnotherWMRunning = TRUE;
- SendMessage(*(HWND *) pProcArg->hwndScreen, WM_UNMANAGE, 0,
- 0);
+ SendMessage(pProcArg->hwndScreen, WM_UNMANAGE, 0, 0);
}
}
else {
if (g_fAnotherWMRunning) {
g_fAnotherWMRunning = FALSE;
- SendMessage(*(HWND *) pProcArg->hwndScreen, WM_MANAGE, 0,
- 0);
+ SendMessage(pProcArg->hwndScreen, WM_MANAGE, 0, 0);
}
}
Sleep(500);
@@ -1734,7 +1732,7 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
{
static Atom windowState, motif_wm_hints, windowType;
static Atom hiddenState, fullscreenState, belowState, aboveState,
- skiptaskbarState;
+ skiptaskbarState, vertMaxState, horzMaxState;
static Atom dockWindow;
static int generation;
Atom type, *pAtom = NULL;
@@ -1761,12 +1759,17 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
dockWindow = XInternAtom(pDisplay, "_NET_WM_WINDOW_TYPE_DOCK", False);
skiptaskbarState =
XInternAtom(pDisplay, "_NET_WM_STATE_SKIP_TASKBAR", False);
+ vertMaxState = XInternAtom(pDisplay, "_NET_WM_STATE_MAXIMIZED_VERT", False);
+ horzMaxState = XInternAtom(pDisplay, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
}
if (XGetWindowProperty(pDisplay, iWindow, windowState, 0L,
MAXINT, False, XA_ATOM, &type, &format,
&nitems, &left,
(unsigned char **) &pAtom) == Success) {
+ Bool verMax = FALSE;
+ Bool horMax = FALSE;
+
if (pAtom ) {
unsigned long i;
@@ -1781,8 +1784,15 @@ winApplyHints(Display * pDisplay, Window iWindow, HWND hWnd, HWND * zstyle)
*zstyle = HWND_BOTTOM;
else if (pAtom[i] == aboveState)
*zstyle = HWND_TOPMOST;
+ if (pAtom[i] == vertMaxState)
+ verMax = TRUE;
+ if (pAtom[i] == horzMaxState)
+ horMax = TRUE;
}
+ if (verMax && horMax)
+ maxmin |= HINT_MAX;
+
XFree(pAtom);
}
}
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index 3a0076a7b..65d310f8b 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -422,14 +422,14 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
/*
* Add whatever the setup file wants to for this window
*/
- SetupSysMenu((unsigned long) hwnd);
+ SetupSysMenu(hwnd);
return 0;
case WM_SYSCOMMAND:
/*
* Any window menu items go through here
*/
- if (HandleCustomWM_COMMAND((unsigned long) hwnd, LOWORD(wParam))) {
+ if (HandleCustomWM_COMMAND(hwnd, LOWORD(wParam))) {
/* Don't pass customized menus to DefWindowProc */
return 0;
}
@@ -445,7 +445,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_INITMENU:
/* Checks/Unchecks any menu items before they are displayed */
- HandleCustomWM_INITMENU((unsigned long) hwnd, wParam);
+ HandleCustomWM_INITMENU(hwnd, wParam);
break;
case WM_ERASEBKGND:
@@ -827,7 +827,7 @@ winTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
}
/* Prevent the mouse wheel from stalling when another window is minimized */
if (HIWORD(wParam) == 0 && LOWORD(wParam) == WA_ACTIVE &&
- (HWND) lParam != NULL && (HWND) lParam != (HWND) GetParent(hwnd))
+ (HWND) lParam != NULL && (HWND) lParam != GetParent(hwnd))
SetFocus(hwnd);
return 0;
diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c
index 73dd1b4a1..92ac99274 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -191,7 +191,7 @@ ReloadEnumWindowsProc(HWND hwnd, LPARAM lParam)
}
/* Update the system menu for this window */
- SetupSysMenu((unsigned long) hwnd);
+ SetupSysMenu(hwnd);
/* That was easy... */
}
@@ -278,15 +278,11 @@ ReloadPrefs(void)
* Check/uncheck the ALWAYSONTOP items in this menu
*/
void
-HandleCustomWM_INITMENU(unsigned long hwndIn, unsigned long hmenuIn)
+HandleCustomWM_INITMENU(HWND hwnd, HMENU hmenu)
{
- HWND hwnd;
- HMENU hmenu;
DWORD dwExStyle;
int i, j;
- hwnd = (HWND) hwndIn;
- hmenu = (HMENU) hmenuIn;
if (!hwnd || !hmenu)
return;
@@ -412,15 +408,12 @@ ExecAndLogThread(void *cmd)
* Return TRUE if command is proccessed, FALSE otherwise.
*/
Bool
-HandleCustomWM_COMMAND(unsigned long hwndIn, int command)
+HandleCustomWM_COMMAND(HWND hwnd, int command)
{
- HWND hwnd;
int i, j;
MENUPARSED *m;
DWORD dwExStyle;
- hwnd = (HWND) hwndIn;
-
if (!command)
return FALSE;
@@ -512,15 +505,13 @@ HandleCustomWM_COMMAND(unsigned long hwndIn, int command)
* Add the default or a custom menu depending on the class match
*/
void
-SetupSysMenu(unsigned long hwndIn)
+SetupSysMenu(HWND hwnd)
{
- HWND hwnd;
HMENU sys;
int i;
WindowPtr pWin;
char *res_name, *res_class;
- hwnd = (HWND) hwndIn;
if (!hwnd)
return;
@@ -565,11 +556,8 @@ SetupSysMenu(unsigned long hwndIn)
* Possibly add a menu to the toolbar icon
*/
void
-SetupRootMenu(unsigned long hmenuRoot)
+SetupRootMenu(HMENU root)
{
- HMENU root;
-
- root = (HMENU) hmenuRoot;
if (!root)
return;
diff --git a/hw/xwin/winprefs.h b/hw/xwin/winprefs.h
index 352ae3a88..702e5897d 100644
--- a/hw/xwin/winprefs.h
+++ b/hw/xwin/winprefs.h
@@ -147,16 +147,16 @@ void
LoadPreferences(void);
void
- SetupRootMenu(unsigned long hmenuRoot);
+ SetupRootMenu(HMENU root);
void
- SetupSysMenu(unsigned long hwndIn);
+ SetupSysMenu(HWND hwnd);
void
- HandleCustomWM_INITMENU(unsigned long hwndIn, unsigned long hmenuIn);
+ HandleCustomWM_INITMENU(HWND hwnd, HMENU hmenu);
Bool
- HandleCustomWM_COMMAND(unsigned long hwndIn, int command);
+ HandleCustomWM_COMMAND(HWND hwnd, int command);
int
winIconIsOverride(HICON hicon);
diff --git a/hw/xwin/wintrayicon.c b/hw/xwin/wintrayicon.c
index f168b884a..e0aa7e5ab 100644
--- a/hw/xwin/wintrayicon.c
+++ b/hw/xwin/wintrayicon.c
@@ -170,7 +170,7 @@ winHandleIconMessage(HWND hwnd, UINT message,
RemoveMenu(hmenuTray, ID_APP_HIDE_ROOT, MF_BYCOMMAND);
}
- SetupRootMenu((unsigned long) hmenuTray);
+ SetupRootMenu(hmenuTray);
/*
* NOTE: This three-step procedure is required for