Merged changes in the trunk up to revision 47056.
Conflicts resolved: source/blender/bmesh/bmesh_class.h source/blender/bmesh/intern/bmesh_construct.c source/blender/editors/interface/resources.c source/blender/render/intern/source/convertblender.c
This commit is contained in:
@@ -103,8 +103,8 @@ enable_testing()
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Redirect output files
|
# Redirect output files
|
||||||
|
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE )
|
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE)
|
||||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE )
|
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Set default config options
|
# Set default config options
|
||||||
@@ -161,8 +161,6 @@ if(UNIX AND NOT APPLE)
|
|||||||
option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON)
|
option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON)
|
||||||
option(WITH_X11_XF86VMODE "Enable X11 video mode switching" ON)
|
option(WITH_X11_XF86VMODE "Enable X11 video mode switching" ON)
|
||||||
option(WITH_BUILTIN_GLEW "Use GLEW OpenGL wrapper library bundled with blender" ON)
|
option(WITH_BUILTIN_GLEW "Use GLEW OpenGL wrapper library bundled with blender" ON)
|
||||||
option(WITH_XDG_USER_DIRS "Build with XDG Base Directory Specification (only config and documents for now)" OFF)
|
|
||||||
mark_as_advanced(WITH_XDG_USER_DIRS)
|
|
||||||
|
|
||||||
# freebsd doesn't seems to support XDND
|
# freebsd doesn't seems to support XDND
|
||||||
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||||
@@ -238,8 +236,14 @@ mark_as_advanced(WITH_MINGW64)
|
|||||||
option(WITH_CYCLES "Enable cycles Render Engine" ON)
|
option(WITH_CYCLES "Enable cycles Render Engine" ON)
|
||||||
option(WITH_CYCLES_TEST "Build cycles test application" OFF)
|
option(WITH_CYCLES_TEST "Build cycles test application" OFF)
|
||||||
option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF)
|
option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF)
|
||||||
set(CYCLES_CUDA_BINARIES_ARCH sm_13 sm_20 sm_21 CACHE STRING "CUDA architectures to build binaries for")
|
if(WIN32 AND NOT CMAKE_CL_64 AND NOT WITH_MINGW64)
|
||||||
|
set(PLATFORM_DEFAULT sm_20 sm_21)
|
||||||
|
else()
|
||||||
|
set(PLATFORM_DEFAULT sm_13 sm_20 sm_21)
|
||||||
|
endif()
|
||||||
|
set(CYCLES_CUDA_BINARIES_ARCH ${PLATFORM_DEFAULT} CACHE STRING "CUDA architectures to build binaries for")
|
||||||
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
|
mark_as_advanced(CYCLES_CUDA_BINARIES_ARCH)
|
||||||
|
unset(PLATFORM_DEFAULT)
|
||||||
|
|
||||||
# disable for now, but plan to support on all platforms eventually
|
# disable for now, but plan to support on all platforms eventually
|
||||||
option(WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
|
option(WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
|
||||||
@@ -1187,13 +1191,13 @@ elseif(APPLE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${XCODE_VERSION} VERSION_LESS 4.3)
|
if(${XCODE_VERSION} VERSION_LESS 4.3)
|
||||||
SET(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE ) # use guaranteed existing sdk
|
set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE) # use guaranteed existing sdk
|
||||||
else()
|
else()
|
||||||
# note: i don't use xcode-select path on purpose, cause also /Applications/Xcode.app would be allowed
|
# note: i don't use xcode-select path on purpose, cause also /Applications/Xcode.app would be allowed
|
||||||
# absolute pathes are more foolproof here !
|
# absolute pathes are more foolproof here !
|
||||||
SET(OSX_SYSROOT_PREFIX /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform)
|
set(OSX_SYSROOT_PREFIX /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform)
|
||||||
SET(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
|
set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
|
||||||
SET(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
|
set(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_LIBS10.5)
|
if(WITH_LIBS10.5)
|
||||||
@@ -1365,7 +1369,7 @@ elseif(APPLE)
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
|
set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
|
||||||
set(OPENCOLLADA_LIBRARIES "OpenCOLLADASaxFrameworkLoader -lOpenCOLLADAFramework -lOpenCOLLADABaseUtils -lOpenCOLLADAStreamWriter -lMathMLSolver -lGeneratedSaxParser -lUTF -lxml2 -lbuffer -lftoa" )
|
set(OPENCOLLADA_LIBRARIES "OpenCOLLADASaxFrameworkLoader -lOpenCOLLADAFramework -lOpenCOLLADABaseUtils -lOpenCOLLADAStreamWriter -lMathMLSolver -lGeneratedSaxParser -lUTF -lxml2 -lbuffer -lftoa")
|
||||||
#pcre is bundled with openCollada
|
#pcre is bundled with openCollada
|
||||||
#set(PCRE ${LIBDIR}/pcre)
|
#set(PCRE ${LIBDIR}/pcre)
|
||||||
#set(PCRE_LIBPATH ${PCRE}/lib)
|
#set(PCRE_LIBPATH ${PCRE}/lib)
|
||||||
|
|||||||
@@ -553,7 +553,7 @@ if env['OURPLATFORM']!='darwin':
|
|||||||
|
|
||||||
source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
|
source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
|
||||||
# To ensure empty dirs are created too
|
# To ensure empty dirs are created too
|
||||||
if len(source)==0:
|
if len(source)==0 and not os.path.exists(dir):
|
||||||
env.Execute(Mkdir(dir))
|
env.Execute(Mkdir(dir))
|
||||||
scriptinstall.append(env.Install(dir=dir,source=source))
|
scriptinstall.append(env.Install(dir=dir,source=source))
|
||||||
if env['WITH_BF_CYCLES']:
|
if env['WITH_BF_CYCLES']:
|
||||||
|
|||||||
@@ -169,6 +169,11 @@ BF_BOOST_LIBPATH = BF_BOOST + '/lib'
|
|||||||
WITH_BF_RAYOPTIMIZATION = True
|
WITH_BF_RAYOPTIMIZATION = True
|
||||||
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
|
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse']
|
||||||
|
|
||||||
|
#CUDA
|
||||||
|
WITH_BF_CYCLES_CUDA_BINARIES = False
|
||||||
|
#BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
|
||||||
|
BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_20', 'sm_21'] # don't build sm_13 until the compile can fit in 32bit process again :)
|
||||||
|
|
||||||
##
|
##
|
||||||
CC = 'gcc'
|
CC = 'gcc'
|
||||||
CXX = 'g++'
|
CXX = 'g++'
|
||||||
|
|||||||
@@ -869,12 +869,17 @@ class BlenderEnvironment(SConsEnvironment):
|
|||||||
lenv.AddPostAction(prog,Action(AppIt,strfunction=my_appit_print))
|
lenv.AddPostAction(prog,Action(AppIt,strfunction=my_appit_print))
|
||||||
elif os.sep == '/' and lenv['OURPLATFORM'] != 'linuxcross': # any unix (except cross-compilation)
|
elif os.sep == '/' and lenv['OURPLATFORM'] != 'linuxcross': # any unix (except cross-compilation)
|
||||||
if lenv['WITH_BF_PYTHON']:
|
if lenv['WITH_BF_PYTHON']:
|
||||||
if not lenv['WITHOUT_BF_INSTALL'] and not lenv['WITHOUT_BF_PYTHON_INSTALL'] and not BlenderEnvironment.PyBundleActionAdded:
|
if (not lenv['WITHOUT_BF_INSTALL'] and
|
||||||
|
not lenv['WITHOUT_BF_PYTHON_INSTALL'] and
|
||||||
|
not lenv['WITHOUT_BF_PYTHON_UNPACK'] and
|
||||||
|
not BlenderEnvironment.PyBundleActionAdded):
|
||||||
lenv.AddPostAction(prog,Action(UnixPyBundle,strfunction=my_unixpybundle_print))
|
lenv.AddPostAction(prog,Action(UnixPyBundle,strfunction=my_unixpybundle_print))
|
||||||
BlenderEnvironment.PyBundleActionAdded = True
|
BlenderEnvironment.PyBundleActionAdded = True
|
||||||
elif lenv['OURPLATFORM'].startswith('win') or lenv['OURPLATFORM'] == 'linuxcross': # windows or cross-compilation
|
elif lenv['OURPLATFORM'].startswith('win') or lenv['OURPLATFORM'] == 'linuxcross': # windows or cross-compilation
|
||||||
if lenv['WITH_BF_PYTHON']:
|
if lenv['WITH_BF_PYTHON']:
|
||||||
if not lenv['WITHOUT_BF_PYTHON_INSTALL'] and not BlenderEnvironment.PyBundleActionAdded:
|
if (not lenv['WITHOUT_BF_PYTHON_INSTALL'] and
|
||||||
|
not lenv['WITHOUT_BF_PYTHON_UNPACK'] and
|
||||||
|
not BlenderEnvironment.PyBundleActionAdded):
|
||||||
lenv.AddPostAction(prog,Action(WinPyBundle,strfunction=my_winpybundle_print))
|
lenv.AddPostAction(prog,Action(WinPyBundle,strfunction=my_winpybundle_print))
|
||||||
BlenderEnvironment.PyBundleActionAdded = True
|
BlenderEnvironment.PyBundleActionAdded = True
|
||||||
return prog
|
return prog
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ def validate_arguments(args, bc):
|
|||||||
'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC',
|
'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC',
|
||||||
'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
|
'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
|
||||||
'WITHOUT_BF_INSTALL',
|
'WITHOUT_BF_INSTALL',
|
||||||
'WITHOUT_BF_PYTHON_INSTALL',
|
'WITHOUT_BF_PYTHON_INSTALL', 'WITHOUT_BF_PYTHON_UNPACK',
|
||||||
'WITHOUT_BF_OVERWRITE_INSTALL',
|
'WITHOUT_BF_OVERWRITE_INSTALL',
|
||||||
'WITH_BF_OPENMP', 'BF_OPENMP', 'BF_OPENMP_LIBPATH',
|
'WITH_BF_OPENMP', 'BF_OPENMP', 'BF_OPENMP_LIBPATH',
|
||||||
'WITH_GHOST_COCOA',
|
'WITH_GHOST_COCOA',
|
||||||
@@ -519,6 +519,7 @@ def read_opts(env, cfg, args):
|
|||||||
(BoolVariable('BF_SPLIT_SRC', 'Split src lib into several chunks if true', False)),
|
(BoolVariable('BF_SPLIT_SRC', 'Split src lib into several chunks if true', False)),
|
||||||
(BoolVariable('WITHOUT_BF_INSTALL', 'dont install if true', False)),
|
(BoolVariable('WITHOUT_BF_INSTALL', 'dont install if true', False)),
|
||||||
(BoolVariable('WITHOUT_BF_PYTHON_INSTALL', 'dont install Python modules if true', False)),
|
(BoolVariable('WITHOUT_BF_PYTHON_INSTALL', 'dont install Python modules if true', False)),
|
||||||
|
(BoolVariable('WITHOUT_BF_PYTHON_UNPACK', 'dont remove and unpack Python modules everytime if true', False)),
|
||||||
(BoolVariable('WITHOUT_BF_OVERWRITE_INSTALL', 'dont remove existing files before breating the new install directory (set to False when making packages for others)', False)),
|
(BoolVariable('WITHOUT_BF_OVERWRITE_INSTALL', 'dont remove existing files before breating the new install directory (set to False when making packages for others)', False)),
|
||||||
(BoolVariable('BF_FANCY', 'Enable fancy output if true', True)),
|
(BoolVariable('BF_FANCY', 'Enable fancy output if true', True)),
|
||||||
(BoolVariable('BF_QUIET', 'Enable silent output if true', True)),
|
(BoolVariable('BF_QUIET', 'Enable silent output if true', True)),
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ This example script prints the vertices and UV's for each polygon, assumes the a
|
|||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
me = bpy.context.object.data
|
me = bpy.context.object.data
|
||||||
uv_layer = me.uv.layers.active.data
|
uv_layer = me.uv_layers.active.data
|
||||||
|
|
||||||
for poly in me.polygons:
|
for poly in me.polygons:
|
||||||
print("Polygon index: %d, length: %d" % (poly.index, poly.loop_total))
|
print("Polygon index: %d, length: %d" % (poly.index, poly.loop_total))
|
||||||
|
|||||||
@@ -13,37 +13,39 @@ Intro
|
|||||||
# Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook::
|
# Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook::
|
||||||
# To use a mouse movement sensor "Mouse" and a
|
# To use a mouse movement sensor "Mouse" and a
|
||||||
# motion actuator to mouse look:
|
# motion actuator to mouse look:
|
||||||
import bge.render
|
import bge
|
||||||
import bge.logic
|
|
||||||
|
|
||||||
# scale sets the speed of motion
|
# scale sets the speed of motion
|
||||||
scale = 1.0, 0.5
|
scale = 1.0, 0.5
|
||||||
|
|
||||||
co = bge.logic.getCurrentController()
|
co = bge.logic.getCurrentController()
|
||||||
obj = co.getOwner()
|
obj = co.owner
|
||||||
mouse = co.getSensor("Mouse")
|
mouse = co.sensors["Mouse"]
|
||||||
lmotion = co.getActuator("LMove")
|
lmotion = co.actuators["LMove"]
|
||||||
wmotion = co.getActuator("WMove")
|
wmotion = co.actuators["WMove"]
|
||||||
|
|
||||||
# Transform the mouse coordinates to see how far the mouse has moved.
|
# Transform the mouse coordinates to see how far the mouse has moved.
|
||||||
def mousePos():
|
def mousePos():
|
||||||
x = (bge.render.getWindowWidth() / 2 - mouse.getXPosition()) * scale[0]
|
x = (bge.render.getWindowWidth() / 2 - mouse.position[0]) * scale[0]
|
||||||
y = (bge.render.getWindowHeight() / 2 - mouse.getYPosition()) * scale[1]
|
y = (bge.render.getWindowHeight() / 2 - mouse.position[1]) * scale[1]
|
||||||
return (x, y)
|
return (x, y)
|
||||||
|
|
||||||
pos = mousePos()
|
pos = mousePos()
|
||||||
|
|
||||||
# Set the amount of motion: X is applied in world coordinates...
|
# Set the amount of motion: X is applied in world coordinates...
|
||||||
lmotion.setTorque(0.0, 0.0, pos[0], False)
|
wmotion.useLocalTorque = False
|
||||||
|
wmotion.torque = ((0.0, 0.0, pos[0]))
|
||||||
|
|
||||||
# ...Y is applied in local coordinates
|
# ...Y is applied in local coordinates
|
||||||
wmotion.setTorque(-pos[1], 0.0, 0.0, True)
|
lmotion.useLocalTorque = True
|
||||||
|
lmotion.torque = ((-pos[1], 0.0, 0.0))
|
||||||
|
|
||||||
# Activate both actuators
|
# Activate both actuators
|
||||||
bge.logic.addActiveActuator(lmotion, True)
|
co.activate(lmotion)
|
||||||
bge.logic.addActiveActuator(wmotion, True)
|
co.activate(wmotion)
|
||||||
|
|
||||||
# Centre the mouse
|
# Centre the mouse
|
||||||
bge.render.setMousePosition(bge.render.getWindowWidth() / 2, bge.render.getWindowHeight() / 2)
|
bge.render.setMousePosition(int(bge.render.getWindowWidth() / 2), int(bge.render.getWindowHeight() / 2))
|
||||||
|
|
||||||
*********
|
*********
|
||||||
Constants
|
Constants
|
||||||
|
|||||||
@@ -99,9 +99,11 @@ Here are some examples ...
|
|||||||
uv_lay = bm.loops.layers.uv.active
|
uv_lay = bm.loops.layers.uv.active
|
||||||
|
|
||||||
for face in bm.faces:
|
for face in bm.faces:
|
||||||
for loop in f.loops:
|
for loop in face.loops:
|
||||||
uv = loop[uv_lay]
|
uv = loop[uv_lay].uv
|
||||||
print("Loop UV: %f, %f" % (uv.x, uv.y))
|
print("Loop UV: %f, %f" % uv[:])
|
||||||
|
vert = loop.vert
|
||||||
|
print("Loop Vert: (%f,%f,%f)" % vert.co[:])
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
|
|||||||
/* object sync */
|
/* object sync */
|
||||||
if(object_updated || (object->mesh && object->mesh->need_update)) {
|
if(object_updated || (object->mesh && object->mesh->need_update)) {
|
||||||
object->name = b_ob.name().c_str();
|
object->name = b_ob.name().c_str();
|
||||||
|
object->instance_id = b_index;
|
||||||
object->pass_id = b_ob.pass_index();
|
object->pass_id = b_ob.pass_index();
|
||||||
object->tfm = tfm;
|
object->tfm = tfm;
|
||||||
object->motion.pre = tfm;
|
object->motion.pre = tfm;
|
||||||
@@ -284,8 +285,10 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
|
|||||||
|
|
||||||
/* object loop */
|
/* object loop */
|
||||||
BL::Scene::objects_iterator b_ob;
|
BL::Scene::objects_iterator b_ob;
|
||||||
|
BL::Scene b_sce = b_scene;
|
||||||
|
|
||||||
for(b_scene.objects.begin(b_ob); b_ob != b_scene.objects.end(); ++b_ob) {
|
for(; b_sce; b_sce = b_sce.background_set()) {
|
||||||
|
for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end(); ++b_ob) {
|
||||||
bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
|
bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
|
||||||
uint ob_layer = get_layer(b_ob->layers());
|
uint ob_layer = get_layer(b_ob->layers());
|
||||||
|
|
||||||
@@ -333,6 +336,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!motion) {
|
if(!motion) {
|
||||||
sync_background_light();
|
sync_background_light();
|
||||||
|
|||||||
@@ -334,6 +334,10 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Shader
|
|||||||
node = new LightFalloffNode();
|
node = new LightFalloffNode();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case BL::ShaderNode::type_OBJECT_INFO: {
|
||||||
|
node = new ObjectInfoNode();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case BL::ShaderNode::type_TEX_IMAGE: {
|
case BL::ShaderNode::type_TEX_IMAGE: {
|
||||||
BL::ShaderNodeTexImage b_image_node(b_node);
|
BL::ShaderNodeTexImage b_image_node(b_node);
|
||||||
BL::Image b_image(b_image_node.image());
|
BL::Image b_image(b_image_node.image());
|
||||||
|
|||||||
@@ -117,6 +117,16 @@ __device_inline void object_dir_transform(KernelGlobals *kg, ShaderData *sd, flo
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__device_inline float3 object_location(KernelGlobals *kg, ShaderData *sd)
|
||||||
|
{
|
||||||
|
#ifdef __MOTION__
|
||||||
|
return make_float3(sd->ob_tfm.x.w, sd->ob_tfm.y.w, sd->ob_tfm.z.w);
|
||||||
|
#else
|
||||||
|
Transform tfm = object_fetch_transform(kg, sd->object, 0.0f, OBJECT_TRANSFORM);
|
||||||
|
return make_float3(tfm.x.w, tfm.y.w, tfm.z.w);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
__device_inline float object_surface_area(KernelGlobals *kg, int object)
|
__device_inline float object_surface_area(KernelGlobals *kg, int object)
|
||||||
{
|
{
|
||||||
int offset = object*OBJECT_SIZE + OBJECT_PROPERTIES;
|
int offset = object*OBJECT_SIZE + OBJECT_PROPERTIES;
|
||||||
@@ -134,5 +144,20 @@ __device_inline float object_pass_id(KernelGlobals *kg, int object)
|
|||||||
return f.y;
|
return f.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__device_inline float object_random_number(KernelGlobals *kg, int object)
|
||||||
|
{
|
||||||
|
if(object == ~0)
|
||||||
|
return 0.0f;
|
||||||
|
|
||||||
|
int offset = object*OBJECT_SIZE + OBJECT_PROPERTIES;
|
||||||
|
float4 f = kernel_tex_fetch(__objects, offset);
|
||||||
|
return f.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
__device int shader_pass_id(KernelGlobals *kg, ShaderData *sd)
|
||||||
|
{
|
||||||
|
return kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2 + 1);
|
||||||
|
}
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
|
||||||
|
|||||||
@@ -679,11 +679,6 @@ __device bool shader_transparent_shadow(KernelGlobals *kg, Intersection *isect)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__device int shader_pass_id(KernelGlobals *kg, ShaderData *sd)
|
|
||||||
{
|
|
||||||
return kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2 + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free ShaderData */
|
/* Free ShaderData */
|
||||||
|
|
||||||
__device void shader_release(KernelGlobals *kg, ShaderData *sd)
|
__device void shader_release(KernelGlobals *kg, ShaderData *sd)
|
||||||
|
|||||||
@@ -266,6 +266,9 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
|
|||||||
case NODE_LIGHT_PATH:
|
case NODE_LIGHT_PATH:
|
||||||
svm_node_light_path(sd, stack, node.y, node.z, path_flag);
|
svm_node_light_path(sd, stack, node.y, node.z, path_flag);
|
||||||
break;
|
break;
|
||||||
|
case NODE_OBJECT_INFO:
|
||||||
|
svm_node_object_info(kg, sd, stack, node.y, node.z);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case NODE_CONVERT:
|
case NODE_CONVERT:
|
||||||
svm_node_convert(sd, stack, node.y, node.z, node.w);
|
svm_node_convert(sd, stack, node.y, node.z, node.w);
|
||||||
|
|||||||
@@ -74,5 +74,25 @@ __device void svm_node_geometry_bump_dy(ShaderData *sd, float *stack, uint type,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Object Info */
|
||||||
|
|
||||||
|
__device void svm_node_object_info(KernelGlobals *kg, ShaderData *sd, float *stack, uint type, uint out_offset)
|
||||||
|
{
|
||||||
|
float data;
|
||||||
|
|
||||||
|
switch(type) {
|
||||||
|
case NODE_INFO_OB_LOCATION: {
|
||||||
|
stack_store_float3(stack, out_offset, object_location(kg, sd));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case NODE_INFO_OB_INDEX: data = object_pass_id(kg, sd->object); break;
|
||||||
|
case NODE_INFO_MAT_INDEX: data = shader_pass_id(kg, sd); break;
|
||||||
|
case NODE_INFO_OB_RANDOM: data = object_random_number(kg, sd->object); break;
|
||||||
|
default: data = 0.0f; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
stack_store_float(stack, out_offset, data);
|
||||||
|
}
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ typedef enum NodeType {
|
|||||||
NODE_RGB_RAMP = 5900,
|
NODE_RGB_RAMP = 5900,
|
||||||
NODE_RGB_CURVES = 6000,
|
NODE_RGB_CURVES = 6000,
|
||||||
NODE_MIN_MAX = 6100,
|
NODE_MIN_MAX = 6100,
|
||||||
NODE_LIGHT_FALLOFF = 6200
|
NODE_LIGHT_FALLOFF = 6200,
|
||||||
|
NODE_OBJECT_INFO = 6300
|
||||||
} NodeType;
|
} NodeType;
|
||||||
|
|
||||||
typedef enum NodeAttributeType {
|
typedef enum NodeAttributeType {
|
||||||
@@ -109,6 +110,13 @@ typedef enum NodeGeometry {
|
|||||||
NODE_GEOM_uv
|
NODE_GEOM_uv
|
||||||
} NodeGeometry;
|
} NodeGeometry;
|
||||||
|
|
||||||
|
typedef enum NodeObjectInfo {
|
||||||
|
NODE_INFO_OB_LOCATION,
|
||||||
|
NODE_INFO_OB_INDEX,
|
||||||
|
NODE_INFO_MAT_INDEX,
|
||||||
|
NODE_INFO_OB_RANDOM
|
||||||
|
} NodeObjectInfo;
|
||||||
|
|
||||||
typedef enum NodeLightPath {
|
typedef enum NodeLightPath {
|
||||||
NODE_LP_camera = 0,
|
NODE_LP_camera = 0,
|
||||||
NODE_LP_shadow,
|
NODE_LP_shadow,
|
||||||
|
|||||||
@@ -325,6 +325,25 @@ void ShaderGraph::remove_proxy_nodes(vector<bool>& removed)
|
|||||||
|
|
||||||
removed[proxy->id] = true;
|
removed[proxy->id] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* remove useless mix closures nodes */
|
||||||
|
MixClosureNode *mix = dynamic_cast<MixClosureNode*>(node);
|
||||||
|
|
||||||
|
if(mix) {
|
||||||
|
if(mix->outputs[0]->links.size() && mix->inputs[1]->link == mix->inputs[2]->link) {
|
||||||
|
ShaderOutput *output = mix->inputs[1]->link;
|
||||||
|
vector<ShaderInput*> inputs = mix->outputs[0]->links;
|
||||||
|
|
||||||
|
foreach(ShaderInput *sock, mix->inputs)
|
||||||
|
if(sock->link)
|
||||||
|
disconnect(sock);
|
||||||
|
|
||||||
|
foreach(ShaderInput *input, inputs) {
|
||||||
|
disconnect(input);
|
||||||
|
connect(output, input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1699,7 +1699,7 @@ void LightPathNode::compile(OSLCompiler& compiler)
|
|||||||
compiler.add(this, "node_light_path");
|
compiler.add(this, "node_light_path");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Light Path */
|
/* Light Falloff */
|
||||||
|
|
||||||
LightFalloffNode::LightFalloffNode()
|
LightFalloffNode::LightFalloffNode()
|
||||||
: ShaderNode("light_path")
|
: ShaderNode("light_path")
|
||||||
@@ -1746,6 +1746,49 @@ void LightFalloffNode::compile(OSLCompiler& compiler)
|
|||||||
compiler.add(this, "node_light_falloff");
|
compiler.add(this, "node_light_falloff");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Object Info */
|
||||||
|
|
||||||
|
ObjectInfoNode::ObjectInfoNode()
|
||||||
|
: ShaderNode("object_info")
|
||||||
|
{
|
||||||
|
add_output("Location", SHADER_SOCKET_VECTOR);
|
||||||
|
add_output("Object Index", SHADER_SOCKET_FLOAT);
|
||||||
|
add_output("Material Index", SHADER_SOCKET_FLOAT);
|
||||||
|
add_output("Random", SHADER_SOCKET_FLOAT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInfoNode::compile(SVMCompiler& compiler)
|
||||||
|
{
|
||||||
|
ShaderOutput *out = output("Location");
|
||||||
|
if(!out->links.empty()) {
|
||||||
|
compiler.stack_assign(out);
|
||||||
|
compiler.add_node(NODE_OBJECT_INFO, NODE_INFO_OB_LOCATION, out->stack_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
out = output("Object Index");
|
||||||
|
if(!out->links.empty()) {
|
||||||
|
compiler.stack_assign(out);
|
||||||
|
compiler.add_node(NODE_OBJECT_INFO, NODE_INFO_OB_INDEX, out->stack_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
out = output("Material Index");
|
||||||
|
if(!out->links.empty()) {
|
||||||
|
compiler.stack_assign(out);
|
||||||
|
compiler.add_node(NODE_OBJECT_INFO, NODE_INFO_MAT_INDEX, out->stack_offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
out = output("Random");
|
||||||
|
if(!out->links.empty()) {
|
||||||
|
compiler.stack_assign(out);
|
||||||
|
compiler.add_node(NODE_OBJECT_INFO, NODE_INFO_OB_RANDOM, out->stack_offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectInfoNode::compile(OSLCompiler& compiler)
|
||||||
|
{
|
||||||
|
compiler.add(this, "node_object_info");
|
||||||
|
}
|
||||||
|
|
||||||
/* Value */
|
/* Value */
|
||||||
|
|
||||||
ValueNode::ValueNode()
|
ValueNode::ValueNode()
|
||||||
|
|||||||
@@ -285,6 +285,11 @@ public:
|
|||||||
SHADER_NODE_CLASS(LightFalloffNode)
|
SHADER_NODE_CLASS(LightFalloffNode)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ObjectInfoNode : public ShaderNode {
|
||||||
|
public:
|
||||||
|
SHADER_NODE_CLASS(ObjectInfoNode)
|
||||||
|
};
|
||||||
|
|
||||||
class ValueNode : public ShaderNode {
|
class ValueNode : public ShaderNode {
|
||||||
public:
|
public:
|
||||||
SHADER_NODE_CLASS(ValueNode)
|
SHADER_NODE_CLASS(ValueNode)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
|
|
||||||
#include "util_foreach.h"
|
#include "util_foreach.h"
|
||||||
|
#include "util_hash.h"
|
||||||
#include "util_map.h"
|
#include "util_map.h"
|
||||||
#include "util_progress.h"
|
#include "util_progress.h"
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ Object::Object()
|
|||||||
mesh = NULL;
|
mesh = NULL;
|
||||||
tfm = transform_identity();
|
tfm = transform_identity();
|
||||||
visibility = ~0;
|
visibility = ~0;
|
||||||
|
instance_id = 0;
|
||||||
pass_id = 0;
|
pass_id = 0;
|
||||||
bounds = BoundBox::empty;
|
bounds = BoundBox::empty;
|
||||||
motion.pre = transform_identity();
|
motion.pre = transform_identity();
|
||||||
@@ -164,6 +166,9 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
|
|||||||
float surface_area = 0.0f;
|
float surface_area = 0.0f;
|
||||||
float pass_id = ob->pass_id;
|
float pass_id = ob->pass_id;
|
||||||
|
|
||||||
|
uint ob_hash = hash_int_2d(hash_string(ob->name.c_str()), ob->instance_id);
|
||||||
|
float random_number = (float)ob_hash * (1.0f/(float)0xFFFFFFFF);
|
||||||
|
|
||||||
if(transform_uniform_scale(tfm, uniform_scale)) {
|
if(transform_uniform_scale(tfm, uniform_scale)) {
|
||||||
map<Mesh*, float>::iterator it = surface_area_map.find(mesh);
|
map<Mesh*, float>::iterator it = surface_area_map.find(mesh);
|
||||||
|
|
||||||
@@ -198,7 +203,7 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
|
|||||||
|
|
||||||
memcpy(&objects[offset], &tfm, sizeof(float4)*3);
|
memcpy(&objects[offset], &tfm, sizeof(float4)*3);
|
||||||
memcpy(&objects[offset+3], &itfm, sizeof(float4)*3);
|
memcpy(&objects[offset+3], &itfm, sizeof(float4)*3);
|
||||||
objects[offset+6] = make_float4(surface_area, pass_id, 0.0f, 0.0f);
|
objects[offset+6] = make_float4(surface_area, pass_id, random_number, 0.0f);
|
||||||
|
|
||||||
if(need_motion == Scene::MOTION_PASS) {
|
if(need_motion == Scene::MOTION_PASS) {
|
||||||
/* motion transformations, is world/object space depending if mesh
|
/* motion transformations, is world/object space depending if mesh
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ public:
|
|||||||
Transform tfm;
|
Transform tfm;
|
||||||
BoundBox bounds;
|
BoundBox bounds;
|
||||||
ustring name;
|
ustring name;
|
||||||
|
int instance_id;
|
||||||
int pass_id;
|
int pass_id;
|
||||||
vector<ParamValue> attributes;
|
vector<ParamValue> attributes;
|
||||||
uint visibility;
|
uint visibility;
|
||||||
|
|||||||
@@ -19,13 +19,15 @@
|
|||||||
#ifndef __UTIL_HASH_H__
|
#ifndef __UTIL_HASH_H__
|
||||||
#define __UTIL_HASH_H__
|
#define __UTIL_HASH_H__
|
||||||
|
|
||||||
|
#include "util_types.h"
|
||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
static inline unsigned int hash_int_2d(unsigned int kx, unsigned int ky)
|
static inline uint hash_int_2d(uint kx, uint ky)
|
||||||
{
|
{
|
||||||
#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
|
#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
|
||||||
|
|
||||||
unsigned int a, b, c;
|
uint a, b, c;
|
||||||
|
|
||||||
a = b = c = 0xdeadbeef + (2 << 2) + 13;
|
a = b = c = 0xdeadbeef + (2 << 2) + 13;
|
||||||
a += kx;
|
a += kx;
|
||||||
@@ -44,11 +46,21 @@ static inline unsigned int hash_int_2d(unsigned int kx, unsigned int ky)
|
|||||||
#undef rot
|
#undef rot
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned int hash_int(unsigned int k)
|
static inline uint hash_int(uint k)
|
||||||
{
|
{
|
||||||
return hash_int_2d(k, 0);
|
return hash_int_2d(k, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline uint hash_string(const char *str)
|
||||||
|
{
|
||||||
|
uint i = 0, c;
|
||||||
|
|
||||||
|
while ((c = *str++))
|
||||||
|
i = i * 37 + c;
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
|
||||||
#endif /* __UTIL_HASH_H__ */
|
#endif /* __UTIL_HASH_H__ */
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ set(SRC
|
|||||||
intern/globals.h
|
intern/globals.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# elbeem has some harmless UNUSED warnings
|
||||||
|
remove_strict_flags()
|
||||||
|
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-DNOGUI
|
-DNOGUI
|
||||||
-DELBEEM_BLENDER=1
|
-DELBEEM_BLENDER=1
|
||||||
|
|||||||
@@ -108,10 +108,6 @@ if(WITH_INPUT_NDOF)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_XDG_USER_DIRS)
|
|
||||||
add_definitions(-DWITH_XDG_USER_DIRS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WITH_HEADLESS OR WITH_GHOST_SDL)
|
if(WITH_HEADLESS OR WITH_GHOST_SDL)
|
||||||
if(WITH_HEADLESS)
|
if(WITH_HEADLESS)
|
||||||
list(APPEND SRC
|
list(APPEND SRC
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ extern GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
|
|||||||
GHOST_TimerTaskHandle timertaskhandle);
|
GHOST_TimerTaskHandle timertaskhandle);
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Display/window management functionality
|
** Display/window management functionality
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of displays on this system.
|
* Returns the number of displays on this system.
|
||||||
@@ -146,8 +146,8 @@ extern GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
|
|||||||
* @return void.
|
* @return void.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
|
extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TUns32* width,
|
GHOST_TUns32 *width,
|
||||||
GHOST_TUns32* height);
|
GHOST_TUns32 *height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new window.
|
* Create a new window.
|
||||||
@@ -166,7 +166,7 @@ extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
|
|||||||
* @return A handle to the new window ( == NULL if creation failed).
|
* @return A handle to the new window ( == NULL if creation failed).
|
||||||
*/
|
*/
|
||||||
extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
||||||
const char* title,
|
const char *title,
|
||||||
GHOST_TInt32 left,
|
GHOST_TInt32 left,
|
||||||
GHOST_TInt32 top,
|
GHOST_TInt32 top,
|
||||||
GHOST_TUns32 width,
|
GHOST_TUns32 width,
|
||||||
@@ -217,7 +217,7 @@ extern int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
|
|||||||
* This window is invalid after full screen has been ended.
|
* This window is invalid after full screen has been ended.
|
||||||
*/
|
*/
|
||||||
extern GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
|
extern GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_DisplaySetting* setting,
|
GHOST_DisplaySetting *setting,
|
||||||
const int stereoVisual);
|
const int stereoVisual);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -235,8 +235,8 @@ extern GHOST_TSuccess GHOST_EndFullScreen(GHOST_SystemHandle systemhandle);
|
|||||||
extern int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle);
|
extern int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle);
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Event management functionality
|
** Event management functionality
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves events from the system and stores them in the queue.
|
* Retrieves events from the system and stores them in the queue.
|
||||||
@@ -273,8 +273,8 @@ extern GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle,
|
|||||||
GHOST_EventConsumerHandle consumerhandle);
|
GHOST_EventConsumerHandle consumerhandle);
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Progress bar functionality
|
** Progress bar functionality
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the progress bar value displayed in the window/application icon
|
* Sets the progress bar value displayed in the window/application icon
|
||||||
@@ -290,8 +290,8 @@ extern GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle, floa
|
|||||||
extern GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle);
|
extern GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle);
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Cursor management functionality
|
** Cursor management functionality
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current cursor shape.
|
* Returns the current cursor shape.
|
||||||
@@ -339,7 +339,7 @@ extern GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhand
|
|||||||
GHOST_TUns8 *mask,
|
GHOST_TUns8 *mask,
|
||||||
int sizex, int sizey,
|
int sizex, int sizey,
|
||||||
int hotX, int hotY,
|
int hotX, int hotY,
|
||||||
int fg_color, int bg_color );
|
int fg_color, int bg_color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the visibility state of the cursor.
|
* Returns the visibility state of the cursor.
|
||||||
@@ -365,8 +365,8 @@ extern GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle,
|
|||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
|
extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TInt32* x,
|
GHOST_TInt32 *x,
|
||||||
GHOST_TInt32* y);
|
GHOST_TInt32 *y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the location of the cursor (location in screen coordinates).
|
* Updates the location of the cursor (location in screen coordinates).
|
||||||
@@ -391,11 +391,11 @@ extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
|
|||||||
*/
|
*/
|
||||||
extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
|
extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TGrabCursorMode mode,
|
GHOST_TGrabCursorMode mode,
|
||||||
int* bounds);
|
int *bounds);
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Access to mouse button and keyboard states.
|
** Access to mouse button and keyboard states.
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the state of a modifier key (ouside the message queue).
|
* Returns the state of a modifier key (ouside the message queue).
|
||||||
@@ -406,7 +406,7 @@ extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
|
|||||||
*/
|
*/
|
||||||
extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
|
extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TModifierKeyMask mask,
|
GHOST_TModifierKeyMask mask,
|
||||||
int* isDown);
|
int *isDown);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the state of a mouse button (ouside the message queue).
|
* Returns the state of a mouse button (ouside the message queue).
|
||||||
@@ -417,12 +417,12 @@ extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
|
|||||||
*/
|
*/
|
||||||
extern GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
|
extern GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TButtonMask mask,
|
GHOST_TButtonMask mask,
|
||||||
int* isDown);
|
int *isDown);
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Drag'n'drop operations
|
** Drag'n'drop operations
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
|
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
|
||||||
@@ -518,7 +518,7 @@ extern GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandl
|
|||||||
* @param title The title to display in the title bar.
|
* @param title The title to display in the title bar.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_SetTitle(GHOST_WindowHandle windowhandle,
|
extern void GHOST_SetTitle(GHOST_WindowHandle windowhandle,
|
||||||
const char* title);
|
const char *title);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the title displayed in the title bar. The title
|
* Returns the title displayed in the title bar. The title
|
||||||
@@ -527,7 +527,7 @@ extern void GHOST_SetTitle(GHOST_WindowHandle windowhandle,
|
|||||||
* @param windowhandle The handle to the window
|
* @param windowhandle The handle to the window
|
||||||
* @return The title, free with free().
|
* @return The title, free with free().
|
||||||
*/
|
*/
|
||||||
extern char* GHOST_GetTitle(GHOST_WindowHandle windowhandle);
|
extern char *GHOST_GetTitle(GHOST_WindowHandle windowhandle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the window rectangle dimensions.
|
* Returns the window rectangle dimensions.
|
||||||
@@ -591,8 +591,8 @@ extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
|
|||||||
extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
|
extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TInt32 inX,
|
GHOST_TInt32 inX,
|
||||||
GHOST_TInt32 inY,
|
GHOST_TInt32 inY,
|
||||||
GHOST_TInt32* outX,
|
GHOST_TInt32 *outX,
|
||||||
GHOST_TInt32* outY);
|
GHOST_TInt32 *outY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a point in screen coordinates to client rectangle coordinates
|
* Converts a point in screen coordinates to client rectangle coordinates
|
||||||
@@ -605,8 +605,8 @@ extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
|
|||||||
extern void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
|
extern void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TInt32 inX,
|
GHOST_TInt32 inX,
|
||||||
GHOST_TInt32 inY,
|
GHOST_TInt32 inY,
|
||||||
GHOST_TInt32* outX,
|
GHOST_TInt32 *outX,
|
||||||
GHOST_TInt32* outY);
|
GHOST_TInt32 *outY);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the state of the window (normal, minimized, maximized).
|
* Returns the state of the window (normal, minimized, maximized).
|
||||||
@@ -694,10 +694,10 @@ extern GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehand
|
|||||||
* @param b Pointer to return bottom coordinate in.
|
* @param b Pointer to return bottom coordinate in.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
|
extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
|
||||||
GHOST_TInt32* l,
|
GHOST_TInt32 *l,
|
||||||
GHOST_TInt32* t,
|
GHOST_TInt32 *t,
|
||||||
GHOST_TInt32* r,
|
GHOST_TInt32 *r,
|
||||||
GHOST_TInt32* b);
|
GHOST_TInt32 *b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets all members of the rectangle.
|
* Sets all members of the rectangle.
|
||||||
@@ -821,7 +821,7 @@ extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
* @param return the selection instead, X11 only feature
|
* @param return the selection instead, X11 only feature
|
||||||
* @return clipboard data
|
* @return clipboard data
|
||||||
*/
|
*/
|
||||||
extern GHOST_TUns8* GHOST_getClipboard(int selection);
|
extern GHOST_TUns8 *GHOST_getClipboard(int selection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put data to the Clipboard
|
* Put data to the Clipboard
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
* or NULL if it is a 'system' event.
|
* or NULL if it is a 'system' event.
|
||||||
* @return The generating window.
|
* @return The generating window.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_IWindow* getWindow() = 0;
|
virtual GHOST_IWindow *getWindow() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the event data.
|
* Returns the event data.
|
||||||
@@ -87,8 +87,12 @@ public:
|
|||||||
|
|
||||||
#ifdef WITH_CXX_GUARDEDALLOC
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
public:
|
public:
|
||||||
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_IEvent"); }
|
void *operator new(size_t num_bytes) {
|
||||||
void operator delete( void *mem ) { MEM_freeN(mem); }
|
return MEM_mallocN(num_bytes, "GHOST:GHOST_IEvent");
|
||||||
|
}
|
||||||
|
void operator delete(void *mem) {
|
||||||
|
MEM_freeN(mem);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
* @param event The event that can be handled or ignored.
|
* @param event The event that can be handled or ignored.
|
||||||
* @return Indication as to whether the event was handled.
|
* @return Indication as to whether the event was handled.
|
||||||
*/
|
*/
|
||||||
virtual bool processEvent(GHOST_IEvent* event) = 0;
|
virtual bool processEvent(GHOST_IEvent *event) = 0;
|
||||||
|
|
||||||
#ifdef WITH_CXX_GUARDEDALLOC
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -158,20 +158,22 @@ public:
|
|||||||
* Returns a pointer to the one and only system (nil if it hasn't been created).
|
* Returns a pointer to the one and only system (nil if it hasn't been created).
|
||||||
* @return A pointer to the system.
|
* @return A pointer to the system.
|
||||||
*/
|
*/
|
||||||
static GHOST_ISystem* getSystem();
|
static GHOST_ISystem *getSystem();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* Protected default constructor to force use of static createSystem member.
|
* Protected default constructor to force use of static createSystem member.
|
||||||
*/
|
*/
|
||||||
GHOST_ISystem() {}
|
GHOST_ISystem() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
* Protected default constructor to force use of static dispose member.
|
* Protected default constructor to force use of static dispose member.
|
||||||
*/
|
*/
|
||||||
virtual ~GHOST_ISystem() {}
|
virtual ~GHOST_ISystem() {
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
@@ -196,7 +198,7 @@ public:
|
|||||||
* @param userData Placeholder for user data.
|
* @param userData Placeholder for user data.
|
||||||
* @return A timer task (0 if timer task installation failed).
|
* @return A timer task (0 if timer task installation failed).
|
||||||
*/
|
*/
|
||||||
virtual GHOST_ITimerTask* installTimer(GHOST_TUns64 delay,
|
virtual GHOST_ITimerTask *installTimer(GHOST_TUns64 delay,
|
||||||
GHOST_TUns64 interval,
|
GHOST_TUns64 interval,
|
||||||
GHOST_TimerProcPtr timerProc,
|
GHOST_TimerProcPtr timerProc,
|
||||||
GHOST_TUserDataPtr userData = 0) = 0;
|
GHOST_TUserDataPtr userData = 0) = 0;
|
||||||
@@ -206,7 +208,7 @@ public:
|
|||||||
* @param timerTask Timer task to be removed.
|
* @param timerTask Timer task to be removed.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess removeTimer(GHOST_ITimerTask* timerTask) = 0;
|
virtual GHOST_TSuccess removeTimer(GHOST_ITimerTask *timerTask) = 0;
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Display/window management functionality
|
** Display/window management functionality
|
||||||
@@ -240,7 +242,7 @@ public:
|
|||||||
* @param parentWindow Parent (embedder) window
|
* @param parentWindow Parent (embedder) window
|
||||||
* @return The new window (or 0 if creation failed).
|
* @return The new window (or 0 if creation failed).
|
||||||
*/
|
*/
|
||||||
virtual GHOST_IWindow* createWindow(
|
virtual GHOST_IWindow *createWindow(
|
||||||
const STR_String& title,
|
const STR_String& title,
|
||||||
GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
|
GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
|
||||||
GHOST_TWindowState state, GHOST_TDrawingContextType type,
|
GHOST_TWindowState state, GHOST_TDrawingContextType type,
|
||||||
@@ -253,14 +255,14 @@ public:
|
|||||||
* @param window Pointer to the window to be disposed.
|
* @param window Pointer to the window to be disposed.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess disposeWindow(GHOST_IWindow* window) = 0;
|
virtual GHOST_TSuccess disposeWindow(GHOST_IWindow *window) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether a window is valid.
|
* Returns whether a window is valid.
|
||||||
* @param window Pointer to the window to be checked.
|
* @param window Pointer to the window to be checked.
|
||||||
* @return Indication of validity.
|
* @return Indication of validity.
|
||||||
*/
|
*/
|
||||||
virtual bool validWindow(GHOST_IWindow* window) = 0;
|
virtual bool validWindow(GHOST_IWindow *window) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Begins full screen mode.
|
* Begins full screen mode.
|
||||||
@@ -269,8 +271,8 @@ public:
|
|||||||
* This window is invalid after full screen has been ended.
|
* This window is invalid after full screen has been ended.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
|
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window,
|
||||||
const bool stereoVisual, const GHOST_TUns16 numOfAASamples=0) = 0;
|
const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the resolution while in fullscreen mode.
|
* Updates the resolution while in fullscreen mode.
|
||||||
@@ -279,7 +281,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window) = 0;
|
virtual GHOST_TSuccess updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ends full screen mode.
|
* Ends full screen mode.
|
||||||
@@ -315,14 +317,14 @@ public:
|
|||||||
* @param consumer The event consumer to add.
|
* @param consumer The event consumer to add.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer* consumer) = 0;
|
virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer *consumer) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the given event consumer to our list.
|
* Removes the given event consumer to our list.
|
||||||
* @param consumer The event consumer to remove.
|
* @param consumer The event consumer to remove.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer* consumer) = 0;
|
virtual GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer *consumer) = 0;
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Cursor management functionality
|
** Cursor management functionality
|
||||||
@@ -385,7 +387,7 @@ public:
|
|||||||
* @return Returns "unsinged char" from X11 XA_CUT_BUFFER0 buffer
|
* @return Returns "unsinged char" from X11 XA_CUT_BUFFER0 buffer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TUns8* getClipboard(bool selection) const = 0;
|
virtual GHOST_TUns8 *getClipboard(bool selection) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put data to the Clipboard
|
* Put data to the Clipboard
|
||||||
@@ -396,7 +398,7 @@ public:
|
|||||||
* Confirms quitting he program when there is just one window left open
|
* Confirms quitting he program when there is just one window left open
|
||||||
* in the application
|
* in the application
|
||||||
*/
|
*/
|
||||||
virtual int confirmQuit(GHOST_IWindow * window) const = 0;
|
virtual int confirmQuit(GHOST_IWindow *window) const = 0;
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Initialize the system.
|
* Initialize the system.
|
||||||
@@ -411,12 +413,16 @@ protected:
|
|||||||
virtual GHOST_TSuccess exit() = 0;
|
virtual GHOST_TSuccess exit() = 0;
|
||||||
|
|
||||||
/** The one and only system */
|
/** The one and only system */
|
||||||
static GHOST_ISystem* m_system;
|
static GHOST_ISystem *m_system;
|
||||||
|
|
||||||
#ifdef WITH_CXX_GUARDEDALLOC
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
public:
|
public:
|
||||||
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_ISystem"); }
|
void *operator new(size_t num_bytes) {
|
||||||
void operator delete( void *mem ) { MEM_freeN(mem); }
|
return MEM_mallocN(num_bytes, "GHOST:GHOST_ISystem");
|
||||||
|
}
|
||||||
|
void operator delete(void *mem) {
|
||||||
|
MEM_freeN(mem);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -52,50 +52,52 @@ public:
|
|||||||
* Returns a pointer to the one and only system (nil if it hasn't been created).
|
* Returns a pointer to the one and only system (nil if it hasn't been created).
|
||||||
* @return A pointer to the system.
|
* @return A pointer to the system.
|
||||||
*/
|
*/
|
||||||
static GHOST_ISystemPaths* get();
|
static GHOST_ISystemPaths *get();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* Protected default constructor to force use of static createSystem member.
|
* Protected default constructor to force use of static createSystem member.
|
||||||
*/
|
*/
|
||||||
GHOST_ISystemPaths() {}
|
GHOST_ISystemPaths() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
* Protected default constructor to force use of static dispose member.
|
* Protected default constructor to force use of static dispose member.
|
||||||
*/
|
*/
|
||||||
virtual ~GHOST_ISystemPaths() {}
|
virtual ~GHOST_ISystemPaths() {
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which shared resources are located. It will first try to use
|
* Determine the base dir in which shared resources are located. It will first try to use
|
||||||
* "unpack and run" path, then look for properly installed path, not including versioning.
|
* "unpack and run" path, then look for properly installed path, including versioning.
|
||||||
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8* getSystemDir() const = 0;
|
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which user configuration is stored, not including versioning.
|
* Determine the base dir in which user configuration is stored, including versioning.
|
||||||
* If needed, it will create the base directory.
|
* If needed, it will create the base directory.
|
||||||
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
|
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8* getUserDir() const = 0;
|
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the directory of the current binary
|
* Determine the directory of the current binary
|
||||||
* @return Unsigned char string pointing to the binary dir
|
* @return Unsigned char string pointing to the binary dir
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8* getBinaryDir() const = 0;
|
virtual const GHOST_TUns8 *getBinaryDir() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the file to the operating system most recently used files
|
* Add the file to the operating system most recently used files
|
||||||
*/
|
*/
|
||||||
virtual void addToSystemRecentFiles(const char* filename) const = 0;
|
virtual void addToSystemRecentFiles(const char *filename) const = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The one and only system paths*/
|
/** The one and only system paths*/
|
||||||
static GHOST_ISystemPaths* m_systemPaths;
|
static GHOST_ISystemPaths *m_systemPaths;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -86,8 +86,12 @@ public:
|
|||||||
|
|
||||||
#ifdef WITH_CXX_GUARDEDALLOC
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
public:
|
public:
|
||||||
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_ITimerTask"); }
|
void *operator new(size_t num_bytes) {
|
||||||
void operator delete( void *mem ) { MEM_freeN(mem); }
|
return MEM_mallocN(num_bytes, "GHOST:GHOST_ITimerTask");
|
||||||
|
}
|
||||||
|
void operator delete(void *mem) {
|
||||||
|
MEM_freeN(mem);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
* Returns the associated OS object/handle
|
* Returns the associated OS object/handle
|
||||||
* @return The associated OS object/handle
|
* @return The associated OS object/handle
|
||||||
*/
|
*/
|
||||||
virtual void* getOSWindow() const = 0;
|
virtual void *getOSWindow() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type of drawing context used in this window.
|
* Returns the type of drawing context used in this window.
|
||||||
@@ -232,7 +232,7 @@ public:
|
|||||||
* Returns the tablet data (pressure etc).
|
* Returns the tablet data (pressure etc).
|
||||||
* @return The tablet data (pressure etc).
|
* @return The tablet data (pressure etc).
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TabletData* GetTabletData() = 0;
|
virtual const GHOST_TabletData *GetTabletData() = 0;
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Progress bar functionality
|
** Progress bar functionality
|
||||||
|
|||||||
@@ -55,28 +55,28 @@ extern GHOST_TSuccess GHOST_DisposeSystemPaths(void);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which shared resources are located. It will first try to use
|
* Determine the base dir in which shared resources are located. It will first try to use
|
||||||
* "unpack and run" path, then look for properly installed path, not including versioning.
|
* "unpack and run" path, then look for properly installed path, including versioning.
|
||||||
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
||||||
*/
|
*/
|
||||||
extern const GHOST_TUns8* GHOST_getSystemDir(void);
|
extern const GHOST_TUns8 *GHOST_getSystemDir(int version, const char *versionstr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which user configuration is stored, not including versioning.
|
* Determine the base dir in which user configuration is stored, including versioning.
|
||||||
* @return Unsigned char string pointing to user dir (eg ~).
|
* @return Unsigned char string pointing to user dir (eg ~).
|
||||||
*/
|
*/
|
||||||
extern const GHOST_TUns8* GHOST_getUserDir(void);
|
extern const GHOST_TUns8 *GHOST_getUserDir(int version, const char *versionstr);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the dir in which the binary file is found.
|
* Determine the dir in which the binary file is found.
|
||||||
* @return Unsigned char string pointing to binary dir (eg ~/usr/local/bin/).
|
* @return Unsigned char string pointing to binary dir (eg ~/usr/local/bin/).
|
||||||
*/
|
*/
|
||||||
extern const GHOST_TUns8* GHOST_getBinaryDir(void);
|
extern const GHOST_TUns8 *GHOST_getBinaryDir(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the file to the operating system most recently used files
|
* Add the file to the operating system most recently used files
|
||||||
*/
|
*/
|
||||||
extern void GHOST_addToSystemRecentFiles(const char* filename);
|
extern void GHOST_addToSystemRecentFiles(const char *filename);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,20 +55,23 @@ public:
|
|||||||
* @param r requested right coordinate of the rectangle
|
* @param r requested right coordinate of the rectangle
|
||||||
* @param b requested bottom coordinate of the rectangle
|
* @param b requested bottom coordinate of the rectangle
|
||||||
*/
|
*/
|
||||||
GHOST_Rect(GHOST_TInt32 l=0, GHOST_TInt32 t=0, GHOST_TInt32 r=0, GHOST_TInt32 b=0)
|
GHOST_Rect(GHOST_TInt32 l = 0, GHOST_TInt32 t = 0, GHOST_TInt32 r = 0, GHOST_TInt32 b = 0)
|
||||||
: m_l(l), m_t(t), m_r(r), m_b(b) {}
|
: m_l(l), m_t(t), m_r(r), m_b(b)
|
||||||
|
{}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy constructor.
|
* Copy constructor.
|
||||||
* @param r rectangle to copy
|
* @param r rectangle to copy
|
||||||
*/
|
*/
|
||||||
GHOST_Rect(const GHOST_Rect& r)
|
GHOST_Rect(const GHOST_Rect& r)
|
||||||
: m_l(r.m_l), m_t(r.m_t), m_r(r.m_r), m_b(r.m_b) {}
|
: m_l(r.m_l), m_t(r.m_t), m_r(r.m_r), m_b(r.m_b)
|
||||||
|
{}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
virtual ~GHOST_Rect() {};
|
virtual ~GHOST_Rect()
|
||||||
|
{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access to rectangle width.
|
* Access to rectangle width.
|
||||||
@@ -237,18 +240,18 @@ inline void GHOST_Rect::unionPoint(GHOST_TInt32 x, GHOST_TInt32 y)
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
inline void GHOST_Rect::wrapPoint(GHOST_TInt32 &x, GHOST_TInt32 &y, GHOST_TInt32 ofs)
|
inline void GHOST_Rect::wrapPoint(GHOST_TInt32 &x, GHOST_TInt32 &y, GHOST_TInt32 ofs)
|
||||||
{
|
{
|
||||||
GHOST_TInt32 w= getWidth();
|
GHOST_TInt32 w = getWidth();
|
||||||
GHOST_TInt32 h= getHeight();
|
GHOST_TInt32 h = getHeight();
|
||||||
|
|
||||||
/* highly unlikely but avoid eternal loop */
|
/* highly unlikely but avoid eternal loop */
|
||||||
if (w-ofs*2 <= 0 || h-ofs*2 <= 0) {
|
if (w - ofs * 2 <= 0 || h - ofs * 2 <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(x-ofs < m_l) x+= w-(ofs*2);
|
while (x - ofs < m_l) x += w - (ofs * 2);
|
||||||
while(y-ofs < m_t) y+= h-(ofs*2);
|
while (y - ofs < m_t) y += h - (ofs * 2);
|
||||||
while(x+ofs > m_r) x-= w-(ofs*2);
|
while (x + ofs > m_r) x -= w - (ofs * 2);
|
||||||
while(y+ofs > m_b) y-= h-(ofs*2);
|
while (y + ofs > m_b) y -= h - (ofs * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool GHOST_Rect::isInside(GHOST_TInt32 x, GHOST_TInt32 y) const
|
inline bool GHOST_Rect::isInside(GHOST_TInt32 x, GHOST_TInt32 y) const
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ typedef long long GHOST_TInt64;
|
|||||||
typedef unsigned long long GHOST_TUns64;
|
typedef unsigned long long GHOST_TUns64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef void* GHOST_TUserDataPtr;
|
typedef void *GHOST_TUserDataPtr;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@@ -290,7 +290,7 @@ typedef enum {
|
|||||||
GHOST_kKeyLeftAlt,
|
GHOST_kKeyLeftAlt,
|
||||||
GHOST_kKeyRightAlt,
|
GHOST_kKeyRightAlt,
|
||||||
GHOST_kKeyOS, // Command key on Apple, Windows key(s) on Windows
|
GHOST_kKeyOS, // Command key on Apple, Windows key(s) on Windows
|
||||||
GHOST_kKeyGrLess , // German PC only!
|
GHOST_kKeyGrLess, // German PC only!
|
||||||
|
|
||||||
GHOST_kKeyCapsLock,
|
GHOST_kKeyCapsLock,
|
||||||
GHOST_kKeyNumLock,
|
GHOST_kKeyNumLock,
|
||||||
@@ -369,7 +369,7 @@ typedef enum {
|
|||||||
GHOST_kGrabHide, /* hide the mouse while grabbing and restore the original location on release (numbuts) */
|
GHOST_kGrabHide, /* hide the mouse while grabbing and restore the original location on release (numbuts) */
|
||||||
} GHOST_TGrabCursorMode;
|
} GHOST_TGrabCursorMode;
|
||||||
|
|
||||||
typedef void* GHOST_TEventDataPtr;
|
typedef void *GHOST_TEventDataPtr;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** The x-coordinate of the cursor position. */
|
/** The x-coordinate of the cursor position. */
|
||||||
@@ -389,7 +389,7 @@ typedef struct {
|
|||||||
} GHOST_TEventWheelData;
|
} GHOST_TEventWheelData;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GHOST_kTrackpadEventUnknown =0,
|
GHOST_kTrackpadEventUnknown = 0,
|
||||||
GHOST_kTrackpadEventScroll,
|
GHOST_kTrackpadEventScroll,
|
||||||
GHOST_kTrackpadEventRotate,
|
GHOST_kTrackpadEventRotate,
|
||||||
GHOST_kTrackpadEventSwipe, /* Reserved, not used for now */
|
GHOST_kTrackpadEventSwipe, /* Reserved, not used for now */
|
||||||
@@ -412,7 +412,7 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GHOST_kDragnDropTypeUnknown =0,
|
GHOST_kDragnDropTypeUnknown = 0,
|
||||||
GHOST_kDragnDropTypeFilenames, /*Array of strings representing file names (full path) */
|
GHOST_kDragnDropTypeFilenames, /*Array of strings representing file names (full path) */
|
||||||
GHOST_kDragnDropTypeString, /* Unformatted text UTF-8 string */
|
GHOST_kDragnDropTypeString, /* Unformatted text UTF-8 string */
|
||||||
GHOST_kDragnDropTypeBitmap /*Bitmap image data */
|
GHOST_kDragnDropTypeBitmap /*Bitmap image data */
|
||||||
@@ -440,7 +440,7 @@ typedef enum {
|
|||||||
GHOST_kInProgress,
|
GHOST_kInProgress,
|
||||||
GHOST_kFinishing,
|
GHOST_kFinishing,
|
||||||
GHOST_kFinished
|
GHOST_kFinished
|
||||||
} GHOST_TProgress;
|
} GHOST_TProgress;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** N-degree of freedom device data v3 [GSoC 2010] */
|
/** N-degree of freedom device data v3 [GSoC 2010] */
|
||||||
@@ -455,7 +455,7 @@ typedef struct {
|
|||||||
} GHOST_TEventNDOFMotionData;
|
} GHOST_TEventNDOFMotionData;
|
||||||
|
|
||||||
typedef enum { GHOST_kPress, GHOST_kRelease } GHOST_TButtonAction;
|
typedef enum { GHOST_kPress, GHOST_kRelease } GHOST_TButtonAction;
|
||||||
// good for mouse or other buttons too, hmmm?
|
// good for mouse or other buttons too, hmmm?
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GHOST_TButtonAction action;
|
GHOST_TButtonAction action;
|
||||||
@@ -509,10 +509,10 @@ typedef int GHOST_TEmbedderWindowID;
|
|||||||
*/
|
*/
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
class GHOST_ITimerTask;
|
class GHOST_ITimerTask;
|
||||||
typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask* task, GHOST_TUns64 time);
|
typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask *task, GHOST_TUns64 time);
|
||||||
#else
|
#else
|
||||||
struct GHOST_TimerTaskHandle__;
|
struct GHOST_TimerTaskHandle__;
|
||||||
typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__* task, GHOST_TUns64 time);
|
typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, GHOST_TUns64 time);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __GHOST_TYPES_H__
|
#endif // __GHOST_TYPES_H__
|
||||||
|
|||||||
@@ -75,4 +75,5 @@ void GHOST_Buttons::clear()
|
|||||||
m_ButtonRight = false;
|
m_ButtonRight = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_Buttons::~GHOST_Buttons() {}
|
GHOST_Buttons::~GHOST_Buttons() {
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
GHOST_SystemHandle GHOST_CreateSystem(void)
|
GHOST_SystemHandle GHOST_CreateSystem(void)
|
||||||
{
|
{
|
||||||
GHOST_ISystem::createSystem();
|
GHOST_ISystem::createSystem();
|
||||||
GHOST_ISystem* system = GHOST_ISystem::getSystem();
|
GHOST_ISystem *system = GHOST_ISystem::getSystem();
|
||||||
|
|
||||||
return (GHOST_SystemHandle)system;
|
return (GHOST_SystemHandle)system;
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ GHOST_SystemHandle GHOST_CreateSystem(void)
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
|
GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
|
|
||||||
return system->disposeSystem();
|
return system->disposeSystem();
|
||||||
}
|
}
|
||||||
@@ -68,20 +68,20 @@ GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
|
|||||||
GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback,
|
GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback,
|
||||||
GHOST_TUserDataPtr userdata)
|
GHOST_TUserDataPtr userdata)
|
||||||
{
|
{
|
||||||
return (GHOST_EventConsumerHandle) new GHOST_CallbackEventConsumer (eventCallback, userdata);
|
return (GHOST_EventConsumerHandle) new GHOST_CallbackEventConsumer(eventCallback, userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhandle)
|
GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhandle)
|
||||||
{
|
{
|
||||||
delete ((GHOST_CallbackEventConsumer*)consumerhandle);
|
delete ((GHOST_CallbackEventConsumer *)consumerhandle);
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
|
GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
|
|
||||||
return system->getMilliSeconds();
|
return system->getMilliSeconds();
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
|
|||||||
GHOST_TimerProcPtr timerproc,
|
GHOST_TimerProcPtr timerproc,
|
||||||
GHOST_TUserDataPtr userdata)
|
GHOST_TUserDataPtr userdata)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
|
|
||||||
return (GHOST_TimerTaskHandle) system->installTimer(delay, interval, timerproc, userdata);
|
return (GHOST_TimerTaskHandle) system->installTimer(delay, interval, timerproc, userdata);
|
||||||
}
|
}
|
||||||
@@ -104,8 +104,8 @@ GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
|
|||||||
GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
|
GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TimerTaskHandle timertaskhandle)
|
GHOST_TimerTaskHandle timertaskhandle)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
|
GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle;
|
||||||
|
|
||||||
return system->removeTimer(timertask);
|
return system->removeTimer(timertask);
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
|
|||||||
|
|
||||||
GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
|
GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
|
|
||||||
return system->getNumDisplays();
|
return system->getNumDisplays();
|
||||||
}
|
}
|
||||||
@@ -122,10 +122,10 @@ GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
|
|||||||
|
|
||||||
|
|
||||||
void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
|
void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TUns32* width,
|
GHOST_TUns32 *width,
|
||||||
GHOST_TUns32* height)
|
GHOST_TUns32 *height)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
|
|
||||||
system->getMainDisplayDimensions(*width, *height);
|
system->getMainDisplayDimensions(*width, *height);
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
|
|||||||
|
|
||||||
|
|
||||||
GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
||||||
const char* title,
|
const char *title,
|
||||||
GHOST_TInt32 left,
|
GHOST_TInt32 left,
|
||||||
GHOST_TInt32 top,
|
GHOST_TInt32 top,
|
||||||
GHOST_TUns32 width,
|
GHOST_TUns32 width,
|
||||||
@@ -143,10 +143,10 @@ GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
|||||||
const int stereoVisual,
|
const int stereoVisual,
|
||||||
const GHOST_TUns16 numOfAASamples)
|
const GHOST_TUns16 numOfAASamples)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
bool bstereoVisual;
|
bool bstereoVisual;
|
||||||
|
|
||||||
if(stereoVisual)
|
if (stereoVisual)
|
||||||
bstereoVisual = true;
|
bstereoVisual = true;
|
||||||
else
|
else
|
||||||
bstereoVisual = false;
|
bstereoVisual = false;
|
||||||
@@ -157,13 +157,13 @@ GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
|||||||
|
|
||||||
GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle)
|
GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->getUserData();
|
return window->getUserData();
|
||||||
}
|
}
|
||||||
void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr userdata)
|
void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr userdata)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
window->setUserData(userdata);
|
window->setUserData(userdata);
|
||||||
}
|
}
|
||||||
@@ -171,8 +171,8 @@ void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr
|
|||||||
GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
|
GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_WindowHandle windowhandle)
|
GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return system->disposeWindow(window);
|
return system->disposeWindow(window);
|
||||||
}
|
}
|
||||||
@@ -182,8 +182,8 @@ GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
|
|||||||
int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
|
int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_WindowHandle windowhandle)
|
GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return (int) system->validWindow(window);
|
return (int) system->validWindow(window);
|
||||||
}
|
}
|
||||||
@@ -191,14 +191,14 @@ int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
|
|||||||
|
|
||||||
|
|
||||||
GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
|
GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_DisplaySetting* setting,
|
GHOST_DisplaySetting *setting,
|
||||||
const int stereoVisual)
|
const int stereoVisual)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
GHOST_IWindow* window = NULL;
|
GHOST_IWindow *window = NULL;
|
||||||
bool bstereoVisual;
|
bool bstereoVisual;
|
||||||
|
|
||||||
if(stereoVisual)
|
if (stereoVisual)
|
||||||
bstereoVisual = true;
|
bstereoVisual = true;
|
||||||
else
|
else
|
||||||
bstereoVisual = false;
|
bstereoVisual = false;
|
||||||
@@ -212,7 +212,7 @@ GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_EndFullScreen(GHOST_SystemHandle systemhandle)
|
GHOST_TSuccess GHOST_EndFullScreen(GHOST_SystemHandle systemhandle)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
|
|
||||||
return system->endFullScreen();
|
return system->endFullScreen();
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ GHOST_TSuccess GHOST_EndFullScreen(GHOST_SystemHandle systemhandle)
|
|||||||
|
|
||||||
int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle)
|
int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
|
|
||||||
return (int) system->getFullScreen();
|
return (int) system->getFullScreen();
|
||||||
}
|
}
|
||||||
@@ -230,16 +230,16 @@ int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle)
|
|||||||
|
|
||||||
int GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, int waitForEvent)
|
int GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, int waitForEvent)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
|
|
||||||
return (int) system->processEvents(waitForEvent?true:false);
|
return (int) system->processEvents(waitForEvent ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int GHOST_DispatchEvents(GHOST_SystemHandle systemhandle)
|
int GHOST_DispatchEvents(GHOST_SystemHandle systemhandle)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
|
|
||||||
return (int) system->dispatchEvents();
|
return (int) system->dispatchEvents();
|
||||||
}
|
}
|
||||||
@@ -247,28 +247,28 @@ int GHOST_DispatchEvents(GHOST_SystemHandle systemhandle)
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle)
|
GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
|
|
||||||
return system->addEventConsumer((GHOST_CallbackEventConsumer*)consumerhandle);
|
return system->addEventConsumer((GHOST_CallbackEventConsumer *)consumerhandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle)
|
GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
|
|
||||||
return system->removeEventConsumer((GHOST_CallbackEventConsumer*)consumerhandle);
|
return system->removeEventConsumer((GHOST_CallbackEventConsumer *)consumerhandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle,float progress)
|
GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle, float progress)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->setProgressBar(progress);
|
return window->setProgressBar(progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle)
|
GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->endProgressBar();
|
return window->endProgressBar();
|
||||||
}
|
}
|
||||||
@@ -276,7 +276,7 @@ GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle)
|
|||||||
|
|
||||||
GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandle)
|
GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->getCursorShape();
|
return window->getCursorShape();
|
||||||
}
|
}
|
||||||
@@ -286,7 +286,7 @@ GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandle)
|
|||||||
GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
|
GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TStandardCursor cursorshape)
|
GHOST_TStandardCursor cursorshape)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->setCursorShape(cursorshape);
|
return window->setCursorShape(cursorshape);
|
||||||
}
|
}
|
||||||
@@ -297,7 +297,7 @@ GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
|
|||||||
int hotX,
|
int hotX,
|
||||||
int hotY)
|
int hotY)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->setCustomCursorShape(bitmap, mask, hotX, hotY);
|
return window->setCustomCursorShape(bitmap, mask, hotX, hotY);
|
||||||
}
|
}
|
||||||
@@ -312,7 +312,7 @@ GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
|
|||||||
int fg_color,
|
int fg_color,
|
||||||
int bg_color)
|
int bg_color)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->setCustomCursorShape(bitmap, mask, sizex, sizey,
|
return window->setCustomCursorShape(bitmap, mask, sizex, sizey,
|
||||||
hotX, hotY, fg_color, bg_color);
|
hotX, hotY, fg_color, bg_color);
|
||||||
@@ -322,7 +322,7 @@ GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
|
|||||||
|
|
||||||
int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
|
int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return (int) window->getCursorVisibility();
|
return (int) window->getCursorVisibility();
|
||||||
}
|
}
|
||||||
@@ -332,18 +332,18 @@ int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
|
|||||||
GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle,
|
GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle,
|
||||||
int visible)
|
int visible)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->setCursorVisibility(visible?true:false);
|
return window->setCursorVisibility(visible ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
|
GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TInt32* x,
|
GHOST_TInt32 *x,
|
||||||
GHOST_TInt32* y)
|
GHOST_TInt32 *y)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
|
|
||||||
return system->getCursorPosition(*x, *y);
|
return system->getCursorPosition(*x, *y);
|
||||||
}
|
}
|
||||||
@@ -354,7 +354,7 @@ GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
|
|||||||
GHOST_TInt32 x,
|
GHOST_TInt32 x,
|
||||||
GHOST_TInt32 y)
|
GHOST_TInt32 y)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
|
|
||||||
return system->setCursorPosition(x, y);
|
return system->setCursorPosition(x, y);
|
||||||
}
|
}
|
||||||
@@ -364,10 +364,10 @@ GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
|
|||||||
GHOST_TGrabCursorMode mode,
|
GHOST_TGrabCursorMode mode,
|
||||||
int *bounds)
|
int *bounds)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
GHOST_Rect bounds_rect, bounds_win;
|
GHOST_Rect bounds_rect, bounds_win;
|
||||||
|
|
||||||
if(bounds) {
|
if (bounds) {
|
||||||
/* if this is X11 specific we need a function that converts */
|
/* if this is X11 specific we need a function that converts */
|
||||||
window->getClientBounds(bounds_win);
|
window->getClientBounds(bounds_win);
|
||||||
window->clientToScreen(bounds[0], bounds_win.getHeight() - bounds[1], bounds_rect.m_l, bounds_rect.m_t);
|
window->clientToScreen(bounds[0], bounds_win.getHeight() - bounds[1], bounds_rect.m_l, bounds_rect.m_t);
|
||||||
@@ -375,17 +375,17 @@ GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return window->setCursorGrab(mode, bounds ? &bounds_rect:NULL);
|
return window->setCursorGrab(mode, bounds ? &bounds_rect : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
|
GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TModifierKeyMask mask,
|
GHOST_TModifierKeyMask mask,
|
||||||
int* isDown)
|
int *isDown)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
GHOST_TSuccess result;
|
GHOST_TSuccess result;
|
||||||
bool isdown= false;
|
bool isdown = false;
|
||||||
|
|
||||||
result = system->getModifierKeyState(mask, isdown);
|
result = system->getModifierKeyState(mask, isdown);
|
||||||
*isDown = (int) isdown;
|
*isDown = (int) isdown;
|
||||||
@@ -397,11 +397,11 @@ GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
|
GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TButtonMask mask,
|
GHOST_TButtonMask mask,
|
||||||
int* isDown)
|
int *isDown)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
|
||||||
GHOST_TSuccess result;
|
GHOST_TSuccess result;
|
||||||
bool isdown= false;
|
bool isdown = false;
|
||||||
|
|
||||||
result = system->getButtonState(mask, isdown);
|
result = system->getButtonState(mask, isdown);
|
||||||
*isDown = (int) isdown;
|
*isDown = (int) isdown;
|
||||||
@@ -412,7 +412,7 @@ GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
|
|||||||
|
|
||||||
void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept)
|
void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
window->setAcceptDragOperation(canAccept);
|
window->setAcceptDragOperation(canAccept);
|
||||||
}
|
}
|
||||||
@@ -420,7 +420,7 @@ void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 c
|
|||||||
|
|
||||||
GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
|
GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
|
||||||
{
|
{
|
||||||
GHOST_IEvent* event = (GHOST_IEvent*) eventhandle;
|
GHOST_IEvent *event = (GHOST_IEvent *) eventhandle;
|
||||||
|
|
||||||
return event->getType();
|
return event->getType();
|
||||||
}
|
}
|
||||||
@@ -429,7 +429,7 @@ GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
|
|||||||
|
|
||||||
GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle)
|
GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle)
|
||||||
{
|
{
|
||||||
GHOST_IEvent* event = (GHOST_IEvent*) eventhandle;
|
GHOST_IEvent *event = (GHOST_IEvent *) eventhandle;
|
||||||
|
|
||||||
return event->getTime();
|
return event->getTime();
|
||||||
}
|
}
|
||||||
@@ -437,7 +437,7 @@ GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle)
|
|||||||
|
|
||||||
GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle)
|
GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle)
|
||||||
{
|
{
|
||||||
GHOST_IEvent* event = (GHOST_IEvent*) eventhandle;
|
GHOST_IEvent *event = (GHOST_IEvent *) eventhandle;
|
||||||
|
|
||||||
return (GHOST_WindowHandle) event->getWindow();
|
return (GHOST_WindowHandle) event->getWindow();
|
||||||
}
|
}
|
||||||
@@ -445,7 +445,7 @@ GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle)
|
|||||||
|
|
||||||
GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle)
|
GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle)
|
||||||
{
|
{
|
||||||
GHOST_IEvent* event = (GHOST_IEvent*) eventhandle;
|
GHOST_IEvent *event = (GHOST_IEvent *) eventhandle;
|
||||||
|
|
||||||
return event->getData();
|
return event->getData();
|
||||||
}
|
}
|
||||||
@@ -454,7 +454,7 @@ GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle)
|
|||||||
|
|
||||||
GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle)
|
GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle)
|
||||||
{
|
{
|
||||||
GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
|
GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle;
|
||||||
|
|
||||||
return timertask->getTimerProc();
|
return timertask->getTimerProc();
|
||||||
}
|
}
|
||||||
@@ -464,7 +464,7 @@ GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle)
|
|||||||
void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
|
void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
|
||||||
GHOST_TimerProcPtr timerproc)
|
GHOST_TimerProcPtr timerproc)
|
||||||
{
|
{
|
||||||
GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
|
GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle;
|
||||||
|
|
||||||
timertask->setTimerProc(timerproc);
|
timertask->setTimerProc(timerproc);
|
||||||
}
|
}
|
||||||
@@ -473,7 +473,7 @@ void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
|
|||||||
|
|
||||||
GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle)
|
GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle)
|
||||||
{
|
{
|
||||||
GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
|
GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle;
|
||||||
|
|
||||||
return timertask->getUserData();
|
return timertask->getUserData();
|
||||||
}
|
}
|
||||||
@@ -483,7 +483,7 @@ GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhan
|
|||||||
void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
|
void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
|
||||||
GHOST_TUserDataPtr userdata)
|
GHOST_TUserDataPtr userdata)
|
||||||
{
|
{
|
||||||
GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
|
GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle;
|
||||||
|
|
||||||
timertask->setUserData(userdata);
|
timertask->setUserData(userdata);
|
||||||
}
|
}
|
||||||
@@ -492,7 +492,7 @@ void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
|
|||||||
|
|
||||||
int GHOST_GetValid(GHOST_WindowHandle windowhandle)
|
int GHOST_GetValid(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return (int) window->getValid();
|
return (int) window->getValid();
|
||||||
}
|
}
|
||||||
@@ -501,7 +501,7 @@ int GHOST_GetValid(GHOST_WindowHandle windowhandle)
|
|||||||
|
|
||||||
GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle windowhandle)
|
GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->getDrawingContextType();
|
return window->getDrawingContextType();
|
||||||
}
|
}
|
||||||
@@ -511,7 +511,7 @@ GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle windowh
|
|||||||
GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle,
|
GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TDrawingContextType type)
|
GHOST_TDrawingContextType type)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->setDrawingContextType(type);
|
return window->setDrawingContextType(type);
|
||||||
}
|
}
|
||||||
@@ -519,22 +519,22 @@ GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle,
|
|||||||
|
|
||||||
|
|
||||||
void GHOST_SetTitle(GHOST_WindowHandle windowhandle,
|
void GHOST_SetTitle(GHOST_WindowHandle windowhandle,
|
||||||
const char* title)
|
const char *title)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
window->setTitle(title);
|
window->setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* GHOST_GetTitle(GHOST_WindowHandle windowhandle)
|
char *GHOST_GetTitle(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
STR_String title;
|
STR_String title;
|
||||||
|
|
||||||
window->getTitle(title);
|
window->getTitle(title);
|
||||||
|
|
||||||
char *ctitle = (char*) malloc(title.Length() + 1);
|
char *ctitle = (char *) malloc(title.Length() + 1);
|
||||||
|
|
||||||
if (ctitle == NULL) return NULL;
|
if (ctitle == NULL) return NULL;
|
||||||
strcpy(ctitle, title.Ptr());
|
strcpy(ctitle, title.Ptr());
|
||||||
@@ -546,8 +546,8 @@ char* GHOST_GetTitle(GHOST_WindowHandle windowhandle)
|
|||||||
|
|
||||||
GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle)
|
GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
GHOST_Rect* rectangle = NULL;
|
GHOST_Rect *rectangle = NULL;
|
||||||
|
|
||||||
rectangle = new GHOST_Rect();
|
rectangle = new GHOST_Rect();
|
||||||
window->getWindowBounds(*rectangle);
|
window->getWindowBounds(*rectangle);
|
||||||
@@ -559,8 +559,8 @@ GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle)
|
|||||||
|
|
||||||
GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle)
|
GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
GHOST_Rect* rectangle = NULL;
|
GHOST_Rect *rectangle = NULL;
|
||||||
|
|
||||||
rectangle = new GHOST_Rect();
|
rectangle = new GHOST_Rect();
|
||||||
window->getClientBounds(*rectangle);
|
window->getClientBounds(*rectangle);
|
||||||
@@ -572,7 +572,7 @@ GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle)
|
|||||||
|
|
||||||
void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle)
|
void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle)
|
||||||
{
|
{
|
||||||
delete (GHOST_Rect*) rectanglehandle;
|
delete (GHOST_Rect *) rectanglehandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -580,7 +580,7 @@ void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle)
|
|||||||
GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle,
|
GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TUns32 width)
|
GHOST_TUns32 width)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->setClientWidth(width);
|
return window->setClientWidth(width);
|
||||||
}
|
}
|
||||||
@@ -590,7 +590,7 @@ GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle,
|
|||||||
GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle,
|
GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TUns32 height)
|
GHOST_TUns32 height)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->setClientHeight(height);
|
return window->setClientHeight(height);
|
||||||
}
|
}
|
||||||
@@ -601,7 +601,7 @@ GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
|
|||||||
GHOST_TUns32 width,
|
GHOST_TUns32 width,
|
||||||
GHOST_TUns32 height)
|
GHOST_TUns32 height)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->setClientSize(width, height);
|
return window->setClientSize(width, height);
|
||||||
}
|
}
|
||||||
@@ -611,10 +611,10 @@ GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
|
|||||||
void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
|
void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TInt32 inX,
|
GHOST_TInt32 inX,
|
||||||
GHOST_TInt32 inY,
|
GHOST_TInt32 inY,
|
||||||
GHOST_TInt32* outX,
|
GHOST_TInt32 *outX,
|
||||||
GHOST_TInt32* outY)
|
GHOST_TInt32 *outY)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
window->screenToClient(inX, inY, *outX, *outY);
|
window->screenToClient(inX, inY, *outX, *outY);
|
||||||
}
|
}
|
||||||
@@ -624,10 +624,10 @@ void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
|
|||||||
void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
|
void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TInt32 inX,
|
GHOST_TInt32 inX,
|
||||||
GHOST_TInt32 inY,
|
GHOST_TInt32 inY,
|
||||||
GHOST_TInt32* outX,
|
GHOST_TInt32 *outX,
|
||||||
GHOST_TInt32* outY)
|
GHOST_TInt32 *outY)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
window->clientToScreen(inX, inY, *outX, *outY);
|
window->clientToScreen(inX, inY, *outX, *outY);
|
||||||
}
|
}
|
||||||
@@ -636,7 +636,7 @@ void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
|
|||||||
|
|
||||||
GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle)
|
GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->getState();
|
return window->getState();
|
||||||
}
|
}
|
||||||
@@ -646,7 +646,7 @@ GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle)
|
|||||||
GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
|
GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TWindowState state)
|
GHOST_TWindowState state)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->setState(state);
|
return window->setState(state);
|
||||||
}
|
}
|
||||||
@@ -654,7 +654,7 @@ GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, GHOST_TUns8 isUnsavedChanges)
|
GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, GHOST_TUns8 isUnsavedChanges)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->setModifiedState(isUnsavedChanges);
|
return window->setModifiedState(isUnsavedChanges);
|
||||||
}
|
}
|
||||||
@@ -663,7 +663,7 @@ GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, GHO
|
|||||||
GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle,
|
GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TWindowOrder order)
|
GHOST_TWindowOrder order)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->setOrder(order);
|
return window->setOrder(order);
|
||||||
}
|
}
|
||||||
@@ -672,7 +672,7 @@ GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle,
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle)
|
GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->swapBuffers();
|
return window->swapBuffers();
|
||||||
}
|
}
|
||||||
@@ -681,7 +681,7 @@ GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle)
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle)
|
GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->activateDrawingContext();
|
return window->activateDrawingContext();
|
||||||
}
|
}
|
||||||
@@ -690,44 +690,44 @@ GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandl
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle)
|
GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
|
||||||
|
|
||||||
return window->invalidate();
|
return window->invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern const GHOST_TabletData* GHOST_GetTabletData(GHOST_WindowHandle windowhandle)
|
extern const GHOST_TabletData *GHOST_GetTabletData(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
return ((GHOST_IWindow*)windowhandle)->GetTabletData();
|
return ((GHOST_IWindow *)windowhandle)->GetTabletData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
|
GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
|
||||||
{
|
{
|
||||||
return ((GHOST_Rect*)rectanglehandle)->getWidth();
|
return ((GHOST_Rect *)rectanglehandle)->getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
|
GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
|
||||||
{
|
{
|
||||||
return ((GHOST_Rect*)rectanglehandle)->getHeight();
|
return ((GHOST_Rect *)rectanglehandle)->getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
|
void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
|
||||||
GHOST_TInt32* l,
|
GHOST_TInt32 *l,
|
||||||
GHOST_TInt32* t,
|
GHOST_TInt32 *t,
|
||||||
GHOST_TInt32* r,
|
GHOST_TInt32 *r,
|
||||||
GHOST_TInt32* b)
|
GHOST_TInt32 *b)
|
||||||
{
|
{
|
||||||
GHOST_Rect *rect= (GHOST_Rect*) rectanglehandle;
|
GHOST_Rect *rect = (GHOST_Rect *) rectanglehandle;
|
||||||
|
|
||||||
*l= rect->m_l;
|
*l = rect->m_l;
|
||||||
*t= rect->m_t;
|
*t = rect->m_t;
|
||||||
*r= rect->m_r;
|
*r = rect->m_r;
|
||||||
*b= rect->m_b;
|
*b = rect->m_b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -737,7 +737,7 @@ void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
GHOST_TInt32 r,
|
GHOST_TInt32 r,
|
||||||
GHOST_TInt32 b)
|
GHOST_TInt32 b)
|
||||||
{
|
{
|
||||||
((GHOST_Rect*)rectanglehandle)->set(l, t, r, b);
|
((GHOST_Rect *)rectanglehandle)->set(l, t, r, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -746,7 +746,7 @@ GHOST_TSuccess GHOST_IsEmptyRectangle(GHOST_RectangleHandle rectanglehandle)
|
|||||||
{
|
{
|
||||||
GHOST_TSuccess result = GHOST_kFailure;
|
GHOST_TSuccess result = GHOST_kFailure;
|
||||||
|
|
||||||
if (((GHOST_Rect*)rectanglehandle)->isEmpty())
|
if (((GHOST_Rect *)rectanglehandle)->isEmpty())
|
||||||
result = GHOST_kSuccess;
|
result = GHOST_kSuccess;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -758,7 +758,7 @@ GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle)
|
|||||||
{
|
{
|
||||||
GHOST_TSuccess result = GHOST_kFailure;
|
GHOST_TSuccess result = GHOST_kFailure;
|
||||||
|
|
||||||
if(((GHOST_Rect*)rectanglehandle)->isValid())
|
if (((GHOST_Rect *)rectanglehandle)->isValid())
|
||||||
result = GHOST_kSuccess;
|
result = GHOST_kSuccess;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -769,7 +769,7 @@ GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle)
|
|||||||
void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle,
|
void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle,
|
||||||
GHOST_TInt32 i)
|
GHOST_TInt32 i)
|
||||||
{
|
{
|
||||||
((GHOST_Rect*)rectanglehandle)->inset(i);
|
((GHOST_Rect *)rectanglehandle)->inset(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -777,7 +777,7 @@ void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
|
void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
|
||||||
GHOST_RectangleHandle anotherrectanglehandle)
|
GHOST_RectangleHandle anotherrectanglehandle)
|
||||||
{
|
{
|
||||||
((GHOST_Rect*)rectanglehandle)->unionRect(*(GHOST_Rect*)anotherrectanglehandle);
|
((GHOST_Rect *)rectanglehandle)->unionRect(*(GHOST_Rect *)anotherrectanglehandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -786,7 +786,7 @@ void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
GHOST_TInt32 x,
|
GHOST_TInt32 x,
|
||||||
GHOST_TInt32 y)
|
GHOST_TInt32 y)
|
||||||
{
|
{
|
||||||
((GHOST_Rect*)rectanglehandle)->unionPoint(x, y);
|
((GHOST_Rect *)rectanglehandle)->unionPoint(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -797,7 +797,7 @@ GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
{
|
{
|
||||||
GHOST_TSuccess result = GHOST_kFailure;
|
GHOST_TSuccess result = GHOST_kFailure;
|
||||||
|
|
||||||
if (((GHOST_Rect*)rectanglehandle)->isInside(x, y))
|
if (((GHOST_Rect *)rectanglehandle)->isInside(x, y))
|
||||||
result = GHOST_kSuccess;
|
result = GHOST_kSuccess;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -810,7 +810,7 @@ GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectangleha
|
|||||||
{
|
{
|
||||||
GHOST_TVisibility visible = GHOST_kNotVisible;
|
GHOST_TVisibility visible = GHOST_kNotVisible;
|
||||||
|
|
||||||
visible = ((GHOST_Rect*)rectanglehandle)->getVisibility(*(GHOST_Rect*)anotherrectanglehandle);
|
visible = ((GHOST_Rect *)rectanglehandle)->getVisibility(*(GHOST_Rect *)anotherrectanglehandle);
|
||||||
|
|
||||||
return visible;
|
return visible;
|
||||||
}
|
}
|
||||||
@@ -821,7 +821,7 @@ void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
GHOST_TInt32 cx,
|
GHOST_TInt32 cx,
|
||||||
GHOST_TInt32 cy)
|
GHOST_TInt32 cy)
|
||||||
{
|
{
|
||||||
((GHOST_Rect*)rectanglehandle)->setCenter(cx, cy);
|
((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -832,7 +832,7 @@ void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
|
|||||||
GHOST_TInt32 w,
|
GHOST_TInt32 w,
|
||||||
GHOST_TInt32 h)
|
GHOST_TInt32 h)
|
||||||
{
|
{
|
||||||
((GHOST_Rect*)rectanglehandle)->setCenter(cx, cy, w, h);
|
((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -842,32 +842,32 @@ GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
{
|
{
|
||||||
GHOST_TSuccess result = GHOST_kFailure;
|
GHOST_TSuccess result = GHOST_kFailure;
|
||||||
|
|
||||||
if (((GHOST_Rect*)rectanglehandle)->clip(*(GHOST_Rect*)anotherrectanglehandle))
|
if (((GHOST_Rect *)rectanglehandle)->clip(*(GHOST_Rect *)anotherrectanglehandle))
|
||||||
result = GHOST_kSuccess;
|
result = GHOST_kSuccess;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TUns8* GHOST_getClipboard(int selection)
|
GHOST_TUns8 *GHOST_getClipboard(int selection)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = GHOST_ISystem::getSystem();
|
GHOST_ISystem *system = GHOST_ISystem::getSystem();
|
||||||
return system->getClipboard(selection);
|
return system->getClipboard(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
|
void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = GHOST_ISystem::getSystem();
|
GHOST_ISystem *system = GHOST_ISystem::getSystem();
|
||||||
system->putClipboard(buffer, selection);
|
system->putClipboard(buffer, selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GHOST_toggleConsole(int action)
|
int GHOST_toggleConsole(int action)
|
||||||
{
|
{
|
||||||
GHOST_ISystem* system = GHOST_ISystem::getSystem();
|
GHOST_ISystem *system = GHOST_ISystem::getSystem();
|
||||||
return system->toggleConsole(action);
|
return system->toggleConsole(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int GHOST_confirmQuit(GHOST_WindowHandle windowhandle){
|
int GHOST_confirmQuit(GHOST_WindowHandle windowhandle){
|
||||||
GHOST_ISystem* system = GHOST_ISystem::getSystem();
|
GHOST_ISystem *system = GHOST_ISystem::getSystem();
|
||||||
return system->confirmQuit((GHOST_IWindow*) windowhandle);
|
return system->confirmQuit((GHOST_IWindow *) windowhandle);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ GHOST_CallbackEventConsumer::GHOST_CallbackEventConsumer(GHOST_EventCallbackProc
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GHOST_CallbackEventConsumer::processEvent(GHOST_IEvent* event)
|
bool GHOST_CallbackEventConsumer::processEvent(GHOST_IEvent *event)
|
||||||
{
|
{
|
||||||
return m_eventCallback((GHOST_EventHandle)event, m_userData) != 0;
|
return m_eventCallback((GHOST_EventHandle)event, m_userData) != 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public:
|
|||||||
* @param event The event that can be handled or ignored.
|
* @param event The event that can be handled or ignored.
|
||||||
* @return Indication as to whether the event was handled.
|
* @return Indication as to whether the event was handled.
|
||||||
*/
|
*/
|
||||||
virtual bool processEvent(GHOST_IEvent* event);
|
virtual bool processEvent(GHOST_IEvent *event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** The call-back routine invoked. */
|
/** The call-back routine invoked. */
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
GHOST_DisplayManager::GHOST_DisplayManager(
|
GHOST_DisplayManager::GHOST_DisplayManager(
|
||||||
void)
|
void)
|
||||||
: m_settingsInitialized(false)
|
: m_settingsInitialized(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ GHOST_DisplayManagerCarbon::GHOST_DisplayManagerCarbon(void)
|
|||||||
}
|
}
|
||||||
if (m_numDisplays > 0)
|
if (m_numDisplays > 0)
|
||||||
{
|
{
|
||||||
m_displayIDs = new CGDirectDisplayID [m_numDisplays];
|
m_displayIDs = new CGDirectDisplayID[m_numDisplays];
|
||||||
GHOST_ASSERT((m_displayIDs!=NULL), "GHOST_DisplayManagerCarbon::GHOST_DisplayManagerCarbon(): memory allocation failed");
|
GHOST_ASSERT((m_displayIDs != NULL), "GHOST_DisplayManagerCarbon::GHOST_DisplayManagerCarbon(): memory allocation failed");
|
||||||
::CGGetActiveDisplayList(m_numDisplays, m_displayIDs, &m_numDisplays);
|
::CGGetActiveDisplayList(m_numDisplays, m_displayIDs, &m_numDisplays);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ GHOST_TSuccess GHOST_DisplayManagerCarbon::getNumDisplays(GHOST_TUns8& numDispla
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerCarbon::getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32& numSettings) const
|
GHOST_TSuccess GHOST_DisplayManagerCarbon::getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32& numSettings) const
|
||||||
{
|
{
|
||||||
GHOST_ASSERT((display==kMainDisplay), "GHOST_DisplayManagerCarbon::getNumDisplaySettings(): only main display is supported");
|
GHOST_ASSERT((display == kMainDisplay), "GHOST_DisplayManagerCarbon::getNumDisplaySettings(): only main display is supported");
|
||||||
|
|
||||||
CFArrayRef displayModes;
|
CFArrayRef displayModes;
|
||||||
displayModes = ::CGDisplayAvailableModes(m_displayIDs[display]);
|
displayModes = ::CGDisplayAvailableModes(m_displayIDs[display]);
|
||||||
@@ -81,14 +81,14 @@ GHOST_TSuccess GHOST_DisplayManagerCarbon::getNumDisplaySettings(GHOST_TUns8 dis
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerCarbon::getDisplaySetting(GHOST_TUns8 display, GHOST_TInt32 index, GHOST_DisplaySetting& setting) const
|
GHOST_TSuccess GHOST_DisplayManagerCarbon::getDisplaySetting(GHOST_TUns8 display, GHOST_TInt32 index, GHOST_DisplaySetting& setting) const
|
||||||
{
|
{
|
||||||
GHOST_ASSERT((display==kMainDisplay), "GHOST_DisplayManagerCarbon::getDisplaySetting(): only main display is supported");
|
GHOST_ASSERT((display == kMainDisplay), "GHOST_DisplayManagerCarbon::getDisplaySetting(): only main display is supported");
|
||||||
|
|
||||||
CFArrayRef displayModes;
|
CFArrayRef displayModes;
|
||||||
CGDirectDisplayID d = m_displayIDs[display];
|
CGDirectDisplayID d = m_displayIDs[display];
|
||||||
displayModes = ::CGDisplayAvailableModes(d);
|
displayModes = ::CGDisplayAvailableModes(d);
|
||||||
//CFIndex numModes = ::CFArrayGetCount(displayModes);/*unused*/
|
//CFIndex numModes = ::CFArrayGetCount(displayModes);/*unused*/
|
||||||
//GHOST_TInt32 numSettings = (GHOST_TInt32)numModes; /*unused*/
|
//GHOST_TInt32 numSettings = (GHOST_TInt32)numModes; /*unused*/
|
||||||
CFDictionaryRef displayModeValues = (CFDictionaryRef)::CFArrayGetValueAtIndex(displayModes, index);
|
CFDictionaryRef displayModeValues = (CFDictionaryRef) ::CFArrayGetValueAtIndex(displayModes, index);
|
||||||
|
|
||||||
setting.xPixels = getValue(displayModeValues, kCGDisplayWidth);
|
setting.xPixels = getValue(displayModeValues, kCGDisplayWidth);
|
||||||
setting.yPixels = getValue(displayModeValues, kCGDisplayHeight);
|
setting.yPixels = getValue(displayModeValues, kCGDisplayHeight);
|
||||||
@@ -105,7 +105,7 @@ GHOST_TSuccess GHOST_DisplayManagerCarbon::getDisplaySetting(GHOST_TUns8 display
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerCarbon::getCurrentDisplaySetting(GHOST_TUns8 display, GHOST_DisplaySetting& setting) const
|
GHOST_TSuccess GHOST_DisplayManagerCarbon::getCurrentDisplaySetting(GHOST_TUns8 display, GHOST_DisplaySetting& setting) const
|
||||||
{
|
{
|
||||||
GHOST_ASSERT((display==kMainDisplay), "GHOST_DisplayManagerCarbon::getCurrentDisplaySetting(): only main display is supported");
|
GHOST_ASSERT((display == kMainDisplay), "GHOST_DisplayManagerCarbon::getCurrentDisplaySetting(): only main display is supported");
|
||||||
|
|
||||||
CFDictionaryRef displayModeValues = ::CGDisplayCurrentMode(m_displayIDs[display]);
|
CFDictionaryRef displayModeValues = ::CGDisplayCurrentMode(m_displayIDs[display]);
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ GHOST_TSuccess GHOST_DisplayManagerCarbon::getCurrentDisplaySetting(GHOST_TUns8
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(GHOST_TUns8 display, const GHOST_DisplaySetting& setting)
|
GHOST_TSuccess GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(GHOST_TUns8 display, const GHOST_DisplaySetting& setting)
|
||||||
{
|
{
|
||||||
GHOST_ASSERT((display==kMainDisplay), "GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(): only main display is supported");
|
GHOST_ASSERT((display == kMainDisplay), "GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(): only main display is supported");
|
||||||
|
|
||||||
#ifdef GHOST_DEBUG
|
#ifdef GHOST_DEBUG
|
||||||
printf("GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(): requested settings:\n");
|
printf("GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(): requested settings:\n");
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ protected:
|
|||||||
/** Cached number of displays. */
|
/** Cached number of displays. */
|
||||||
CGDisplayCount m_numDisplays;
|
CGDisplayCount m_numDisplays;
|
||||||
/** Cached display id's for each display. */
|
/** Cached display id's for each display. */
|
||||||
CGDirectDisplayID* m_displayIDs;
|
CGDirectDisplayID *m_displayIDs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
GHOST_TSuccess getCurrentDisplaySetting( GHOST_TUns8 display, GHOST_DisplaySetting& setting ) const { return getDisplaySetting(display,GHOST_TInt32(0),setting); }
|
GHOST_TSuccess getCurrentDisplaySetting( GHOST_TUns8 display, GHOST_DisplaySetting& setting ) const { return getDisplaySetting(display,GHOST_TInt32(0),setting); }
|
||||||
GHOST_TSuccess setCurrentDisplaySetting( GHOST_TUns8 display, const GHOST_DisplaySetting& setting ){ return GHOST_kSuccess; }
|
GHOST_TSuccess setCurrentDisplaySetting( GHOST_TUns8 display, const GHOST_DisplaySetting& setting ){ return GHOST_kSuccess; }
|
||||||
|
|
||||||
private :
|
private:
|
||||||
GHOST_SystemNULL * m_system;
|
GHOST_SystemNULL * m_system;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ GHOST_DisplayManagerSDL::GHOST_DisplayManagerSDL(GHOST_SystemSDL *system)
|
|||||||
GHOST_TSuccess
|
GHOST_TSuccess
|
||||||
GHOST_DisplayManagerSDL::getNumDisplays(GHOST_TUns8& numDisplays) const
|
GHOST_DisplayManagerSDL::getNumDisplays(GHOST_TUns8& numDisplays) const
|
||||||
{
|
{
|
||||||
numDisplays= SDL_GetNumVideoDisplays();
|
numDisplays = SDL_GetNumVideoDisplays();
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +141,9 @@ GHOST_DisplayManagerSDL:: setCurrentDisplaySetting(GHOST_TUns8 display,
|
|||||||
|
|
||||||
if (setting.xPixels > mode.w ||
|
if (setting.xPixels > mode.w ||
|
||||||
setting.yPixels > mode.h)
|
setting.yPixels > mode.h)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
x = setting.xPixels - mode.w;
|
x = setting.xPixels - mode.w;
|
||||||
y = setting.yPixels - mode.h;
|
y = setting.yPixels - mode.h;
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ public:
|
|||||||
setCurrentDisplaySetting(GHOST_TUns8 display,
|
setCurrentDisplaySetting(GHOST_TUns8 display,
|
||||||
const GHOST_DisplaySetting& setting);
|
const GHOST_DisplaySetting& setting);
|
||||||
|
|
||||||
private :
|
private:
|
||||||
GHOST_SystemSDL * m_system;
|
GHOST_SystemSDL *m_system;
|
||||||
SDL_DisplayMode m_mode;
|
SDL_DisplayMode m_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplays(GHOST_TUns8& numDisplay
|
|||||||
*/
|
*/
|
||||||
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32& numSettings) const
|
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32& numSettings) const
|
||||||
{
|
{
|
||||||
GHOST_ASSERT((display==kMainDisplay), "GHOST_DisplayManagerWin32::getNumDisplaySettings(): only main displlay is supported");
|
GHOST_ASSERT((display == kMainDisplay), "GHOST_DisplayManagerWin32::getNumDisplaySettings(): only main displlay is supported");
|
||||||
numSettings = 0;
|
numSettings = 0;
|
||||||
DEVMODE dm;
|
DEVMODE dm;
|
||||||
while (::EnumDisplaySettings(NULL, numSettings, &dm)) {
|
while (::EnumDisplaySettings(NULL, numSettings, &dm)) {
|
||||||
@@ -79,7 +79,7 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(GHOST_TUns8 disp
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(GHOST_TUns8 display, GHOST_TInt32 index, GHOST_DisplaySetting& setting) const
|
GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(GHOST_TUns8 display, GHOST_TInt32 index, GHOST_DisplaySetting& setting) const
|
||||||
{
|
{
|
||||||
GHOST_ASSERT((display==kMainDisplay), "GHOST_DisplayManagerWin32::getDisplaySetting(): only main display is supported");
|
GHOST_ASSERT((display == kMainDisplay), "GHOST_DisplayManagerWin32::getDisplaySetting(): only main display is supported");
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
DEVMODE dm;
|
DEVMODE dm;
|
||||||
if (::EnumDisplaySettings(NULL, index, &dm)) {
|
if (::EnumDisplaySettings(NULL, index, &dm)) {
|
||||||
@@ -112,14 +112,14 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(GHOST_TUns8 display,
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerWin32::getCurrentDisplaySetting(GHOST_TUns8 display, GHOST_DisplaySetting& setting) const
|
GHOST_TSuccess GHOST_DisplayManagerWin32::getCurrentDisplaySetting(GHOST_TUns8 display, GHOST_DisplaySetting& setting) const
|
||||||
{
|
{
|
||||||
GHOST_ASSERT((display==kMainDisplay), "GHOST_DisplayManagerWin32::getCurrentDisplaySetting(): only main display is supported");
|
GHOST_ASSERT((display == kMainDisplay), "GHOST_DisplayManagerWin32::getCurrentDisplaySetting(): only main display is supported");
|
||||||
return getDisplaySetting(kMainDisplay, ENUM_CURRENT_SETTINGS, setting);
|
return getDisplaySetting(kMainDisplay, ENUM_CURRENT_SETTINGS, setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(GHOST_TUns8 display, const GHOST_DisplaySetting& setting)
|
GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(GHOST_TUns8 display, const GHOST_DisplaySetting& setting)
|
||||||
{
|
{
|
||||||
GHOST_ASSERT((display==kMainDisplay), "GHOST_DisplayManagerWin32::setCurrentDisplaySetting(): only main display is supported");
|
GHOST_ASSERT((display == kMainDisplay), "GHOST_DisplayManagerWin32::setCurrentDisplaySetting(): only main display is supported");
|
||||||
|
|
||||||
GHOST_DisplaySetting match;
|
GHOST_DisplaySetting match;
|
||||||
findMatch(display, setting, match);
|
findMatch(display, setting, match);
|
||||||
@@ -129,18 +129,19 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(GHOST_TUns8 d
|
|||||||
if ((dm.dmBitsPerPel == match.bpp) &&
|
if ((dm.dmBitsPerPel == match.bpp) &&
|
||||||
(dm.dmPelsWidth == match.xPixels) &&
|
(dm.dmPelsWidth == match.xPixels) &&
|
||||||
(dm.dmPelsHeight == match.yPixels) &&
|
(dm.dmPelsHeight == match.yPixels) &&
|
||||||
(dm.dmDisplayFrequency == match.frequency)) {
|
(dm.dmDisplayFrequency == match.frequency))
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
dm.dmBitsPerPel = match.bpp;
|
* dm.dmBitsPerPel = match.bpp;
|
||||||
dm.dmPelsWidth = match.xPixels;
|
* dm.dmPelsWidth = match.xPixels;
|
||||||
dm.dmPelsHeight = match.yPixels;
|
* dm.dmPelsHeight = match.yPixels;
|
||||||
dm.dmDisplayFrequency = match.frequency;
|
* dm.dmDisplayFrequency = match.frequency;
|
||||||
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
|
* dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
|
||||||
dm.dmSize = sizeof(DEVMODE);
|
* dm.dmSize = sizeof(DEVMODE);
|
||||||
dm.dmDriverExtra = 0;
|
* dm.dmDriverExtra = 0;
|
||||||
*/
|
*/
|
||||||
#ifdef GHOST_DEBUG
|
#ifdef GHOST_DEBUG
|
||||||
printf("display change: Requested settings:\n");
|
printf("display change: Requested settings:\n");
|
||||||
@@ -180,5 +181,5 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(GHOST_TUns8 d
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // GHOST_DEBUG
|
#endif // GHOST_DEBUG
|
||||||
return status == DISP_CHANGE_SUCCESSFUL? GHOST_kSuccess : GHOST_kFailure;
|
return status == DISP_CHANGE_SUCCESSFUL ? GHOST_kSuccess : GHOST_kFailure;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,10 +43,10 @@ void printLastError(void);
|
|||||||
#endif // GHOST_DEBUG
|
#endif // GHOST_DEBUG
|
||||||
|
|
||||||
|
|
||||||
GHOST_DropTargetWin32::GHOST_DropTargetWin32(GHOST_WindowWin32 * window, GHOST_SystemWin32 * system)
|
GHOST_DropTargetWin32::GHOST_DropTargetWin32(GHOST_WindowWin32 *window, GHOST_SystemWin32 *system)
|
||||||
:
|
:
|
||||||
m_window(window),
|
m_window(window),
|
||||||
m_system(system)
|
m_system(system)
|
||||||
{
|
{
|
||||||
m_cRef = 1;
|
m_cRef = 1;
|
||||||
m_hWnd = window->getHWND();
|
m_hWnd = window->getHWND();
|
||||||
@@ -65,21 +65,20 @@ GHOST_DropTargetWin32::~GHOST_DropTargetWin32()
|
|||||||
/*
|
/*
|
||||||
* IUnknown::QueryInterface
|
* IUnknown::QueryInterface
|
||||||
*/
|
*/
|
||||||
HRESULT __stdcall GHOST_DropTargetWin32::QueryInterface (REFIID riid, void ** ppvObj)
|
HRESULT __stdcall GHOST_DropTargetWin32::QueryInterface(REFIID riid, void **ppvObj)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!ppvObj)
|
if (!ppvObj)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
*ppvObj = NULL;
|
*ppvObj = NULL;
|
||||||
|
|
||||||
if(riid == IID_IUnknown || riid == IID_IDropTarget)
|
if (riid == IID_IUnknown || riid == IID_IDropTarget)
|
||||||
{
|
{
|
||||||
AddRef();
|
AddRef();
|
||||||
*ppvObj = (void*)this;
|
*ppvObj = (void *)this;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
*ppvObj = 0;
|
*ppvObj = 0;
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
@@ -102,13 +101,12 @@ ULONG __stdcall GHOST_DropTargetWin32::Release(void)
|
|||||||
{
|
{
|
||||||
ULONG refs = ::InterlockedDecrement(&m_cRef);
|
ULONG refs = ::InterlockedDecrement(&m_cRef);
|
||||||
|
|
||||||
if(refs == 0)
|
if (refs == 0)
|
||||||
{
|
{
|
||||||
delete this;
|
delete this;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
return refs;
|
return refs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,7 +114,7 @@ ULONG __stdcall GHOST_DropTargetWin32::Release(void)
|
|||||||
/*
|
/*
|
||||||
* Implementation of IDropTarget::DragEnter
|
* Implementation of IDropTarget::DragEnter
|
||||||
*/
|
*/
|
||||||
HRESULT __stdcall GHOST_DropTargetWin32::DragEnter(IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect)
|
HRESULT __stdcall GHOST_DropTargetWin32::DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
||||||
{
|
{
|
||||||
// we accept all drop by default
|
// we accept all drop by default
|
||||||
m_window->setAcceptDragOperation(true);
|
m_window->setAcceptDragOperation(true);
|
||||||
@@ -130,14 +128,13 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragEnter(IDataObject * pDataObject, DW
|
|||||||
/*
|
/*
|
||||||
* Implementation of IDropTarget::DragOver
|
* Implementation of IDropTarget::DragOver
|
||||||
*/
|
*/
|
||||||
HRESULT __stdcall GHOST_DropTargetWin32::DragOver(DWORD grfKeyState, POINTL pt, DWORD * pdwEffect)
|
HRESULT __stdcall GHOST_DropTargetWin32::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
||||||
{
|
{
|
||||||
if(m_window->canAcceptDragOperation())
|
if (m_window->canAcceptDragOperation())
|
||||||
{
|
{
|
||||||
*pdwEffect = allowedDropEffect(*pdwEffect);
|
*pdwEffect = allowedDropEffect(*pdwEffect);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
*pdwEffect = DROPEFFECT_NONE;
|
*pdwEffect = DROPEFFECT_NONE;
|
||||||
//*pdwEffect = DROPEFFECT_COPY; // XXX Uncomment to test drop. Drop will not be called if pdwEffect == DROPEFFECT_NONE.
|
//*pdwEffect = DROPEFFECT_COPY; // XXX Uncomment to test drop. Drop will not be called if pdwEffect == DROPEFFECT_NONE.
|
||||||
}
|
}
|
||||||
@@ -159,20 +156,19 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragLeave(void)
|
|||||||
* This function will not be called if pdwEffect is set to DROPEFFECT_NONE in
|
* This function will not be called if pdwEffect is set to DROPEFFECT_NONE in
|
||||||
* the implementation of IDropTarget::DragOver
|
* the implementation of IDropTarget::DragOver
|
||||||
*/
|
*/
|
||||||
HRESULT __stdcall GHOST_DropTargetWin32::Drop(IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect)
|
HRESULT __stdcall GHOST_DropTargetWin32::Drop(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
|
||||||
{
|
{
|
||||||
void * data = getGhostData(pDataObject);
|
void *data = getGhostData(pDataObject);
|
||||||
if(m_window->canAcceptDragOperation())
|
if (m_window->canAcceptDragOperation())
|
||||||
{
|
{
|
||||||
*pdwEffect = allowedDropEffect(*pdwEffect);
|
*pdwEffect = allowedDropEffect(*pdwEffect);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
*pdwEffect = DROPEFFECT_NONE;
|
*pdwEffect = DROPEFFECT_NONE;
|
||||||
}
|
}
|
||||||
if (data)
|
if (data)
|
||||||
m_system->pushDragDropEvent(GHOST_kEventDraggingDropDone, m_draggedObjectType, m_window, pt.x, pt.y, data );
|
m_system->pushDragDropEvent(GHOST_kEventDraggingDropDone, m_draggedObjectType, m_window, pt.x, pt.y, data);
|
||||||
|
|
||||||
m_draggedObjectType = GHOST_kDragnDropTypeUnknown;
|
m_draggedObjectType = GHOST_kDragnDropTypeUnknown;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@@ -185,27 +181,27 @@ HRESULT __stdcall GHOST_DropTargetWin32::Drop(IDataObject * pDataObject, DWORD g
|
|||||||
DWORD GHOST_DropTargetWin32::allowedDropEffect(DWORD dwAllowed)
|
DWORD GHOST_DropTargetWin32::allowedDropEffect(DWORD dwAllowed)
|
||||||
{
|
{
|
||||||
DWORD dwEffect = DROPEFFECT_NONE;
|
DWORD dwEffect = DROPEFFECT_NONE;
|
||||||
if(dwAllowed & DROPEFFECT_COPY)
|
if (dwAllowed & DROPEFFECT_COPY)
|
||||||
dwEffect = DROPEFFECT_COPY;
|
dwEffect = DROPEFFECT_COPY;
|
||||||
|
|
||||||
return dwEffect;
|
return dwEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TDragnDropTypes GHOST_DropTargetWin32::getGhostType(IDataObject * pDataObject)
|
GHOST_TDragnDropTypes GHOST_DropTargetWin32::getGhostType(IDataObject *pDataObject)
|
||||||
{
|
{
|
||||||
/* Text
|
/* Text
|
||||||
* Note: Unicode text is aviable as CF_TEXT too, the system can do the
|
* Note: Unicode text is aviable as CF_TEXT too, the system can do the
|
||||||
* conversion, but we do the conversion ourself with WC_NO_BEST_FIT_CHARS.
|
* conversion, but we do the conversion ourself with WC_NO_BEST_FIT_CHARS.
|
||||||
*/
|
*/
|
||||||
FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
|
FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
|
||||||
if(pDataObject->QueryGetData(&fmtetc) == S_OK)
|
if (pDataObject->QueryGetData(&fmtetc) == S_OK)
|
||||||
{
|
{
|
||||||
return GHOST_kDragnDropTypeString;
|
return GHOST_kDragnDropTypeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filesnames
|
// Filesnames
|
||||||
fmtetc.cfFormat = CF_HDROP;
|
fmtetc.cfFormat = CF_HDROP;
|
||||||
if(pDataObject->QueryGetData(&fmtetc) == S_OK)
|
if (pDataObject->QueryGetData(&fmtetc) == S_OK)
|
||||||
{
|
{
|
||||||
return GHOST_kDragnDropTypeFilenames;
|
return GHOST_kDragnDropTypeFilenames;
|
||||||
}
|
}
|
||||||
@@ -213,10 +209,10 @@ GHOST_TDragnDropTypes GHOST_DropTargetWin32::getGhostType(IDataObject * pDataObj
|
|||||||
return GHOST_kDragnDropTypeUnknown;
|
return GHOST_kDragnDropTypeUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * GHOST_DropTargetWin32::getGhostData(IDataObject * pDataObject)
|
void *GHOST_DropTargetWin32::getGhostData(IDataObject *pDataObject)
|
||||||
{
|
{
|
||||||
GHOST_TDragnDropTypes type = getGhostType(pDataObject);
|
GHOST_TDragnDropTypes type = getGhostType(pDataObject);
|
||||||
switch(type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case GHOST_kDragnDropTypeFilenames:
|
case GHOST_kDragnDropTypeFilenames:
|
||||||
return getDropDataAsFilenames(pDataObject);
|
return getDropDataAsFilenames(pDataObject);
|
||||||
@@ -237,11 +233,11 @@ void * GHOST_DropTargetWin32::getGhostData(IDataObject * pDataObject)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject * pDataObject)
|
void *GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject *pDataObject)
|
||||||
{
|
{
|
||||||
UINT totfiles, nvalid=0;
|
UINT totfiles, nvalid = 0;
|
||||||
WCHAR fpath [MAX_PATH];
|
WCHAR fpath[MAX_PATH];
|
||||||
char * temp_path;
|
char *temp_path;
|
||||||
GHOST_TStringArray *strArray = NULL;
|
GHOST_TStringArray *strArray = NULL;
|
||||||
FORMATETC fmtetc = { CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
|
FORMATETC fmtetc = { CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
|
||||||
STGMEDIUM stgmed;
|
STGMEDIUM stgmed;
|
||||||
@@ -249,35 +245,35 @@ void * GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject * pDataObject)
|
|||||||
|
|
||||||
// Check if dataobject supplies the format we want.
|
// Check if dataobject supplies the format we want.
|
||||||
// Double checking here, first in getGhostType.
|
// Double checking here, first in getGhostType.
|
||||||
if(pDataObject->QueryGetData(&fmtetc) == S_OK)
|
if (pDataObject->QueryGetData(&fmtetc) == S_OK)
|
||||||
{
|
{
|
||||||
if(pDataObject->GetData(&fmtetc, &stgmed) == S_OK)
|
if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK)
|
||||||
{
|
{
|
||||||
hdrop = (HDROP)::GlobalLock(stgmed.hGlobal);
|
hdrop = (HDROP) ::GlobalLock(stgmed.hGlobal);
|
||||||
|
|
||||||
totfiles = ::DragQueryFileW ( hdrop, -1, NULL, 0 );
|
totfiles = ::DragQueryFileW(hdrop, -1, NULL, 0);
|
||||||
if (!totfiles)
|
if (!totfiles)
|
||||||
{
|
{
|
||||||
::GlobalUnlock(stgmed.hGlobal);
|
::GlobalUnlock(stgmed.hGlobal);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strArray = (GHOST_TStringArray*) ::malloc(sizeof(GHOST_TStringArray));
|
strArray = (GHOST_TStringArray *) ::malloc(sizeof(GHOST_TStringArray));
|
||||||
strArray->count = 0;
|
strArray->count = 0;
|
||||||
strArray->strings = (GHOST_TUns8**) ::malloc(totfiles*sizeof(GHOST_TUns8*));
|
strArray->strings = (GHOST_TUns8 **) ::malloc(totfiles * sizeof(GHOST_TUns8 *));
|
||||||
|
|
||||||
for ( UINT nfile = 0; nfile < totfiles; nfile++ )
|
for (UINT nfile = 0; nfile < totfiles; nfile++)
|
||||||
{
|
{
|
||||||
if ( ::DragQueryFileW ( hdrop, nfile, fpath, MAX_PATH ) > 0 )
|
if (::DragQueryFileW(hdrop, nfile, fpath, MAX_PATH) > 0)
|
||||||
{
|
{
|
||||||
if ( !(temp_path = alloc_utf_8_from_16(fpath, 0)) )
|
if (!(temp_path = alloc_utf_8_from_16(fpath, 0)) )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Just ignore paths that could not be converted verbatim.
|
// Just ignore paths that could not be converted verbatim.
|
||||||
|
|
||||||
strArray->strings[nvalid] = (GHOST_TUns8*) temp_path;
|
strArray->strings[nvalid] = (GHOST_TUns8 *) temp_path;
|
||||||
strArray->count = nvalid+1;
|
strArray->count = nvalid + 1;
|
||||||
nvalid++;
|
nvalid++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -291,20 +287,20 @@ void * GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject * pDataObject)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * GHOST_DropTargetWin32::getDropDataAsString(IDataObject * pDataObject)
|
void *GHOST_DropTargetWin32::getDropDataAsString(IDataObject *pDataObject)
|
||||||
{
|
{
|
||||||
char* tmp_string;
|
char *tmp_string;
|
||||||
FORMATETC fmtetc = { CF_UNICODETEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
|
FORMATETC fmtetc = { CF_UNICODETEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
|
||||||
STGMEDIUM stgmed;
|
STGMEDIUM stgmed;
|
||||||
|
|
||||||
// Try unicode first.
|
// Try unicode first.
|
||||||
// Check if dataobject supplies the format we want.
|
// Check if dataobject supplies the format we want.
|
||||||
if(pDataObject->QueryGetData(&fmtetc) == S_OK)
|
if (pDataObject->QueryGetData(&fmtetc) == S_OK)
|
||||||
{
|
{
|
||||||
if(pDataObject->GetData(&fmtetc, &stgmed) == S_OK)
|
if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK)
|
||||||
{
|
{
|
||||||
LPCWSTR wstr = (LPCWSTR)::GlobalLock(stgmed.hGlobal);
|
LPCWSTR wstr = (LPCWSTR) ::GlobalLock(stgmed.hGlobal);
|
||||||
if ( !(tmp_string = alloc_utf_8_from_16((wchar_t*)wstr, 0)) )
|
if (!(tmp_string = alloc_utf_8_from_16((wchar_t *)wstr, 0)) )
|
||||||
{
|
{
|
||||||
::GlobalUnlock(stgmed.hGlobal);
|
::GlobalUnlock(stgmed.hGlobal);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -313,7 +309,7 @@ void * GHOST_DropTargetWin32::getDropDataAsString(IDataObject * pDataObject)
|
|||||||
::GlobalUnlock(stgmed.hGlobal);
|
::GlobalUnlock(stgmed.hGlobal);
|
||||||
::ReleaseStgMedium(&stgmed);
|
::ReleaseStgMedium(&stgmed);
|
||||||
#ifdef GHOST_DEBUG
|
#ifdef GHOST_DEBUG
|
||||||
::printf("\n<converted droped unicode string>\n%s\n</droped converted unicode string>\n",tmp_string);
|
::printf("\n<converted droped unicode string>\n%s\n</droped converted unicode string>\n", tmp_string);
|
||||||
#endif // GHOST_DEBUG
|
#endif // GHOST_DEBUG
|
||||||
return tmp_string;
|
return tmp_string;
|
||||||
}
|
}
|
||||||
@@ -321,20 +317,20 @@ void * GHOST_DropTargetWin32::getDropDataAsString(IDataObject * pDataObject)
|
|||||||
|
|
||||||
fmtetc.cfFormat = CF_TEXT;
|
fmtetc.cfFormat = CF_TEXT;
|
||||||
|
|
||||||
if(pDataObject->QueryGetData(&fmtetc) == S_OK)
|
if (pDataObject->QueryGetData(&fmtetc) == S_OK)
|
||||||
{
|
{
|
||||||
if(pDataObject->GetData(&fmtetc, &stgmed) == S_OK)
|
if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK)
|
||||||
{
|
{
|
||||||
char * str = (char*)::GlobalLock(stgmed.hGlobal);
|
char *str = (char *)::GlobalLock(stgmed.hGlobal);
|
||||||
|
|
||||||
tmp_string = (char*)::malloc(::strlen(str)+1);
|
tmp_string = (char *)::malloc(::strlen(str) + 1);
|
||||||
if ( !tmp_string )
|
if (!tmp_string)
|
||||||
{
|
{
|
||||||
::GlobalUnlock(stgmed.hGlobal);
|
::GlobalUnlock(stgmed.hGlobal);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !::strcpy(tmp_string, str) )
|
if (!::strcpy(tmp_string, str) )
|
||||||
{
|
{
|
||||||
::free(tmp_string);
|
::free(tmp_string);
|
||||||
::GlobalUnlock(stgmed.hGlobal);
|
::GlobalUnlock(stgmed.hGlobal);
|
||||||
@@ -363,10 +359,10 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char * &out)
|
|||||||
-1, //-1 null terminated, makes output null terminated too.
|
-1, //-1 null terminated, makes output null terminated too.
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
NULL,NULL
|
NULL, NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
if(!size)
|
if (!size)
|
||||||
{
|
{
|
||||||
#ifdef GHOST_DEBUG
|
#ifdef GHOST_DEBUG
|
||||||
::printLastError();
|
::printLastError();
|
||||||
@@ -374,7 +370,7 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char * &out)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
out = (char*)::malloc(size);
|
out = (char *)::malloc(size);
|
||||||
if (!out)
|
if (!out)
|
||||||
{
|
{
|
||||||
::printf("\nmalloc failed!!!");
|
::printf("\nmalloc failed!!!");
|
||||||
@@ -387,10 +383,10 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char * &out)
|
|||||||
-1,
|
-1,
|
||||||
(LPSTR) out,
|
(LPSTR) out,
|
||||||
size,
|
size,
|
||||||
NULL,NULL
|
NULL, NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
if(!size)
|
if (!size)
|
||||||
{
|
{
|
||||||
#ifdef GHOST_DEBUG
|
#ifdef GHOST_DEBUG
|
||||||
::printLastError();
|
::printLastError();
|
||||||
@@ -408,7 +404,7 @@ void printLastError(void)
|
|||||||
DWORD err;
|
DWORD err;
|
||||||
|
|
||||||
err = GetLastError();
|
err = GetLastError();
|
||||||
if(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||||
FORMAT_MESSAGE_FROM_SYSTEM,
|
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
NULL,
|
NULL,
|
||||||
err,
|
err,
|
||||||
|
|||||||
@@ -47,15 +47,15 @@ public:
|
|||||||
* inherited, directly or indirectly, from IUnknown. Therefore, the three
|
* inherited, directly or indirectly, from IUnknown. Therefore, the three
|
||||||
* methods in IUnknown are the first entries in the VTable for every interface.
|
* methods in IUnknown are the first entries in the VTable for every interface.
|
||||||
*/
|
*/
|
||||||
HRESULT __stdcall QueryInterface (REFIID riid, void ** ppvObj);
|
HRESULT __stdcall QueryInterface(REFIID riid, void **ppvObj);
|
||||||
ULONG __stdcall AddRef (void);
|
ULONG __stdcall AddRef(void);
|
||||||
ULONG __stdcall Release (void);
|
ULONG __stdcall Release(void);
|
||||||
|
|
||||||
/* IDropTarget implementation
|
/* IDropTarget implementation
|
||||||
+ The IDropTarget interface is one of the interfaces you implement to
|
* + The IDropTarget interface is one of the interfaces you implement to
|
||||||
provide drag-and-drop operations in your application. It contains methods
|
* provide drag-and-drop operations in your application. It contains methods
|
||||||
used in any application that can be a target for data during a
|
* used in any application that can be a target for data during a
|
||||||
drag-and-drop operation. A drop-target application is responsible for:
|
* drag-and-drop operation. A drop-target application is responsible for:
|
||||||
*
|
*
|
||||||
* - Determining the effect of the drop on the target application.
|
* - Determining the effect of the drop on the target application.
|
||||||
* - Incorporating any valid dropped data when the drop occurs.
|
* - Incorporating any valid dropped data when the drop occurs.
|
||||||
@@ -70,10 +70,10 @@ public:
|
|||||||
* RevokeDragDrop functions.
|
* RevokeDragDrop functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
HRESULT __stdcall DragEnter (IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect);
|
HRESULT __stdcall DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
|
||||||
HRESULT __stdcall DragOver (DWORD grfKeyState, POINTL pt, DWORD * pdwEffect);
|
HRESULT __stdcall DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
|
||||||
HRESULT __stdcall DragLeave (void);
|
HRESULT __stdcall DragLeave(void);
|
||||||
HRESULT __stdcall Drop (IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect);
|
HRESULT __stdcall Drop(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
* @param window The window to register as drop target.
|
* @param window The window to register as drop target.
|
||||||
* @param system The associated system.
|
* @param system The associated system.
|
||||||
*/
|
*/
|
||||||
GHOST_DropTargetWin32(GHOST_WindowWin32 * window, GHOST_SystemWin32 * system);
|
GHOST_DropTargetWin32(GHOST_WindowWin32 *window, GHOST_SystemWin32 *system);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
@@ -107,7 +107,7 @@ private:
|
|||||||
* @param pDataObject Pointer to the DataObject.
|
* @param pDataObject Pointer to the DataObject.
|
||||||
* @return GHOST data type.
|
* @return GHOST data type.
|
||||||
*/
|
*/
|
||||||
GHOST_TDragnDropTypes getGhostType(IDataObject * pDataObject);
|
GHOST_TDragnDropTypes getGhostType(IDataObject *pDataObject);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get data to pass in event.
|
* Get data to pass in event.
|
||||||
@@ -115,21 +115,21 @@ private:
|
|||||||
* @param pDataObject Pointer to the DataObject.
|
* @param pDataObject Pointer to the DataObject.
|
||||||
* @return Pointer to data.
|
* @return Pointer to data.
|
||||||
*/
|
*/
|
||||||
void * getGhostData(IDataObject * pDataObject);
|
void *getGhostData(IDataObject *pDataObject);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate data as file array to pass in event.
|
* Allocate data as file array to pass in event.
|
||||||
* @param pDataObject Pointer to the DataObject.
|
* @param pDataObject Pointer to the DataObject.
|
||||||
* @return Pointer to data.
|
* @return Pointer to data.
|
||||||
*/
|
*/
|
||||||
void * getDropDataAsFilenames(IDataObject * pDataObject);
|
void *getDropDataAsFilenames(IDataObject *pDataObject);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate data as string to pass in event.
|
* Allocate data as string to pass in event.
|
||||||
* @param pDataObject Pointer to the DataObject.
|
* @param pDataObject Pointer to the DataObject.
|
||||||
* @return Pointer to data.
|
* @return Pointer to data.
|
||||||
*/
|
*/
|
||||||
void * getDropDataAsString(IDataObject * pDataObject);
|
void *getDropDataAsString(IDataObject *pDataObject);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert Unicode to ANSI, replacing unconvertable chars with '?'.
|
* Convert Unicode to ANSI, replacing unconvertable chars with '?'.
|
||||||
@@ -147,12 +147,11 @@ private:
|
|||||||
/* Handle of the associated window. */
|
/* Handle of the associated window. */
|
||||||
HWND m_hWnd;
|
HWND m_hWnd;
|
||||||
/* The associated GHOST_WindowWin32. */
|
/* The associated GHOST_WindowWin32. */
|
||||||
GHOST_WindowWin32 * m_window;
|
GHOST_WindowWin32 *m_window;
|
||||||
/* The System. */
|
/* The System. */
|
||||||
GHOST_SystemWin32 * m_system;
|
GHOST_SystemWin32 *m_system;
|
||||||
/* Data type of the dragged object */
|
/* Data type of the dragged object */
|
||||||
GHOST_TDragnDropTypes m_draggedObjectType;
|
GHOST_TDragnDropTypes m_draggedObjectType;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GHOST_DROPTARGETWIN32_H__
|
#endif // __GHOST_DROPTARGETWIN32_H__
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
* @param type The type of this event.
|
* @param type The type of this event.
|
||||||
* @param window The generating window (or NULL if system event).
|
* @param window The generating window (or NULL if system event).
|
||||||
*/
|
*/
|
||||||
GHOST_Event(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow* window)
|
GHOST_Event(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow *window)
|
||||||
: m_type(type), m_time(msec), m_window(window), m_data(0)
|
: m_type(type), m_time(msec), m_window(window), m_data(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ public:
|
|||||||
* or NULL if it is a 'system' event.
|
* or NULL if it is a 'system' event.
|
||||||
* @return The generating window.
|
* @return The generating window.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_IWindow* getWindow()
|
virtual GHOST_IWindow *getWindow()
|
||||||
{
|
{
|
||||||
return m_window;
|
return m_window;
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ protected:
|
|||||||
/** The time this event was generated. */
|
/** The time this event was generated. */
|
||||||
GHOST_TUns64 m_time;
|
GHOST_TUns64 m_time;
|
||||||
/** Pointer to the generating window. */
|
/** Pointer to the generating window. */
|
||||||
GHOST_IWindow* m_window;
|
GHOST_IWindow *m_window;
|
||||||
/** Pointer to the event data. */
|
/** Pointer to the event data. */
|
||||||
GHOST_TEventDataPtr m_data;
|
GHOST_TEventDataPtr m_data;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
* @param y The y-coordinate of the location the cursor was at at the time of the event.
|
* @param y The y-coordinate of the location the cursor was at at the time of the event.
|
||||||
* @param buttons The state of the buttons was at at the time of the event.
|
* @param buttons The state of the buttons was at at the time of the event.
|
||||||
*/
|
*/
|
||||||
GHOST_EventButton(GHOST_TUns64 time, GHOST_TEventType type, GHOST_IWindow* window, GHOST_TButtonMask button)
|
GHOST_EventButton(GHOST_TUns64 time, GHOST_TEventType type, GHOST_IWindow *window, GHOST_TButtonMask button)
|
||||||
: GHOST_Event(time, type, window)
|
: GHOST_Event(time, type, window)
|
||||||
{
|
{
|
||||||
m_buttonEventData.button = button;
|
m_buttonEventData.button = button;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
* @param x The x-coordinate of the location the cursor was at at the time of the event.
|
* @param x The x-coordinate of the location the cursor was at at the time of the event.
|
||||||
* @param y The y-coordinate of the location the cursor was at at the time of the event.
|
* @param y The y-coordinate of the location the cursor was at at the time of the event.
|
||||||
*/
|
*/
|
||||||
GHOST_EventCursor(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow* window, GHOST_TInt32 x, GHOST_TInt32 y)
|
GHOST_EventCursor(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow *window, GHOST_TInt32 x, GHOST_TInt32 y)
|
||||||
: GHOST_Event(msec, type, window)
|
: GHOST_Event(msec, type, window)
|
||||||
{
|
{
|
||||||
m_cursorEventData.x = x;
|
m_cursorEventData.x = x;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
GHOST_EventDragnDrop(GHOST_TUns64 time,
|
GHOST_EventDragnDrop(GHOST_TUns64 time,
|
||||||
GHOST_TEventType type,
|
GHOST_TEventType type,
|
||||||
GHOST_TDragnDropTypes dataType,
|
GHOST_TDragnDropTypes dataType,
|
||||||
GHOST_IWindow* window,
|
GHOST_IWindow *window,
|
||||||
int x, int y, GHOST_TEventDataPtr data)
|
int x, int y, GHOST_TEventDataPtr data)
|
||||||
: GHOST_Event(time, type, window)
|
: GHOST_Event(time, type, window)
|
||||||
{
|
{
|
||||||
@@ -102,14 +102,14 @@ public:
|
|||||||
|
|
||||||
switch (m_dragnDropEventData.dataType) {
|
switch (m_dragnDropEventData.dataType) {
|
||||||
case GHOST_kDragnDropTypeBitmap:
|
case GHOST_kDragnDropTypeBitmap:
|
||||||
IMB_freeImBuf((ImBuf*)m_dragnDropEventData.data);
|
IMB_freeImBuf((ImBuf *)m_dragnDropEventData.data);
|
||||||
break;
|
break;
|
||||||
case GHOST_kDragnDropTypeFilenames:
|
case GHOST_kDragnDropTypeFilenames:
|
||||||
{
|
{
|
||||||
GHOST_TStringArray *strArray = (GHOST_TStringArray*)m_dragnDropEventData.data;
|
GHOST_TStringArray *strArray = (GHOST_TStringArray *)m_dragnDropEventData.data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0;i<strArray->count;i++)
|
for (i = 0; i < strArray->count; i++)
|
||||||
free(strArray->strings[i]);
|
free(strArray->strings[i]);
|
||||||
|
|
||||||
free(strArray);
|
free(strArray);
|
||||||
|
|||||||
@@ -51,13 +51,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
GHOST_EventKey(GHOST_TUns64 msec,
|
GHOST_EventKey(GHOST_TUns64 msec,
|
||||||
GHOST_TEventType type,
|
GHOST_TEventType type,
|
||||||
GHOST_IWindow* window,
|
GHOST_IWindow *window,
|
||||||
GHOST_TKey key)
|
GHOST_TKey key)
|
||||||
: GHOST_Event(msec, type, window)
|
: GHOST_Event(msec, type, window)
|
||||||
{
|
{
|
||||||
m_keyEventData.key = key;
|
m_keyEventData.key = key;
|
||||||
m_keyEventData.ascii = '\0';
|
m_keyEventData.ascii = '\0';
|
||||||
m_keyEventData.utf8_buf[0]= '\0';
|
m_keyEventData.utf8_buf[0] = '\0';
|
||||||
m_data = &m_keyEventData;
|
m_data = &m_keyEventData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
GHOST_EventKey(GHOST_TUns64 msec,
|
GHOST_EventKey(GHOST_TUns64 msec,
|
||||||
GHOST_TEventType type,
|
GHOST_TEventType type,
|
||||||
GHOST_IWindow* window,
|
GHOST_IWindow *window,
|
||||||
GHOST_TKey key,
|
GHOST_TKey key,
|
||||||
char ascii,
|
char ascii,
|
||||||
const char utf8_buf[6])
|
const char utf8_buf[6])
|
||||||
@@ -79,7 +79,7 @@ public:
|
|||||||
m_keyEventData.key = key;
|
m_keyEventData.key = key;
|
||||||
m_keyEventData.ascii = ascii;
|
m_keyEventData.ascii = ascii;
|
||||||
if (utf8_buf) memcpy(m_keyEventData.utf8_buf, utf8_buf, sizeof(m_keyEventData.utf8_buf));
|
if (utf8_buf) memcpy(m_keyEventData.utf8_buf, utf8_buf, sizeof(m_keyEventData.utf8_buf));
|
||||||
else m_keyEventData.utf8_buf[0]= '\0';
|
else m_keyEventData.utf8_buf[0] = '\0';
|
||||||
m_data = &m_keyEventData;
|
m_data = &m_keyEventData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,10 +51,9 @@ GHOST_EventManager::~GHOST_EventManager()
|
|||||||
{
|
{
|
||||||
disposeEvents();
|
disposeEvents();
|
||||||
|
|
||||||
TConsumerVector::iterator iter= m_consumers.begin();
|
TConsumerVector::iterator iter = m_consumers.begin();
|
||||||
while (iter != m_consumers.end())
|
while (iter != m_consumers.end()) {
|
||||||
{
|
GHOST_IEventConsumer *consumer = *iter;
|
||||||
GHOST_IEventConsumer* consumer = *iter;
|
|
||||||
delete consumer;
|
delete consumer;
|
||||||
m_consumers.erase(iter);
|
m_consumers.erase(iter);
|
||||||
iter = m_consumers.begin();
|
iter = m_consumers.begin();
|
||||||
@@ -81,9 +80,9 @@ GHOST_TUns32 GHOST_EventManager::getNumEvents(GHOST_TEventType type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_IEvent* GHOST_EventManager::peekEvent()
|
GHOST_IEvent *GHOST_EventManager::peekEvent()
|
||||||
{
|
{
|
||||||
GHOST_IEvent* event = 0;
|
GHOST_IEvent *event = 0;
|
||||||
if (m_events.size() > 0) {
|
if (m_events.size() > 0) {
|
||||||
event = m_events.back();
|
event = m_events.back();
|
||||||
}
|
}
|
||||||
@@ -91,7 +90,7 @@ GHOST_IEvent* GHOST_EventManager::peekEvent()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_EventManager::pushEvent(GHOST_IEvent* event)
|
GHOST_TSuccess GHOST_EventManager::pushEvent(GHOST_IEvent *event)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
GHOST_ASSERT(event, "invalid event");
|
GHOST_ASSERT(event, "invalid event");
|
||||||
@@ -106,7 +105,7 @@ GHOST_TSuccess GHOST_EventManager::pushEvent(GHOST_IEvent* event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GHOST_EventManager::dispatchEvent(GHOST_IEvent* event)
|
bool GHOST_EventManager::dispatchEvent(GHOST_IEvent *event)
|
||||||
{
|
{
|
||||||
bool handled;
|
bool handled;
|
||||||
if (event) {
|
if (event) {
|
||||||
@@ -127,7 +126,7 @@ bool GHOST_EventManager::dispatchEvent(GHOST_IEvent* event)
|
|||||||
|
|
||||||
bool GHOST_EventManager::dispatchEvent()
|
bool GHOST_EventManager::dispatchEvent()
|
||||||
{
|
{
|
||||||
GHOST_IEvent* event = popEvent();
|
GHOST_IEvent *event = popEvent();
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
if (event) {
|
if (event) {
|
||||||
handled = dispatchEvent(event);
|
handled = dispatchEvent(event);
|
||||||
@@ -155,7 +154,7 @@ bool GHOST_EventManager::dispatchEvents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_EventManager::addConsumer(GHOST_IEventConsumer* consumer)
|
GHOST_TSuccess GHOST_EventManager::addConsumer(GHOST_IEventConsumer *consumer)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
GHOST_ASSERT(consumer, "invalid consumer");
|
GHOST_ASSERT(consumer, "invalid consumer");
|
||||||
@@ -175,7 +174,7 @@ GHOST_TSuccess GHOST_EventManager::addConsumer(GHOST_IEventConsumer* consumer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_EventManager::removeConsumer(GHOST_IEventConsumer* consumer)
|
GHOST_TSuccess GHOST_EventManager::removeConsumer(GHOST_IEventConsumer *consumer)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
GHOST_ASSERT(consumer, "invalid consumer");
|
GHOST_ASSERT(consumer, "invalid consumer");
|
||||||
@@ -195,13 +194,13 @@ GHOST_TSuccess GHOST_EventManager::removeConsumer(GHOST_IEventConsumer* consumer
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GHOST_EventManager::removeWindowEvents(GHOST_IWindow* window)
|
void GHOST_EventManager::removeWindowEvents(GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
TEventStack::iterator iter;
|
TEventStack::iterator iter;
|
||||||
iter = m_events.begin();
|
iter = m_events.begin();
|
||||||
while (iter != m_events.end())
|
while (iter != m_events.end())
|
||||||
{
|
{
|
||||||
GHOST_IEvent* event = *iter;
|
GHOST_IEvent *event = *iter;
|
||||||
if (event->getWindow() == window)
|
if (event->getWindow() == window)
|
||||||
{
|
{
|
||||||
GHOST_PRINT("GHOST_EventManager::removeWindowEvents(): removing event\n");
|
GHOST_PRINT("GHOST_EventManager::removeWindowEvents(): removing event\n");
|
||||||
@@ -213,20 +212,19 @@ void GHOST_EventManager::removeWindowEvents(GHOST_IWindow* window)
|
|||||||
m_events.erase(iter);
|
m_events.erase(iter);
|
||||||
iter = m_events.begin();
|
iter = m_events.begin();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_EventManager::removeTypeEvents(GHOST_TEventType type, GHOST_IWindow* window)
|
void GHOST_EventManager::removeTypeEvents(GHOST_TEventType type, GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
TEventStack::iterator iter;
|
TEventStack::iterator iter;
|
||||||
iter = m_events.begin();
|
iter = m_events.begin();
|
||||||
while (iter != m_events.end())
|
while (iter != m_events.end())
|
||||||
{
|
{
|
||||||
GHOST_IEvent* event = *iter;
|
GHOST_IEvent *event = *iter;
|
||||||
if ((event->getType() == type) && (!window || (event->getWindow() == window)))
|
if ((event->getType() == type) && (!window || (event->getWindow() == window)))
|
||||||
{
|
{
|
||||||
GHOST_PRINT("GHOST_EventManager::removeTypeEvents(): removing event\n");
|
GHOST_PRINT("GHOST_EventManager::removeTypeEvents(): removing event\n");
|
||||||
@@ -238,17 +236,16 @@ void GHOST_EventManager::removeTypeEvents(GHOST_TEventType type, GHOST_IWindow*
|
|||||||
m_events.erase(iter);
|
m_events.erase(iter);
|
||||||
iter = m_events.begin();
|
iter = m_events.begin();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_IEvent* GHOST_EventManager::popEvent()
|
GHOST_IEvent *GHOST_EventManager::popEvent()
|
||||||
{
|
{
|
||||||
GHOST_IEvent* event = peekEvent();
|
GHOST_IEvent *event = peekEvent();
|
||||||
if (event) {
|
if (event) {
|
||||||
m_events.pop_back();
|
m_events.pop_back();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public:
|
|||||||
* Do not delete the event!
|
* Do not delete the event!
|
||||||
* @return The event at the top of the stack.
|
* @return The event at the top of the stack.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_IEvent* peekEvent();
|
virtual GHOST_IEvent *peekEvent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pushes an event on the stack.
|
* Pushes an event on the stack.
|
||||||
@@ -86,13 +86,13 @@ public:
|
|||||||
* Do not delete the event!
|
* Do not delete the event!
|
||||||
* @param event The event to push on the stack.
|
* @param event The event to push on the stack.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess pushEvent(GHOST_IEvent* event);
|
virtual GHOST_TSuccess pushEvent(GHOST_IEvent *event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches the given event directly, bypassing the event stack.
|
* Dispatches the given event directly, bypassing the event stack.
|
||||||
* @return Indication as to whether any of the consumers handled the event.
|
* @return Indication as to whether any of the consumers handled the event.
|
||||||
*/
|
*/
|
||||||
virtual bool dispatchEvent(GHOST_IEvent* event);
|
virtual bool dispatchEvent(GHOST_IEvent *event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches the event at the back of the stack.
|
* Dispatches the event at the back of the stack.
|
||||||
@@ -113,14 +113,14 @@ public:
|
|||||||
* @param consumer The consumer added to the list.
|
* @param consumer The consumer added to the list.
|
||||||
* @return Indication as to whether addition has succeeded.
|
* @return Indication as to whether addition has succeeded.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess addConsumer(GHOST_IEventConsumer* consumer);
|
virtual GHOST_TSuccess addConsumer(GHOST_IEventConsumer *consumer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a consumer from the list of event consumers.
|
* Removes a consumer from the list of event consumers.
|
||||||
* @param consumer The consumer removed from the list.
|
* @param consumer The consumer removed from the list.
|
||||||
* @return Indication as to whether removal has succeeded.
|
* @return Indication as to whether removal has succeeded.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess removeConsumer(GHOST_IEventConsumer* consumer);
|
virtual GHOST_TSuccess removeConsumer(GHOST_IEventConsumer *consumer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all events for a window from the stack.
|
* Removes all events for a window from the stack.
|
||||||
@@ -128,7 +128,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
removeWindowEvents(
|
removeWindowEvents(
|
||||||
GHOST_IWindow* window
|
GHOST_IWindow *window
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,7 +141,7 @@ public:
|
|||||||
virtual void
|
virtual void
|
||||||
removeTypeEvents(
|
removeTypeEvents(
|
||||||
GHOST_TEventType type,
|
GHOST_TEventType type,
|
||||||
GHOST_IWindow* window = 0
|
GHOST_IWindow *window = 0
|
||||||
);
|
);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -150,7 +150,7 @@ protected:
|
|||||||
* Delete the event after use!
|
* Delete the event after use!
|
||||||
* @return The event at the top of the stack.
|
* @return The event at the top of the stack.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_IEvent* popEvent();
|
virtual GHOST_IEvent *popEvent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all events from the stack.
|
* Removes all events from the stack.
|
||||||
@@ -158,13 +158,13 @@ protected:
|
|||||||
virtual void disposeEvents();
|
virtual void disposeEvents();
|
||||||
|
|
||||||
/** A stack with events. */
|
/** A stack with events. */
|
||||||
typedef std::deque<GHOST_IEvent*> TEventStack;
|
typedef std::deque<GHOST_IEvent *> TEventStack;
|
||||||
|
|
||||||
/** The event stack. */
|
/** The event stack. */
|
||||||
std::deque<GHOST_IEvent*> m_events;
|
std::deque<GHOST_IEvent *> m_events;
|
||||||
|
|
||||||
/** A vector with event consumers. */
|
/** A vector with event consumers. */
|
||||||
typedef std::vector<GHOST_IEventConsumer*> TConsumerVector;
|
typedef std::vector<GHOST_IEventConsumer *> TConsumerVector;
|
||||||
|
|
||||||
/** The list with event consumers. */
|
/** The list with event consumers. */
|
||||||
TConsumerVector m_consumers;
|
TConsumerVector m_consumers;
|
||||||
|
|||||||
@@ -32,31 +32,30 @@
|
|||||||
|
|
||||||
|
|
||||||
class GHOST_EventNDOFMotion : public GHOST_Event
|
class GHOST_EventNDOFMotion : public GHOST_Event
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
GHOST_TEventNDOFMotionData m_axisData;
|
GHOST_TEventNDOFMotionData m_axisData;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GHOST_EventNDOFMotion(GHOST_TUns64 time, GHOST_IWindow* window)
|
GHOST_EventNDOFMotion(GHOST_TUns64 time, GHOST_IWindow *window)
|
||||||
: GHOST_Event(time, GHOST_kEventNDOFMotion, window)
|
: GHOST_Event(time, GHOST_kEventNDOFMotion, window)
|
||||||
{
|
{
|
||||||
m_data = &m_axisData;
|
m_data = &m_axisData;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class GHOST_EventNDOFButton : public GHOST_Event
|
class GHOST_EventNDOFButton : public GHOST_Event
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
GHOST_TEventNDOFButtonData m_buttonData;
|
GHOST_TEventNDOFButtonData m_buttonData;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GHOST_EventNDOFButton(GHOST_TUns64 time, GHOST_IWindow* window)
|
GHOST_EventNDOFButton(GHOST_TUns64 time, GHOST_IWindow *window)
|
||||||
: GHOST_Event(time, GHOST_kEventNDOFButton, window)
|
: GHOST_Event(time, GHOST_kEventNDOFButton, window)
|
||||||
{
|
{
|
||||||
m_data = &m_buttonData;
|
m_data = &m_buttonData;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // __GHOST_EVENTNDOF_H__
|
#endif // __GHOST_EVENTNDOF_H__
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event)
|
bool GHOST_EventPrinter::processEvent(GHOST_IEvent *event)
|
||||||
{
|
{
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
|
|
||||||
@@ -54,43 +54,43 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event)
|
|||||||
|
|
||||||
case GHOST_kEventButtonUp:
|
case GHOST_kEventButtonUp:
|
||||||
{
|
{
|
||||||
GHOST_TEventButtonData* buttonData = (GHOST_TEventButtonData*)((GHOST_IEvent*)event)->getData();
|
GHOST_TEventButtonData *buttonData = (GHOST_TEventButtonData *)((GHOST_IEvent *)event)->getData();
|
||||||
std::cout << "GHOST_kEventCursorButtonUp, button: " << buttonData->button;
|
std::cout << "GHOST_kEventCursorButtonUp, button: " << buttonData->button;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GHOST_kEventButtonDown:
|
case GHOST_kEventButtonDown:
|
||||||
{
|
{
|
||||||
GHOST_TEventButtonData* buttonData = (GHOST_TEventButtonData*)((GHOST_IEvent*)event)->getData();
|
GHOST_TEventButtonData *buttonData = (GHOST_TEventButtonData *)((GHOST_IEvent *)event)->getData();
|
||||||
std::cout << "GHOST_kEventButtonDown, button: " << buttonData->button;
|
std::cout << "GHOST_kEventButtonDown, button: " << buttonData->button;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GHOST_kEventWheel:
|
case GHOST_kEventWheel:
|
||||||
{
|
{
|
||||||
GHOST_TEventWheelData* wheelData = (GHOST_TEventWheelData*)((GHOST_IEvent*)event)->getData();
|
GHOST_TEventWheelData *wheelData = (GHOST_TEventWheelData *)((GHOST_IEvent *)event)->getData();
|
||||||
std::cout << "GHOST_kEventWheel, z: " << wheelData->z;
|
std::cout << "GHOST_kEventWheel, z: " << wheelData->z;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GHOST_kEventCursorMove:
|
case GHOST_kEventCursorMove:
|
||||||
{
|
{
|
||||||
GHOST_TEventCursorData* cursorData = (GHOST_TEventCursorData*)((GHOST_IEvent*)event)->getData();
|
GHOST_TEventCursorData *cursorData = (GHOST_TEventCursorData *)((GHOST_IEvent *)event)->getData();
|
||||||
std::cout << "GHOST_kEventCursorMove, (x,y): (" << cursorData->x << "," << cursorData->y << ")";
|
std::cout << "GHOST_kEventCursorMove, (x,y): (" << cursorData->x << "," << cursorData->y << ")";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GHOST_kEventKeyUp:
|
case GHOST_kEventKeyUp:
|
||||||
{
|
{
|
||||||
GHOST_TEventKeyData* keyData = (GHOST_TEventKeyData*)((GHOST_IEvent*)event)->getData();
|
GHOST_TEventKeyData *keyData = (GHOST_TEventKeyData *)((GHOST_IEvent *)event)->getData();
|
||||||
char str[32]= {'\0'};
|
char str[32] = {'\0'};
|
||||||
getKeyString(keyData->key, str);
|
getKeyString(keyData->key, str);
|
||||||
std::cout << "GHOST_kEventKeyUp, key: " << str;
|
std::cout << "GHOST_kEventKeyUp, key: " << str;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GHOST_kEventKeyDown:
|
case GHOST_kEventKeyDown:
|
||||||
{
|
{
|
||||||
GHOST_TEventKeyData* keyData = (GHOST_TEventKeyData*)((GHOST_IEvent*)event)->getData();
|
GHOST_TEventKeyData *keyData = (GHOST_TEventKeyData *)((GHOST_IEvent *)event)->getData();
|
||||||
char str[32]= {'\0'};
|
char str[32] = {'\0'};
|
||||||
getKeyString(keyData->key, str);
|
getKeyString(keyData->key, str);
|
||||||
std::cout << "GHOST_kEventKeyDown, key: " << str;
|
std::cout << "GHOST_kEventKeyDown, key: " << str;
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event)
|
|||||||
|
|
||||||
case GHOST_kEventDraggingEntered:
|
case GHOST_kEventDraggingEntered:
|
||||||
{
|
{
|
||||||
GHOST_TEventDragnDropData* dragnDropData = (GHOST_TEventDragnDropData*)((GHOST_IEvent*)event)->getData();
|
GHOST_TEventDragnDropData *dragnDropData = (GHOST_TEventDragnDropData *)((GHOST_IEvent *)event)->getData();
|
||||||
std::cout << "GHOST_kEventDraggingEntered, dragged object type : " << dragnDropData->dataType;
|
std::cout << "GHOST_kEventDraggingEntered, dragged object type : " << dragnDropData->dataType;
|
||||||
std::cout << " mouse at x=" << dragnDropData->x << " y=" << dragnDropData->y;
|
std::cout << " mouse at x=" << dragnDropData->x << " y=" << dragnDropData->y;
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event)
|
|||||||
|
|
||||||
case GHOST_kEventDraggingUpdated:
|
case GHOST_kEventDraggingUpdated:
|
||||||
{
|
{
|
||||||
GHOST_TEventDragnDropData* dragnDropData = (GHOST_TEventDragnDropData*)((GHOST_IEvent*)event)->getData();
|
GHOST_TEventDragnDropData *dragnDropData = (GHOST_TEventDragnDropData *)((GHOST_IEvent *)event)->getData();
|
||||||
std::cout << "GHOST_kEventDraggingUpdated, dragged object type : " << dragnDropData->dataType;
|
std::cout << "GHOST_kEventDraggingUpdated, dragged object type : " << dragnDropData->dataType;
|
||||||
std::cout << " mouse at x=" << dragnDropData->x << " y=" << dragnDropData->y;
|
std::cout << " mouse at x=" << dragnDropData->x << " y=" << dragnDropData->y;
|
||||||
}
|
}
|
||||||
@@ -114,29 +114,29 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event)
|
|||||||
|
|
||||||
case GHOST_kEventDraggingExited:
|
case GHOST_kEventDraggingExited:
|
||||||
{
|
{
|
||||||
GHOST_TEventDragnDropData* dragnDropData = (GHOST_TEventDragnDropData*)((GHOST_IEvent*)event)->getData();
|
GHOST_TEventDragnDropData *dragnDropData = (GHOST_TEventDragnDropData *)((GHOST_IEvent *)event)->getData();
|
||||||
std::cout << "GHOST_kEventDraggingExited, dragged object type : " << dragnDropData->dataType;
|
std::cout << "GHOST_kEventDraggingExited, dragged object type : " << dragnDropData->dataType;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GHOST_kEventDraggingDropDone:
|
case GHOST_kEventDraggingDropDone:
|
||||||
{
|
{
|
||||||
GHOST_TEventDragnDropData* dragnDropData = (GHOST_TEventDragnDropData*)((GHOST_IEvent*)event)->getData();
|
GHOST_TEventDragnDropData *dragnDropData = (GHOST_TEventDragnDropData *)((GHOST_IEvent *)event)->getData();
|
||||||
std::cout << "GHOST_kEventDraggingDropDone,";
|
std::cout << "GHOST_kEventDraggingDropDone,";
|
||||||
std::cout << " mouse at x=" << dragnDropData->x << " y=" << dragnDropData->y;
|
std::cout << " mouse at x=" << dragnDropData->x << " y=" << dragnDropData->y;
|
||||||
switch (dragnDropData->dataType) {
|
switch (dragnDropData->dataType) {
|
||||||
case GHOST_kDragnDropTypeString:
|
case GHOST_kDragnDropTypeString:
|
||||||
std::cout << " type : GHOST_kDragnDropTypeString,";
|
std::cout << " type : GHOST_kDragnDropTypeString,";
|
||||||
std::cout << "\n String received = " << (char*)dragnDropData->data;
|
std::cout << "\n String received = " << (char *)dragnDropData->data;
|
||||||
break;
|
break;
|
||||||
case GHOST_kDragnDropTypeFilenames:
|
case GHOST_kDragnDropTypeFilenames:
|
||||||
{
|
{
|
||||||
GHOST_TStringArray *strArray = (GHOST_TStringArray*)dragnDropData->data;
|
GHOST_TStringArray *strArray = (GHOST_TStringArray *)dragnDropData->data;
|
||||||
int i;
|
int i;
|
||||||
std::cout << " type : GHOST_kDragnDropTypeFilenames,";
|
std::cout << " type : GHOST_kDragnDropTypeFilenames,";
|
||||||
std::cout << "\n Received " << strArray->count << " filename" << (strArray->count > 1 ? "s:" : ":");
|
std::cout << "\n Received " << strArray->count << " filename" << (strArray->count > 1 ? "s:" : ":");
|
||||||
for (i=0;i<strArray->count;i++)
|
for (i = 0; i < strArray->count; i++)
|
||||||
std::cout << "\n File[" << i << "] : " << strArray->strings[i];
|
std::cout << "\n File["<< i << "] : " << strArray->strings[i];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -147,10 +147,10 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event)
|
|||||||
|
|
||||||
case GHOST_kEventOpenMainFile:
|
case GHOST_kEventOpenMainFile:
|
||||||
{
|
{
|
||||||
GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData();
|
GHOST_TEventDataPtr eventData = ((GHOST_IEvent *)event)->getData();
|
||||||
|
|
||||||
if (eventData)
|
if (eventData)
|
||||||
std::cout << "GHOST_kEventOpenMainFile for path : " << (char*)eventData;
|
std::cout << "GHOST_kEventOpenMainFile for path : " << (char *)eventData;
|
||||||
else
|
else
|
||||||
std::cout << "GHOST_kEventOpenMainFile with no path specified!!";
|
std::cout << "GHOST_kEventOpenMainFile with no path specified!!";
|
||||||
}
|
}
|
||||||
@@ -187,20 +187,25 @@ void GHOST_EventPrinter::getKeyString(GHOST_TKey key, char str[32]) const
|
|||||||
{
|
{
|
||||||
if ((key >= GHOST_kKeyComma) && (key <= GHOST_kKeyRightBracket)) {
|
if ((key >= GHOST_kKeyComma) && (key <= GHOST_kKeyRightBracket)) {
|
||||||
sprintf(str, "%c", (char)key);
|
sprintf(str, "%c", (char)key);
|
||||||
} else if ((key >= GHOST_kKeyNumpad0) && (key <= GHOST_kKeyNumpad9)) {
|
}
|
||||||
|
else if ((key >= GHOST_kKeyNumpad0) && (key <= GHOST_kKeyNumpad9)) {
|
||||||
sprintf(str, "Numpad %d", (key - GHOST_kKeyNumpad0));
|
sprintf(str, "Numpad %d", (key - GHOST_kKeyNumpad0));
|
||||||
#if defined(__sun__) || defined(__sun)
|
#if defined(__sun__) || defined(__sun)
|
||||||
} else if (key == 268828432) { /* solaris keyboards are messed up */
|
}
|
||||||
|
else if (key == 268828432) { /* solaris keyboards are messed up */
|
||||||
/* This should really test XK_F11 but that doesn't work */
|
/* This should really test XK_F11 but that doesn't work */
|
||||||
strcpy(str, "F11");
|
strcpy(str, "F11");
|
||||||
} else if (key == 268828433) { /* solaris keyboards are messed up */
|
}
|
||||||
|
else if (key == 268828433) { /* solaris keyboards are messed up */
|
||||||
/* This should really test XK_F12 but that doesn't work */
|
/* This should really test XK_F12 but that doesn't work */
|
||||||
strcpy(str, "F12");
|
strcpy(str, "F12");
|
||||||
#endif
|
#endif
|
||||||
} else if ((key >= GHOST_kKeyF1) && (key <= GHOST_kKeyF24)) {
|
}
|
||||||
|
else if ((key >= GHOST_kKeyF1) && (key <= GHOST_kKeyF24)) {
|
||||||
sprintf(str, "F%d", key - GHOST_kKeyF1 + 1);
|
sprintf(str, "F%d", key - GHOST_kKeyF1 + 1);
|
||||||
} else {
|
}
|
||||||
const char *tstr= NULL;
|
else {
|
||||||
|
const char *tstr = NULL;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case GHOST_kKeyBackSpace:
|
case GHOST_kKeyBackSpace:
|
||||||
tstr = "BackSpace";
|
tstr = "BackSpace";
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
* @param event The event that can be handled or not.
|
* @param event The event that can be handled or not.
|
||||||
* @return Indication as to whether the event was handled.
|
* @return Indication as to whether the event was handled.
|
||||||
*/
|
*/
|
||||||
virtual bool processEvent(GHOST_IEvent* event);
|
virtual bool processEvent(GHOST_IEvent *event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -51,8 +51,9 @@ public:
|
|||||||
* @param window The generating window (or NULL if system event).
|
* @param window The generating window (or NULL if system event).
|
||||||
* @param data_ptr Pointer to the (unformatted) data associated with the event
|
* @param data_ptr Pointer to the (unformatted) data associated with the event
|
||||||
*/
|
*/
|
||||||
GHOST_EventString(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow* window, GHOST_TEventDataPtr data_ptr)
|
GHOST_EventString(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow *window, GHOST_TEventDataPtr data_ptr)
|
||||||
: GHOST_Event(msec, type, window) {
|
: GHOST_Event(msec, type, window)
|
||||||
|
{
|
||||||
m_data = data_ptr;
|
m_data = data_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
* @param y The y-delta of the pan event.
|
* @param y The y-delta of the pan event.
|
||||||
*/
|
*/
|
||||||
GHOST_EventTrackpad(GHOST_TUns64 msec,
|
GHOST_EventTrackpad(GHOST_TUns64 msec,
|
||||||
GHOST_IWindow* window,
|
GHOST_IWindow *window,
|
||||||
GHOST_TTrackpadEventSubTypes subtype,
|
GHOST_TTrackpadEventSubTypes subtype,
|
||||||
GHOST_TInt32 x, GHOST_TInt32 y,
|
GHOST_TInt32 x, GHOST_TInt32 y,
|
||||||
GHOST_TInt32 deltaX, GHOST_TInt32 deltaY)
|
GHOST_TInt32 deltaX, GHOST_TInt32 deltaY)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
* @param type The type of this event.
|
* @param type The type of this event.
|
||||||
* @param z The displacement of the mouse wheel.
|
* @param z The displacement of the mouse wheel.
|
||||||
*/
|
*/
|
||||||
GHOST_EventWheel(GHOST_TUns64 msec, GHOST_IWindow* window, GHOST_TInt32 z)
|
GHOST_EventWheel(GHOST_TUns64 msec, GHOST_IWindow *window, GHOST_TInt32 z)
|
||||||
: GHOST_Event(msec, GHOST_kEventWheel, window)
|
: GHOST_Event(msec, GHOST_kEventWheel, window)
|
||||||
{
|
{
|
||||||
m_wheelEventData.z = z;
|
m_wheelEventData.z = z;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
GHOST_ISystem* GHOST_ISystem::m_system = 0;
|
GHOST_ISystem *GHOST_ISystem::m_system = 0;
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_ISystem::createSystem()
|
GHOST_TSuccess GHOST_ISystem::createSystem()
|
||||||
@@ -70,16 +70,16 @@ GHOST_TSuccess GHOST_ISystem::createSystem()
|
|||||||
#elif defined(WITH_GHOST_SDL)
|
#elif defined(WITH_GHOST_SDL)
|
||||||
m_system = new GHOST_SystemSDL();
|
m_system = new GHOST_SystemSDL();
|
||||||
#elif defined(WIN32)
|
#elif defined(WIN32)
|
||||||
m_system = new GHOST_SystemWin32 ();
|
m_system = new GHOST_SystemWin32();
|
||||||
#else
|
#else
|
||||||
# ifdef __APPLE__
|
# ifdef __APPLE__
|
||||||
# ifdef GHOST_COCOA
|
# ifdef GHOST_COCOA
|
||||||
m_system = new GHOST_SystemCocoa ();
|
m_system = new GHOST_SystemCocoa();
|
||||||
# else
|
# else
|
||||||
m_system = new GHOST_SystemCarbon ();
|
m_system = new GHOST_SystemCarbon();
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
m_system = new GHOST_SystemX11 ();
|
m_system = new GHOST_SystemX11();
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
success = m_system != 0 ? GHOST_kSuccess : GHOST_kFailure;
|
success = m_system != 0 ? GHOST_kSuccess : GHOST_kFailure;
|
||||||
@@ -107,7 +107,7 @@ GHOST_TSuccess GHOST_ISystem::disposeSystem()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_ISystem* GHOST_ISystem::getSystem()
|
GHOST_ISystem *GHOST_ISystem::getSystem()
|
||||||
{
|
{
|
||||||
return m_system;
|
return m_system;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
GHOST_ISystemPaths* GHOST_ISystemPaths::m_systemPaths = 0;
|
GHOST_ISystemPaths *GHOST_ISystemPaths::m_systemPaths = 0;
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_ISystemPaths::create()
|
GHOST_TSuccess GHOST_ISystemPaths::create()
|
||||||
@@ -62,16 +62,16 @@ GHOST_TSuccess GHOST_ISystemPaths::create()
|
|||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
if (!m_systemPaths) {
|
if (!m_systemPaths) {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
m_systemPaths = new GHOST_SystemPathsWin32 ();
|
m_systemPaths = new GHOST_SystemPathsWin32();
|
||||||
#else
|
#else
|
||||||
# ifdef __APPLE__
|
# ifdef __APPLE__
|
||||||
# ifdef GHOST_COCOA
|
# ifdef GHOST_COCOA
|
||||||
m_systemPaths = new GHOST_SystemPathsCocoa ();
|
m_systemPaths = new GHOST_SystemPathsCocoa();
|
||||||
# else
|
# else
|
||||||
m_systemPaths = new GHOST_SystemPathsCarbon ();
|
m_systemPaths = new GHOST_SystemPathsCarbon();
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
m_systemPaths = new GHOST_SystemPathsX11 ();
|
m_systemPaths = new GHOST_SystemPathsX11();
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
success = m_systemPaths != 0 ? GHOST_kSuccess : GHOST_kFailure;
|
success = m_systemPaths != 0 ? GHOST_kSuccess : GHOST_kFailure;
|
||||||
@@ -95,7 +95,7 @@ GHOST_TSuccess GHOST_ISystemPaths::dispose()
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_ISystemPaths* GHOST_ISystemPaths::get()
|
GHOST_ISystemPaths *GHOST_ISystemPaths::get()
|
||||||
{
|
{
|
||||||
if (!m_systemPaths) {
|
if (!m_systemPaths) {
|
||||||
create();
|
create();
|
||||||
|
|||||||
@@ -41,8 +41,7 @@
|
|||||||
* @author Maarten Gribnau
|
* @author Maarten Gribnau
|
||||||
* @date May 17, 2001
|
* @date May 17, 2001
|
||||||
*/
|
*/
|
||||||
struct GHOST_ModifierKeys
|
struct GHOST_ModifierKeys {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -32,12 +32,12 @@
|
|||||||
|
|
||||||
#ifdef DEBUG_NDOF_MOTION
|
#ifdef DEBUG_NDOF_MOTION
|
||||||
// printable version of each GHOST_TProgress value
|
// printable version of each GHOST_TProgress value
|
||||||
static const char* progress_string[] =
|
static const char *progress_string[] =
|
||||||
{"not started","starting","in progress","finishing","finished"};
|
{"not started", "starting", "in progress", "finishing", "finished"};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_NDOF_BUTTONS
|
#ifdef DEBUG_NDOF_BUTTONS
|
||||||
static const char* ndof_button_names[] = {
|
static const char *ndof_button_names[] = {
|
||||||
// used internally, never sent
|
// used internally, never sent
|
||||||
"NDOF_BUTTON_NONE",
|
"NDOF_BUTTON_NONE",
|
||||||
// these two are available from any 3Dconnexion device
|
// these two are available from any 3Dconnexion device
|
||||||
@@ -309,13 +309,13 @@ void GHOST_NDOFManager::updateRotation(short r[3], GHOST_TUns64 time)
|
|||||||
m_motionEventPending = true;
|
m_motionEventPending = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button, bool press, GHOST_TUns64 time, GHOST_IWindow* window)
|
void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button, bool press, GHOST_TUns64 time, GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
GHOST_ASSERT(button > NDOF_BUTTON_NONE && button < NDOF_BUTTON_LAST,
|
GHOST_ASSERT(button > NDOF_BUTTON_NONE && button < NDOF_BUTTON_LAST,
|
||||||
"rogue button trying to escape NDOF manager");
|
"rogue button trying to escape NDOF manager");
|
||||||
|
|
||||||
GHOST_EventNDOFButton* event = new GHOST_EventNDOFButton(time, window);
|
GHOST_EventNDOFButton *event = new GHOST_EventNDOFButton(time, window);
|
||||||
GHOST_TEventNDOFButtonData* data = (GHOST_TEventNDOFButtonData*) event->getData();
|
GHOST_TEventNDOFButtonData *data = (GHOST_TEventNDOFButtonData *) event->getData();
|
||||||
|
|
||||||
data->action = press ? GHOST_kPress : GHOST_kRelease;
|
data->action = press ? GHOST_kPress : GHOST_kRelease;
|
||||||
data->button = button;
|
data->button = button;
|
||||||
@@ -327,10 +327,10 @@ void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button, bool press, GHOST_T
|
|||||||
m_system.pushEvent(event);
|
m_system.pushEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key, bool press, GHOST_TUns64 time, GHOST_IWindow* window)
|
void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key, bool press, GHOST_TUns64 time, GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
GHOST_TEventType type = press ? GHOST_kEventKeyDown : GHOST_kEventKeyUp;
|
GHOST_TEventType type = press ? GHOST_kEventKeyDown : GHOST_kEventKeyUp;
|
||||||
GHOST_EventKey* event = new GHOST_EventKey(time, type, window, key);
|
GHOST_EventKey *event = new GHOST_EventKey(time, type, window, key);
|
||||||
|
|
||||||
#ifdef DEBUG_NDOF_BUTTONS
|
#ifdef DEBUG_NDOF_BUTTONS
|
||||||
printf("keyboard %s\n", press ? "down" : "up");
|
printf("keyboard %s\n", press ? "down" : "up");
|
||||||
@@ -341,7 +341,7 @@ void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key, bool press, GHOST_TUns64 ti
|
|||||||
|
|
||||||
void GHOST_NDOFManager::updateButton(int button_number, bool press, GHOST_TUns64 time)
|
void GHOST_NDOFManager::updateButton(int button_number, bool press, GHOST_TUns64 time)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = m_system.getWindowManager()->getActiveWindow();
|
GHOST_IWindow *window = m_system.getWindowManager()->getActiveWindow();
|
||||||
|
|
||||||
#ifdef DEBUG_NDOF_BUTTONS
|
#ifdef DEBUG_NDOF_BUTTONS
|
||||||
printf("ndof: button %d -> ", button_number);
|
printf("ndof: button %d -> ", button_number);
|
||||||
@@ -403,14 +403,14 @@ void GHOST_NDOFManager::setDeadZone(float dz)
|
|||||||
GHOST_PRINTF("ndof: dead zone set to %.2f\n", dz);
|
GHOST_PRINTF("ndof: dead zone set to %.2f\n", dz);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool atHomePosition(GHOST_TEventNDOFMotionData* ndof)
|
static bool atHomePosition(GHOST_TEventNDOFMotionData *ndof)
|
||||||
{
|
{
|
||||||
#define HOME(foo) (ndof->foo == 0.f)
|
#define HOME(foo) (ndof->foo == 0.f)
|
||||||
return HOME(tx) && HOME(ty) && HOME(tz) && HOME(rx) && HOME(ry) && HOME(rz);
|
return HOME(tx) && HOME(ty) && HOME(tz) && HOME(rx) && HOME(ry) && HOME(rz);
|
||||||
#undef HOME
|
#undef HOME
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool nearHomePosition(GHOST_TEventNDOFMotionData* ndof, float threshold)
|
static bool nearHomePosition(GHOST_TEventNDOFMotionData *ndof, float threshold)
|
||||||
{
|
{
|
||||||
if (threshold == 0.f) {
|
if (threshold == 0.f) {
|
||||||
return atHomePosition(ndof);
|
return atHomePosition(ndof);
|
||||||
@@ -429,14 +429,14 @@ bool GHOST_NDOFManager::sendMotionEvent()
|
|||||||
|
|
||||||
m_motionEventPending = false; // any pending motion is handled right now
|
m_motionEventPending = false; // any pending motion is handled right now
|
||||||
|
|
||||||
GHOST_IWindow* window = m_system.getWindowManager()->getActiveWindow();
|
GHOST_IWindow *window = m_system.getWindowManager()->getActiveWindow();
|
||||||
|
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
return false; // delivery will fail, so don't bother sending
|
return false; // delivery will fail, so don't bother sending
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_EventNDOFMotion* event = new GHOST_EventNDOFMotion(m_motionTime, window);
|
GHOST_EventNDOFMotion *event = new GHOST_EventNDOFMotion(m_motionTime, window);
|
||||||
GHOST_TEventNDOFMotionData* data = (GHOST_TEventNDOFMotionData*) event->getData();
|
GHOST_TEventNDOFMotionData *data = (GHOST_TEventNDOFMotionData *) event->getData();
|
||||||
|
|
||||||
// scale axis values here to normalize them to around +/- 1
|
// scale axis values here to normalize them to around +/- 1
|
||||||
// they are scaled again for overall sensitivity in the WM based on user prefs
|
// they are scaled again for overall sensitivity in the WM based on user prefs
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ typedef enum {
|
|||||||
NDOF_Spaceball5000,
|
NDOF_Spaceball5000,
|
||||||
NDOF_SpaceTraveler
|
NDOF_SpaceTraveler
|
||||||
|
|
||||||
} NDOF_DeviceT;
|
} NDOF_DeviceT;
|
||||||
|
|
||||||
// NDOF device button event types
|
// NDOF device button event types
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -100,7 +100,7 @@ typedef enum {
|
|||||||
NDOF_BUTTON_C,
|
NDOF_BUTTON_C,
|
||||||
// the end
|
// the end
|
||||||
NDOF_BUTTON_LAST
|
NDOF_BUTTON_LAST
|
||||||
} NDOF_ButtonT;
|
} NDOF_ButtonT;
|
||||||
|
|
||||||
class GHOST_NDOFManager
|
class GHOST_NDOFManager
|
||||||
{
|
{
|
||||||
@@ -149,13 +149,13 @@ protected:
|
|||||||
GHOST_System& m_system;
|
GHOST_System& m_system;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void sendButtonEvent(NDOF_ButtonT, bool press, GHOST_TUns64 time, GHOST_IWindow*);
|
void sendButtonEvent(NDOF_ButtonT, bool press, GHOST_TUns64 time, GHOST_IWindow *);
|
||||||
void sendKeyEvent(GHOST_TKey, bool press, GHOST_TUns64 time, GHOST_IWindow*);
|
void sendKeyEvent(GHOST_TKey, bool press, GHOST_TUns64 time, GHOST_IWindow *);
|
||||||
|
|
||||||
NDOF_DeviceT m_deviceType;
|
NDOF_DeviceT m_deviceType;
|
||||||
int m_buttonCount;
|
int m_buttonCount;
|
||||||
int m_buttonMask;
|
int m_buttonMask;
|
||||||
const NDOF_ButtonT* m_hidMap;
|
const NDOF_ButtonT *m_hidMap;
|
||||||
|
|
||||||
short m_translation[3];
|
short m_translation[3];
|
||||||
short m_rotation[3];
|
short m_rotation[3];
|
||||||
|
|||||||
@@ -45,27 +45,27 @@ GHOST_TSuccess GHOST_DisposeSystemPaths(void)
|
|||||||
return GHOST_ISystemPaths::dispose();
|
return GHOST_ISystemPaths::dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8* GHOST_getSystemDir()
|
const GHOST_TUns8 *GHOST_getSystemDir(int version, const char *versionstr)
|
||||||
{
|
{
|
||||||
GHOST_ISystemPaths* systemPaths = GHOST_ISystemPaths::get();
|
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
|
||||||
return systemPaths ? systemPaths->getSystemDir() : 0;
|
return systemPaths ? systemPaths->getSystemDir(version, versionstr) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8* GHOST_getUserDir()
|
const GHOST_TUns8 *GHOST_getUserDir(int version, const char *versionstr)
|
||||||
{
|
{
|
||||||
GHOST_ISystemPaths* systemPaths = GHOST_ISystemPaths::get();
|
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
|
||||||
return systemPaths ? systemPaths->getUserDir() : 0; /* shouldn't be NULL */
|
return systemPaths ? systemPaths->getUserDir(version, versionstr) : 0; /* shouldn't be NULL */
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8* GHOST_getBinaryDir()
|
const GHOST_TUns8 *GHOST_getBinaryDir()
|
||||||
{
|
{
|
||||||
GHOST_ISystemPaths* systemPaths = GHOST_ISystemPaths::get();
|
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
|
||||||
return systemPaths ? systemPaths->getBinaryDir() : 0; /* shouldn't be NULL */
|
return systemPaths ? systemPaths->getBinaryDir() : 0; /* shouldn't be NULL */
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_addToSystemRecentFiles(const char* filename)
|
void GHOST_addToSystemRecentFiles(const char *filename)
|
||||||
{
|
{
|
||||||
GHOST_ISystemPaths* systemPaths = GHOST_ISystemPaths::get();
|
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
|
||||||
if (systemPaths) {
|
if (systemPaths) {
|
||||||
systemPaths->addToSystemRecentFiles(filename);
|
systemPaths->addToSystemRecentFiles(filename);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,10 +97,10 @@ GHOST_TVisibility GHOST_Rect::getVisibility(GHOST_Rect& r) const
|
|||||||
|
|
||||||
void GHOST_Rect::setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy)
|
void GHOST_Rect::setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy)
|
||||||
{
|
{
|
||||||
GHOST_TInt32 offset = cx - (m_l + (m_r - m_l)/2);
|
GHOST_TInt32 offset = cx - (m_l + (m_r - m_l) / 2);
|
||||||
m_l += offset;
|
m_l += offset;
|
||||||
m_r += offset;
|
m_r += offset;
|
||||||
offset = cy - (m_t + (m_b - m_t)/2);
|
offset = cy - (m_t + (m_b - m_t) / 2);
|
||||||
m_t += offset;
|
m_t += offset;
|
||||||
m_b += offset;
|
m_b += offset;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,13 +73,13 @@ GHOST_TUns64 GHOST_System::getMilliSeconds() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_ITimerTask* GHOST_System::installTimer(GHOST_TUns64 delay,
|
GHOST_ITimerTask *GHOST_System::installTimer(GHOST_TUns64 delay,
|
||||||
GHOST_TUns64 interval,
|
GHOST_TUns64 interval,
|
||||||
GHOST_TimerProcPtr timerProc,
|
GHOST_TimerProcPtr timerProc,
|
||||||
GHOST_TUserDataPtr userData)
|
GHOST_TUserDataPtr userData)
|
||||||
{
|
{
|
||||||
GHOST_TUns64 millis = getMilliSeconds();
|
GHOST_TUns64 millis = getMilliSeconds();
|
||||||
GHOST_TimerTask* timer = new GHOST_TimerTask(millis+delay, interval, timerProc, userData);
|
GHOST_TimerTask *timer = new GHOST_TimerTask(millis + delay, interval, timerProc, userData);
|
||||||
if (timer) {
|
if (timer) {
|
||||||
if (m_timerManager->addTimer(timer) == GHOST_kSuccess) {
|
if (m_timerManager->addTimer(timer) == GHOST_kSuccess) {
|
||||||
// Check to see whether we need to fire the timer right away
|
// Check to see whether we need to fire the timer right away
|
||||||
@@ -94,17 +94,17 @@ GHOST_ITimerTask* GHOST_System::installTimer(GHOST_TUns64 delay,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_System::removeTimer(GHOST_ITimerTask* timerTask)
|
GHOST_TSuccess GHOST_System::removeTimer(GHOST_ITimerTask *timerTask)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success = GHOST_kFailure;
|
GHOST_TSuccess success = GHOST_kFailure;
|
||||||
if (timerTask) {
|
if (timerTask) {
|
||||||
success = m_timerManager->removeTimer((GHOST_TimerTask*)timerTask);
|
success = m_timerManager->removeTimer((GHOST_TimerTask *)timerTask);
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_System::disposeWindow(GHOST_IWindow* window)
|
GHOST_TSuccess GHOST_System::disposeWindow(GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
|
|
||||||
@@ -132,13 +132,13 @@ GHOST_TSuccess GHOST_System::disposeWindow(GHOST_IWindow* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GHOST_System::validWindow(GHOST_IWindow* window)
|
bool GHOST_System::validWindow(GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
return m_windowManager->getWindowFound(window);
|
return m_windowManager->getWindowFound(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
|
GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window,
|
||||||
const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
|
const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success = GHOST_kFailure;
|
GHOST_TSuccess success = GHOST_kFailure;
|
||||||
@@ -151,7 +151,7 @@ GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting
|
|||||||
success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, setting);
|
success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, setting);
|
||||||
if (success == GHOST_kSuccess) {
|
if (success == GHOST_kSuccess) {
|
||||||
//GHOST_PRINT("GHOST_System::beginFullScreen(): creating full-screen window\n");
|
//GHOST_PRINT("GHOST_System::beginFullScreen(): creating full-screen window\n");
|
||||||
success = createFullScreenWindow((GHOST_Window**)window, stereoVisual, numOfAASamples);
|
success = createFullScreenWindow((GHOST_Window **)window, stereoVisual, numOfAASamples);
|
||||||
if (success == GHOST_kSuccess) {
|
if (success == GHOST_kSuccess) {
|
||||||
m_windowManager->beginFullScreen(*window, stereoVisual);
|
m_windowManager->beginFullScreen(*window, stereoVisual);
|
||||||
}
|
}
|
||||||
@@ -168,11 +168,11 @@ GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_System::updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window)
|
GHOST_TSuccess GHOST_System::updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success = GHOST_kFailure;
|
GHOST_TSuccess success = GHOST_kFailure;
|
||||||
GHOST_ASSERT(m_windowManager, "GHOST_System::updateFullScreen(): invalid window manager");
|
GHOST_ASSERT(m_windowManager, "GHOST_System::updateFullScreen(): invalid window manager");
|
||||||
if(m_displayManager) {
|
if (m_displayManager) {
|
||||||
if (m_windowManager->getFullScreen()) {
|
if (m_windowManager->getFullScreen()) {
|
||||||
success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, setting);
|
success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, setting);
|
||||||
}
|
}
|
||||||
@@ -233,7 +233,7 @@ bool GHOST_System::dispatchEvents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_System::addEventConsumer(GHOST_IEventConsumer* consumer)
|
GHOST_TSuccess GHOST_System::addEventConsumer(GHOST_IEventConsumer *consumer)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
if (m_eventManager) {
|
if (m_eventManager) {
|
||||||
@@ -245,7 +245,7 @@ GHOST_TSuccess GHOST_System::addEventConsumer(GHOST_IEventConsumer* consumer)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_System::removeEventConsumer(GHOST_IEventConsumer* consumer)
|
GHOST_TSuccess GHOST_System::removeEventConsumer(GHOST_IEventConsumer *consumer)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
if (m_eventManager) {
|
if (m_eventManager) {
|
||||||
@@ -257,7 +257,7 @@ GHOST_TSuccess GHOST_System::removeEventConsumer(GHOST_IEventConsumer* consumer)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent* event)
|
GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent *event)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
if (m_eventManager) {
|
if (m_eventManager) {
|
||||||
@@ -296,9 +296,9 @@ GHOST_TSuccess GHOST_System::getButtonState(GHOST_TButtonMask mask, bool& isDown
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_System::init()
|
GHOST_TSuccess GHOST_System::init()
|
||||||
{
|
{
|
||||||
m_timerManager = new GHOST_TimerManager ();
|
m_timerManager = new GHOST_TimerManager();
|
||||||
m_windowManager = new GHOST_WindowManager ();
|
m_windowManager = new GHOST_WindowManager();
|
||||||
m_eventManager = new GHOST_EventManager ();
|
m_eventManager = new GHOST_EventManager();
|
||||||
|
|
||||||
#ifdef GHOST_DEBUG
|
#ifdef GHOST_DEBUG
|
||||||
if (m_eventManager) {
|
if (m_eventManager) {
|
||||||
@@ -309,7 +309,8 @@ GHOST_TSuccess GHOST_System::init()
|
|||||||
|
|
||||||
if (m_timerManager && m_windowManager && m_eventManager) {
|
if (m_timerManager && m_windowManager && m_eventManager) {
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -346,7 +347,7 @@ GHOST_TSuccess GHOST_System::exit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window** window, const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
|
GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window, const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
GHOST_ASSERT(m_displayManager, "GHOST_System::createFullScreenWindow(): invalid display manager")
|
GHOST_ASSERT(m_displayManager, "GHOST_System::createFullScreenWindow(): invalid display manager")
|
||||||
@@ -355,8 +356,8 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window** window, const
|
|||||||
success = m_displayManager->getCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, settings);
|
success = m_displayManager->getCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, settings);
|
||||||
if (success) {
|
if (success) {
|
||||||
//GHOST_PRINT("GHOST_System::createFullScreenWindow(): creating full-screen window\n");
|
//GHOST_PRINT("GHOST_System::createFullScreenWindow(): creating full-screen window\n");
|
||||||
*window = (GHOST_Window*)createWindow(
|
*window = (GHOST_Window *)createWindow(
|
||||||
STR_String (""),
|
STR_String(""),
|
||||||
0, 0, settings.xPixels, settings.yPixels,
|
0, 0, settings.xPixels, settings.yPixels,
|
||||||
GHOST_kWindowStateFullScreen,
|
GHOST_kWindowStateFullScreen,
|
||||||
GHOST_kDrawingContextTypeOpenGL,
|
GHOST_kDrawingContextTypeOpenGL,
|
||||||
@@ -368,7 +369,7 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window** window, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int GHOST_System::confirmQuit(GHOST_IWindow * window) const
|
int GHOST_System::confirmQuit(GHOST_IWindow *window) const
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public:
|
|||||||
* @param userData Placeholder for user data.
|
* @param userData Placeholder for user data.
|
||||||
* @return A timer task (0 if timer task installation failed).
|
* @return A timer task (0 if timer task installation failed).
|
||||||
*/
|
*/
|
||||||
virtual GHOST_ITimerTask* installTimer(GHOST_TUns64 delay,
|
virtual GHOST_ITimerTask *installTimer(GHOST_TUns64 delay,
|
||||||
GHOST_TUns64 interval,
|
GHOST_TUns64 interval,
|
||||||
GHOST_TimerProcPtr timerProc,
|
GHOST_TimerProcPtr timerProc,
|
||||||
GHOST_TUserDataPtr userData = 0);
|
GHOST_TUserDataPtr userData = 0);
|
||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
* @param timerTask Timer task to be removed.
|
* @param timerTask Timer task to be removed.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess removeTimer(GHOST_ITimerTask* timerTask);
|
virtual GHOST_TSuccess removeTimer(GHOST_ITimerTask *timerTask);
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Display/window management functionality
|
** Display/window management functionality
|
||||||
@@ -126,14 +126,14 @@ public:
|
|||||||
* @param window Pointer to the window to be disposed.
|
* @param window Pointer to the window to be disposed.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess disposeWindow(GHOST_IWindow* window);
|
virtual GHOST_TSuccess disposeWindow(GHOST_IWindow *window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether a window is valid.
|
* Returns whether a window is valid.
|
||||||
* @param window Pointer to the window to be checked.
|
* @param window Pointer to the window to be checked.
|
||||||
* @return Indication of validity.
|
* @return Indication of validity.
|
||||||
*/
|
*/
|
||||||
virtual bool validWindow(GHOST_IWindow* window);
|
virtual bool validWindow(GHOST_IWindow *window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Begins full screen mode.
|
* Begins full screen mode.
|
||||||
@@ -143,8 +143,8 @@ public:
|
|||||||
* This window is invalid after full screen has been ended.
|
* This window is invalid after full screen has been ended.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
|
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window,
|
||||||
const bool stereoVisual, const GHOST_TUns16 numOfAASamples=0);
|
const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the resolution while in fullscreen mode.
|
* Updates the resolution while in fullscreen mode.
|
||||||
@@ -153,7 +153,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window);
|
virtual GHOST_TSuccess updateFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ends full screen mode.
|
* Ends full screen mode.
|
||||||
@@ -192,14 +192,14 @@ public:
|
|||||||
* @param consumer The event consumer to add.
|
* @param consumer The event consumer to add.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer* consumer);
|
virtual GHOST_TSuccess addEventConsumer(GHOST_IEventConsumer *consumer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the given event consumer to our list.
|
* Remove the given event consumer to our list.
|
||||||
* @param consumer The event consumer to remove.
|
* @param consumer The event consumer to remove.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer* consumer);
|
virtual GHOST_TSuccess removeEventConsumer(GHOST_IEventConsumer *consumer);
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Cursor management functionality
|
** Cursor management functionality
|
||||||
@@ -240,32 +240,32 @@ public:
|
|||||||
* Do not delete the event!
|
* Do not delete the event!
|
||||||
* @param event The event to push on the stack.
|
* @param event The event to push on the stack.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess pushEvent(GHOST_IEvent* event);
|
virtual GHOST_TSuccess pushEvent(GHOST_IEvent *event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the timer manager.
|
* Returns the timer manager.
|
||||||
* @return The timer manager.
|
* @return The timer manager.
|
||||||
*/
|
*/
|
||||||
inline virtual GHOST_TimerManager* getTimerManager() const;
|
inline virtual GHOST_TimerManager *getTimerManager() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a pointer to our event manager.
|
* Returns a pointer to our event manager.
|
||||||
* @return A pointer to our event manager.
|
* @return A pointer to our event manager.
|
||||||
*/
|
*/
|
||||||
virtual inline GHOST_EventManager* getEventManager() const;
|
virtual inline GHOST_EventManager *getEventManager() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a pointer to our window manager.
|
* Returns a pointer to our window manager.
|
||||||
* @return A pointer to our window manager.
|
* @return A pointer to our window manager.
|
||||||
*/
|
*/
|
||||||
virtual inline GHOST_WindowManager* getWindowManager() const;
|
virtual inline GHOST_WindowManager *getWindowManager() const;
|
||||||
|
|
||||||
#ifdef WITH_INPUT_NDOF
|
#ifdef WITH_INPUT_NDOF
|
||||||
/**
|
/**
|
||||||
* Returns a pointer to our n-degree of freedeom manager.
|
* Returns a pointer to our n-degree of freedeom manager.
|
||||||
* @return A pointer to our n-degree of freedeom manager.
|
* @return A pointer to our n-degree of freedeom manager.
|
||||||
*/
|
*/
|
||||||
virtual inline GHOST_NDOFManager* getNDOFManager() const;
|
virtual inline GHOST_NDOFManager *getNDOFManager() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -288,7 +288,7 @@ public:
|
|||||||
* @return Returns the clipboard data
|
* @return Returns the clipboard data
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TUns8* getClipboard(bool selection) const = 0;
|
virtual GHOST_TUns8 *getClipboard(bool selection) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put data to the Clipboard
|
* Put data to the Clipboard
|
||||||
@@ -301,7 +301,7 @@ public:
|
|||||||
* Confirms quitting he program when there is just one window left open
|
* Confirms quitting he program when there is just one window left open
|
||||||
* in the application
|
* in the application
|
||||||
*/
|
*/
|
||||||
virtual int confirmQuit(GHOST_IWindow * window) const;
|
virtual int confirmQuit(GHOST_IWindow *window) const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -323,52 +323,52 @@ protected:
|
|||||||
* @param window The window created.
|
* @param window The window created.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess createFullScreenWindow(GHOST_Window** window,
|
virtual GHOST_TSuccess createFullScreenWindow(GHOST_Window **window,
|
||||||
const bool stereoVisual, const GHOST_TUns16 numOfAASamples=0);
|
const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0);
|
||||||
|
|
||||||
/** The display manager (platform dependant). */
|
/** The display manager (platform dependant). */
|
||||||
GHOST_DisplayManager* m_displayManager;
|
GHOST_DisplayManager *m_displayManager;
|
||||||
|
|
||||||
/** The timer manager. */
|
/** The timer manager. */
|
||||||
GHOST_TimerManager* m_timerManager;
|
GHOST_TimerManager *m_timerManager;
|
||||||
|
|
||||||
/** The window manager. */
|
/** The window manager. */
|
||||||
GHOST_WindowManager* m_windowManager;
|
GHOST_WindowManager *m_windowManager;
|
||||||
|
|
||||||
/** The event manager. */
|
/** The event manager. */
|
||||||
GHOST_EventManager* m_eventManager;
|
GHOST_EventManager *m_eventManager;
|
||||||
|
|
||||||
#ifdef WITH_INPUT_NDOF
|
#ifdef WITH_INPUT_NDOF
|
||||||
/** The N-degree of freedom device manager */
|
/** The N-degree of freedom device manager */
|
||||||
GHOST_NDOFManager* m_ndofManager;
|
GHOST_NDOFManager *m_ndofManager;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Prints all the events. */
|
/** Prints all the events. */
|
||||||
#ifdef GHOST_DEBUG
|
#ifdef GHOST_DEBUG
|
||||||
GHOST_EventPrinter* m_eventPrinter;
|
GHOST_EventPrinter *m_eventPrinter;
|
||||||
#endif // GHOST_DEBUG
|
#endif // GHOST_DEBUG
|
||||||
|
|
||||||
/** Settings of the display before the display went fullscreen. */
|
/** Settings of the display before the display went fullscreen. */
|
||||||
GHOST_DisplaySetting m_preFullScreenSetting;
|
GHOST_DisplaySetting m_preFullScreenSetting;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline GHOST_TimerManager* GHOST_System::getTimerManager() const
|
inline GHOST_TimerManager *GHOST_System::getTimerManager() const
|
||||||
{
|
{
|
||||||
return m_timerManager;
|
return m_timerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline GHOST_EventManager* GHOST_System::getEventManager() const
|
inline GHOST_EventManager *GHOST_System::getEventManager() const
|
||||||
{
|
{
|
||||||
return m_eventManager;
|
return m_eventManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline GHOST_WindowManager* GHOST_System::getWindowManager() const
|
inline GHOST_WindowManager *GHOST_System::getWindowManager() const
|
||||||
{
|
{
|
||||||
return m_windowManager;
|
return m_windowManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_INPUT_NDOF
|
#ifdef WITH_INPUT_NDOF
|
||||||
inline GHOST_NDOFManager* GHOST_System::getNDOFManager() const
|
inline GHOST_NDOFManager *GHOST_System::getNDOFManager() const
|
||||||
{
|
{
|
||||||
return m_ndofManager;
|
return m_ndofManager;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ const EventTypeSpec kEvents[] =
|
|||||||
/*
|
/*
|
||||||
{ kEventClassApplication, kEventAppActivated },
|
{ kEventClassApplication, kEventAppActivated },
|
||||||
{ kEventClassApplication, kEventAppDeactivated },
|
{ kEventClassApplication, kEventAppDeactivated },
|
||||||
*/
|
*/
|
||||||
{ kEventClassKeyboard, kEventRawKeyDown },
|
{ kEventClassKeyboard, kEventRawKeyDown },
|
||||||
{ kEventClassKeyboard, kEventRawKeyRepeat },
|
{ kEventClassKeyboard, kEventRawKeyRepeat },
|
||||||
{ kEventClassKeyboard, kEventRawKeyUp },
|
{ kEventClassKeyboard, kEventRawKeyUp },
|
||||||
@@ -87,9 +87,9 @@ const EventTypeSpec kEvents[] =
|
|||||||
{ kEventClassMouse, kEventMouseDragged },
|
{ kEventClassMouse, kEventMouseDragged },
|
||||||
{ kEventClassMouse, kEventMouseWheelMoved },
|
{ kEventClassMouse, kEventMouseWheelMoved },
|
||||||
|
|
||||||
{ kEventClassWindow, kEventWindowClickZoomRgn } , /* for new zoom behaviour */
|
{ kEventClassWindow, kEventWindowClickZoomRgn }, /* for new zoom behaviour */
|
||||||
{ kEventClassWindow, kEventWindowZoom }, /* for new zoom behaviour */
|
{ kEventClassWindow, kEventWindowZoom }, /* for new zoom behaviour */
|
||||||
{ kEventClassWindow, kEventWindowExpand } , /* for new zoom behaviour */
|
{ kEventClassWindow, kEventWindowExpand }, /* for new zoom behaviour */
|
||||||
{ kEventClassWindow, kEventWindowExpandAll }, /* for new zoom behaviour */
|
{ kEventClassWindow, kEventWindowExpandAll }, /* for new zoom behaviour */
|
||||||
|
|
||||||
{ kEventClassWindow, kEventWindowClose },
|
{ kEventClassWindow, kEventWindowClose },
|
||||||
@@ -127,7 +127,7 @@ static GHOST_TKey convertKey(int rawCode)
|
|||||||
* without regard to the modifiers (so we don't get 'a'
|
* without regard to the modifiers (so we don't get 'a'
|
||||||
* and 'A' for example.
|
* and 'A' for example.
|
||||||
*/
|
*/
|
||||||
static UInt32 dummy= 0;
|
static UInt32 dummy = 0;
|
||||||
Handle transData = (Handle) GetScriptManagerVariable(smKCHRCache);
|
Handle transData = (Handle) GetScriptManagerVariable(smKCHRCache);
|
||||||
unsigned char vk = KeyTranslate(transData, rawCode, &dummy);
|
unsigned char vk = KeyTranslate(transData, rawCode, &dummy);
|
||||||
/* Map numpad based on rawcodes first, otherwise they
|
/* Map numpad based on rawcodes first, otherwise they
|
||||||
@@ -168,9 +168,11 @@ static GHOST_TKey convertKey(int rawCode)
|
|||||||
|
|
||||||
if ((vk >= 'a') && (vk <= 'z')) {
|
if ((vk >= 'a') && (vk <= 'z')) {
|
||||||
return (GHOST_TKey) (vk - 'a' + GHOST_kKeyA);
|
return (GHOST_TKey) (vk - 'a' + GHOST_kKeyA);
|
||||||
} else if ((vk >= '0') && (vk <= '9')) {
|
}
|
||||||
|
else if ((vk >= '0') && (vk <= '9')) {
|
||||||
return (GHOST_TKey) (vk - '0' + GHOST_kKey0);
|
return (GHOST_TKey) (vk - '0' + GHOST_kKey0);
|
||||||
} else if (vk==16) {
|
}
|
||||||
|
else if (vk == 16) {
|
||||||
switch (rawCode) {
|
switch (rawCode) {
|
||||||
case 122: return GHOST_kKeyF1;
|
case 122: return GHOST_kKeyF1;
|
||||||
case 120: return GHOST_kKeyF2;
|
case 120: return GHOST_kKeyF2;
|
||||||
@@ -185,7 +187,8 @@ static GHOST_TKey convertKey(int rawCode)
|
|||||||
case 103: return GHOST_kKeyF11;
|
case 103: return GHOST_kKeyF11;
|
||||||
case 111: return GHOST_kKeyF12; // Never get, is used for ejecting the CD!
|
case 111: return GHOST_kKeyF12; // Never get, is used for ejecting the CD!
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
switch (vk) {
|
switch (vk) {
|
||||||
case kUpArrowCharCode: return GHOST_kKeyUpArrow;
|
case kUpArrowCharCode: return GHOST_kKeyUpArrow;
|
||||||
case kDownArrowCharCode: return GHOST_kKeyDownArrow;
|
case kDownArrowCharCode: return GHOST_kKeyDownArrow;
|
||||||
@@ -233,9 +236,9 @@ static GHOST_TKey convertKey(int rawCode)
|
|||||||
static unsigned char convertRomanToLatin(unsigned char ascii)
|
static unsigned char convertRomanToLatin(unsigned char ascii)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(ascii<128) return ascii;
|
if (ascii < 128) return ascii;
|
||||||
|
|
||||||
switch(ascii) {
|
switch (ascii) {
|
||||||
case 128: return 142;
|
case 128: return 142;
|
||||||
case 129: return 143;
|
case 129: return 143;
|
||||||
case 130: return 128;
|
case 130: return 128;
|
||||||
@@ -357,13 +360,13 @@ static unsigned char convertRomanToLatin(unsigned char ascii)
|
|||||||
GHOST_SystemCarbon::GHOST_SystemCarbon() :
|
GHOST_SystemCarbon::GHOST_SystemCarbon() :
|
||||||
m_modifierMask(0)
|
m_modifierMask(0)
|
||||||
{
|
{
|
||||||
m_displayManager = new GHOST_DisplayManagerCarbon ();
|
m_displayManager = new GHOST_DisplayManagerCarbon();
|
||||||
GHOST_ASSERT(m_displayManager, "GHOST_SystemCarbon::GHOST_SystemCarbon(): m_displayManager==0\n");
|
GHOST_ASSERT(m_displayManager, "GHOST_SystemCarbon::GHOST_SystemCarbon(): m_displayManager==0\n");
|
||||||
m_displayManager->initialize();
|
m_displayManager->initialize();
|
||||||
|
|
||||||
UnsignedWide micros;
|
UnsignedWide micros;
|
||||||
::Microseconds(µs);
|
::Microseconds(µs);
|
||||||
m_start_time = UnsignedWideToUInt64(micros)/1000;
|
m_start_time = UnsignedWideToUInt64(micros) / 1000;
|
||||||
m_ignoreWindowSizedMessages = false;
|
m_ignoreWindowSizedMessages = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,7 +384,6 @@ GHOST_TUns64 GHOST_SystemCarbon::getMilliSeconds() const
|
|||||||
return (millis / 1000) - m_start_time;
|
return (millis / 1000) - m_start_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TUns8 GHOST_SystemCarbon::getNumDisplays() const
|
GHOST_TUns8 GHOST_SystemCarbon::getNumDisplays() const
|
||||||
{
|
{
|
||||||
// We do not support multiple monitors at the moment
|
// We do not support multiple monitors at the moment
|
||||||
@@ -398,7 +400,7 @@ void GHOST_SystemCarbon::getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUn
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_IWindow* GHOST_SystemCarbon::createWindow(
|
GHOST_IWindow *GHOST_SystemCarbon::createWindow(
|
||||||
const STR_String& title,
|
const STR_String& title,
|
||||||
GHOST_TInt32 left,
|
GHOST_TInt32 left,
|
||||||
GHOST_TInt32 top,
|
GHOST_TInt32 top,
|
||||||
@@ -408,12 +410,11 @@ GHOST_IWindow* GHOST_SystemCarbon::createWindow(
|
|||||||
GHOST_TDrawingContextType type,
|
GHOST_TDrawingContextType type,
|
||||||
bool stereoVisual,
|
bool stereoVisual,
|
||||||
const GHOST_TUns16 numOfAASamples,
|
const GHOST_TUns16 numOfAASamples,
|
||||||
const GHOST_TEmbedderWindowID parentWindow
|
const GHOST_TEmbedderWindowID parentWindow)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = 0;
|
GHOST_IWindow *window = 0;
|
||||||
|
|
||||||
window = new GHOST_WindowCarbon (title, left, top, width, height, state, type);
|
window = new GHOST_WindowCarbon(title, left, top, width, height, state, type);
|
||||||
|
|
||||||
if (window) {
|
if (window) {
|
||||||
if (window->getValid()) {
|
if (window->getValid()) {
|
||||||
@@ -435,16 +436,16 @@ GHOST_IWindow* GHOST_SystemCarbon::createWindow(
|
|||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_SystemCarbon::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window, const bool stereoVisual)
|
GHOST_TSuccess GHOST_SystemCarbon::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window, const bool stereoVisual)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success = GHOST_kFailure;
|
GHOST_TSuccess success = GHOST_kFailure;
|
||||||
|
|
||||||
// need yo make this Carbon all on 10.5 for fullscreen to work correctly
|
// need yo make this Carbon all on 10.5 for fullscreen to work correctly
|
||||||
CGCaptureAllDisplays();
|
CGCaptureAllDisplays();
|
||||||
|
|
||||||
success = GHOST_System::beginFullScreen( setting, window, stereoVisual);
|
success = GHOST_System::beginFullScreen(setting, window, stereoVisual);
|
||||||
|
|
||||||
if( success != GHOST_kSuccess ) {
|
if (success != GHOST_kSuccess) {
|
||||||
// fullscreen failed for other reasons, release
|
// fullscreen failed for other reasons, release
|
||||||
CGReleaseAllDisplays();
|
CGReleaseAllDisplays();
|
||||||
}
|
}
|
||||||
@@ -459,8 +460,8 @@ GHOST_TSuccess GHOST_SystemCarbon::endFullScreen(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* this is an old style low level event queue.
|
/* this is an old style low level event queue.
|
||||||
As we want to handle our own timers, this is ok.
|
* As we want to handle our own timers, this is ok.
|
||||||
the full screen hack should be removed */
|
* the full screen hack should be removed */
|
||||||
bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
|
bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
|
||||||
{
|
{
|
||||||
bool anyProcessed = false;
|
bool anyProcessed = false;
|
||||||
@@ -469,7 +470,7 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
|
|||||||
// SetMouseCoalescingEnabled(false, NULL);
|
// SetMouseCoalescingEnabled(false, NULL);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
GHOST_TimerManager* timerMgr = getTimerManager();
|
GHOST_TimerManager *timerMgr = getTimerManager();
|
||||||
|
|
||||||
if (waitForEvent) {
|
if (waitForEvent) {
|
||||||
GHOST_TUns64 next = timerMgr->nextFireTime();
|
GHOST_TUns64 next = timerMgr->nextFireTime();
|
||||||
@@ -477,8 +478,9 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
|
|||||||
|
|
||||||
if (next == GHOST_kFireTimeNever) {
|
if (next == GHOST_kFireTimeNever) {
|
||||||
timeOut = kEventDurationForever;
|
timeOut = kEventDurationForever;
|
||||||
} else {
|
}
|
||||||
timeOut = (double)(next - getMilliSeconds())/1000.0;
|
else {
|
||||||
|
timeOut = (double)(next - getMilliSeconds()) / 1000.0;
|
||||||
if (timeOut < 0.0)
|
if (timeOut < 0.0)
|
||||||
timeOut = 0.0;
|
timeOut = 0.0;
|
||||||
}
|
}
|
||||||
@@ -492,26 +494,27 @@ bool GHOST_SystemCarbon::processEvents(bool waitForEvent)
|
|||||||
|
|
||||||
if (getFullScreen()) {
|
if (getFullScreen()) {
|
||||||
// Check if the full-screen window is dirty
|
// Check if the full-screen window is dirty
|
||||||
GHOST_IWindow* window = m_windowManager->getFullScreenWindow();
|
GHOST_IWindow *window = m_windowManager->getFullScreenWindow();
|
||||||
if (((GHOST_WindowCarbon*)window)->getFullScreenDirty()) {
|
if (((GHOST_WindowCarbon *)window)->getFullScreenDirty()) {
|
||||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) );
|
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) );
|
||||||
anyProcessed = true;
|
anyProcessed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* end loop when no more events available */
|
/* end loop when no more events available */
|
||||||
while (::ReceiveNextEvent(0, NULL, 0, true, &event)==noErr) {
|
while (::ReceiveNextEvent(0, NULL, 0, true, &event) == noErr) {
|
||||||
OSStatus status= ::SendEventToEventTarget(event, ::GetEventDispatcherTarget());
|
OSStatus status = ::SendEventToEventTarget(event, ::GetEventDispatcherTarget());
|
||||||
if (status==noErr) {
|
if (status == noErr) {
|
||||||
anyProcessed = true;
|
anyProcessed = true;
|
||||||
} else {
|
}
|
||||||
UInt32 i= ::GetEventClass(event);
|
else {
|
||||||
|
UInt32 i = ::GetEventClass(event);
|
||||||
|
|
||||||
/* Ignore 'cgs ' class, no documentation on what they
|
/* Ignore 'cgs ' class, no documentation on what they
|
||||||
* are, but we get a lot of them
|
* are, but we get a lot of them
|
||||||
*/
|
*/
|
||||||
if (i!='cgs ') {
|
if (i != 'cgs ') {
|
||||||
if (i!='tblt') { // tablet event. we use the one packaged in the mouse event
|
if (i != 'tblt') { // tablet event. we use the one packaged in the mouse event
|
||||||
; //printf("Missed - Class: '%.4s', Kind: %d\n", &i, ::GetEventKind(event));
|
; //printf("Missed - Class: '%.4s', Kind: %d\n", &i, ::GetEventKind(event));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -538,7 +541,7 @@ GHOST_TSuccess GHOST_SystemCarbon::getCursorPosition(GHOST_TInt32& x, GHOST_TInt
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_SystemCarbon::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
|
GHOST_TSuccess GHOST_SystemCarbon::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
|
||||||
{
|
{
|
||||||
float xf=(float)x, yf=(float)y;
|
float xf = (float)x, yf = (float)y;
|
||||||
|
|
||||||
CGAssociateMouseAndMouseCursorPosition(false);
|
CGAssociateMouseAndMouseCursorPosition(false);
|
||||||
CGSetLocalEventsSuppressionInterval(0);
|
CGSetLocalEventsSuppressionInterval(0);
|
||||||
@@ -585,7 +588,8 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
|
|||||||
strncpy(buf, g_firstFileBuf, FIRSTFILEBUFLG - 1);
|
strncpy(buf, g_firstFileBuf, FIRSTFILEBUFLG - 1);
|
||||||
buf[FIRSTFILEBUFLG - 1] = '\0';
|
buf[FIRSTFILEBUFLG - 1] = '\0';
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -608,25 +612,25 @@ OSErr GHOST_SystemCarbon::sAEHandlerOpenDocs(const AppleEvent *event, AppleEvent
|
|||||||
if (err != noErr) return err;
|
if (err != noErr) return err;
|
||||||
|
|
||||||
err = AECountItems(&docs, &ndocs);
|
err = AECountItems(&docs, &ndocs);
|
||||||
if (err==noErr) {
|
if (err == noErr) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<ndocs; i++) {
|
for (i = 0; i < ndocs; i++) {
|
||||||
FSSpec fss;
|
FSSpec fss;
|
||||||
AEKeyword kwd;
|
AEKeyword kwd;
|
||||||
DescType actType;
|
DescType actType;
|
||||||
Size actSize;
|
Size actSize;
|
||||||
|
|
||||||
err = AEGetNthPtr(&docs, i+1, typeFSS, &kwd, &actType, &fss, sizeof(fss), &actSize);
|
err = AEGetNthPtr(&docs, i + 1, typeFSS, &kwd, &actType, &fss, sizeof(fss), &actSize);
|
||||||
if (err!=noErr)
|
if (err != noErr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (i==0) {
|
if (i == 0) {
|
||||||
FSRef fsref;
|
FSRef fsref;
|
||||||
|
|
||||||
if (FSpMakeFSRef(&fss, &fsref)!=noErr)
|
if (FSpMakeFSRef(&fss, &fsref) != noErr)
|
||||||
break;
|
break;
|
||||||
if (FSRefMakePath(&fsref, (UInt8*) g_firstFileBuf, sizeof(g_firstFileBuf))!=noErr)
|
if (FSRefMakePath(&fsref, (UInt8 *) g_firstFileBuf, sizeof(g_firstFileBuf)) != noErr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
g_hasFirstFile = true;
|
g_hasFirstFile = true;
|
||||||
@@ -648,9 +652,9 @@ OSErr GHOST_SystemCarbon::sAEHandlerPrintDocs(const AppleEvent *event, AppleEven
|
|||||||
|
|
||||||
OSErr GHOST_SystemCarbon::sAEHandlerQuit(const AppleEvent *event, AppleEvent *reply, SInt32 refCon)
|
OSErr GHOST_SystemCarbon::sAEHandlerQuit(const AppleEvent *event, AppleEvent *reply, SInt32 refCon)
|
||||||
{
|
{
|
||||||
GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) refCon;
|
GHOST_SystemCarbon *sys = (GHOST_SystemCarbon *) refCon;
|
||||||
|
|
||||||
sys->pushEvent( new GHOST_Event(sys->getMilliSeconds(), GHOST_kEventQuit, NULL) );
|
sys->pushEvent(new GHOST_Event(sys->getMilliSeconds(), GHOST_kEventQuit, NULL) );
|
||||||
|
|
||||||
return noErr;
|
return noErr;
|
||||||
}
|
}
|
||||||
@@ -698,36 +702,36 @@ OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event)
|
|||||||
|
|
||||||
// Check if the event was send to a GHOST window
|
// Check if the event was send to a GHOST window
|
||||||
::GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &windowRef);
|
::GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &windowRef);
|
||||||
window = (GHOST_WindowCarbon*) ::GetWRefCon(windowRef);
|
window = (GHOST_WindowCarbon *) ::GetWRefCon(windowRef);
|
||||||
if (!validWindow(window)) {
|
if (!validWindow(window)) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (!getFullScreen()) {
|
//if (!getFullScreen()) {
|
||||||
err = noErr;
|
err = noErr;
|
||||||
switch(::GetEventKind(event))
|
switch (::GetEventKind(event))
|
||||||
{
|
{
|
||||||
case kEventWindowClose:
|
case kEventWindowClose:
|
||||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window) );
|
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window) );
|
||||||
break;
|
break;
|
||||||
case kEventWindowActivated:
|
case kEventWindowActivated:
|
||||||
m_windowManager->setActiveWindow(window);
|
m_windowManager->setActiveWindow(window);
|
||||||
window->loadCursor(window->getCursorVisibility(), window->getCursorShape());
|
window->loadCursor(window->getCursorVisibility(), window->getCursorShape());
|
||||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window) );
|
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window) );
|
||||||
break;
|
break;
|
||||||
case kEventWindowDeactivated:
|
case kEventWindowDeactivated:
|
||||||
m_windowManager->setWindowInactive(window);
|
m_windowManager->setWindowInactive(window);
|
||||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowDeactivate, window) );
|
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowDeactivate, window) );
|
||||||
break;
|
break;
|
||||||
case kEventWindowUpdate:
|
case kEventWindowUpdate:
|
||||||
//if (getFullScreen()) GHOST_PRINT("GHOST_SystemCarbon::handleWindowEvent(): full-screen update event\n");
|
//if (getFullScreen()) GHOST_PRINT("GHOST_SystemCarbon::handleWindowEvent(): full-screen update event\n");
|
||||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) );
|
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) );
|
||||||
break;
|
break;
|
||||||
case kEventWindowBoundsChanged:
|
case kEventWindowBoundsChanged:
|
||||||
if (!m_ignoreWindowSizedMessages)
|
if (!m_ignoreWindowSizedMessages)
|
||||||
{
|
{
|
||||||
window->updateDrawingContext();
|
window->updateDrawingContext();
|
||||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
|
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -746,11 +750,11 @@ OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event)
|
|||||||
|
|
||||||
OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
|
OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
|
||||||
{
|
{
|
||||||
GHOST_IWindow* window = m_windowManager->getActiveWindow();
|
GHOST_IWindow *window = m_windowManager->getActiveWindow();
|
||||||
TabletPointRec tabletPointRecord;
|
TabletPointRec tabletPointRecord;
|
||||||
TabletProximityRec tabletProximityRecord;
|
TabletProximityRec tabletProximityRecord;
|
||||||
UInt32 anInt32;
|
UInt32 anInt32;
|
||||||
GHOST_TabletData& ct=((GHOST_WindowCarbon*)window)->GetCarbonTabletData();
|
GHOST_TabletData& ct = ((GHOST_WindowCarbon *)window)->GetCarbonTabletData();
|
||||||
OSStatus err = eventNotHandledErr;
|
OSStatus err = eventNotHandledErr;
|
||||||
|
|
||||||
ct.Pressure = 0;
|
ct.Pressure = 0;
|
||||||
@@ -758,11 +762,11 @@ OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
|
|||||||
ct.Ytilt = 0;
|
ct.Ytilt = 0;
|
||||||
|
|
||||||
// is there an embedded tablet event inside this mouse event?
|
// is there an embedded tablet event inside this mouse event?
|
||||||
if(noErr == GetEventParameter(event, kEventParamTabletEventType, typeUInt32, NULL, sizeof(UInt32), NULL, (void *)&anInt32))
|
if (noErr == GetEventParameter(event, kEventParamTabletEventType, typeUInt32, NULL, sizeof(UInt32), NULL, (void *)&anInt32))
|
||||||
{
|
{
|
||||||
// yes there is one!
|
// yes there is one!
|
||||||
// Embedded tablet events can either be a proximity or pointer event.
|
// Embedded tablet events can either be a proximity or pointer event.
|
||||||
if(anInt32 == kEventTabletPoint)
|
if (anInt32 == kEventTabletPoint)
|
||||||
{
|
{
|
||||||
//GHOST_PRINT("Embedded pointer event!\n");
|
//GHOST_PRINT("Embedded pointer event!\n");
|
||||||
|
|
||||||
@@ -771,7 +775,7 @@ OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
|
|||||||
// error and go on. This can occur when a proximity event is embedded in
|
// error and go on. This can occur when a proximity event is embedded in
|
||||||
// a mouse event and you did not check the mouse event to see which type
|
// a mouse event and you did not check the mouse event to see which type
|
||||||
// of tablet event was embedded.
|
// of tablet event was embedded.
|
||||||
if(noErr == GetEventParameter(event, kEventParamTabletPointRec,
|
if (noErr == GetEventParameter(event, kEventParamTabletPointRec,
|
||||||
typeTabletPointRec, NULL,
|
typeTabletPointRec, NULL,
|
||||||
sizeof(TabletPointRec),
|
sizeof(TabletPointRec),
|
||||||
NULL, (void *)&tabletPointRecord))
|
NULL, (void *)&tabletPointRecord))
|
||||||
@@ -780,11 +784,12 @@ OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
|
|||||||
ct.Xtilt = tabletPointRecord.tiltX / 32767.0f; /* can be positive or negative */
|
ct.Xtilt = tabletPointRecord.tiltX / 32767.0f; /* can be positive or negative */
|
||||||
ct.Ytilt = tabletPointRecord.tiltY / 32767.0f; /* can be positive or negative */
|
ct.Ytilt = tabletPointRecord.tiltY / 32767.0f; /* can be positive or negative */
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
//GHOST_PRINT("Embedded proximity event\n");
|
//GHOST_PRINT("Embedded proximity event\n");
|
||||||
|
|
||||||
// Extract the Tablet Proximity record from the event.
|
// Extract the Tablet Proximity record from the event.
|
||||||
if(noErr == GetEventParameter(event, kEventParamTabletProximityRec,
|
if (noErr == GetEventParameter(event, kEventParamTabletProximityRec,
|
||||||
typeTabletProximityRec, NULL,
|
typeTabletProximityRec, NULL,
|
||||||
sizeof(TabletProximityRec),
|
sizeof(TabletProximityRec),
|
||||||
NULL, (void *)&tabletProximityRecord))
|
NULL, (void *)&tabletProximityRecord))
|
||||||
@@ -792,7 +797,7 @@ OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
|
|||||||
if (tabletProximityRecord.enterProximity) {
|
if (tabletProximityRecord.enterProximity) {
|
||||||
//pointer is entering tablet area proximity
|
//pointer is entering tablet area proximity
|
||||||
|
|
||||||
switch(tabletProximityRecord.pointerType)
|
switch (tabletProximityRecord.pointerType)
|
||||||
{
|
{
|
||||||
case 1: /* stylus */
|
case 1: /* stylus */
|
||||||
ct.Active = GHOST_kTabletModeStylus;
|
ct.Active = GHOST_kTabletModeStylus;
|
||||||
@@ -807,7 +812,8 @@ OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
|
|||||||
ct.Active = GHOST_kTabletModeNone;
|
ct.Active = GHOST_kTabletModeNone;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// pointer is leaving - return to mouse
|
// pointer is leaving - return to mouse
|
||||||
ct.Active = GHOST_kTabletModeNone;
|
ct.Active = GHOST_kTabletModeNone;
|
||||||
}
|
}
|
||||||
@@ -821,7 +827,7 @@ OSStatus GHOST_SystemCarbon::handleTabletEvent(EventRef event)
|
|||||||
OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
|
OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
|
||||||
{
|
{
|
||||||
OSStatus err = eventNotHandledErr;
|
OSStatus err = eventNotHandledErr;
|
||||||
GHOST_IWindow* window = m_windowManager->getActiveWindow();
|
GHOST_IWindow *window = m_windowManager->getActiveWindow();
|
||||||
UInt32 kind = ::GetEventKind(event);
|
UInt32 kind = ::GetEventKind(event);
|
||||||
|
|
||||||
switch (kind)
|
switch (kind)
|
||||||
@@ -894,7 +900,7 @@ OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
|
|||||||
OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event)
|
OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event)
|
||||||
{
|
{
|
||||||
OSStatus err = eventNotHandledErr;
|
OSStatus err = eventNotHandledErr;
|
||||||
GHOST_IWindow* window = m_windowManager->getActiveWindow();
|
GHOST_IWindow *window = m_windowManager->getActiveWindow();
|
||||||
UInt32 kind = ::GetEventKind(event);
|
UInt32 kind = ::GetEventKind(event);
|
||||||
UInt32 modifiers;
|
UInt32 modifiers;
|
||||||
UInt32 rawCode;
|
UInt32 rawCode;
|
||||||
@@ -919,18 +925,20 @@ OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event)
|
|||||||
::GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &ascii);
|
::GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &ascii);
|
||||||
|
|
||||||
key = convertKey(rawCode);
|
key = convertKey(rawCode);
|
||||||
ascii= convertRomanToLatin(ascii);
|
ascii = convertRomanToLatin(ascii);
|
||||||
|
|
||||||
// if (key!=GHOST_kKeyUnknown) {
|
// if (key!=GHOST_kKeyUnknown) {
|
||||||
GHOST_TEventType type;
|
GHOST_TEventType type;
|
||||||
if (kind == kEventRawKeyDown) {
|
if (kind == kEventRawKeyDown) {
|
||||||
type = GHOST_kEventKeyDown;
|
type = GHOST_kEventKeyDown;
|
||||||
} else if (kind == kEventRawKeyRepeat) {
|
}
|
||||||
|
else if (kind == kEventRawKeyRepeat) {
|
||||||
type = GHOST_kEventKeyDown; /* XXX, fixme */
|
type = GHOST_kEventKeyDown; /* XXX, fixme */
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
type = GHOST_kEventKeyUp;
|
type = GHOST_kEventKeyUp;
|
||||||
}
|
}
|
||||||
pushEvent( new GHOST_EventKey( getMilliSeconds(), type, window, key, ascii, NULL) );
|
pushEvent(new GHOST_EventKey(getMilliSeconds(), type, window, key, ascii, NULL) );
|
||||||
// }
|
// }
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -938,16 +946,16 @@ OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event)
|
|||||||
/* ugh */
|
/* ugh */
|
||||||
::GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
::GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
||||||
if ((modifiers & shiftKey) != (m_modifierMask & shiftKey)) {
|
if ((modifiers & shiftKey) != (m_modifierMask & shiftKey)) {
|
||||||
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & shiftKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift) );
|
pushEvent(new GHOST_EventKey(getMilliSeconds(), (modifiers & shiftKey) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift) );
|
||||||
}
|
}
|
||||||
if ((modifiers & controlKey) != (m_modifierMask & controlKey)) {
|
if ((modifiers & controlKey) != (m_modifierMask & controlKey)) {
|
||||||
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & controlKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl) );
|
pushEvent(new GHOST_EventKey(getMilliSeconds(), (modifiers & controlKey) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl) );
|
||||||
}
|
}
|
||||||
if ((modifiers & optionKey) != (m_modifierMask & optionKey)) {
|
if ((modifiers & optionKey) != (m_modifierMask & optionKey)) {
|
||||||
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & optionKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) );
|
pushEvent(new GHOST_EventKey(getMilliSeconds(), (modifiers & optionKey) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) );
|
||||||
}
|
}
|
||||||
if ((modifiers & cmdKey) != (m_modifierMask & cmdKey)) {
|
if ((modifiers & cmdKey) != (m_modifierMask & cmdKey)) {
|
||||||
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & cmdKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyOS) );
|
pushEvent(new GHOST_EventKey(getMilliSeconds(), (modifiers & cmdKey) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, GHOST_kKeyOS) );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_modifierMask = modifiers;
|
m_modifierMask = modifiers;
|
||||||
@@ -968,13 +976,13 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event)
|
|||||||
short part;
|
short part;
|
||||||
BitMap screenBits;
|
BitMap screenBits;
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
GHOST_WindowCarbon* ghostWindow;
|
GHOST_WindowCarbon *ghostWindow;
|
||||||
Point mousePos = {0 , 0};
|
Point mousePos = {0, 0};
|
||||||
|
|
||||||
::GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &mousePos);
|
::GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &mousePos);
|
||||||
|
|
||||||
part = ::FindWindow(mousePos, &window);
|
part = ::FindWindow(mousePos, &window);
|
||||||
ghostWindow = (GHOST_WindowCarbon*) ::GetWRefCon(window);
|
ghostWindow = (GHOST_WindowCarbon *) ::GetWRefCon(window);
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case inMenuBar:
|
case inMenuBar:
|
||||||
@@ -995,7 +1003,7 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event)
|
|||||||
::DragWindow(window, mousePos, &GetQDGlobalsScreenBits(&screenBits)->bounds);
|
::DragWindow(window, mousePos, &GetQDGlobalsScreenBits(&screenBits)->bounds);
|
||||||
m_ignoreWindowSizedMessages = false;
|
m_ignoreWindowSizedMessages = false;
|
||||||
|
|
||||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowMove, ghostWindow) );
|
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowMove, ghostWindow) );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1009,7 +1017,8 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event)
|
|||||||
EventMouseButton button;
|
EventMouseButton button;
|
||||||
::GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
|
::GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
|
||||||
pushEvent(new GHOST_EventButton(getMilliSeconds(), GHOST_kEventButtonDown, ghostWindow, convertButton(button)));
|
pushEvent(new GHOST_EventButton(getMilliSeconds(), GHOST_kEventButtonDown, ghostWindow, convertButton(button)));
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
handled = false;
|
handled = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1040,22 +1049,23 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event)
|
|||||||
int macState;
|
int macState;
|
||||||
|
|
||||||
macState = ghostWindow->getMac_windowState();
|
macState = ghostWindow->getMac_windowState();
|
||||||
if ( macState== 0)
|
if (macState == 0)
|
||||||
::ZoomWindow(window, part, true);
|
::ZoomWindow(window, part, true);
|
||||||
else
|
else
|
||||||
if (macState == 2) { // always ok
|
if (macState == 2) { // always ok
|
||||||
::ZoomWindow(window, part, true);
|
::ZoomWindow(window, part, true);
|
||||||
ghostWindow->setMac_windowState(1);
|
ghostWindow->setMac_windowState(1);
|
||||||
} else { // need to force size again
|
}
|
||||||
|
else { // need to force size again
|
||||||
// GHOST_TUns32 scr_x,scr_y; /*unused*/
|
// GHOST_TUns32 scr_x,scr_y; /*unused*/
|
||||||
Rect outAvailableRect;
|
Rect outAvailableRect;
|
||||||
|
|
||||||
ghostWindow->setMac_windowState(2);
|
ghostWindow->setMac_windowState(2);
|
||||||
::GetAvailableWindowPositioningBounds ( GetMainDevice(), &outAvailableRect);
|
::GetAvailableWindowPositioningBounds(GetMainDevice(), &outAvailableRect);
|
||||||
|
|
||||||
//this->getMainDisplayDimensions(scr_x,scr_y);
|
//this->getMainDisplayDimensions(scr_x,scr_y);
|
||||||
::SizeWindow (window, outAvailableRect.right-outAvailableRect.left,outAvailableRect.bottom-outAvailableRect.top-1,false);
|
::SizeWindow(window, outAvailableRect.right - outAvailableRect.left, outAvailableRect.bottom - outAvailableRect.top - 1, false);
|
||||||
::MoveWindow (window, outAvailableRect.left, outAvailableRect.top,true);
|
::MoveWindow(window, outAvailableRect.left, outAvailableRect.top, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1088,7 +1098,7 @@ bool GHOST_SystemCarbon::handleMenuCommand(GHOST_TInt32 menuResult)
|
|||||||
if (err || command == 0) {
|
if (err || command == 0) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch(command) {
|
switch (command) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1097,11 +1107,11 @@ bool GHOST_SystemCarbon::handleMenuCommand(GHOST_TInt32 menuResult)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData)
|
OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, EventRef event, void *userData)
|
||||||
{
|
{
|
||||||
GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) userData;
|
GHOST_SystemCarbon *sys = (GHOST_SystemCarbon *) userData;
|
||||||
OSStatus err = eventNotHandledErr;
|
OSStatus err = eventNotHandledErr;
|
||||||
GHOST_IWindow* window;
|
GHOST_IWindow *window;
|
||||||
#ifdef WITH_INPUT_NDOF
|
#ifdef WITH_INPUT_NDOF
|
||||||
GHOST_TEventNDOFData data;
|
GHOST_TEventNDOFData data;
|
||||||
#endif
|
#endif
|
||||||
@@ -1124,7 +1134,7 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
|
|||||||
case kEventClassKeyboard:
|
case kEventClassKeyboard:
|
||||||
err = sys->handleKeyEvent(event);
|
err = sys->handleKeyEvent(event);
|
||||||
break;
|
break;
|
||||||
case kEventClassBlender :
|
case kEventClassBlender:
|
||||||
#ifdef WITH_INPUT_NDOF
|
#ifdef WITH_INPUT_NDOF
|
||||||
window = sys->m_windowManager->getActiveWindow();
|
window = sys->m_windowManager->getActiveWindow();
|
||||||
sys->m_ndofManager->GHOST_NDOFGetDatas(data);
|
sys->m_ndofManager->GHOST_NDOFGetDatas(data);
|
||||||
@@ -1144,7 +1154,7 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
|
|||||||
#endif
|
#endif
|
||||||
err = noErr;
|
err = noErr;
|
||||||
break;
|
break;
|
||||||
default :
|
default:
|
||||||
;
|
;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1152,48 +1162,49 @@ OSStatus GHOST_SystemCarbon::sEventHandlerProc(EventHandlerCallRef handler, Even
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TUns8* GHOST_SystemCarbon::getClipboard(bool selection) const
|
GHOST_TUns8 *GHOST_SystemCarbon::getClipboard(bool selection) const
|
||||||
{
|
{
|
||||||
PasteboardRef inPasteboard;
|
PasteboardRef inPasteboard;
|
||||||
PasteboardItemID itemID;
|
PasteboardItemID itemID;
|
||||||
CFDataRef flavorData;
|
CFDataRef flavorData;
|
||||||
OSStatus err = noErr;
|
OSStatus err = noErr;
|
||||||
GHOST_TUns8 * temp_buff;
|
GHOST_TUns8 *temp_buff;
|
||||||
CFRange range;
|
CFRange range;
|
||||||
OSStatus syncFlags;
|
OSStatus syncFlags;
|
||||||
|
|
||||||
err = PasteboardCreate(kPasteboardClipboard, &inPasteboard);
|
err = PasteboardCreate(kPasteboardClipboard, &inPasteboard);
|
||||||
if(err != noErr) { return NULL;}
|
if (err != noErr) { return NULL; }
|
||||||
|
|
||||||
syncFlags = PasteboardSynchronize( inPasteboard );
|
syncFlags = PasteboardSynchronize(inPasteboard);
|
||||||
/* as we always get in a new string, we can safely ignore sync flags if not an error*/
|
/* as we always get in a new string, we can safely ignore sync flags if not an error*/
|
||||||
if(syncFlags <0) { return NULL;}
|
if (syncFlags < 0) { return NULL; }
|
||||||
|
|
||||||
|
|
||||||
err = PasteboardGetItemIdentifier( inPasteboard, 1, &itemID );
|
err = PasteboardGetItemIdentifier(inPasteboard, 1, &itemID);
|
||||||
if(err != noErr) { return NULL;}
|
if (err != noErr) { return NULL; }
|
||||||
|
|
||||||
err = PasteboardCopyItemFlavorData( inPasteboard, itemID, CFSTR("public.utf8-plain-text"), &flavorData);
|
err = PasteboardCopyItemFlavorData(inPasteboard, itemID, CFSTR("public.utf8-plain-text"), &flavorData);
|
||||||
if(err != noErr) { return NULL;}
|
if (err != noErr) { return NULL; }
|
||||||
|
|
||||||
range = CFRangeMake(0, CFDataGetLength(flavorData));
|
range = CFRangeMake(0, CFDataGetLength(flavorData));
|
||||||
|
|
||||||
temp_buff = (GHOST_TUns8*) malloc(range.length+1);
|
temp_buff = (GHOST_TUns8 *) malloc(range.length + 1);
|
||||||
|
|
||||||
CFDataGetBytes(flavorData, range, (UInt8*)temp_buff);
|
CFDataGetBytes(flavorData, range, (UInt8 *)temp_buff);
|
||||||
|
|
||||||
temp_buff[range.length] = '\0';
|
temp_buff[range.length] = '\0';
|
||||||
|
|
||||||
if(temp_buff) {
|
if (temp_buff) {
|
||||||
return temp_buff;
|
return temp_buff;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, bool selection) const
|
void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, bool selection) const
|
||||||
{
|
{
|
||||||
if(selection) {return;} // for copying the selection, used on X11
|
if (selection) {return; } // for copying the selection, used on X11
|
||||||
|
|
||||||
PasteboardRef inPasteboard;
|
PasteboardRef inPasteboard;
|
||||||
CFDataRef textData = NULL;
|
CFDataRef textData = NULL;
|
||||||
@@ -1201,26 +1212,26 @@ void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, bool selection) const
|
|||||||
OSStatus syncFlags;
|
OSStatus syncFlags;
|
||||||
|
|
||||||
err = PasteboardCreate(kPasteboardClipboard, &inPasteboard);
|
err = PasteboardCreate(kPasteboardClipboard, &inPasteboard);
|
||||||
if(err != noErr) { return;}
|
if (err != noErr) { return; }
|
||||||
|
|
||||||
syncFlags = PasteboardSynchronize( inPasteboard );
|
syncFlags = PasteboardSynchronize(inPasteboard);
|
||||||
/* as we always put in a new string, we can safely ignore sync flags */
|
/* as we always put in a new string, we can safely ignore sync flags */
|
||||||
if(syncFlags <0) { return;}
|
if (syncFlags < 0) { return; }
|
||||||
|
|
||||||
err = PasteboardClear( inPasteboard );
|
err = PasteboardClear(inPasteboard);
|
||||||
if(err != noErr) { return;}
|
if (err != noErr) { return; }
|
||||||
|
|
||||||
textData = CFDataCreate(kCFAllocatorDefault, (UInt8*)buffer, strlen(buffer));
|
textData = CFDataCreate(kCFAllocatorDefault, (UInt8 *)buffer, strlen(buffer));
|
||||||
|
|
||||||
if (textData) {
|
if (textData) {
|
||||||
err = PasteboardPutItemFlavor( inPasteboard, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), textData, 0);
|
err = PasteboardPutItemFlavor(inPasteboard, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), textData, 0);
|
||||||
if(err != noErr) {
|
if (err != noErr) {
|
||||||
if(textData) { CFRelease(textData);}
|
if (textData) { CFRelease(textData); }
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(textData) {
|
if (textData) {
|
||||||
CFRelease(textData);
|
CFRelease(textData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public:
|
|||||||
* @param parentWindow Parent (embedder) window
|
* @param parentWindow Parent (embedder) window
|
||||||
* @return The new window (or 0 if creation failed).
|
* @return The new window (or 0 if creation failed).
|
||||||
*/
|
*/
|
||||||
virtual GHOST_IWindow* createWindow(
|
virtual GHOST_IWindow *createWindow(
|
||||||
const STR_String& title,
|
const STR_String& title,
|
||||||
GHOST_TInt32 left,
|
GHOST_TInt32 left,
|
||||||
GHOST_TInt32 top,
|
GHOST_TInt32 top,
|
||||||
@@ -121,11 +121,11 @@ public:
|
|||||||
|
|
||||||
virtual GHOST_TSuccess beginFullScreen(
|
virtual GHOST_TSuccess beginFullScreen(
|
||||||
const GHOST_DisplaySetting& setting,
|
const GHOST_DisplaySetting& setting,
|
||||||
GHOST_IWindow** window,
|
GHOST_IWindow **window,
|
||||||
const bool stereoVisual
|
const bool stereoVisual
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual GHOST_TSuccess endFullScreen( void );
|
virtual GHOST_TSuccess endFullScreen(void);
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Event management functionality
|
** Event management functionality
|
||||||
@@ -181,7 +181,7 @@ public:
|
|||||||
* @param selection Indicate which buffer to return
|
* @param selection Indicate which buffer to return
|
||||||
* @return Returns the selected buffer
|
* @return Returns the selected buffer
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TUns8* getClipboard(bool selection) const;
|
virtual GHOST_TUns8 *getClipboard(bool selection) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Puts buffer to system clipboard
|
* Puts buffer to system clipboard
|
||||||
@@ -193,7 +193,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @see GHOST_ISystem
|
* @see GHOST_ISystem
|
||||||
*/
|
*/
|
||||||
int toggleConsole(int action) { return 0; }
|
int toggleConsole(int action) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@@ -258,7 +260,7 @@ protected:
|
|||||||
/**
|
/**
|
||||||
* Callback for Carbon when it has events.
|
* Callback for Carbon when it has events.
|
||||||
*/
|
*/
|
||||||
static OSStatus sEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData);
|
static OSStatus sEventHandlerProc(EventHandlerCallRef handler, EventRef event, void *userData);
|
||||||
|
|
||||||
/** Apple Event Handlers */
|
/** Apple Event Handlers */
|
||||||
static OSErr sAEHandlerLaunch(const AppleEvent *event, AppleEvent *reply, SInt32 refCon);
|
static OSErr sAEHandlerLaunch(const AppleEvent *event, AppleEvent *reply, SInt32 refCon);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public:
|
|||||||
* @param parentWindow Parent (embedder) window
|
* @param parentWindow Parent (embedder) window
|
||||||
* @return The new window (or 0 if creation failed).
|
* @return The new window (or 0 if creation failed).
|
||||||
*/
|
*/
|
||||||
virtual GHOST_IWindow* createWindow(
|
virtual GHOST_IWindow *createWindow(
|
||||||
const STR_String& title,
|
const STR_String& title,
|
||||||
GHOST_TInt32 left,
|
GHOST_TInt32 left,
|
||||||
GHOST_TInt32 top,
|
GHOST_TInt32 top,
|
||||||
@@ -151,7 +151,7 @@ public:
|
|||||||
* @return Indication whether the event was handled.
|
* @return Indication whether the event was handled.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess handleDraggingEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType,
|
GHOST_TSuccess handleDraggingEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType,
|
||||||
GHOST_WindowCocoa* window, int mouseX, int mouseY, void* data);
|
GHOST_WindowCocoa *window, int mouseX, int mouseY, void *data);
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Cursor management functionality
|
** Cursor management functionality
|
||||||
@@ -196,7 +196,7 @@ public:
|
|||||||
* @param selection Indicate which buffer to return
|
* @param selection Indicate which buffer to return
|
||||||
* @return Returns the selected buffer
|
* @return Returns the selected buffer
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TUns8* getClipboard(bool selection) const;
|
virtual GHOST_TUns8 *getClipboard(bool selection) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Puts buffer to system clipboard
|
* Puts buffer to system clipboard
|
||||||
@@ -211,7 +211,7 @@ public:
|
|||||||
* @param window The window on which the event occurred
|
* @param window The window on which the event occurred
|
||||||
* @return Indication whether the event was handled.
|
* @return Indication whether the event was handled.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess handleWindowEvent(GHOST_TEventType eventType, GHOST_WindowCocoa* window);
|
GHOST_TSuccess handleWindowEvent(GHOST_TEventType eventType, GHOST_WindowCocoa *window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the Cocoa event telling the application has become active (again)
|
* Handles the Cocoa event telling the application has become active (again)
|
||||||
@@ -227,7 +227,9 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @see GHOST_ISystem
|
* @see GHOST_ISystem
|
||||||
*/
|
*/
|
||||||
int toggleConsole(int action) { return 0; }
|
int toggleConsole(int action) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public:
|
|||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_IWindow* createWindow(
|
GHOST_IWindow *createWindow(
|
||||||
const STR_String& title,
|
const STR_String& title,
|
||||||
GHOST_TInt32 left,
|
GHOST_TInt32 left,
|
||||||
GHOST_TInt32 top,
|
GHOST_TInt32 top,
|
||||||
@@ -76,9 +76,9 @@ public:
|
|||||||
GHOST_TDrawingContextType type,
|
GHOST_TDrawingContextType type,
|
||||||
bool stereoVisual,
|
bool stereoVisual,
|
||||||
const GHOST_TUns16 numOfAASamples,
|
const GHOST_TUns16 numOfAASamples,
|
||||||
const GHOST_TEmbedderWindowID parentWindow
|
const GHOST_TEmbedderWindowID parentWindow)
|
||||||
) {
|
{
|
||||||
return new GHOST_WindowNULL (this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1);
|
return new GHOST_WindowNULL(this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -40,40 +40,40 @@ protected:
|
|||||||
* Constructor.
|
* Constructor.
|
||||||
* Protected default constructor to force use of static createSystem member.
|
* Protected default constructor to force use of static createSystem member.
|
||||||
*/
|
*/
|
||||||
GHOST_SystemPaths(){};
|
GHOST_SystemPaths() {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
* Protected default constructor to force use of static dispose member.
|
* Protected default constructor to force use of static dispose member.
|
||||||
*/
|
*/
|
||||||
virtual ~GHOST_SystemPaths(){};
|
virtual ~GHOST_SystemPaths() {};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which shared resources are located. It will first try to use
|
* Determine the base dir in which shared resources are located. It will first try to use
|
||||||
* "unpack and run" path, then look for properly installed path, not including versioning.
|
* "unpack and run" path, then look for properly installed path, including versioning.
|
||||||
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8* getSystemDir() const = 0;
|
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which user configuration is stored, not including versioning.
|
* Determine the base dir in which user configuration is stored, including versioning.
|
||||||
* If needed, it will create the base directory.
|
* If needed, it will create the base directory.
|
||||||
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
|
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8* getUserDir() const = 0;
|
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the directory of the current binary
|
* Determine the directory of the current binary
|
||||||
* @return Unsigned char string pointing to the binary dir
|
* @return Unsigned char string pointing to the binary dir
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8* getBinaryDir() const = 0;
|
virtual const GHOST_TUns8 *getBinaryDir() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the file to the operating system most recently used files
|
* Add the file to the operating system most recently used files
|
||||||
*/
|
*/
|
||||||
virtual void addToSystemRecentFiles(const char* filename) const = 0;
|
virtual void addToSystemRecentFiles(const char *filename) const = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -44,27 +44,29 @@ GHOST_SystemPathsCarbon::~GHOST_SystemPathsCarbon()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8* GHOST_SystemPathsCarbon::getSystemDir() const
|
const GHOST_TUns8 *GHOST_SystemPathsCarbon::getSystemDir(int, const char *versionstr) const
|
||||||
{
|
{
|
||||||
return (GHOST_TUns8*)"/Library/Application Support";
|
static char systemPath[1024];
|
||||||
|
|
||||||
|
snprintf(systemPath, sizeof(systemPath), "/Library/Application Support/Blender/%s", versionstr);
|
||||||
|
|
||||||
|
return (GHOST_TUns8*)systemPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8* GHOST_SystemPathsCarbon::getUserDir() const
|
const GHOST_TUns8 *GHOST_SystemPathsCarbon::getUserDir(int, const char *versionstr) const
|
||||||
{
|
{
|
||||||
static char usrPath[256] = "";
|
static char usrPath[1024];
|
||||||
char* env = getenv("HOME");
|
char *env = getenv("HOME");
|
||||||
|
|
||||||
if (env) {
|
if (env) {
|
||||||
strncpy(usrPath, env, 245);
|
snprintf(usrPath, sizeof(usrPath), "%s/Library/Application Support/Blender/%s", env, versionstr);
|
||||||
usrPath[245]=0;
|
return (GHOST_TUns8*)usrPath;
|
||||||
strcat(usrPath, "/Library/Application Support");
|
|
||||||
return (GHOST_TUns8*) usrPath;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8* GHOST_SystemPathsCarbon::getBinaryDir() const
|
const GHOST_TUns8 *GHOST_SystemPathsCarbon::getBinaryDir() const
|
||||||
{
|
{
|
||||||
CFURLRef bundleURL;
|
CFURLRef bundleURL;
|
||||||
CFStringRef pathStr;
|
CFStringRef pathStr;
|
||||||
@@ -76,10 +78,10 @@ const GHOST_TUns8* GHOST_SystemPathsCarbon::getBinaryDir() const
|
|||||||
CFStringGetCString(pathStr, path, 255, kCFStringEncodingASCII);
|
CFStringGetCString(pathStr, path, 255, kCFStringEncodingASCII);
|
||||||
CFRelease(pathStr);
|
CFRelease(pathStr);
|
||||||
CFRelease(bundleURL);
|
CFRelease(bundleURL);
|
||||||
return (GHOST_TUns8*)path;
|
return (GHOST_TUns8 *)path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_SystemPathsCarbon::addToSystemRecentFiles(const char* filename) const
|
void GHOST_SystemPathsCarbon::addToSystemRecentFiles(const char *filename) const
|
||||||
{
|
{
|
||||||
/* XXXXX TODO: Implementation for Carbon if possible */
|
/* XXXXX TODO: Implementation for Carbon if possible */
|
||||||
|
|
||||||
|
|||||||
@@ -60,28 +60,28 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which shared resources are located. It will first try to use
|
* Determine the base dir in which shared resources are located. It will first try to use
|
||||||
* "unpack and run" path, then look for properly installed path, not including versioning.
|
* "unpack and run" path, then look for properly installed path, including versioning.
|
||||||
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8* getSystemDir() const;
|
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which user configuration is stored, not including versioning.
|
* Determine the base dir in which user configuration is stored, including versioning.
|
||||||
* If needed, it will create the base directory.
|
* If needed, it will create the base directory.
|
||||||
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
|
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8* getUserDir() const;
|
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the directory of the current binary
|
* Determine the directory of the current binary
|
||||||
* @return Unsigned char string pointing to the binary dir
|
* @return Unsigned char string pointing to the binary dir
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8* getBinaryDir() const;
|
virtual const GHOST_TUns8 *getBinaryDir() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the file to the operating system most recently used files
|
* Add the file to the operating system most recently used files
|
||||||
*/
|
*/
|
||||||
void addToSystemRecentFiles(const char* filename) const;
|
void addToSystemRecentFiles(const char *filename) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GHOST_SYSTEMPATHSCARBON_H__
|
#endif // __GHOST_SYSTEMPATHSCARBON_H__
|
||||||
|
|||||||
@@ -54,28 +54,28 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which shared resources are located. It will first try to use
|
* Determine the base dir in which shared resources are located. It will first try to use
|
||||||
* "unpack and run" path, then look for properly installed path, not including versioning.
|
* "unpack and run" path, then look for properly installed path, including versioning.
|
||||||
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8* getSystemDir() const;
|
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which user configuration is stored, not including versioning.
|
* Determine the base dir in which user configuration is stored, including versioning.
|
||||||
* If needed, it will create the base directory.
|
* If needed, it will create the base directory.
|
||||||
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
|
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8* getUserDir() const;
|
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the directory of the current binary
|
* Determine the directory of the current binary
|
||||||
* @return Unsigned char string pointing to the binary dir
|
* @return Unsigned char string pointing to the binary dir
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8* getBinaryDir() const;
|
virtual const GHOST_TUns8 *getBinaryDir() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the file to the operating system most recently used files
|
* Add the file to the operating system most recently used files
|
||||||
*/
|
*/
|
||||||
void addToSystemRecentFiles(const char* filename) const;
|
void addToSystemRecentFiles(const char *filename) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GHOST_SYSTEMPATHSCOCOA_H__
|
#endif // __GHOST_SYSTEMPATHSCOCOA_H__
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ GHOST_SystemPathsCocoa::~GHOST_SystemPathsCocoa()
|
|||||||
|
|
||||||
#pragma mark Base directories retrieval
|
#pragma mark Base directories retrieval
|
||||||
|
|
||||||
const GHOST_TUns8* GHOST_SystemPathsCocoa::getSystemDir() const
|
const GHOST_TUns8* GHOST_SystemPathsCocoa::getSystemDir(int, const char *versionstr) const
|
||||||
{
|
{
|
||||||
static GHOST_TUns8 tempPath[512] = "";
|
static char tempPath[512] = "";
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
NSString *basePath;
|
NSString *basePath;
|
||||||
NSArray *paths;
|
NSArray *paths;
|
||||||
@@ -66,15 +66,15 @@ const GHOST_TUns8* GHOST_SystemPathsCocoa::getSystemDir() const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
|
snprintf(tempPath, sizeof(tempPath), "%s/Blender/%s", [basePath cStringUsingEncoding:NSASCIIStringEncoding], versionstr);
|
||||||
|
|
||||||
[pool drain];
|
[pool drain];
|
||||||
return tempPath;
|
return (GHOST_TUns8*)tempPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8* GHOST_SystemPathsCocoa::getUserDir() const
|
const GHOST_TUns8* GHOST_SystemPathsCocoa::getUserDir(int, const char *versionstr) const
|
||||||
{
|
{
|
||||||
static GHOST_TUns8 tempPath[512] = "";
|
static char tempPath[512] = "";
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
NSString *basePath;
|
NSString *basePath;
|
||||||
NSArray *paths;
|
NSArray *paths;
|
||||||
@@ -88,10 +88,10 @@ const GHOST_TUns8* GHOST_SystemPathsCocoa::getUserDir() const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
|
snprintf(tempPath, sizeof(tempPath), "%s/Blender/%s", [basePath cStringUsingEncoding:NSASCIIStringEncoding], versionstr);
|
||||||
|
|
||||||
[pool drain];
|
[pool drain];
|
||||||
return tempPath;
|
return (GHOST_TUns8*)tempPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8* GHOST_SystemPathsCocoa::getBinaryDir() const
|
const GHOST_TUns8* GHOST_SystemPathsCocoa::getBinaryDir() const
|
||||||
|
|||||||
@@ -69,46 +69,50 @@ GHOST_SystemPathsWin32::~GHOST_SystemPathsWin32()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8* GHOST_SystemPathsWin32::getSystemDir() const
|
const GHOST_TUns8 *GHOST_SystemPathsWin32::getSystemDir(int, const char *versionstr) const
|
||||||
{
|
{
|
||||||
static char knownpath[MAX_PATH*3] = {0}; /* 1 utf-16 might translante into 3 utf-8. 2 utf-16 translates into 4 utf-8*/
|
static char knownpath[MAX_PATH * 3 + 128] = {0}; /* 1 utf-16 might translante into 3 utf-8. 2 utf-16 translates into 4 utf-8*/
|
||||||
wchar_t knownpath_16[MAX_PATH];
|
wchar_t knownpath_16[MAX_PATH];
|
||||||
|
|
||||||
HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
|
HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
|
||||||
|
|
||||||
if (hResult == S_OK)
|
if (hResult == S_OK)
|
||||||
{
|
{
|
||||||
conv_utf_16_to_8(knownpath_16,knownpath,MAX_PATH*3);
|
conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3);
|
||||||
|
strcat(knownpath, "\\Blender Foundation\\Blender\\");
|
||||||
|
strcat(knownpath, versionstr);
|
||||||
return (GHOST_TUns8*)knownpath;
|
return (GHOST_TUns8*)knownpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8* GHOST_SystemPathsWin32::getUserDir() const
|
const GHOST_TUns8 *GHOST_SystemPathsWin32::getUserDir(int, const char *versionstr) const
|
||||||
{
|
{
|
||||||
static char knownpath[MAX_PATH*3] = {0};
|
static char knownpath[MAX_PATH * 3 + 128] = {0};
|
||||||
wchar_t knownpath_16[MAX_PATH];
|
wchar_t knownpath_16[MAX_PATH];
|
||||||
|
|
||||||
HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
|
HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
|
||||||
|
|
||||||
if (hResult == S_OK)
|
if (hResult == S_OK)
|
||||||
{
|
{
|
||||||
conv_utf_16_to_8(knownpath_16,knownpath,MAX_PATH*3);
|
conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3);
|
||||||
|
strcat(knownpath, "\\Blender Foundation\\Blender\\");
|
||||||
|
strcat(knownpath, versionstr);
|
||||||
return (GHOST_TUns8*)knownpath;
|
return (GHOST_TUns8*)knownpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8* GHOST_SystemPathsWin32::getBinaryDir() const
|
const GHOST_TUns8 *GHOST_SystemPathsWin32::getBinaryDir() const
|
||||||
{
|
{
|
||||||
static char fullname[MAX_PATH*3] = {0};
|
static char fullname[MAX_PATH * 3] = {0};
|
||||||
wchar_t fullname_16[MAX_PATH*3];
|
wchar_t fullname_16[MAX_PATH * 3];
|
||||||
|
|
||||||
if(GetModuleFileNameW(0, fullname_16, MAX_PATH)) {
|
if (GetModuleFileNameW(0, fullname_16, MAX_PATH)) {
|
||||||
conv_utf_16_to_8(fullname_16,fullname,MAX_PATH*3);
|
conv_utf_16_to_8(fullname_16, fullname, MAX_PATH * 3);
|
||||||
return (GHOST_TUns8*)fullname;
|
return (GHOST_TUns8 *)fullname;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -64,23 +64,23 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which shared resources are located. It will first try to use
|
* Determine the base dir in which shared resources are located. It will first try to use
|
||||||
* "unpack and run" path, then look for properly installed path, not including versioning.
|
* "unpack and run" path, then look for properly installed path, including versioning.
|
||||||
* @return Unsigned char string pointing to system dir (eg /usr/share/).
|
* @return Unsigned char string pointing to system dir (eg /usr/share/).
|
||||||
*/
|
*/
|
||||||
const GHOST_TUns8* getSystemDir() const;
|
const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which user configuration is stored, not including versioning.
|
* Determine the base dir in which user configuration is stored, including versioning.
|
||||||
* If needed, it will create the base directory.
|
* If needed, it will create the base directory.
|
||||||
* @return Unsigned char string pointing to user dir (eg ~/).
|
* @return Unsigned char string pointing to user dir (eg ~/).
|
||||||
*/
|
*/
|
||||||
const GHOST_TUns8* getUserDir() const;
|
const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the directory of the current binary
|
* Determine the directory of the current binary
|
||||||
* @return Unsigned char string pointing to the binary dir
|
* @return Unsigned char string pointing to the binary dir
|
||||||
*/
|
*/
|
||||||
const GHOST_TUns8* getBinaryDir() const;
|
const GHOST_TUns8 *getBinaryDir() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the file to the operating system most recently used files
|
* Add the file to the operating system most recently used files
|
||||||
|
|||||||
@@ -41,10 +41,8 @@
|
|||||||
#include <stdio.h> // for fprintf only
|
#include <stdio.h> // for fprintf only
|
||||||
#include <cstdlib> // for exit
|
#include <cstdlib> // for exit
|
||||||
|
|
||||||
#ifdef WITH_XDG_USER_DIRS
|
#include <pwd.h> // for get home without use getenv()
|
||||||
# include <pwd.h> // for get home without use getenv()
|
#include <limits.h> // for PATH_MAX
|
||||||
# include <limits.h> // for PATH_MAX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PREFIX
|
#ifdef PREFIX
|
||||||
static const char *static_path = PREFIX "/share";
|
static const char *static_path = PREFIX "/share";
|
||||||
@@ -60,35 +58,51 @@ GHOST_SystemPathsX11::~GHOST_SystemPathsX11()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8 *GHOST_SystemPathsX11::getSystemDir() const
|
const GHOST_TUns8 *GHOST_SystemPathsX11::getSystemDir(int, const char *versionstr) const
|
||||||
{
|
{
|
||||||
/* no prefix assumes a portable build which only uses bundled scripts */
|
/* no prefix assumes a portable build which only uses bundled scripts */
|
||||||
return (const GHOST_TUns8 *)static_path;
|
if(static_path) {
|
||||||
|
static char system_path[PATH_MAX];
|
||||||
|
snprintf(system_path, sizeof(system_path), "%s/blender/%s", static_path, versionstr);
|
||||||
|
return (GHOST_TUns8*)system_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8 *GHOST_SystemPathsX11::getUserDir() const
|
const GHOST_TUns8 *GHOST_SystemPathsX11::getUserDir(int version, const char *versionstr) const
|
||||||
{
|
{
|
||||||
#ifndef WITH_XDG_USER_DIRS
|
|
||||||
return (const GHOST_TUns8 *)getenv("HOME");
|
|
||||||
#else /* WITH_XDG_USER_DIRS */
|
|
||||||
const char *home = getenv("XDG_CONFIG_HOME");
|
|
||||||
|
|
||||||
if (home) {
|
|
||||||
return (const GHOST_TUns8 *)home;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
static char user_path[PATH_MAX];
|
static char user_path[PATH_MAX];
|
||||||
|
|
||||||
home = getenv("HOME");
|
/* in blender 2.64, we migrate to XDG. to ensure the copy previous settings
|
||||||
|
* operator works we give a different path depending on the requested version */
|
||||||
|
if(version < 264) {
|
||||||
|
const char *home = getenv("HOME");
|
||||||
|
|
||||||
if (home == NULL) {
|
if(home) {
|
||||||
home = getpwuid(getuid())->pw_dir;
|
snprintf(user_path, sizeof(user_path), "%s/.blender/%s", home, versionstr);
|
||||||
|
return (GHOST_TUns8*)user_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const char *home= getenv("XDG_CONFIG_HOME");
|
||||||
|
|
||||||
|
if (home) {
|
||||||
|
snprintf(user_path, sizeof(user_path), "%s/blender/%s", home, versionstr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
home= getenv("HOME");
|
||||||
|
|
||||||
|
if (home == NULL)
|
||||||
|
home= getpwuid(getuid())->pw_dir;
|
||||||
|
|
||||||
|
snprintf(user_path, sizeof(user_path), "%s/.config/blender/%s", home, versionstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(user_path, sizeof(user_path), "%s/.config", home);
|
|
||||||
return (const GHOST_TUns8 *)user_path;
|
return (const GHOST_TUns8 *)user_path;
|
||||||
}
|
}
|
||||||
#endif /* WITH_XDG_USER_DIRS */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8 *GHOST_SystemPathsX11::getBinaryDir() const
|
const GHOST_TUns8 *GHOST_SystemPathsX11::getBinaryDir() const
|
||||||
|
|||||||
@@ -52,17 +52,17 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which shared resources are located. It will first try to use
|
* Determine the base dir in which shared resources are located. It will first try to use
|
||||||
* "unpack and run" path, then look for properly installed path, not including versioning.
|
* "unpack and run" path, then look for properly installed path, including versioning.
|
||||||
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
* @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
||||||
*/
|
*/
|
||||||
const GHOST_TUns8 *getSystemDir() const;
|
const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which user configuration is stored, not including versioning.
|
* Determine the base dir in which user configuration is stored, including versioning.
|
||||||
* If needed, it will create the base directory.
|
* If needed, it will create the base directory.
|
||||||
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
|
* @return Unsigned char string pointing to user dir (eg ~/.blender/).
|
||||||
*/
|
*/
|
||||||
const GHOST_TUns8 *getUserDir() const;
|
const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the directory of the current binary
|
* Determine the directory of the current binary
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ GHOST_SystemSDL::GHOST_SystemSDL()
|
|||||||
:
|
:
|
||||||
GHOST_System()
|
GHOST_System()
|
||||||
{
|
{
|
||||||
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) != 0) {
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
|
||||||
printf ("Error initializing SDL: %s\n", SDL_GetError());
|
printf("Error initializing SDL: %s\n", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); */
|
/* SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); */
|
||||||
@@ -71,9 +71,9 @@ GHOST_SystemSDL::createWindow(const STR_String& title,
|
|||||||
const GHOST_TEmbedderWindowID parentWindow
|
const GHOST_TEmbedderWindowID parentWindow
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
GHOST_WindowSDL *window= NULL;
|
GHOST_WindowSDL *window = NULL;
|
||||||
|
|
||||||
window= new GHOST_WindowSDL (this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1);
|
window = new GHOST_WindowSDL(this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1);
|
||||||
|
|
||||||
if (window) {
|
if (window) {
|
||||||
if (GHOST_kWindowStateFullScreen == state) {
|
if (GHOST_kWindowStateFullScreen == state) {
|
||||||
@@ -93,7 +93,7 @@ GHOST_SystemSDL::createWindow(const STR_String& title,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
delete window;
|
delete window;
|
||||||
window= NULL;
|
window = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return window;
|
return window;
|
||||||
@@ -120,8 +120,8 @@ GHOST_SystemSDL::getMainDisplayDimensions(GHOST_TUns32& width,
|
|||||||
{
|
{
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
SDL_GetCurrentDisplayMode(0, &mode); /* note, always 0 display */
|
SDL_GetCurrentDisplayMode(0, &mode); /* note, always 0 display */
|
||||||
width= mode.w;
|
width = mode.w;
|
||||||
height= mode.h;
|
height = mode.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TUns8
|
GHOST_TUns8
|
||||||
@@ -133,7 +133,7 @@ GHOST_SystemSDL::getNumDisplays() const
|
|||||||
GHOST_TSuccess
|
GHOST_TSuccess
|
||||||
GHOST_SystemSDL::getModifierKeys(GHOST_ModifierKeys& keys) const
|
GHOST_SystemSDL::getModifierKeys(GHOST_ModifierKeys& keys) const
|
||||||
{
|
{
|
||||||
SDL_Keymod mod= SDL_GetModState();
|
SDL_Keymod mod = SDL_GetModState();
|
||||||
|
|
||||||
keys.set(GHOST_kModifierKeyLeftShift, (mod & KMOD_LSHIFT) != 0);
|
keys.set(GHOST_kModifierKeyLeftShift, (mod & KMOD_LSHIFT) != 0);
|
||||||
keys.set(GHOST_kModifierKeyRightShift, (mod & KMOD_RSHIFT) != 0);
|
keys.set(GHOST_kModifierKeyRightShift, (mod & KMOD_RSHIFT) != 0);
|
||||||
@@ -141,12 +141,12 @@ GHOST_SystemSDL::getModifierKeys(GHOST_ModifierKeys& keys) const
|
|||||||
keys.set(GHOST_kModifierKeyRightControl, (mod & KMOD_RCTRL) != 0);
|
keys.set(GHOST_kModifierKeyRightControl, (mod & KMOD_RCTRL) != 0);
|
||||||
keys.set(GHOST_kModifierKeyLeftAlt, (mod & KMOD_LALT) != 0);
|
keys.set(GHOST_kModifierKeyLeftAlt, (mod & KMOD_LALT) != 0);
|
||||||
keys.set(GHOST_kModifierKeyRightAlt, (mod & KMOD_RALT) != 0);
|
keys.set(GHOST_kModifierKeyRightAlt, (mod & KMOD_RALT) != 0);
|
||||||
keys.set(GHOST_kModifierKeyOS, (mod & (KMOD_LGUI|KMOD_RGUI)) != 0);
|
keys.set(GHOST_kModifierKeyOS, (mod & (KMOD_LGUI | KMOD_RGUI)) != 0);
|
||||||
|
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GXMAP(k,x,y) case x: k= y; break;
|
#define GXMAP(k, x, y) case x: k = y; break
|
||||||
|
|
||||||
static GHOST_TKey
|
static GHOST_TKey
|
||||||
convertSDLKey(SDL_Scancode key)
|
convertSDLKey(SDL_Scancode key)
|
||||||
@@ -154,96 +154,100 @@ convertSDLKey(SDL_Scancode key)
|
|||||||
GHOST_TKey type;
|
GHOST_TKey type;
|
||||||
|
|
||||||
if ((key >= SDL_SCANCODE_A) && (key <= SDL_SCANCODE_Z)) {
|
if ((key >= SDL_SCANCODE_A) && (key <= SDL_SCANCODE_Z)) {
|
||||||
type= GHOST_TKey( key - SDL_SCANCODE_A + int(GHOST_kKeyA));
|
type = GHOST_TKey(key - SDL_SCANCODE_A + int(GHOST_kKeyA));
|
||||||
} else if ((key >= SDL_SCANCODE_1) && (key <= SDL_SCANCODE_0)) {
|
}
|
||||||
type= (key == SDL_SCANCODE_0) ? GHOST_kKey0 : GHOST_TKey(key - SDL_SCANCODE_1 + int(GHOST_kKey1));
|
else if ((key >= SDL_SCANCODE_1) && (key <= SDL_SCANCODE_0)) {
|
||||||
} else if ((key >= SDL_SCANCODE_F1) && (key <= SDL_SCANCODE_F12)) {
|
type = (key == SDL_SCANCODE_0) ? GHOST_kKey0 : GHOST_TKey(key - SDL_SCANCODE_1 + int(GHOST_kKey1));
|
||||||
type= GHOST_TKey(key - SDL_SCANCODE_F1 + int(GHOST_kKeyF1));
|
}
|
||||||
} else if ((key >= SDL_SCANCODE_F13) && (key <= SDL_SCANCODE_F24)) {
|
else if ((key >= SDL_SCANCODE_F1) && (key <= SDL_SCANCODE_F12)) {
|
||||||
type= GHOST_TKey(key - SDL_SCANCODE_F13 + int(GHOST_kKeyF13));
|
type = GHOST_TKey(key - SDL_SCANCODE_F1 + int(GHOST_kKeyF1));
|
||||||
} else {
|
}
|
||||||
switch(key) {
|
else if ((key >= SDL_SCANCODE_F13) && (key <= SDL_SCANCODE_F24)) {
|
||||||
|
type = GHOST_TKey(key - SDL_SCANCODE_F13 + int(GHOST_kKeyF13));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (key) {
|
||||||
/* TODO SDL_SCANCODE_NONUSBACKSLASH */
|
/* TODO SDL_SCANCODE_NONUSBACKSLASH */
|
||||||
|
|
||||||
GXMAP(type,SDL_SCANCODE_BACKSPACE, GHOST_kKeyBackSpace);
|
GXMAP(type, SDL_SCANCODE_BACKSPACE, GHOST_kKeyBackSpace);
|
||||||
GXMAP(type,SDL_SCANCODE_TAB, GHOST_kKeyTab);
|
GXMAP(type, SDL_SCANCODE_TAB, GHOST_kKeyTab);
|
||||||
GXMAP(type,SDL_SCANCODE_RETURN, GHOST_kKeyEnter);
|
GXMAP(type, SDL_SCANCODE_RETURN, GHOST_kKeyEnter);
|
||||||
GXMAP(type,SDL_SCANCODE_ESCAPE, GHOST_kKeyEsc);
|
GXMAP(type, SDL_SCANCODE_ESCAPE, GHOST_kKeyEsc);
|
||||||
GXMAP(type,SDL_SCANCODE_SPACE, GHOST_kKeySpace);
|
GXMAP(type, SDL_SCANCODE_SPACE, GHOST_kKeySpace);
|
||||||
|
|
||||||
GXMAP(type,SDL_SCANCODE_SEMICOLON, GHOST_kKeySemicolon);
|
GXMAP(type, SDL_SCANCODE_SEMICOLON, GHOST_kKeySemicolon);
|
||||||
GXMAP(type,SDL_SCANCODE_PERIOD, GHOST_kKeyPeriod);
|
GXMAP(type, SDL_SCANCODE_PERIOD, GHOST_kKeyPeriod);
|
||||||
GXMAP(type,SDL_SCANCODE_COMMA, GHOST_kKeyComma);
|
GXMAP(type, SDL_SCANCODE_COMMA, GHOST_kKeyComma);
|
||||||
GXMAP(type,SDL_SCANCODE_APOSTROPHE, GHOST_kKeyQuote);
|
GXMAP(type, SDL_SCANCODE_APOSTROPHE, GHOST_kKeyQuote);
|
||||||
GXMAP(type,SDL_SCANCODE_GRAVE, GHOST_kKeyAccentGrave);
|
GXMAP(type, SDL_SCANCODE_GRAVE, GHOST_kKeyAccentGrave);
|
||||||
GXMAP(type,SDL_SCANCODE_MINUS, GHOST_kKeyMinus);
|
GXMAP(type, SDL_SCANCODE_MINUS, GHOST_kKeyMinus);
|
||||||
GXMAP(type,SDL_SCANCODE_EQUALS, GHOST_kKeyEqual);
|
GXMAP(type, SDL_SCANCODE_EQUALS, GHOST_kKeyEqual);
|
||||||
|
|
||||||
GXMAP(type,SDL_SCANCODE_SLASH, GHOST_kKeySlash);
|
GXMAP(type, SDL_SCANCODE_SLASH, GHOST_kKeySlash);
|
||||||
GXMAP(type,SDL_SCANCODE_BACKSLASH, GHOST_kKeyBackslash);
|
GXMAP(type, SDL_SCANCODE_BACKSLASH, GHOST_kKeyBackslash);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_EQUALS, GHOST_kKeyEqual);
|
GXMAP(type, SDL_SCANCODE_KP_EQUALS, GHOST_kKeyEqual);
|
||||||
GXMAP(type,SDL_SCANCODE_LEFTBRACKET, GHOST_kKeyLeftBracket);
|
GXMAP(type, SDL_SCANCODE_LEFTBRACKET, GHOST_kKeyLeftBracket);
|
||||||
GXMAP(type,SDL_SCANCODE_RIGHTBRACKET, GHOST_kKeyRightBracket);
|
GXMAP(type, SDL_SCANCODE_RIGHTBRACKET, GHOST_kKeyRightBracket);
|
||||||
GXMAP(type,SDL_SCANCODE_PAUSE, GHOST_kKeyPause);
|
GXMAP(type, SDL_SCANCODE_PAUSE, GHOST_kKeyPause);
|
||||||
|
|
||||||
GXMAP(type,SDL_SCANCODE_LSHIFT, GHOST_kKeyLeftShift);
|
GXMAP(type, SDL_SCANCODE_LSHIFT, GHOST_kKeyLeftShift);
|
||||||
GXMAP(type,SDL_SCANCODE_RSHIFT, GHOST_kKeyRightShift);
|
GXMAP(type, SDL_SCANCODE_RSHIFT, GHOST_kKeyRightShift);
|
||||||
GXMAP(type,SDL_SCANCODE_LCTRL, GHOST_kKeyLeftControl);
|
GXMAP(type, SDL_SCANCODE_LCTRL, GHOST_kKeyLeftControl);
|
||||||
GXMAP(type,SDL_SCANCODE_RCTRL, GHOST_kKeyRightControl);
|
GXMAP(type, SDL_SCANCODE_RCTRL, GHOST_kKeyRightControl);
|
||||||
GXMAP(type,SDL_SCANCODE_LALT, GHOST_kKeyLeftAlt);
|
GXMAP(type, SDL_SCANCODE_LALT, GHOST_kKeyLeftAlt);
|
||||||
GXMAP(type,SDL_SCANCODE_RALT, GHOST_kKeyRightAlt);
|
GXMAP(type, SDL_SCANCODE_RALT, GHOST_kKeyRightAlt);
|
||||||
GXMAP(type,SDL_SCANCODE_LGUI, GHOST_kKeyOS);
|
GXMAP(type, SDL_SCANCODE_LGUI, GHOST_kKeyOS);
|
||||||
GXMAP(type,SDL_SCANCODE_RGUI, GHOST_kKeyOS);
|
GXMAP(type, SDL_SCANCODE_RGUI, GHOST_kKeyOS);
|
||||||
|
|
||||||
GXMAP(type,SDL_SCANCODE_INSERT, GHOST_kKeyInsert);
|
GXMAP(type, SDL_SCANCODE_INSERT, GHOST_kKeyInsert);
|
||||||
GXMAP(type,SDL_SCANCODE_DELETE, GHOST_kKeyDelete);
|
GXMAP(type, SDL_SCANCODE_DELETE, GHOST_kKeyDelete);
|
||||||
GXMAP(type,SDL_SCANCODE_HOME, GHOST_kKeyHome);
|
GXMAP(type, SDL_SCANCODE_HOME, GHOST_kKeyHome);
|
||||||
GXMAP(type,SDL_SCANCODE_END, GHOST_kKeyEnd);
|
GXMAP(type, SDL_SCANCODE_END, GHOST_kKeyEnd);
|
||||||
GXMAP(type,SDL_SCANCODE_PAGEUP, GHOST_kKeyUpPage);
|
GXMAP(type, SDL_SCANCODE_PAGEUP, GHOST_kKeyUpPage);
|
||||||
GXMAP(type,SDL_SCANCODE_PAGEDOWN, GHOST_kKeyDownPage);
|
GXMAP(type, SDL_SCANCODE_PAGEDOWN, GHOST_kKeyDownPage);
|
||||||
|
|
||||||
GXMAP(type,SDL_SCANCODE_LEFT, GHOST_kKeyLeftArrow);
|
GXMAP(type, SDL_SCANCODE_LEFT, GHOST_kKeyLeftArrow);
|
||||||
GXMAP(type,SDL_SCANCODE_RIGHT, GHOST_kKeyRightArrow);
|
GXMAP(type, SDL_SCANCODE_RIGHT, GHOST_kKeyRightArrow);
|
||||||
GXMAP(type,SDL_SCANCODE_UP, GHOST_kKeyUpArrow);
|
GXMAP(type, SDL_SCANCODE_UP, GHOST_kKeyUpArrow);
|
||||||
GXMAP(type,SDL_SCANCODE_DOWN, GHOST_kKeyDownArrow);
|
GXMAP(type, SDL_SCANCODE_DOWN, GHOST_kKeyDownArrow);
|
||||||
|
|
||||||
GXMAP(type,SDL_SCANCODE_CAPSLOCK, GHOST_kKeyCapsLock);
|
GXMAP(type, SDL_SCANCODE_CAPSLOCK, GHOST_kKeyCapsLock);
|
||||||
GXMAP(type,SDL_SCANCODE_SCROLLLOCK, GHOST_kKeyScrollLock);
|
GXMAP(type, SDL_SCANCODE_SCROLLLOCK, GHOST_kKeyScrollLock);
|
||||||
GXMAP(type,SDL_SCANCODE_NUMLOCKCLEAR, GHOST_kKeyNumLock);
|
GXMAP(type, SDL_SCANCODE_NUMLOCKCLEAR, GHOST_kKeyNumLock);
|
||||||
GXMAP(type,SDL_SCANCODE_PRINTSCREEN, GHOST_kKeyPrintScreen);
|
GXMAP(type, SDL_SCANCODE_PRINTSCREEN, GHOST_kKeyPrintScreen);
|
||||||
|
|
||||||
/* keypad events */
|
/* keypad events */
|
||||||
|
|
||||||
/* note, sdl defines a bunch of kp defines I never saw before like
|
/* note, sdl defines a bunch of kp defines I never saw before like
|
||||||
* SDL_SCANCODE_KP_PERCENT, SDL_SCANCODE_KP_XOR - campbell */
|
* SDL_SCANCODE_KP_PERCENT, SDL_SCANCODE_KP_XOR - campbell */
|
||||||
GXMAP(type,SDL_SCANCODE_KP_0, GHOST_kKeyNumpad0);
|
GXMAP(type, SDL_SCANCODE_KP_0, GHOST_kKeyNumpad0);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_1, GHOST_kKeyNumpad1);
|
GXMAP(type, SDL_SCANCODE_KP_1, GHOST_kKeyNumpad1);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_2, GHOST_kKeyNumpad2);
|
GXMAP(type, SDL_SCANCODE_KP_2, GHOST_kKeyNumpad2);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_3, GHOST_kKeyNumpad3);
|
GXMAP(type, SDL_SCANCODE_KP_3, GHOST_kKeyNumpad3);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_4, GHOST_kKeyNumpad4);
|
GXMAP(type, SDL_SCANCODE_KP_4, GHOST_kKeyNumpad4);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_5, GHOST_kKeyNumpad5);
|
GXMAP(type, SDL_SCANCODE_KP_5, GHOST_kKeyNumpad5);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_6, GHOST_kKeyNumpad6);
|
GXMAP(type, SDL_SCANCODE_KP_6, GHOST_kKeyNumpad6);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_7, GHOST_kKeyNumpad7);
|
GXMAP(type, SDL_SCANCODE_KP_7, GHOST_kKeyNumpad7);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_8, GHOST_kKeyNumpad8);
|
GXMAP(type, SDL_SCANCODE_KP_8, GHOST_kKeyNumpad8);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_9, GHOST_kKeyNumpad9);
|
GXMAP(type, SDL_SCANCODE_KP_9, GHOST_kKeyNumpad9);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_PERIOD, GHOST_kKeyNumpadPeriod);
|
GXMAP(type, SDL_SCANCODE_KP_PERIOD, GHOST_kKeyNumpadPeriod);
|
||||||
|
|
||||||
GXMAP(type,SDL_SCANCODE_KP_ENTER, GHOST_kKeyNumpadEnter);
|
GXMAP(type, SDL_SCANCODE_KP_ENTER, GHOST_kKeyNumpadEnter);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_PLUS, GHOST_kKeyNumpadPlus);
|
GXMAP(type, SDL_SCANCODE_KP_PLUS, GHOST_kKeyNumpadPlus);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_MINUS, GHOST_kKeyNumpadMinus);
|
GXMAP(type, SDL_SCANCODE_KP_MINUS, GHOST_kKeyNumpadMinus);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_MULTIPLY, GHOST_kKeyNumpadAsterisk);
|
GXMAP(type, SDL_SCANCODE_KP_MULTIPLY, GHOST_kKeyNumpadAsterisk);
|
||||||
GXMAP(type,SDL_SCANCODE_KP_DIVIDE, GHOST_kKeyNumpadSlash);
|
GXMAP(type, SDL_SCANCODE_KP_DIVIDE, GHOST_kKeyNumpadSlash);
|
||||||
|
|
||||||
/* Media keys in some keyboards and laptops with XFree86/Xorg */
|
/* Media keys in some keyboards and laptops with XFree86/Xorg */
|
||||||
GXMAP(type,SDL_SCANCODE_AUDIOPLAY, GHOST_kKeyMediaPlay);
|
GXMAP(type, SDL_SCANCODE_AUDIOPLAY, GHOST_kKeyMediaPlay);
|
||||||
GXMAP(type,SDL_SCANCODE_AUDIOSTOP, GHOST_kKeyMediaStop);
|
GXMAP(type, SDL_SCANCODE_AUDIOSTOP, GHOST_kKeyMediaStop);
|
||||||
GXMAP(type,SDL_SCANCODE_AUDIOPREV, GHOST_kKeyMediaFirst);
|
GXMAP(type, SDL_SCANCODE_AUDIOPREV, GHOST_kKeyMediaFirst);
|
||||||
// GXMAP(type,XF86XK_AudioRewind, GHOST_kKeyMediaFirst);
|
// GXMAP(type,XF86XK_AudioRewind, GHOST_kKeyMediaFirst);
|
||||||
GXMAP(type,SDL_SCANCODE_AUDIONEXT, GHOST_kKeyMediaLast);
|
GXMAP(type, SDL_SCANCODE_AUDIONEXT, GHOST_kKeyMediaLast);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("Unknown\n");
|
printf("Unknown\n");
|
||||||
type= GHOST_kKeyUnknown;
|
type = GHOST_kKeyUnknown;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -256,64 +260,64 @@ convertSDLKey(SDL_Scancode key)
|
|||||||
void
|
void
|
||||||
GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
|
GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
|
||||||
{
|
{
|
||||||
GHOST_Event * g_event= NULL;
|
GHOST_Event *g_event = NULL;
|
||||||
|
|
||||||
switch(sdl_event->type) {
|
switch (sdl_event->type) {
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
{
|
{
|
||||||
SDL_WindowEvent &sdl_sub_evt= sdl_event->window;
|
SDL_WindowEvent &sdl_sub_evt = sdl_event->window;
|
||||||
GHOST_WindowSDL *window= findGhostWindow(SDL_GetWindowFromID(sdl_sub_evt.windowID));
|
GHOST_WindowSDL *window = findGhostWindow(SDL_GetWindowFromID(sdl_sub_evt.windowID));
|
||||||
//assert(window != NULL); // can be NULL on close window.
|
//assert(window != NULL); // can be NULL on close window.
|
||||||
|
|
||||||
switch (sdl_sub_evt.event) {
|
switch (sdl_sub_evt.event) {
|
||||||
case SDL_WINDOWEVENT_EXPOSED:
|
case SDL_WINDOWEVENT_EXPOSED:
|
||||||
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window);
|
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_RESIZED:
|
case SDL_WINDOWEVENT_RESIZED:
|
||||||
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window);
|
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_MOVED:
|
case SDL_WINDOWEVENT_MOVED:
|
||||||
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowMove, window);
|
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowMove, window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||||
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window);
|
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||||
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowDeactivate, window);
|
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowDeactivate, window);
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_CLOSE:
|
case SDL_WINDOWEVENT_CLOSE:
|
||||||
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window);
|
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventQuit, NULL);
|
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventQuit, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_MOUSEMOTION:
|
||||||
{
|
{
|
||||||
SDL_MouseMotionEvent &sdl_sub_evt= sdl_event->motion;
|
SDL_MouseMotionEvent &sdl_sub_evt = sdl_event->motion;
|
||||||
SDL_Window *sdl_win= SDL_GetWindowFromID(sdl_sub_evt.windowID);
|
SDL_Window *sdl_win = SDL_GetWindowFromID(sdl_sub_evt.windowID);
|
||||||
GHOST_WindowSDL *window= findGhostWindow(sdl_win);
|
GHOST_WindowSDL *window = findGhostWindow(sdl_win);
|
||||||
assert(window != NULL);
|
assert(window != NULL);
|
||||||
|
|
||||||
int x_win, y_win;
|
int x_win, y_win;
|
||||||
SDL_GetWindowPosition(sdl_win, &x_win, &y_win);
|
SDL_GetWindowPosition(sdl_win, &x_win, &y_win);
|
||||||
|
|
||||||
GHOST_TInt32 x_root= sdl_sub_evt.x + x_win;
|
GHOST_TInt32 x_root = sdl_sub_evt.x + x_win;
|
||||||
GHOST_TInt32 y_root= sdl_sub_evt.y + y_win;
|
GHOST_TInt32 y_root = sdl_sub_evt.y + y_win;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(window->getCursorGrabMode() != GHOST_kGrabDisable && window->getCursorGrabMode() != GHOST_kGrabNormal)
|
if (window->getCursorGrabMode() != GHOST_kGrabDisable && window->getCursorGrabMode() != GHOST_kGrabNormal)
|
||||||
{
|
{
|
||||||
GHOST_TInt32 x_new= x_root;
|
GHOST_TInt32 x_new = x_root;
|
||||||
GHOST_TInt32 y_new= y_root;
|
GHOST_TInt32 y_new = y_root;
|
||||||
GHOST_TInt32 x_accum, y_accum;
|
GHOST_TInt32 x_accum, y_accum;
|
||||||
GHOST_Rect bounds;
|
GHOST_Rect bounds;
|
||||||
|
|
||||||
/* fallback to window bounds */
|
/* fallback to window bounds */
|
||||||
if(window->getCursorGrabBounds(bounds)==GHOST_kFailure)
|
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure)
|
||||||
window->getClientBounds(bounds);
|
window->getClientBounds(bounds);
|
||||||
|
|
||||||
/* could also clamp to screen bounds
|
/* could also clamp to screen bounds
|
||||||
@@ -322,14 +326,15 @@ GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
|
|||||||
window->getCursorGrabAccum(x_accum, y_accum);
|
window->getCursorGrabAccum(x_accum, y_accum);
|
||||||
|
|
||||||
// cant use setCursorPosition because the mouse may have no focus!
|
// cant use setCursorPosition because the mouse may have no focus!
|
||||||
if(x_new != x_root || y_new != y_root) {
|
if (x_new != x_root || y_new != y_root) {
|
||||||
if (1 ) { //xme.time > m_last_warp) {
|
if (1) { //xme.time > m_last_warp) {
|
||||||
/* when wrapping we don't need to add an event because the
|
/* when wrapping we don't need to add an event because the
|
||||||
* setCursorPosition call will cause a new event after */
|
* setCursorPosition call will cause a new event after */
|
||||||
SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win); /* wrap */
|
SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win); /* wrap */
|
||||||
window->setCursorGrabAccum(x_accum + (x_root - x_new), y_accum + (y_root - y_new));
|
window->setCursorGrabAccum(x_accum + (x_root - x_new), y_accum + (y_root - y_new));
|
||||||
// m_last_warp= lastEventTime(xme.time);
|
// m_last_warp= lastEventTime(xme.time);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// setCursorPosition(x_new, y_new); /* wrap but don't accumulate */
|
// setCursorPosition(x_new, y_new); /* wrap but don't accumulate */
|
||||||
SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win);
|
SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win);
|
||||||
}
|
}
|
||||||
@@ -343,115 +348,115 @@ GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
g_event= new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x_root, y_root);
|
g_event = new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, x_root, y_root);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP:
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
{
|
{
|
||||||
SDL_MouseButtonEvent &sdl_sub_evt= sdl_event->button;
|
SDL_MouseButtonEvent &sdl_sub_evt = sdl_event->button;
|
||||||
GHOST_TButtonMask gbmask= GHOST_kButtonMaskLeft;
|
GHOST_TButtonMask gbmask = GHOST_kButtonMaskLeft;
|
||||||
GHOST_TEventType type= (sdl_sub_evt.state==SDL_PRESSED) ? GHOST_kEventButtonDown : GHOST_kEventButtonUp;
|
GHOST_TEventType type = (sdl_sub_evt.state == SDL_PRESSED) ? GHOST_kEventButtonDown : GHOST_kEventButtonUp;
|
||||||
|
|
||||||
GHOST_WindowSDL *window= findGhostWindow(SDL_GetWindowFromID(sdl_sub_evt.windowID));
|
GHOST_WindowSDL *window = findGhostWindow(SDL_GetWindowFromID(sdl_sub_evt.windowID));
|
||||||
assert(window != NULL);
|
assert(window != NULL);
|
||||||
|
|
||||||
/* process rest of normal mouse buttons */
|
/* process rest of normal mouse buttons */
|
||||||
if(sdl_sub_evt.button == SDL_BUTTON_LEFT)
|
if (sdl_sub_evt.button == SDL_BUTTON_LEFT)
|
||||||
gbmask= GHOST_kButtonMaskLeft;
|
gbmask = GHOST_kButtonMaskLeft;
|
||||||
else if(sdl_sub_evt.button == SDL_BUTTON_MIDDLE)
|
else if (sdl_sub_evt.button == SDL_BUTTON_MIDDLE)
|
||||||
gbmask= GHOST_kButtonMaskMiddle;
|
gbmask = GHOST_kButtonMaskMiddle;
|
||||||
else if(sdl_sub_evt.button == SDL_BUTTON_RIGHT)
|
else if (sdl_sub_evt.button == SDL_BUTTON_RIGHT)
|
||||||
gbmask= GHOST_kButtonMaskRight;
|
gbmask = GHOST_kButtonMaskRight;
|
||||||
/* these buttons are untested! */
|
/* these buttons are untested! */
|
||||||
else if(sdl_sub_evt.button == SDL_BUTTON_X1)
|
else if (sdl_sub_evt.button == SDL_BUTTON_X1)
|
||||||
gbmask= GHOST_kButtonMaskButton4;
|
gbmask = GHOST_kButtonMaskButton4;
|
||||||
else if(sdl_sub_evt.button == SDL_BUTTON_X2)
|
else if (sdl_sub_evt.button == SDL_BUTTON_X2)
|
||||||
gbmask= GHOST_kButtonMaskButton5;
|
gbmask = GHOST_kButtonMaskButton5;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
g_event= new GHOST_EventButton(getMilliSeconds(), type, window, gbmask);
|
g_event = new GHOST_EventButton(getMilliSeconds(), type, window, gbmask);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_MOUSEWHEEL:
|
case SDL_MOUSEWHEEL:
|
||||||
{
|
{
|
||||||
SDL_MouseWheelEvent &sdl_sub_evt= sdl_event->wheel;
|
SDL_MouseWheelEvent &sdl_sub_evt = sdl_event->wheel;
|
||||||
GHOST_WindowSDL *window= findGhostWindow(SDL_GetWindowFromID(sdl_sub_evt.windowID));
|
GHOST_WindowSDL *window = findGhostWindow(SDL_GetWindowFromID(sdl_sub_evt.windowID));
|
||||||
assert(window != NULL);
|
assert(window != NULL);
|
||||||
g_event= new GHOST_EventWheel(getMilliSeconds(), window, sdl_sub_evt.y);
|
g_event = new GHOST_EventWheel(getMilliSeconds(), window, sdl_sub_evt.y);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
{
|
{
|
||||||
SDL_KeyboardEvent &sdl_sub_evt= sdl_event->key;
|
SDL_KeyboardEvent &sdl_sub_evt = sdl_event->key;
|
||||||
SDL_Keycode sym= sdl_sub_evt.keysym.sym;
|
SDL_Keycode sym = sdl_sub_evt.keysym.sym;
|
||||||
GHOST_TEventType type= (sdl_sub_evt.state == SDL_PRESSED) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp;
|
GHOST_TEventType type = (sdl_sub_evt.state == SDL_PRESSED) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp;
|
||||||
|
|
||||||
GHOST_WindowSDL *window= findGhostWindow(SDL_GetWindowFromID(sdl_sub_evt.windowID));
|
GHOST_WindowSDL *window = findGhostWindow(SDL_GetWindowFromID(sdl_sub_evt.windowID));
|
||||||
assert(window != NULL);
|
assert(window != NULL);
|
||||||
|
|
||||||
GHOST_TKey gkey= convertSDLKey(sdl_sub_evt.keysym.scancode);
|
GHOST_TKey gkey = convertSDLKey(sdl_sub_evt.keysym.scancode);
|
||||||
/* note, the sdl_sub_evt.keysym.sym is truncated, for unicode support ghost has to be modified */
|
/* note, the sdl_sub_evt.keysym.sym is truncated, for unicode support ghost has to be modified */
|
||||||
/* printf("%d\n", sym); */
|
/* printf("%d\n", sym); */
|
||||||
if(sym > 127) {
|
if (sym > 127) {
|
||||||
switch(sym) {
|
switch (sym) {
|
||||||
case SDLK_KP_DIVIDE: sym= '/'; break;
|
case SDLK_KP_DIVIDE: sym = '/'; break;
|
||||||
case SDLK_KP_MULTIPLY: sym= '*'; break;
|
case SDLK_KP_MULTIPLY: sym = '*'; break;
|
||||||
case SDLK_KP_MINUS: sym= '-'; break;
|
case SDLK_KP_MINUS: sym = '-'; break;
|
||||||
case SDLK_KP_PLUS: sym= '+'; break;
|
case SDLK_KP_PLUS: sym = '+'; break;
|
||||||
case SDLK_KP_1: sym= '1'; break;
|
case SDLK_KP_1: sym = '1'; break;
|
||||||
case SDLK_KP_2: sym= '2'; break;
|
case SDLK_KP_2: sym = '2'; break;
|
||||||
case SDLK_KP_3: sym= '3'; break;
|
case SDLK_KP_3: sym = '3'; break;
|
||||||
case SDLK_KP_4: sym= '4'; break;
|
case SDLK_KP_4: sym = '4'; break;
|
||||||
case SDLK_KP_5: sym= '5'; break;
|
case SDLK_KP_5: sym = '5'; break;
|
||||||
case SDLK_KP_6: sym= '6'; break;
|
case SDLK_KP_6: sym = '6'; break;
|
||||||
case SDLK_KP_7: sym= '7'; break;
|
case SDLK_KP_7: sym = '7'; break;
|
||||||
case SDLK_KP_8: sym= '8'; break;
|
case SDLK_KP_8: sym = '8'; break;
|
||||||
case SDLK_KP_9: sym= '9'; break;
|
case SDLK_KP_9: sym = '9'; break;
|
||||||
case SDLK_KP_0: sym= '0'; break;
|
case SDLK_KP_0: sym = '0'; break;
|
||||||
case SDLK_KP_PERIOD: sym= '.'; break;
|
case SDLK_KP_PERIOD: sym = '.'; break;
|
||||||
default: sym= 0; break;
|
default: sym = 0; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(sdl_sub_evt.keysym.mod & (KMOD_LSHIFT|KMOD_RSHIFT)) {
|
if (sdl_sub_evt.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) {
|
||||||
/* lame US keyboard assumptions */
|
/* lame US keyboard assumptions */
|
||||||
if(sym >= 'a' && sym <= ('a' + 32)) {
|
if (sym >= 'a' && sym <= ('a' + 32)) {
|
||||||
sym -= 32;
|
sym -= 32;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch(sym) {
|
switch (sym) {
|
||||||
case '`': sym= '~'; break;
|
case '`': sym = '~'; break;
|
||||||
case '1': sym= '!'; break;
|
case '1': sym = '!'; break;
|
||||||
case '2': sym= '@'; break;
|
case '2': sym = '@'; break;
|
||||||
case '3': sym= '#'; break;
|
case '3': sym = '#'; break;
|
||||||
case '4': sym= '$'; break;
|
case '4': sym = '$'; break;
|
||||||
case '5': sym= '%'; break;
|
case '5': sym = '%'; break;
|
||||||
case '6': sym= '^'; break;
|
case '6': sym = '^'; break;
|
||||||
case '7': sym= '&'; break;
|
case '7': sym = '&'; break;
|
||||||
case '8': sym= '*'; break;
|
case '8': sym = '*'; break;
|
||||||
case '9': sym= '('; break;
|
case '9': sym = '('; break;
|
||||||
case '0': sym= ')'; break;
|
case '0': sym = ')'; break;
|
||||||
case '-': sym= '_'; break;
|
case '-': sym = '_'; break;
|
||||||
case '=': sym= '+'; break;
|
case '=': sym = '+'; break;
|
||||||
case '[': sym= '{'; break;
|
case '[': sym = '{'; break;
|
||||||
case ']': sym= '}'; break;
|
case ']': sym = '}'; break;
|
||||||
case '\\': sym= '|'; break;
|
case '\\': sym = '|'; break;
|
||||||
case ';': sym= ':'; break;
|
case ';': sym = ':'; break;
|
||||||
case '\'': sym= '"'; break;
|
case '\'': sym = '"'; break;
|
||||||
case ',': sym= '<'; break;
|
case ',': sym = '<'; break;
|
||||||
case '.': sym= '>'; break;
|
case '.': sym = '>'; break;
|
||||||
case '/': sym= '?'; break;
|
case '/': sym = '?'; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_event= new GHOST_EventKey(getMilliSeconds(), type, window, gkey, sym, NULL);
|
g_event = new GHOST_EventKey(getMilliSeconds(), type, window, gkey, sym, NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -466,13 +471,13 @@ GHOST_SystemSDL::getCursorPosition(GHOST_TInt32& x,
|
|||||||
GHOST_TInt32& y) const
|
GHOST_TInt32& y) const
|
||||||
{
|
{
|
||||||
int x_win, y_win;
|
int x_win, y_win;
|
||||||
SDL_Window *win= SDL_GetMouseFocus();
|
SDL_Window *win = SDL_GetMouseFocus();
|
||||||
SDL_GetWindowPosition(win, &x_win, &y_win);
|
SDL_GetWindowPosition(win, &x_win, &y_win);
|
||||||
|
|
||||||
int xi, yi;
|
int xi, yi;
|
||||||
SDL_GetMouseState(&xi, &yi);
|
SDL_GetMouseState(&xi, &yi);
|
||||||
x= xi + x_win;
|
x = xi + x_win;
|
||||||
y= yi + x_win;
|
y = yi + x_win;
|
||||||
|
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
@@ -482,7 +487,7 @@ GHOST_SystemSDL::setCursorPosition(GHOST_TInt32 x,
|
|||||||
GHOST_TInt32 y)
|
GHOST_TInt32 y)
|
||||||
{
|
{
|
||||||
int x_win, y_win;
|
int x_win, y_win;
|
||||||
SDL_Window *win= SDL_GetMouseFocus();
|
SDL_Window *win = SDL_GetMouseFocus();
|
||||||
SDL_GetWindowPosition(win, &x_win, &y_win);
|
SDL_GetWindowPosition(win, &x_win, &y_win);
|
||||||
|
|
||||||
SDL_WarpMouseInWindow(win, x - x_win, y - y_win);
|
SDL_WarpMouseInWindow(win, x - x_win, y - y_win);
|
||||||
@@ -492,12 +497,12 @@ GHOST_SystemSDL::setCursorPosition(GHOST_TInt32 x,
|
|||||||
bool
|
bool
|
||||||
GHOST_SystemSDL::generateWindowExposeEvents()
|
GHOST_SystemSDL::generateWindowExposeEvents()
|
||||||
{
|
{
|
||||||
std::vector<GHOST_WindowSDL *>::iterator w_start= m_dirty_windows.begin();
|
std::vector<GHOST_WindowSDL *>::iterator w_start = m_dirty_windows.begin();
|
||||||
std::vector<GHOST_WindowSDL *>::const_iterator w_end= m_dirty_windows.end();
|
std::vector<GHOST_WindowSDL *>::const_iterator w_end = m_dirty_windows.end();
|
||||||
bool anyProcessed= false;
|
bool anyProcessed = false;
|
||||||
|
|
||||||
for (;w_start != w_end; ++w_start) {
|
for (; w_start != w_end; ++w_start) {
|
||||||
GHOST_Event * g_event= new
|
GHOST_Event *g_event = new
|
||||||
GHOST_Event(
|
GHOST_Event(
|
||||||
getMilliSeconds(),
|
getMilliSeconds(),
|
||||||
GHOST_kEventWindowUpdate,
|
GHOST_kEventWindowUpdate,
|
||||||
@@ -509,7 +514,7 @@ GHOST_SystemSDL::generateWindowExposeEvents()
|
|||||||
if (g_event) {
|
if (g_event) {
|
||||||
printf("Expose events pushed\n");
|
printf("Expose events pushed\n");
|
||||||
pushEvent(g_event);
|
pushEvent(g_event);
|
||||||
anyProcessed= true;
|
anyProcessed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,21 +529,22 @@ GHOST_SystemSDL::processEvents(bool waitForEvent)
|
|||||||
// Get all the current events -- translate them into
|
// Get all the current events -- translate them into
|
||||||
// ghost events and call base class pushEvent() method.
|
// ghost events and call base class pushEvent() method.
|
||||||
|
|
||||||
bool anyProcessed= false;
|
bool anyProcessed = false;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
GHOST_TimerManager* timerMgr= getTimerManager();
|
GHOST_TimerManager *timerMgr = getTimerManager();
|
||||||
|
|
||||||
if (waitForEvent && m_dirty_windows.empty() && !SDL_HasEvents(SDL_FIRSTEVENT, SDL_LASTEVENT)) {
|
if (waitForEvent && m_dirty_windows.empty() && !SDL_HasEvents(SDL_FIRSTEVENT, SDL_LASTEVENT)) {
|
||||||
GHOST_TUns64 next= timerMgr->nextFireTime();
|
GHOST_TUns64 next = timerMgr->nextFireTime();
|
||||||
|
|
||||||
if (next==GHOST_kFireTimeNever) {
|
if (next == GHOST_kFireTimeNever) {
|
||||||
SDL_WaitEventTimeout(NULL, -1);
|
SDL_WaitEventTimeout(NULL, -1);
|
||||||
//SleepTillEvent(m_display, -1);
|
//SleepTillEvent(m_display, -1);
|
||||||
} else {
|
}
|
||||||
GHOST_TInt64 maxSleep= next - getMilliSeconds();
|
else {
|
||||||
|
GHOST_TInt64 maxSleep = next - getMilliSeconds();
|
||||||
|
|
||||||
if(maxSleep >= 0) {
|
if (maxSleep >= 0) {
|
||||||
SDL_WaitEventTimeout(NULL, next - getMilliSeconds());
|
SDL_WaitEventTimeout(NULL, next - getMilliSeconds());
|
||||||
// SleepTillEvent(m_display, next - getMilliSeconds()); // X11
|
// SleepTillEvent(m_display, next - getMilliSeconds()); // X11
|
||||||
}
|
}
|
||||||
@@ -546,17 +552,17 @@ GHOST_SystemSDL::processEvents(bool waitForEvent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (timerMgr->fireTimers(getMilliSeconds())) {
|
if (timerMgr->fireTimers(getMilliSeconds())) {
|
||||||
anyProcessed= true;
|
anyProcessed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Event sdl_event;
|
SDL_Event sdl_event;
|
||||||
while (SDL_PollEvent(&sdl_event)) {
|
while (SDL_PollEvent(&sdl_event)) {
|
||||||
processEvent(&sdl_event);
|
processEvent(&sdl_event);
|
||||||
anyProcessed= true;
|
anyProcessed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (generateWindowExposeEvents()) {
|
if (generateWindowExposeEvents()) {
|
||||||
anyProcessed= true;
|
anyProcessed = true;
|
||||||
}
|
}
|
||||||
} while (waitForEvent && !anyProcessed);
|
} while (waitForEvent && !anyProcessed);
|
||||||
|
|
||||||
@@ -574,13 +580,13 @@ GHOST_SystemSDL::findGhostWindow(SDL_Window *sdl_win)
|
|||||||
// We should always check the window manager's list of windows
|
// We should always check the window manager's list of windows
|
||||||
// and only process events on these windows.
|
// and only process events on these windows.
|
||||||
|
|
||||||
std::vector<GHOST_IWindow *> & win_vec= m_windowManager->getWindows();
|
std::vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();
|
||||||
|
|
||||||
std::vector<GHOST_IWindow *>::iterator win_it= win_vec.begin();
|
std::vector<GHOST_IWindow *>::iterator win_it = win_vec.begin();
|
||||||
std::vector<GHOST_IWindow *>::const_iterator win_end= win_vec.end();
|
std::vector<GHOST_IWindow *>::const_iterator win_end = win_vec.end();
|
||||||
|
|
||||||
for (; win_it != win_end; ++win_it) {
|
for (; win_it != win_end; ++win_it) {
|
||||||
GHOST_WindowSDL * window= static_cast<GHOST_WindowSDL *>(*win_it);
|
GHOST_WindowSDL *window = static_cast<GHOST_WindowSDL *>(*win_it);
|
||||||
if (window->getSDLWindow() == sdl_win) {
|
if (window->getSDLWindow() == sdl_win) {
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
@@ -600,7 +606,7 @@ GHOST_SystemSDL::addDirtyWindow(GHOST_WindowSDL *bad_wind)
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_SystemSDL::getButtons(GHOST_Buttons& buttons) const
|
GHOST_TSuccess GHOST_SystemSDL::getButtons(GHOST_Buttons& buttons) const
|
||||||
{
|
{
|
||||||
Uint8 state= SDL_GetMouseState(NULL, NULL);
|
Uint8 state = SDL_GetMouseState(NULL, NULL);
|
||||||
buttons.set(GHOST_kButtonMaskLeft, (state & SDL_BUTTON_LMASK) != 0);
|
buttons.set(GHOST_kButtonMaskLeft, (state & SDL_BUTTON_LMASK) != 0);
|
||||||
buttons.set(GHOST_kButtonMaskMiddle, (state & SDL_BUTTON_MMASK) != 0);
|
buttons.set(GHOST_kButtonMaskMiddle, (state & SDL_BUTTON_MMASK) != 0);
|
||||||
buttons.set(GHOST_kButtonMaskRight, (state & SDL_BUTTON_RMASK) != 0);
|
buttons.set(GHOST_kButtonMaskRight, (state & SDL_BUTTON_RMASK) != 0);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ private:
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* SDL specific */
|
/* SDL specific */
|
||||||
GHOST_WindowSDL * findGhostWindow(SDL_Window *sdl_win);
|
GHOST_WindowSDL *findGhostWindow(SDL_Window *sdl_win);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
generateWindowExposeEvents();
|
generateWindowExposeEvents();
|
||||||
|
|||||||
@@ -158,9 +158,9 @@ static void initRawInput()
|
|||||||
}
|
}
|
||||||
|
|
||||||
GHOST_SystemWin32::GHOST_SystemWin32()
|
GHOST_SystemWin32::GHOST_SystemWin32()
|
||||||
: m_hasPerformanceCounter(false), m_freq(0), m_start(0)
|
: m_hasPerformanceCounter(false), m_freq(0), m_start(0)
|
||||||
{
|
{
|
||||||
m_displayManager = new GHOST_DisplayManagerWin32 ();
|
m_displayManager = new GHOST_DisplayManagerWin32();
|
||||||
GHOST_ASSERT(m_displayManager, "GHOST_SystemWin32::GHOST_SystemWin32(): m_displayManager==0\n");
|
GHOST_ASSERT(m_displayManager, "GHOST_SystemWin32::GHOST_SystemWin32(): m_displayManager==0\n");
|
||||||
m_displayManager->initialize();
|
m_displayManager->initialize();
|
||||||
|
|
||||||
@@ -195,12 +195,12 @@ GHOST_TUns64 GHOST_SystemWin32::getMilliSeconds() const
|
|||||||
|
|
||||||
// Retrieve current count
|
// Retrieve current count
|
||||||
__int64 count = 0;
|
__int64 count = 0;
|
||||||
::QueryPerformanceCounter((LARGE_INTEGER*)&count);
|
::QueryPerformanceCounter((LARGE_INTEGER *)&count);
|
||||||
|
|
||||||
// Calculate the time passed since system initialization.
|
// Calculate the time passed since system initialization.
|
||||||
__int64 delta = 1000*(count-m_start);
|
__int64 delta = 1000 * (count - m_start);
|
||||||
|
|
||||||
GHOST_TUns64 t = (GHOST_TUns64)(delta/m_freq);
|
GHOST_TUns64 t = (GHOST_TUns64)(delta / m_freq);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,18 +217,18 @@ GHOST_TUns8 GHOST_SystemWin32::getNumDisplays() const
|
|||||||
void GHOST_SystemWin32::getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const
|
void GHOST_SystemWin32::getMainDisplayDimensions(GHOST_TUns32& width, GHOST_TUns32& height) const
|
||||||
{
|
{
|
||||||
width = ::GetSystemMetrics(SM_CXSCREEN);
|
width = ::GetSystemMetrics(SM_CXSCREEN);
|
||||||
height= ::GetSystemMetrics(SM_CYSCREEN);
|
height = ::GetSystemMetrics(SM_CYSCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_IWindow* GHOST_SystemWin32::createWindow(
|
GHOST_IWindow *GHOST_SystemWin32::createWindow(
|
||||||
const STR_String& title,
|
const STR_String& title,
|
||||||
GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
|
GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
|
||||||
GHOST_TWindowState state, GHOST_TDrawingContextType type,
|
GHOST_TWindowState state, GHOST_TDrawingContextType type,
|
||||||
bool stereoVisual, const GHOST_TUns16 numOfAASamples, const GHOST_TEmbedderWindowID parentWindow )
|
bool stereoVisual, const GHOST_TUns16 numOfAASamples, const GHOST_TEmbedderWindowID parentWindow)
|
||||||
{
|
{
|
||||||
GHOST_Window* window = 0;
|
GHOST_Window *window = 0;
|
||||||
window = new GHOST_WindowWin32 (this, title, left, top, width, height, state, type, stereoVisual, numOfAASamples, parentWindow);
|
window = new GHOST_WindowWin32(this, title, left, top, width, height, state, type, stereoVisual, numOfAASamples, parentWindow);
|
||||||
if (window) {
|
if (window) {
|
||||||
if (window->getValid()) {
|
if (window->getValid()) {
|
||||||
// Store the pointer to the window
|
// Store the pointer to the window
|
||||||
@@ -240,14 +240,14 @@ GHOST_IWindow* GHOST_SystemWin32::createWindow(
|
|||||||
else {
|
else {
|
||||||
|
|
||||||
// Invalid parent window hwnd
|
// Invalid parent window hwnd
|
||||||
if (((GHOST_WindowWin32*)window)->getNextWindow() == NULL) {
|
if (((GHOST_WindowWin32 *)window)->getNextWindow() == NULL) {
|
||||||
delete window;
|
delete window;
|
||||||
window = 0;
|
window = 0;
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
// An invalid window could be one that was used to test for AA
|
// An invalid window could be one that was used to test for AA
|
||||||
window = ((GHOST_WindowWin32*)window)->getNextWindow();
|
window = ((GHOST_WindowWin32 *)window)->getNextWindow();
|
||||||
|
|
||||||
// If another window is found, let the wm know about that one, but not the old one
|
// If another window is found, let the wm know about that one, but not the old one
|
||||||
if (window->getValid()) {
|
if (window->getValid()) {
|
||||||
@@ -270,7 +270,7 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
|
|||||||
bool anyProcessed = false;
|
bool anyProcessed = false;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
GHOST_TimerManager* timerMgr = getTimerManager();
|
GHOST_TimerManager *timerMgr = getTimerManager();
|
||||||
|
|
||||||
if (waitForEvent && !::PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) {
|
if (waitForEvent && !::PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) {
|
||||||
#if 1
|
#if 1
|
||||||
@@ -281,7 +281,8 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
|
|||||||
|
|
||||||
if (next == GHOST_kFireTimeNever) {
|
if (next == GHOST_kFireTimeNever) {
|
||||||
::WaitMessage();
|
::WaitMessage();
|
||||||
} else if(maxSleep >= 0.0) {
|
}
|
||||||
|
else if (maxSleep >= 0.0) {
|
||||||
::SetTimer(NULL, 0, maxSleep, NULL);
|
::SetTimer(NULL, 0, maxSleep, NULL);
|
||||||
::WaitMessage();
|
::WaitMessage();
|
||||||
::KillTimer(NULL, 0);
|
::KillTimer(NULL, 0);
|
||||||
@@ -307,7 +308,7 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
|
|||||||
GHOST_TSuccess GHOST_SystemWin32::getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const
|
GHOST_TSuccess GHOST_SystemWin32::getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const
|
||||||
{
|
{
|
||||||
POINT point;
|
POINT point;
|
||||||
if(::GetCursorPos(&point)){
|
if (::GetCursorPos(&point)) {
|
||||||
x = point.x;
|
x = point.x;
|
||||||
y = point.y;
|
y = point.y;
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
@@ -343,7 +344,7 @@ GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys& keys) cons
|
|||||||
|
|
||||||
bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0;
|
bool lwindown = HIBYTE(::GetKeyState(VK_LWIN)) != 0;
|
||||||
bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0;
|
bool rwindown = HIBYTE(::GetKeyState(VK_RWIN)) != 0;
|
||||||
if(lwindown || rwindown)
|
if (lwindown || rwindown)
|
||||||
keys.set(GHOST_kModifierKeyOS, true);
|
keys.set(GHOST_kModifierKeyOS, true);
|
||||||
else
|
else
|
||||||
keys.set(GHOST_kModifierKeyOS, false);
|
keys.set(GHOST_kModifierKeyOS, false);
|
||||||
@@ -386,10 +387,10 @@ GHOST_TSuccess GHOST_SystemWin32::init()
|
|||||||
initRawInput();
|
initRawInput();
|
||||||
|
|
||||||
// Determine whether this system has a high frequency performance counter. */
|
// Determine whether this system has a high frequency performance counter. */
|
||||||
m_hasPerformanceCounter = ::QueryPerformanceFrequency((LARGE_INTEGER*)&m_freq) == TRUE;
|
m_hasPerformanceCounter = ::QueryPerformanceFrequency((LARGE_INTEGER *)&m_freq) == TRUE;
|
||||||
if (m_hasPerformanceCounter) {
|
if (m_hasPerformanceCounter) {
|
||||||
GHOST_PRINT("GHOST_SystemWin32::init: High Frequency Performance Timer available\n")
|
GHOST_PRINT("GHOST_SystemWin32::init: High Frequency Performance Timer available\n")
|
||||||
::QueryPerformanceCounter((LARGE_INTEGER*)&m_start);
|
::QueryPerformanceCounter((LARGE_INTEGER *)&m_start);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GHOST_PRINT("GHOST_SystemWin32::init: High Frequency Performance Timer not available\n")
|
GHOST_PRINT("GHOST_SystemWin32::init: High Frequency Performance Timer not available\n")
|
||||||
@@ -397,20 +398,20 @@ GHOST_TSuccess GHOST_SystemWin32::init()
|
|||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
WNDCLASSW wc;
|
WNDCLASSW wc;
|
||||||
wc.style= CS_HREDRAW | CS_VREDRAW;
|
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
wc.lpfnWndProc= s_wndProc;
|
wc.lpfnWndProc = s_wndProc;
|
||||||
wc.cbClsExtra= 0;
|
wc.cbClsExtra = 0;
|
||||||
wc.cbWndExtra= 0;
|
wc.cbWndExtra = 0;
|
||||||
wc.hInstance= ::GetModuleHandle(0);
|
wc.hInstance = ::GetModuleHandle(0);
|
||||||
wc.hIcon = ::LoadIcon(wc.hInstance, "APPICON");
|
wc.hIcon = ::LoadIcon(wc.hInstance, "APPICON");
|
||||||
|
|
||||||
if (!wc.hIcon) {
|
if (!wc.hIcon) {
|
||||||
::LoadIcon(NULL, IDI_APPLICATION);
|
::LoadIcon(NULL, IDI_APPLICATION);
|
||||||
}
|
}
|
||||||
wc.hCursor = ::LoadCursor(0, IDC_ARROW);
|
wc.hCursor = ::LoadCursor(0, IDC_ARROW);
|
||||||
wc.hbrBackground= (HBRUSH)::GetStockObject(BLACK_BRUSH);
|
wc.hbrBackground = (HBRUSH) ::GetStockObject(BLACK_BRUSH);
|
||||||
wc.lpszMenuName = 0;
|
wc.lpszMenuName = 0;
|
||||||
wc.lpszClassName= L"GHOST_WindowClass";
|
wc.lpszClassName = L"GHOST_WindowClass";
|
||||||
|
|
||||||
// Use RegisterClassEx for setting small icon
|
// Use RegisterClassEx for setting small icon
|
||||||
if (::RegisterClassW(&wc) == 0) {
|
if (::RegisterClassW(&wc) == 0) {
|
||||||
@@ -427,12 +428,12 @@ GHOST_TSuccess GHOST_SystemWin32::exit()
|
|||||||
return GHOST_System::exit();
|
return GHOST_System::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TKey GHOST_SystemWin32::hardKey(GHOST_IWindow *window, RAWINPUT const& raw, int * keyDown, char * vk)
|
GHOST_TKey GHOST_SystemWin32::hardKey(GHOST_IWindow *window, RAWINPUT const& raw, int *keyDown, char *vk)
|
||||||
{
|
{
|
||||||
GHOST_TKey key = GHOST_kKeyUnknown;
|
GHOST_TKey key = GHOST_kKeyUnknown;
|
||||||
|
|
||||||
|
|
||||||
if(!keyDown)
|
if (!keyDown)
|
||||||
return GHOST_kKeyUnknown;
|
return GHOST_kKeyUnknown;
|
||||||
|
|
||||||
|
|
||||||
@@ -446,14 +447,14 @@ GHOST_TKey GHOST_SystemWin32::hardKey(GHOST_IWindow *window, RAWINPUT const& raw
|
|||||||
unsigned int msg = raw.data.keyboard.Message;
|
unsigned int msg = raw.data.keyboard.Message;
|
||||||
*keyDown = !(raw.data.keyboard.Flags & RI_KEY_BREAK) && msg != WM_KEYUP && msg != WM_SYSKEYUP;
|
*keyDown = !(raw.data.keyboard.Flags & RI_KEY_BREAK) && msg != WM_KEYUP && msg != WM_SYSKEYUP;
|
||||||
|
|
||||||
key = this->convertKey(window, raw.data.keyboard.VKey, raw.data.keyboard.MakeCode, (raw.data.keyboard.Flags&(RI_KEY_E1|RI_KEY_E0)));
|
key = this->convertKey(window, raw.data.keyboard.VKey, raw.data.keyboard.MakeCode, (raw.data.keyboard.Flags & (RI_KEY_E1 | RI_KEY_E0)));
|
||||||
|
|
||||||
// extra handling of modifier keys: don't send repeats out from GHOST
|
// extra handling of modifier keys: don't send repeats out from GHOST
|
||||||
if(key >= GHOST_kKeyLeftShift && key <= GHOST_kKeyRightAlt)
|
if (key >= GHOST_kKeyLeftShift && key <= GHOST_kKeyRightAlt)
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
GHOST_TModifierKeyMask modifier;
|
GHOST_TModifierKeyMask modifier;
|
||||||
switch(key) {
|
switch (key) {
|
||||||
case GHOST_kKeyLeftShift:
|
case GHOST_kKeyLeftShift:
|
||||||
{
|
{
|
||||||
changed = (modifiers.get(GHOST_kModifierKeyLeftShift) != (bool)*keyDown);
|
changed = (modifiers.get(GHOST_kModifierKeyLeftShift) != (bool)*keyDown);
|
||||||
@@ -493,19 +494,18 @@ GHOST_TKey GHOST_SystemWin32::hardKey(GHOST_IWindow *window, RAWINPUT const& raw
|
|||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
modifiers.set(modifier, (bool)*keyDown);
|
modifiers.set(modifier, (bool)*keyDown);
|
||||||
system->storeModifierKeys(modifiers);
|
system->storeModifierKeys(modifiers);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
key = GHOST_kKeyUnknown;
|
key = GHOST_kKeyUnknown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(vk) *vk = raw.data.keyboard.VKey;
|
if (vk) *vk = raw.data.keyboard.VKey;
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
@@ -515,9 +515,9 @@ GHOST_TKey GHOST_SystemWin32::hardKey(GHOST_IWindow *window, RAWINPUT const& raw
|
|||||||
GHOST_TKey GHOST_SystemWin32::processSpecialKey(GHOST_IWindow *window, short vKey, short scanCode) const
|
GHOST_TKey GHOST_SystemWin32::processSpecialKey(GHOST_IWindow *window, short vKey, short scanCode) const
|
||||||
{
|
{
|
||||||
GHOST_TKey key = GHOST_kKeyUnknown;
|
GHOST_TKey key = GHOST_kKeyUnknown;
|
||||||
switch(PRIMARYLANGID(m_langId)) {
|
switch (PRIMARYLANGID(m_langId)) {
|
||||||
case LANG_FRENCH:
|
case LANG_FRENCH:
|
||||||
if(vKey==VK_OEM_8) key = GHOST_kKeyF13; // oem key; used purely for shortcuts .
|
if (vKey == VK_OEM_8) key = GHOST_kKeyF13; // oem key; used purely for shortcuts .
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,7 +542,7 @@ GHOST_TKey GHOST_SystemWin32::convertKey(GHOST_IWindow *window, short vKey, shor
|
|||||||
else {
|
else {
|
||||||
switch (vKey) {
|
switch (vKey) {
|
||||||
case VK_RETURN:
|
case VK_RETURN:
|
||||||
key = (extend)?GHOST_kKeyNumpadEnter : GHOST_kKeyEnter; break;
|
key = (extend) ? GHOST_kKeyNumpadEnter : GHOST_kKeyEnter; break;
|
||||||
|
|
||||||
case VK_BACK: key = GHOST_kKeyBackSpace; break;
|
case VK_BACK: key = GHOST_kKeyBackSpace; break;
|
||||||
case VK_TAB: key = GHOST_kKeyTab; break;
|
case VK_TAB: key = GHOST_kKeyTab; break;
|
||||||
@@ -566,7 +566,7 @@ GHOST_TKey GHOST_SystemWin32::convertKey(GHOST_IWindow *window, short vKey, shor
|
|||||||
key = (extend) ? GHOST_kKeyLeftArrow : GHOST_kKeyNumpad4; break;
|
key = (extend) ? GHOST_kKeyLeftArrow : GHOST_kKeyNumpad4; break;
|
||||||
case VK_CLEAR:
|
case VK_CLEAR:
|
||||||
case VK_NUMPAD5:
|
case VK_NUMPAD5:
|
||||||
key = (extend) ? GHOST_kKeyUnknown: GHOST_kKeyNumpad5; break;
|
key = (extend) ? GHOST_kKeyUnknown : GHOST_kKeyNumpad5; break;
|
||||||
case VK_RIGHT:
|
case VK_RIGHT:
|
||||||
case VK_NUMPAD6:
|
case VK_NUMPAD6:
|
||||||
key = (extend) ? GHOST_kKeyRightArrow : GHOST_kKeyNumpad6; break;
|
key = (extend) ? GHOST_kKeyRightArrow : GHOST_kKeyNumpad6; break;
|
||||||
@@ -604,13 +604,13 @@ GHOST_TKey GHOST_SystemWin32::convertKey(GHOST_IWindow *window, short vKey, shor
|
|||||||
case VK_GR_LESS: key = GHOST_kKeyGrLess; break;
|
case VK_GR_LESS: key = GHOST_kKeyGrLess; break;
|
||||||
|
|
||||||
case VK_SHIFT:
|
case VK_SHIFT:
|
||||||
key = (scanCode == 0x36)? GHOST_kKeyRightShift : GHOST_kKeyLeftShift;
|
key = (scanCode == 0x36) ? GHOST_kKeyRightShift : GHOST_kKeyLeftShift;
|
||||||
break;
|
break;
|
||||||
case VK_CONTROL:
|
case VK_CONTROL:
|
||||||
key = (extend)? GHOST_kKeyRightControl : GHOST_kKeyLeftControl;
|
key = (extend) ? GHOST_kKeyRightControl : GHOST_kKeyLeftControl;
|
||||||
break;
|
break;
|
||||||
case VK_MENU:
|
case VK_MENU:
|
||||||
key = (extend)? GHOST_kKeyRightAlt : GHOST_kKeyLeftAlt;
|
key = (extend) ? GHOST_kKeyRightAlt : GHOST_kKeyLeftAlt;
|
||||||
break;
|
break;
|
||||||
case VK_LWIN:
|
case VK_LWIN:
|
||||||
case VK_RWIN:
|
case VK_RWIN:
|
||||||
@@ -620,7 +620,7 @@ GHOST_TKey GHOST_SystemWin32::convertKey(GHOST_IWindow *window, short vKey, shor
|
|||||||
case VK_SCROLL: key = GHOST_kKeyScrollLock; break;
|
case VK_SCROLL: key = GHOST_kKeyScrollLock; break;
|
||||||
case VK_CAPITAL: key = GHOST_kKeyCapsLock; break;
|
case VK_CAPITAL: key = GHOST_kKeyCapsLock; break;
|
||||||
case VK_OEM_8:
|
case VK_OEM_8:
|
||||||
key = ((GHOST_SystemWin32*)getSystem())->processSpecialKey(window, vKey, scanCode);
|
key = ((GHOST_SystemWin32 *)getSystem())->processSpecialKey(window, vKey, scanCode);
|
||||||
break;
|
break;
|
||||||
case VK_MEDIA_PLAY_PAUSE: key = GHOST_kKeyMediaPlay; break;
|
case VK_MEDIA_PLAY_PAUSE: key = GHOST_kKeyMediaPlay; break;
|
||||||
case VK_MEDIA_STOP: key = GHOST_kKeyMediaStop; break;
|
case VK_MEDIA_STOP: key = GHOST_kKeyMediaStop; break;
|
||||||
@@ -635,17 +635,17 @@ GHOST_TKey GHOST_SystemWin32::convertKey(GHOST_IWindow *window, short vKey, shor
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_EventButton* GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type, GHOST_IWindow *window, GHOST_TButtonMask mask)
|
GHOST_EventButton *GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type, GHOST_IWindow *window, GHOST_TButtonMask mask)
|
||||||
{
|
{
|
||||||
return new GHOST_EventButton (getSystem()->getMilliSeconds(), type, window, mask);
|
return new GHOST_EventButton(getSystem()->getMilliSeconds(), type, window, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_EventCursor* GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type, GHOST_IWindow *Iwindow)
|
GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type, GHOST_IWindow *Iwindow)
|
||||||
{
|
{
|
||||||
GHOST_TInt32 x_screen, y_screen;
|
GHOST_TInt32 x_screen, y_screen;
|
||||||
GHOST_SystemWin32 * system = ((GHOST_SystemWin32 * ) getSystem());
|
GHOST_SystemWin32 *system = ((GHOST_SystemWin32 * ) getSystem());
|
||||||
GHOST_WindowWin32 * window = ( GHOST_WindowWin32 * ) Iwindow;
|
GHOST_WindowWin32 *window = ( GHOST_WindowWin32 * ) Iwindow;
|
||||||
|
|
||||||
system->getCursorPosition(x_screen, y_screen);
|
system->getCursorPosition(x_screen, y_screen);
|
||||||
|
|
||||||
@@ -653,13 +653,13 @@ GHOST_EventCursor* GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type,
|
|||||||
bool is_tablet = false;
|
bool is_tablet = false;
|
||||||
|
|
||||||
if (is_tablet == false && window->getCursorGrabModeIsWarp()) {
|
if (is_tablet == false && window->getCursorGrabModeIsWarp()) {
|
||||||
GHOST_TInt32 x_new= x_screen;
|
GHOST_TInt32 x_new = x_screen;
|
||||||
GHOST_TInt32 y_new= y_screen;
|
GHOST_TInt32 y_new = y_screen;
|
||||||
GHOST_TInt32 x_accum, y_accum;
|
GHOST_TInt32 x_accum, y_accum;
|
||||||
GHOST_Rect bounds;
|
GHOST_Rect bounds;
|
||||||
|
|
||||||
/* fallback to window bounds */
|
/* fallback to window bounds */
|
||||||
if(window->getCursorGrabBounds(bounds)==GHOST_kFailure){
|
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
|
||||||
window->getClientBounds(bounds);
|
window->getClientBounds(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -669,12 +669,13 @@ GHOST_EventCursor* GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type,
|
|||||||
bounds.wrapPoint(x_new, y_new, 2); /* offset of one incase blender is at screen bounds */
|
bounds.wrapPoint(x_new, y_new, 2); /* offset of one incase blender is at screen bounds */
|
||||||
|
|
||||||
window->getCursorGrabAccum(x_accum, y_accum);
|
window->getCursorGrabAccum(x_accum, y_accum);
|
||||||
if(x_new != x_screen|| y_new != y_screen) {
|
if (x_new != x_screen || y_new != y_screen) {
|
||||||
/* when wrapping we don't need to add an event because the
|
/* when wrapping we don't need to add an event because the
|
||||||
* setCursorPosition call will cause a new event after */
|
* setCursorPosition call will cause a new event after */
|
||||||
system->setCursorPosition(x_new, y_new); /* wrap */
|
system->setCursorPosition(x_new, y_new); /* wrap */
|
||||||
window->setCursorGrabAccum(x_accum + (x_screen - x_new), y_accum + (y_screen - y_new));
|
window->setCursorGrabAccum(x_accum + (x_screen - x_new), y_accum + (y_screen - y_new));
|
||||||
}else{
|
}
|
||||||
|
else {
|
||||||
return new GHOST_EventCursor(system->getMilliSeconds(),
|
return new GHOST_EventCursor(system->getMilliSeconds(),
|
||||||
GHOST_kEventCursorMove,
|
GHOST_kEventCursorMove,
|
||||||
window,
|
window,
|
||||||
@@ -696,59 +697,59 @@ GHOST_EventCursor* GHOST_SystemWin32::processCursorEvent(GHOST_TEventType type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_EventWheel* GHOST_SystemWin32::processWheelEvent(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam)
|
GHOST_EventWheel *GHOST_SystemWin32::processWheelEvent(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// short fwKeys = LOWORD(wParam); // key flags
|
// short fwKeys = LOWORD(wParam); // key flags
|
||||||
int zDelta = (short) HIWORD(wParam); // wheel rotation
|
int zDelta = (short) HIWORD(wParam); // wheel rotation
|
||||||
|
|
||||||
// zDelta /= WHEEL_DELTA;
|
// zDelta /= WHEEL_DELTA;
|
||||||
// temporary fix below: microsoft now has added more precision, making the above division not work
|
// temporary fix below: microsoft now has added more precision, making the above division not work
|
||||||
if (zDelta <= 0 ) zDelta= -1; else zDelta= 1;
|
if (zDelta <= 0) zDelta = -1; else zDelta = 1;
|
||||||
|
|
||||||
// short xPos = (short) LOWORD(lParam); // horizontal position of pointer
|
// short xPos = (short) LOWORD(lParam); // horizontal position of pointer
|
||||||
// short yPos = (short) HIWORD(lParam); // vertical position of pointer
|
// short yPos = (short) HIWORD(lParam); // vertical position of pointer
|
||||||
return new GHOST_EventWheel (getSystem()->getMilliSeconds(), window, zDelta);
|
return new GHOST_EventWheel(getSystem()->getMilliSeconds(), window, zDelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINPUT const& raw)
|
GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINPUT const& raw)
|
||||||
{
|
{
|
||||||
int keyDown=0;
|
int keyDown = 0;
|
||||||
char vk;
|
char vk;
|
||||||
GHOST_SystemWin32 * system = (GHOST_SystemWin32 *)getSystem();
|
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
|
||||||
GHOST_TKey key = system->hardKey(window, raw, &keyDown, &vk);
|
GHOST_TKey key = system->hardKey(window, raw, &keyDown, &vk);
|
||||||
GHOST_EventKey* event;
|
GHOST_EventKey *event;
|
||||||
|
|
||||||
if (key != GHOST_kKeyUnknown) {
|
if (key != GHOST_kKeyUnknown) {
|
||||||
char utf8_char[6] = {0};
|
char utf8_char[6] = {0};
|
||||||
char ascii = 0;
|
char ascii = 0;
|
||||||
|
|
||||||
wchar_t utf16[3]={0};
|
wchar_t utf16[3] = {0};
|
||||||
BYTE state[256] ={0};
|
BYTE state[256] = {0};
|
||||||
int r;
|
int r;
|
||||||
GetKeyboardState((PBYTE)state);
|
GetKeyboardState((PBYTE)state);
|
||||||
|
|
||||||
if(r = ToUnicodeEx(vk, 0, state, utf16, 2, 0, system->m_keylayout)) {
|
if (r = ToUnicodeEx(vk, 0, state, utf16, 2, 0, system->m_keylayout)) {
|
||||||
if((r>0 && r<3)){
|
if ((r > 0 && r < 3)) {
|
||||||
utf16[r]=0;
|
utf16[r] = 0;
|
||||||
conv_utf_16_to_8(utf16,utf8_char,6);
|
conv_utf_16_to_8(utf16, utf8_char, 6);
|
||||||
}
|
}
|
||||||
else if (r==-1) {
|
else if (r == -1) {
|
||||||
utf8_char[0] = '\0';
|
utf8_char[0] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!keyDown) {
|
if (!keyDown) {
|
||||||
utf8_char[0] = '\0';
|
utf8_char[0] = '\0';
|
||||||
ascii='\0';
|
ascii = '\0';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ascii = utf8_char[0]& 0x80?'?' : utf8_char[0];
|
ascii = utf8_char[0] & 0x80 ? '?' : utf8_char[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(0x80&state[VK_MENU]) utf8_char[0]='\0';
|
if (0x80 & state[VK_MENU]) utf8_char[0] = '\0';
|
||||||
|
|
||||||
event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown: GHOST_kEventKeyUp, window, key, ascii, utf8_char);
|
event = new GHOST_EventKey(system->getMilliSeconds(), keyDown ? GHOST_kEventKeyDown : GHOST_kEventKeyUp, window, key, ascii, utf8_char);
|
||||||
|
|
||||||
#ifdef GHOST_DEBUG
|
#ifdef GHOST_DEBUG
|
||||||
std::cout << ascii << std::endl;
|
std::cout << ascii << std::endl;
|
||||||
@@ -761,9 +762,9 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_Event* GHOST_SystemWin32::processWindowEvent(GHOST_TEventType type, GHOST_IWindow* window)
|
GHOST_Event *GHOST_SystemWin32::processWindowEvent(GHOST_TEventType type, GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
GHOST_System* system = (GHOST_System*)getSystem();
|
GHOST_System *system = (GHOST_System *)getSystem();
|
||||||
|
|
||||||
if (type == GHOST_kEventWindowActivate) {
|
if (type == GHOST_kEventWindowActivate) {
|
||||||
system->getWindowManager()->setActiveWindow(window);
|
system->getWindowManager()->setActiveWindow(window);
|
||||||
@@ -774,22 +775,22 @@ GHOST_Event* GHOST_SystemWin32::processWindowEvent(GHOST_TEventType type, GHOST_
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_SystemWin32::pushDragDropEvent(GHOST_TEventType eventType,
|
GHOST_TSuccess GHOST_SystemWin32::pushDragDropEvent(GHOST_TEventType eventType,
|
||||||
GHOST_TDragnDropTypes draggedObjectType,
|
GHOST_TDragnDropTypes draggedObjectType,
|
||||||
GHOST_IWindow* window,
|
GHOST_IWindow *window,
|
||||||
int mouseX, int mouseY,
|
int mouseX, int mouseY,
|
||||||
void* data)
|
void *data)
|
||||||
{
|
{
|
||||||
GHOST_SystemWin32* system = ((GHOST_SystemWin32*)getSystem());
|
GHOST_SystemWin32 *system = ((GHOST_SystemWin32 *)getSystem());
|
||||||
return system->pushEvent(new GHOST_EventDragnDrop(system->getMilliSeconds(),
|
return system->pushEvent(new GHOST_EventDragnDrop(system->getMilliSeconds(),
|
||||||
eventType,
|
eventType,
|
||||||
draggedObjectType,
|
draggedObjectType,
|
||||||
window,mouseX,mouseY,data)
|
window, mouseX, mouseY, data)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_SystemWin32::processMinMaxInfo(MINMAXINFO * minmax)
|
void GHOST_SystemWin32::processMinMaxInfo(MINMAXINFO *minmax)
|
||||||
{
|
{
|
||||||
minmax->ptMinTrackSize.x=320;
|
minmax->ptMinTrackSize.x = 320;
|
||||||
minmax->ptMinTrackSize.y=240;
|
minmax->ptMinTrackSize.y = 240;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_INPUT_NDOF
|
#ifdef WITH_INPUT_NDOF
|
||||||
@@ -821,7 +822,7 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw)
|
|||||||
// using Microsoft compiler & header files
|
// using Microsoft compiler & header files
|
||||||
// they invented the RawInput API, so this version is (probably) correct.
|
// they invented the RawInput API, so this version is (probably) correct.
|
||||||
// MinGW64 also works fine with this
|
// MinGW64 also works fine with this
|
||||||
BYTE const* data = raw.data.hid.bRawData;
|
BYTE const *data = raw.data.hid.bRawData;
|
||||||
// struct RAWHID {
|
// struct RAWHID {
|
||||||
// DWORD dwSizeHid;
|
// DWORD dwSizeHid;
|
||||||
// DWORD dwCount;
|
// DWORD dwCount;
|
||||||
@@ -830,7 +831,7 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw)
|
|||||||
#else
|
#else
|
||||||
// MinGW's definition (below) doesn't agree, so we need a slight
|
// MinGW's definition (below) doesn't agree, so we need a slight
|
||||||
// workaround until it's fixed
|
// workaround until it's fixed
|
||||||
BYTE const* data = &raw.data.hid.bRawData;
|
BYTE const *data = &raw.data.hid.bRawData;
|
||||||
// struct RAWHID {
|
// struct RAWHID {
|
||||||
// DWORD dwSizeHid;
|
// DWORD dwSizeHid;
|
||||||
// DWORD dwCount;
|
// DWORD dwCount;
|
||||||
@@ -843,7 +844,7 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw)
|
|||||||
{
|
{
|
||||||
case 1: // translation
|
case 1: // translation
|
||||||
{
|
{
|
||||||
short* axis = (short*)(data + 1);
|
short *axis = (short *)(data + 1);
|
||||||
// massage into blender view coords (same goes for rotation)
|
// massage into blender view coords (same goes for rotation)
|
||||||
short t[3] = {axis[0], -axis[2], axis[1]};
|
short t[3] = {axis[0], -axis[2], axis[1]};
|
||||||
m_ndofManager->updateTranslation(t, now);
|
m_ndofManager->updateTranslation(t, now);
|
||||||
@@ -860,7 +861,7 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw)
|
|||||||
}
|
}
|
||||||
case 2: // rotation
|
case 2: // rotation
|
||||||
{
|
{
|
||||||
short* axis = (short*)(data + 1);
|
short *axis = (short *)(data + 1);
|
||||||
short r[3] = {-axis[0], axis[2], -axis[1]};
|
short r[3] = {-axis[0], axis[2], -axis[1]};
|
||||||
m_ndofManager->updateRotation(r, now);
|
m_ndofManager->updateRotation(r, now);
|
||||||
break;
|
break;
|
||||||
@@ -879,15 +880,15 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw)
|
|||||||
|
|
||||||
LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
GHOST_Event* event = 0;
|
GHOST_Event *event = 0;
|
||||||
bool eventHandled = false;
|
bool eventHandled = false;
|
||||||
|
|
||||||
LRESULT lResult = 0;
|
LRESULT lResult = 0;
|
||||||
GHOST_SystemWin32* system = ((GHOST_SystemWin32*)getSystem());
|
GHOST_SystemWin32 *system = ((GHOST_SystemWin32 *)getSystem());
|
||||||
GHOST_ASSERT(system, "GHOST_SystemWin32::s_wndProc(): system not initialized")
|
GHOST_ASSERT(system, "GHOST_SystemWin32::s_wndProc(): system not initialized")
|
||||||
|
|
||||||
if (hwnd) {
|
if (hwnd) {
|
||||||
GHOST_WindowWin32* window = (GHOST_WindowWin32*)::GetWindowLong(hwnd, GWL_USERDATA);
|
GHOST_WindowWin32 *window = (GHOST_WindowWin32 *)::GetWindowLong(hwnd, GWL_USERDATA);
|
||||||
if (window) {
|
if (window) {
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
// we need to check if new key layout has AltGr
|
// we need to check if new key layout has AltGr
|
||||||
@@ -906,7 +907,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
|||||||
} //else wParam == RIM_INPUT
|
} //else wParam == RIM_INPUT
|
||||||
|
|
||||||
RAWINPUT raw;
|
RAWINPUT raw;
|
||||||
RAWINPUT* raw_ptr = &raw;
|
RAWINPUT *raw_ptr = &raw;
|
||||||
UINT rawSize = sizeof(RAWINPUT);
|
UINT rawSize = sizeof(RAWINPUT);
|
||||||
|
|
||||||
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, raw_ptr, &rawSize, sizeof(RAWINPUTHEADER));
|
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, raw_ptr, &rawSize, sizeof(RAWINPUTHEADER));
|
||||||
@@ -972,17 +973,17 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
|||||||
* maximize, minimize or close the window are triggered. Also it is sent when ALT
|
* maximize, minimize or close the window are triggered. Also it is sent when ALT
|
||||||
* button is press for menu. To prevent this we must return preventing DefWindowProc.
|
* button is press for menu. To prevent this we must return preventing DefWindowProc.
|
||||||
*/
|
*/
|
||||||
if(wParam==SC_KEYMENU) return 0;
|
if (wParam == SC_KEYMENU) return 0;
|
||||||
break;
|
break;
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Tablet events, processed
|
// Tablet events, processed
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
case WT_PACKET:
|
case WT_PACKET:
|
||||||
((GHOST_WindowWin32*)window)->processWin32TabletEvent(wParam, lParam);
|
((GHOST_WindowWin32 *)window)->processWin32TabletEvent(wParam, lParam);
|
||||||
break;
|
break;
|
||||||
case WT_CSRCHANGE:
|
case WT_CSRCHANGE:
|
||||||
case WT_PROXIMITY:
|
case WT_PROXIMITY:
|
||||||
((GHOST_WindowWin32*)window)->processWin32TabletInitEvent();
|
((GHOST_WindowWin32 *)window)->processWin32TabletInitEvent();
|
||||||
break;
|
break;
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Mouse events, processed
|
// Mouse events, processed
|
||||||
@@ -1001,9 +1002,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
|||||||
break;
|
break;
|
||||||
case WM_XBUTTONDOWN:
|
case WM_XBUTTONDOWN:
|
||||||
window->registerMouseClickEvent(0);
|
window->registerMouseClickEvent(0);
|
||||||
if ((short) HIWORD(wParam) == XBUTTON1){
|
if ((short) HIWORD(wParam) == XBUTTON1) {
|
||||||
event = processButtonEvent(GHOST_kEventButtonDown, window, GHOST_kButtonMaskButton4);
|
event = processButtonEvent(GHOST_kEventButtonDown, window, GHOST_kButtonMaskButton4);
|
||||||
}else if((short) HIWORD(wParam) == XBUTTON2){
|
}
|
||||||
|
else if ((short) HIWORD(wParam) == XBUTTON2) {
|
||||||
event = processButtonEvent(GHOST_kEventButtonDown, window, GHOST_kButtonMaskButton5);
|
event = processButtonEvent(GHOST_kEventButtonDown, window, GHOST_kButtonMaskButton5);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1021,9 +1023,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
|||||||
break;
|
break;
|
||||||
case WM_XBUTTONUP:
|
case WM_XBUTTONUP:
|
||||||
window->registerMouseClickEvent(1);
|
window->registerMouseClickEvent(1);
|
||||||
if ((short) HIWORD(wParam) == XBUTTON1){
|
if ((short) HIWORD(wParam) == XBUTTON1) {
|
||||||
event = processButtonEvent(GHOST_kEventButtonUp, window, GHOST_kButtonMaskButton4);
|
event = processButtonEvent(GHOST_kEventButtonUp, window, GHOST_kButtonMaskButton4);
|
||||||
}else if((short) HIWORD(wParam) == XBUTTON2){
|
}
|
||||||
|
else if ((short) HIWORD(wParam) == XBUTTON2) {
|
||||||
event = processButtonEvent(GHOST_kEventButtonUp, window, GHOST_kButtonMaskButton5);
|
event = processButtonEvent(GHOST_kEventButtonUp, window, GHOST_kButtonMaskButton5);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1182,7 +1185,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
|||||||
case WM_KILLFOCUS:
|
case WM_KILLFOCUS:
|
||||||
/* The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus.
|
/* The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus.
|
||||||
* We want to prevent this if a window is still active and it loses focus to nowhere*/
|
* We want to prevent this if a window is still active and it loses focus to nowhere*/
|
||||||
if(!wParam && hwnd==GetActiveWindow())
|
if (!wParam && hwnd == GetActiveWindow())
|
||||||
SetFocus(hwnd);
|
SetFocus(hwnd);
|
||||||
case WM_SHOWWINDOW:
|
case WM_SHOWWINDOW:
|
||||||
/* The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown. */
|
/* The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown. */
|
||||||
@@ -1256,66 +1259,68 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
|||||||
return lResult;
|
return lResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TUns8* GHOST_SystemWin32::getClipboard(bool selection) const
|
GHOST_TUns8 *GHOST_SystemWin32::getClipboard(bool selection) const
|
||||||
{
|
{
|
||||||
char *temp_buff;
|
char *temp_buff;
|
||||||
|
|
||||||
if ( IsClipboardFormatAvailable(CF_UNICODETEXT) && OpenClipboard(NULL) ) {
|
if (IsClipboardFormatAvailable(CF_UNICODETEXT) && OpenClipboard(NULL) ) {
|
||||||
wchar_t *buffer;
|
wchar_t *buffer;
|
||||||
HANDLE hData = GetClipboardData( CF_UNICODETEXT );
|
HANDLE hData = GetClipboardData(CF_UNICODETEXT);
|
||||||
if (hData == NULL) {
|
if (hData == NULL) {
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
buffer = (wchar_t*)GlobalLock( hData );
|
buffer = (wchar_t *)GlobalLock(hData);
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp_buff = alloc_utf_8_from_16(buffer,0);
|
temp_buff = alloc_utf_8_from_16(buffer, 0);
|
||||||
|
|
||||||
/* Buffer mustn't be accessed after CloseClipboard
|
/* Buffer mustn't be accessed after CloseClipboard
|
||||||
it would like accessing free-d memory */
|
it would like accessing free-d memory */
|
||||||
GlobalUnlock( hData );
|
GlobalUnlock(hData);
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
|
|
||||||
return (GHOST_TUns8*)temp_buff;
|
return (GHOST_TUns8 *)temp_buff;
|
||||||
} else if ( IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL) ) {
|
}
|
||||||
|
else if (IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL) ) {
|
||||||
char *buffer;
|
char *buffer;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
HANDLE hData = GetClipboardData( CF_TEXT );
|
HANDLE hData = GetClipboardData(CF_TEXT);
|
||||||
if (hData == NULL) {
|
if (hData == NULL) {
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
buffer = (char*)GlobalLock( hData );
|
buffer = (char *)GlobalLock(hData);
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = strlen(buffer);
|
len = strlen(buffer);
|
||||||
temp_buff = (char*) malloc(len+1);
|
temp_buff = (char *) malloc(len + 1);
|
||||||
strncpy(temp_buff, buffer, len);
|
strncpy(temp_buff, buffer, len);
|
||||||
temp_buff[len] = '\0';
|
temp_buff[len] = '\0';
|
||||||
|
|
||||||
/* Buffer mustn't be accessed after CloseClipboard
|
/* Buffer mustn't be accessed after CloseClipboard
|
||||||
it would like accessing free-d memory */
|
it would like accessing free-d memory */
|
||||||
GlobalUnlock( hData );
|
GlobalUnlock(hData);
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
|
|
||||||
return (GHOST_TUns8*)temp_buff;
|
return (GHOST_TUns8 *)temp_buff;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
|
void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
|
||||||
{
|
{
|
||||||
if(selection) {return;} // for copying the selection, used on X11
|
if (selection) {return; } // for copying the selection, used on X11
|
||||||
|
|
||||||
if(OpenClipboard(NULL)) {
|
if (OpenClipboard(NULL)) {
|
||||||
HLOCAL clipbuffer;
|
HLOCAL clipbuffer;
|
||||||
wchar_t *data;
|
wchar_t *data;
|
||||||
|
|
||||||
@@ -1323,23 +1328,24 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
|
|||||||
size_t len = count_utf_16_from_8(buffer);
|
size_t len = count_utf_16_from_8(buffer);
|
||||||
EmptyClipboard();
|
EmptyClipboard();
|
||||||
|
|
||||||
clipbuffer = LocalAlloc(LMEM_FIXED,sizeof(wchar_t) * len);
|
clipbuffer = LocalAlloc(LMEM_FIXED, sizeof(wchar_t) * len);
|
||||||
data = (wchar_t*)GlobalLock(clipbuffer);
|
data = (wchar_t *)GlobalLock(clipbuffer);
|
||||||
|
|
||||||
conv_utf_8_to_16(buffer, data, len);
|
conv_utf_8_to_16(buffer, data, len);
|
||||||
|
|
||||||
LocalUnlock(clipbuffer);
|
LocalUnlock(clipbuffer);
|
||||||
SetClipboardData(CF_UNICODETEXT,clipbuffer);
|
SetClipboardData(CF_UNICODETEXT, clipbuffer);
|
||||||
}
|
}
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int GHOST_SystemWin32::toggleConsole(int action)
|
int GHOST_SystemWin32::toggleConsole(int action)
|
||||||
{
|
{
|
||||||
switch(action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case 3: //hide if no console
|
case 3: //hide if no console
|
||||||
{
|
{
|
||||||
@@ -1347,41 +1353,41 @@ int GHOST_SystemWin32::toggleConsole(int action)
|
|||||||
HANDLE ptree = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
HANDLE ptree = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||||
PROCESSENTRY32 e = {0}; e.dwSize = sizeof(PROCESSENTRY32);
|
PROCESSENTRY32 e = {0}; e.dwSize = sizeof(PROCESSENTRY32);
|
||||||
|
|
||||||
if( Process32First(ptree, &e)) {
|
if (Process32First(ptree, &e)) {
|
||||||
do { //Searches for Blender's PROCESSENTRY32
|
do { //Searches for Blender's PROCESSENTRY32
|
||||||
if (e.th32ProcessID == sp) {
|
if (e.th32ProcessID == sp) {
|
||||||
sp = e.th32ParentProcessID;
|
sp = e.th32ParentProcessID;
|
||||||
Process32First(ptree, &e);
|
Process32First(ptree, &e);
|
||||||
do { //Got parent id, searches for its PROCESSENTRY32
|
do { //Got parent id, searches for its PROCESSENTRY32
|
||||||
if (e.th32ProcessID == sp) {
|
if (e.th32ProcessID == sp) {
|
||||||
if(strcmp("explorer.exe",e.szExeFile)==0)
|
if (strcmp("explorer.exe", e.szExeFile) == 0)
|
||||||
{ //If explorer, hide cmd
|
{ //If explorer, hide cmd
|
||||||
ShowWindow(GetConsoleWindow(),SW_HIDE);
|
ShowWindow(GetConsoleWindow(), SW_HIDE);
|
||||||
m_consoleStatus = 0;
|
m_consoleStatus = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while( Process32Next(ptree, &e));
|
} while (Process32Next(ptree, &e));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while( Process32Next(ptree, &e));
|
} while (Process32Next(ptree, &e));
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseHandle(ptree);
|
CloseHandle(ptree);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0: //hide
|
case 0: //hide
|
||||||
ShowWindow(GetConsoleWindow(),SW_HIDE);
|
ShowWindow(GetConsoleWindow(), SW_HIDE);
|
||||||
m_consoleStatus = 0;
|
m_consoleStatus = 0;
|
||||||
break;
|
break;
|
||||||
case 1: //show
|
case 1: //show
|
||||||
ShowWindow(GetConsoleWindow(),SW_SHOW);
|
ShowWindow(GetConsoleWindow(), SW_SHOW);
|
||||||
m_consoleStatus = 1;
|
m_consoleStatus = 1;
|
||||||
break;
|
break;
|
||||||
case 2: //toggle
|
case 2: //toggle
|
||||||
ShowWindow(GetConsoleWindow(),m_consoleStatus?SW_HIDE:SW_SHOW);
|
ShowWindow(GetConsoleWindow(), m_consoleStatus ? SW_HIDE : SW_SHOW);
|
||||||
m_consoleStatus=!m_consoleStatus;
|
m_consoleStatus = !m_consoleStatus;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -1390,8 +1396,8 @@ int GHOST_SystemWin32::toggleConsole(int action)
|
|||||||
return m_consoleStatus;
|
return m_consoleStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GHOST_SystemWin32::confirmQuit(GHOST_IWindow * window) const
|
int GHOST_SystemWin32::confirmQuit(GHOST_IWindow *window) const
|
||||||
{
|
{
|
||||||
return (MessageBox(window ? ((GHOST_WindowWin32*)window)->getHWND() : 0, "Some changes have not been saved.\nDo you really want to quit ?",
|
return (MessageBox(window ? ((GHOST_WindowWin32 *)window)->getHWND() : 0, "Some changes have not been saved.\nDo you really want to quit ?",
|
||||||
"Exit Blender", MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST) == IDOK);
|
"Exit Blender", MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST) == IDOK);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,13 +117,13 @@ public:
|
|||||||
* @param parentWindow Parent (embedder) window
|
* @param parentWindow Parent (embedder) window
|
||||||
* @return The new window (or 0 if creation failed).
|
* @return The new window (or 0 if creation failed).
|
||||||
*/
|
*/
|
||||||
virtual GHOST_IWindow* createWindow(
|
virtual GHOST_IWindow *createWindow(
|
||||||
const STR_String& title,
|
const STR_String& title,
|
||||||
GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
|
GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
|
||||||
GHOST_TWindowState state, GHOST_TDrawingContextType type,
|
GHOST_TWindowState state, GHOST_TDrawingContextType type,
|
||||||
const bool stereoVisual = false,
|
const bool stereoVisual = false,
|
||||||
const GHOST_TUns16 numOfAASamples = 0,
|
const GHOST_TUns16 numOfAASamples = 0,
|
||||||
const GHOST_TEmbedderWindowID parentWindow = 0 );
|
const GHOST_TEmbedderWindowID parentWindow = 0);
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
** Event management functionality
|
** Event management functionality
|
||||||
@@ -180,7 +180,7 @@ public:
|
|||||||
* @param selection Used by X11 only
|
* @param selection Used by X11 only
|
||||||
* @return Returns the Clipboard
|
* @return Returns the Clipboard
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TUns8* getClipboard(bool selection) const;
|
virtual GHOST_TUns8 *getClipboard(bool selection) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Puts buffer to system clipboard
|
* Puts buffer to system clipboard
|
||||||
@@ -199,13 +199,13 @@ public:
|
|||||||
* @param window The window on which the event occurred
|
* @param window The window on which the event occurred
|
||||||
* @return Indication whether the event was handled.
|
* @return Indication whether the event was handled.
|
||||||
*/
|
*/
|
||||||
static GHOST_TSuccess pushDragDropEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType,GHOST_IWindow* window, int mouseX, int mouseY, void* data);
|
static GHOST_TSuccess pushDragDropEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType, GHOST_IWindow *window, int mouseX, int mouseY, void *data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Confirms quitting he program when there is just one window left open
|
* Confirms quitting he program when there is just one window left open
|
||||||
* in the application
|
* in the application
|
||||||
*/
|
*/
|
||||||
virtual int confirmQuit(GHOST_IWindow * window) const;
|
virtual int confirmQuit(GHOST_IWindow *window) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@@ -239,7 +239,7 @@ protected:
|
|||||||
* @param vk Pointer to virtual key
|
* @param vk Pointer to virtual key
|
||||||
* @return The GHOST key (GHOST_kKeyUnknown if no match).
|
* @return The GHOST key (GHOST_kKeyUnknown if no match).
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TKey hardKey(GHOST_IWindow *window, RAWINPUT const& raw, int * keyDown, char * vk);
|
virtual GHOST_TKey hardKey(GHOST_IWindow *window, RAWINPUT const& raw, int *keyDown, char *vk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates modifier key event(s) and updates the key data stored locally (m_modifierKeys).
|
* Creates modifier key event(s) and updates the key data stored locally (m_modifierKeys).
|
||||||
@@ -248,7 +248,7 @@ protected:
|
|||||||
* events generated for both keys.
|
* events generated for both keys.
|
||||||
* @param window The window receiving the event (the active window).
|
* @param window The window receiving the event (the active window).
|
||||||
*/
|
*/
|
||||||
GHOST_EventKey* processModifierKeys(GHOST_IWindow *window);
|
GHOST_EventKey *processModifierKeys(GHOST_IWindow *window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates mouse button event.
|
* Creates mouse button event.
|
||||||
@@ -257,7 +257,7 @@ protected:
|
|||||||
* @param mask The button mask of this event.
|
* @param mask The button mask of this event.
|
||||||
* @return The event created.
|
* @return The event created.
|
||||||
*/
|
*/
|
||||||
static GHOST_EventButton* processButtonEvent(GHOST_TEventType type, GHOST_IWindow *window, GHOST_TButtonMask mask);
|
static GHOST_EventButton *processButtonEvent(GHOST_TEventType type, GHOST_IWindow *window, GHOST_TButtonMask mask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates cursor event.
|
* Creates cursor event.
|
||||||
@@ -265,7 +265,7 @@ protected:
|
|||||||
* @param window The window receiving the event (the active window).
|
* @param window The window receiving the event (the active window).
|
||||||
* @return The event created.
|
* @return The event created.
|
||||||
*/
|
*/
|
||||||
static GHOST_EventCursor* processCursorEvent(GHOST_TEventType type, GHOST_IWindow *Iwindow);
|
static GHOST_EventCursor *processCursorEvent(GHOST_TEventType type, GHOST_IWindow *Iwindow);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a mouse wheel event.
|
* Creates a mouse wheel event.
|
||||||
@@ -273,7 +273,7 @@ protected:
|
|||||||
* @param wParam The wParam from the wndproc
|
* @param wParam The wParam from the wndproc
|
||||||
* @param lParam The lParam from the wndproc
|
* @param lParam The lParam from the wndproc
|
||||||
*/
|
*/
|
||||||
static GHOST_EventWheel* processWheelEvent(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam);
|
static GHOST_EventWheel *processWheelEvent(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a key event and updates the key data stored locally (m_modifierKeys).
|
* Creates a key event and updates the key data stored locally (m_modifierKeys).
|
||||||
@@ -282,7 +282,7 @@ protected:
|
|||||||
* @param window The window receiving the event (the active window).
|
* @param window The window receiving the event (the active window).
|
||||||
* @param raw RawInput structure with detailed info about the key event
|
* @param raw RawInput structure with detailed info about the key event
|
||||||
*/
|
*/
|
||||||
static GHOST_EventKey* processKeyEvent(GHOST_IWindow *window, RAWINPUT const& raw);
|
static GHOST_EventKey *processKeyEvent(GHOST_IWindow *window, RAWINPUT const& raw);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process special keys (VK_OEM_*), to see if current key layout
|
* Process special keys (VK_OEM_*), to see if current key layout
|
||||||
@@ -299,13 +299,13 @@ protected:
|
|||||||
* @param window The window receiving the event (the active window).
|
* @param window The window receiving the event (the active window).
|
||||||
* @return The event created.
|
* @return The event created.
|
||||||
*/
|
*/
|
||||||
static GHOST_Event* processWindowEvent(GHOST_TEventType type, GHOST_IWindow* window);
|
static GHOST_Event *processWindowEvent(GHOST_TEventType type, GHOST_IWindow *window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles minimum window size.
|
* Handles minimum window size.
|
||||||
* @param minmax The MINMAXINFO structure.
|
* @param minmax The MINMAXINFO structure.
|
||||||
*/
|
*/
|
||||||
static void processMinMaxInfo(MINMAXINFO * minmax);
|
static void processMinMaxInfo(MINMAXINFO *minmax);
|
||||||
|
|
||||||
#ifdef WITH_INPUT_NDOF
|
#ifdef WITH_INPUT_NDOF
|
||||||
/**
|
/**
|
||||||
@@ -390,12 +390,12 @@ inline void GHOST_SystemWin32::handleKeyboardChange(void)
|
|||||||
// save the language identifier.
|
// save the language identifier.
|
||||||
m_langId = LOWORD(m_keylayout);
|
m_langId = LOWORD(m_keylayout);
|
||||||
|
|
||||||
for(m_hasAltGr = false, i = 32; i < 256; ++i) {
|
for (m_hasAltGr = false, i = 32; i < 256; ++i) {
|
||||||
s = VkKeyScanEx((char)i, m_keylayout);
|
s = VkKeyScanEx((char)i, m_keylayout);
|
||||||
// s == -1 means no key that translates passed char code
|
// s == -1 means no key that translates passed char code
|
||||||
// high byte contains shift state. bit 2 ctrl pressed, bit 4 alt pressed
|
// high byte contains shift state. bit 2 ctrl pressed, bit 4 alt pressed
|
||||||
// if both are pressed, we have AltGr keycombo on keylayout
|
// if both are pressed, we have AltGr keycombo on keylayout
|
||||||
if(s!=-1 && (s & 0x600) == 0x600) {
|
if (s != -1 && (s & 0x600) == 0x600) {
|
||||||
m_hasAltGr = true;
|
m_hasAltGr = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,27 +19,27 @@
|
|||||||
// GHOST_WindowWin32
|
// GHOST_WindowWin32
|
||||||
#ifndef __ITaskbarList_INTERFACE_DEFINED__
|
#ifndef __ITaskbarList_INTERFACE_DEFINED__
|
||||||
#define __ITaskbarList_INTERFACE_DEFINED__
|
#define __ITaskbarList_INTERFACE_DEFINED__
|
||||||
extern "C" {const GUID CLSID_TaskbarList = {0x56FDF344, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90} };
|
extern "C" {const GUID CLSID_TaskbarList = {0x56FDF344, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90} };
|
||||||
const GUID IID_ITaskbarList = {0x56FDF342, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90} }; }
|
const GUID IID_ITaskbarList = {0x56FDF342, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90} }; }
|
||||||
class ITaskbarList : public IUnknown
|
class ITaskbarList : public IUnknown
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual HRESULT STDMETHODCALLTYPE HrInit (void) = 0;
|
virtual HRESULT STDMETHODCALLTYPE HrInit(void) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE AddTab (HWND hwnd) = 0;
|
virtual HRESULT STDMETHODCALLTYPE AddTab(HWND hwnd) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE DeleteTab (HWND hwnd) = 0;
|
virtual HRESULT STDMETHODCALLTYPE DeleteTab(HWND hwnd) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE ActivateTab (HWND hwnd) = 0;
|
virtual HRESULT STDMETHODCALLTYPE ActivateTab(HWND hwnd) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetActiveAlt (HWND hwnd) = 0;
|
virtual HRESULT STDMETHODCALLTYPE SetActiveAlt(HWND hwnd) = 0;
|
||||||
};
|
};
|
||||||
#endif /* ITaskbarList */
|
#endif /* ITaskbarList */
|
||||||
|
|
||||||
#ifndef __ITaskbarList2_INTERFACE_DEFINED__
|
#ifndef __ITaskbarList2_INTERFACE_DEFINED__
|
||||||
#define __ITaskbarList2_INTERFACE_DEFINED__
|
#define __ITaskbarList2_INTERFACE_DEFINED__
|
||||||
extern "C" {const GUID IID_ITaskbarList2 = {0x602D4995, 0xB13A, 0x429b, {0xA6, 0x6E, 0x19, 0x35, 0xE4, 0x4F, 0x43, 0x17} }; }
|
extern "C" {const GUID IID_ITaskbarList2 = {0x602D4995, 0xB13A, 0x429b, {0xA6, 0x6E, 0x19, 0x35, 0xE4, 0x4F, 0x43, 0x17} }; }
|
||||||
class ITaskbarList2 : public ITaskbarList
|
class ITaskbarList2 : public ITaskbarList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual HRESULT STDMETHODCALLTYPE MarkFullscreenWindow(HWND hwnd, BOOL fFullscreen) = 0;
|
virtual HRESULT STDMETHODCALLTYPE MarkFullscreenWindow(HWND hwnd, BOOL fFullscreen) = 0;
|
||||||
};
|
};
|
||||||
#endif /* ITaskbarList2 */
|
#endif /* ITaskbarList2 */
|
||||||
|
|
||||||
#ifndef __ITaskbarList3_INTERFACE_DEFINED__
|
#ifndef __ITaskbarList3_INTERFACE_DEFINED__
|
||||||
@@ -49,24 +49,24 @@ typedef enum THUMBBUTTONMASK {THB_BITMAP = 0x1, THB_ICON = 0x2, THB_TOOLTIP = 0x
|
|||||||
typedef struct THUMBBUTTON {THUMBBUTTONMASK dwMask; UINT iId; UINT iBitmap; HICON hIcon; WCHAR szTip[260]; THUMBBUTTONFLAGS dwFlags; } THUMBBUTTON;
|
typedef struct THUMBBUTTON {THUMBBUTTONMASK dwMask; UINT iId; UINT iBitmap; HICON hIcon; WCHAR szTip[260]; THUMBBUTTONFLAGS dwFlags; } THUMBBUTTON;
|
||||||
typedef enum TBPFLAG {TBPF_NOPROGRESS = 0, TBPF_INDETERMINATE = 0x1, TBPF_NORMAL = 0x2, TBPF_ERROR = 0x4, TBPF_PAUSED = 0x8 } TBPFLAG;
|
typedef enum TBPFLAG {TBPF_NOPROGRESS = 0, TBPF_INDETERMINATE = 0x1, TBPF_NORMAL = 0x2, TBPF_ERROR = 0x4, TBPF_PAUSED = 0x8 } TBPFLAG;
|
||||||
#define THBN_CLICKED 0x1800
|
#define THBN_CLICKED 0x1800
|
||||||
extern "C" {const GUID IID_ITaskList3 = { 0xEA1AFB91, 0x9E28, 0x4B86, {0x90, 0xE9, 0x9E, 0x9F, 0x8A, 0x5E, 0xEF, 0xAF} };}
|
extern "C" {const GUID IID_ITaskList3 = { 0xEA1AFB91, 0x9E28, 0x4B86, {0x90, 0xE9, 0x9E, 0x9F, 0x8A, 0x5E, 0xEF, 0xAF} }; }
|
||||||
|
|
||||||
class ITaskbarList3 : public ITaskbarList2
|
class ITaskbarList3 : public ITaskbarList2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetProgressValue (HWND hwnd, ULONGLONG ullCompleted, ULONGLONG ullTotal) = 0;
|
virtual HRESULT STDMETHODCALLTYPE SetProgressValue(HWND hwnd, ULONGLONG ullCompleted, ULONGLONG ullTotal) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetProgressState (HWND hwnd, TBPFLAG tbpFlags) = 0;
|
virtual HRESULT STDMETHODCALLTYPE SetProgressState(HWND hwnd, TBPFLAG tbpFlags) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE RegisterTab (HWND hwndTab, HWND hwndMDI) = 0;
|
virtual HRESULT STDMETHODCALLTYPE RegisterTab(HWND hwndTab, HWND hwndMDI) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE UnregisterTab (HWND hwndTab) = 0;
|
virtual HRESULT STDMETHODCALLTYPE UnregisterTab(HWND hwndTab) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetTabOrder (HWND hwndTab, HWND hwndInsertBefore) = 0;
|
virtual HRESULT STDMETHODCALLTYPE SetTabOrder(HWND hwndTab, HWND hwndInsertBefore) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetTabActive (HWND hwndTab, HWND hwndMDI, DWORD dwReserved) = 0;
|
virtual HRESULT STDMETHODCALLTYPE SetTabActive(HWND hwndTab, HWND hwndMDI, DWORD dwReserved) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE ThumbBarAddButtons (HWND hwnd, UINT cButtons, THUMBBUTTON * pButton) = 0;
|
virtual HRESULT STDMETHODCALLTYPE ThumbBarAddButtons(HWND hwnd, UINT cButtons, THUMBBUTTON *pButton) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE ThumbBarUpdateButtons (HWND hwnd, UINT cButtons, THUMBBUTTON * pButton) = 0;
|
virtual HRESULT STDMETHODCALLTYPE ThumbBarUpdateButtons(HWND hwnd, UINT cButtons, THUMBBUTTON *pButton) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE ThumbBarSetImageList (HWND hwnd, HIMAGELIST himl) = 0;
|
virtual HRESULT STDMETHODCALLTYPE ThumbBarSetImageList(HWND hwnd, HIMAGELIST himl) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetOverlayIcon (HWND hwnd, HICON hIcon, LPCWSTR pszDescription) = 0;
|
virtual HRESULT STDMETHODCALLTYPE SetOverlayIcon(HWND hwnd, HICON hIcon, LPCWSTR pszDescription) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetThumbnailTooltip (HWND hwnd, LPCWSTR pszTip) = 0;
|
virtual HRESULT STDMETHODCALLTYPE SetThumbnailTooltip(HWND hwnd, LPCWSTR pszTip) = 0;
|
||||||
virtual HRESULT STDMETHODCALLTYPE SetThumbnailClip (HWND hwnd, RECT *prcClip) = 0;
|
virtual HRESULT STDMETHODCALLTYPE SetThumbnailClip(HWND hwnd, RECT *prcClip) = 0;
|
||||||
};
|
};
|
||||||
#endif /* ITaskbarList3 */
|
#endif /* ITaskbarList3 */
|
||||||
|
|
||||||
#endif /*__GHOST_TASKBARWIN32_H__*/
|
#endif /*__GHOST_TASKBARWIN32_H__*/
|
||||||
|
|||||||
@@ -61,14 +61,14 @@ GHOST_TUns32 GHOST_TimerManager::getNumTimers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GHOST_TimerManager::getTimerFound(GHOST_TimerTask* timer)
|
bool GHOST_TimerManager::getTimerFound(GHOST_TimerTask *timer)
|
||||||
{
|
{
|
||||||
TTimerVector::const_iterator iter = std::find(m_timers.begin(), m_timers.end(), timer);
|
TTimerVector::const_iterator iter = std::find(m_timers.begin(), m_timers.end(), timer);
|
||||||
return iter != m_timers.end();
|
return iter != m_timers.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_TimerManager::addTimer(GHOST_TimerTask* timer)
|
GHOST_TSuccess GHOST_TimerManager::addTimer(GHOST_TimerTask *timer)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
if (!getTimerFound(timer)) {
|
if (!getTimerFound(timer)) {
|
||||||
@@ -83,7 +83,7 @@ GHOST_TSuccess GHOST_TimerManager::addTimer(GHOST_TimerTask* timer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_TimerManager::removeTimer(GHOST_TimerTask* timer)
|
GHOST_TSuccess GHOST_TimerManager::removeTimer(GHOST_TimerTask *timer)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
TTimerVector::iterator iter = std::find(m_timers.begin(), m_timers.end(), timer);
|
TTimerVector::iterator iter = std::find(m_timers.begin(), m_timers.end(), timer);
|
||||||
@@ -108,7 +108,7 @@ GHOST_TUns64 GHOST_TimerManager::nextFireTime()
|
|||||||
for (iter = m_timers.begin(); iter != m_timers.end(); iter++) {
|
for (iter = m_timers.begin(); iter != m_timers.end(); iter++) {
|
||||||
GHOST_TUns64 next = (*iter)->getNext();
|
GHOST_TUns64 next = (*iter)->getNext();
|
||||||
|
|
||||||
if (next<smallest)
|
if (next < smallest)
|
||||||
smallest = next;
|
smallest = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ bool GHOST_TimerManager::fireTimers(GHOST_TUns64 time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GHOST_TimerManager::fireTimer(GHOST_TUns64 time, GHOST_TimerTask* task)
|
bool GHOST_TimerManager::fireTimer(GHOST_TUns64 time, GHOST_TimerTask *task)
|
||||||
{
|
{
|
||||||
GHOST_TUns64 next = task->getNext();
|
GHOST_TUns64 next = task->getNext();
|
||||||
|
|
||||||
@@ -148,7 +148,8 @@ bool GHOST_TimerManager::fireTimer(GHOST_TUns64 time, GHOST_TimerTask* task)
|
|||||||
task->setNext(next);
|
task->setNext(next);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
* Returns whther this timer task ins in our list.
|
* Returns whther this timer task ins in our list.
|
||||||
* @return Indication of presence.
|
* @return Indication of presence.
|
||||||
*/
|
*/
|
||||||
virtual bool getTimerFound(GHOST_TimerTask* timer);
|
virtual bool getTimerFound(GHOST_TimerTask *timer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a timer task to the list.
|
* Adds a timer task to the list.
|
||||||
@@ -78,7 +78,7 @@ public:
|
|||||||
* @param timer The timer task added to the list.
|
* @param timer The timer task added to the list.
|
||||||
* @return Indication as to whether addition has succeeded.
|
* @return Indication as to whether addition has succeeded.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess addTimer(GHOST_TimerTask* timer);
|
virtual GHOST_TSuccess addTimer(GHOST_TimerTask *timer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a timer task from the list.
|
* Removes a timer task from the list.
|
||||||
@@ -86,7 +86,7 @@ public:
|
|||||||
* @param timer The timer task to be removed from the list.
|
* @param timer The timer task to be removed from the list.
|
||||||
* @return Indication as to whether removal has succeeded.
|
* @return Indication as to whether removal has succeeded.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess removeTimer(GHOST_TimerTask* timer);
|
virtual GHOST_TSuccess removeTimer(GHOST_TimerTask *timer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the soonest time the next timer would fire.
|
* Finds the soonest time the next timer would fire.
|
||||||
@@ -108,7 +108,7 @@ public:
|
|||||||
* @param task The timer task to check and optionally fire.
|
* @param task The timer task to check and optionally fire.
|
||||||
* @return True if the timer fired.
|
* @return True if the timer fired.
|
||||||
*/
|
*/
|
||||||
virtual bool fireTimer(GHOST_TUns64 time, GHOST_TimerTask* task);
|
virtual bool fireTimer(GHOST_TUns64 time, GHOST_TimerTask *task);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@@ -116,7 +116,7 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void disposeTimers();
|
void disposeTimers();
|
||||||
|
|
||||||
typedef std::vector<GHOST_TimerTask*> TTimerVector;
|
typedef std::vector<GHOST_TimerTask *> TTimerVector;
|
||||||
/** The list with event consumers. */
|
/** The list with event consumers. */
|
||||||
TTimerVector m_timers;
|
TTimerVector m_timers;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ GHOST_Window::GHOST_Window(
|
|||||||
GHOST_TDrawingContextType type,
|
GHOST_TDrawingContextType type,
|
||||||
const bool stereoVisual,
|
const bool stereoVisual,
|
||||||
const GHOST_TUns16 numOfAASamples)
|
const GHOST_TUns16 numOfAASamples)
|
||||||
:
|
:
|
||||||
m_drawingContextType(type),
|
m_drawingContextType(type),
|
||||||
m_cursorVisible(true),
|
m_cursorVisible(true),
|
||||||
m_cursorGrab(GHOST_kGrabDisable),
|
m_cursorGrab(GHOST_kGrabDisable),
|
||||||
@@ -73,7 +73,7 @@ GHOST_Window::~GHOST_Window()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void* GHOST_Window::getOSWindow() const
|
void *GHOST_Window::getOSWindow() const
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -107,16 +107,17 @@ GHOST_TSuccess GHOST_Window::setCursorVisibility(bool visible)
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_Window::setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rect *bounds)
|
GHOST_TSuccess GHOST_Window::setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rect *bounds)
|
||||||
{
|
{
|
||||||
if(m_cursorGrab == mode)
|
if (m_cursorGrab == mode)
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
|
|
||||||
if (setWindowCursorGrab(mode)) {
|
if (setWindowCursorGrab(mode)) {
|
||||||
|
|
||||||
if(mode==GHOST_kGrabDisable)
|
if (mode == GHOST_kGrabDisable)
|
||||||
m_cursorGrabBounds.m_l= m_cursorGrabBounds.m_r= -1;
|
m_cursorGrabBounds.m_l = m_cursorGrabBounds.m_r = -1;
|
||||||
else if (bounds) {
|
else if (bounds) {
|
||||||
m_cursorGrabBounds= *bounds;
|
m_cursorGrabBounds = *bounds;
|
||||||
} else { /* if bounds not defined, use window */
|
}
|
||||||
|
else { /* if bounds not defined, use window */
|
||||||
getClientBounds(m_cursorGrabBounds);
|
getClientBounds(m_cursorGrabBounds);
|
||||||
}
|
}
|
||||||
m_cursorGrab = mode;
|
m_cursorGrab = mode;
|
||||||
@@ -129,8 +130,8 @@ GHOST_TSuccess GHOST_Window::setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rec
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_Window::getCursorGrabBounds(GHOST_Rect& bounds)
|
GHOST_TSuccess GHOST_Window::getCursorGrabBounds(GHOST_Rect& bounds)
|
||||||
{
|
{
|
||||||
bounds= m_cursorGrabBounds;
|
bounds = m_cursorGrabBounds;
|
||||||
return (bounds.m_l==-1 && bounds.m_r==-1) ? GHOST_kFailure : GHOST_kSuccess;
|
return (bounds.m_l == -1 && bounds.m_r == -1) ? GHOST_kFailure : GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_Window::setCursorShape(GHOST_TStandardCursor cursorShape)
|
GHOST_TSuccess GHOST_Window::setCursorShape(GHOST_TStandardCursor cursorShape)
|
||||||
@@ -148,14 +149,14 @@ GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHO
|
|||||||
int hotX, int hotY)
|
int hotX, int hotY)
|
||||||
{
|
{
|
||||||
return setCustomCursorShape((GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask,
|
return setCustomCursorShape((GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask,
|
||||||
16, 16, hotX, hotY, 0, 1 );
|
16, 16, hotX, hotY, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
|
GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
|
||||||
int sizex, int sizey, int hotX, int hotY,
|
int sizex, int sizey, int hotX, int hotY,
|
||||||
int fg_color, int bg_color)
|
int fg_color, int bg_color)
|
||||||
{
|
{
|
||||||
if (setWindowCustomCursorShape(bitmap, mask, sizex, sizey,hotX, hotY, fg_color, bg_color)) {
|
if (setWindowCustomCursorShape(bitmap, mask, sizex, sizey, hotX, hotY, fg_color, bg_color)) {
|
||||||
m_cursorShape = GHOST_kStandardCursorCustom;
|
m_cursorShape = GHOST_kStandardCursorCustom;
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public:
|
|||||||
* Returns the associated OS object/handle
|
* Returns the associated OS object/handle
|
||||||
* @return The associated OS object/handle
|
* @return The associated OS object/handle
|
||||||
*/
|
*/
|
||||||
virtual void* getOSWindow() const;
|
virtual void *getOSWindow() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current cursor shape.
|
* Returns the current cursor shape.
|
||||||
@@ -190,12 +190,16 @@ public:
|
|||||||
* Sets the progress bar value displayed in the window/application icon
|
* Sets the progress bar value displayed in the window/application icon
|
||||||
* @param progress The progress % (0.0 to 1.0)
|
* @param progress The progress % (0.0 to 1.0)
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess setProgressBar(float progress) {return GHOST_kFailure;};
|
virtual GHOST_TSuccess setProgressBar(float progress) {
|
||||||
|
return GHOST_kFailure;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides the progress bar in the icon
|
* Hides the progress bar in the icon
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess endProgressBar() {return GHOST_kFailure;};
|
virtual GHOST_TSuccess endProgressBar() {
|
||||||
|
return GHOST_kFailure;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
|
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
|
||||||
@@ -278,7 +282,9 @@ protected:
|
|||||||
* Sets the cursor grab on the window using
|
* Sets the cursor grab on the window using
|
||||||
* native window system calls.
|
* native window system calls.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) { return GHOST_kSuccess; };
|
virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) {
|
||||||
|
return GHOST_kSuccess;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the cursor shape on the window using
|
* Sets the cursor shape on the window using
|
||||||
@@ -377,14 +383,14 @@ inline void GHOST_Window::getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y)
|
|||||||
|
|
||||||
inline void GHOST_Window::getCursorGrabAccum(GHOST_TInt32 &x, GHOST_TInt32 &y) const
|
inline void GHOST_Window::getCursorGrabAccum(GHOST_TInt32 &x, GHOST_TInt32 &y) const
|
||||||
{
|
{
|
||||||
x= m_cursorGrabAccumPos[0];
|
x = m_cursorGrabAccumPos[0];
|
||||||
y= m_cursorGrabAccumPos[1];
|
y = m_cursorGrabAccumPos[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void GHOST_Window::setCursorGrabAccum(GHOST_TInt32 x, GHOST_TInt32 y)
|
inline void GHOST_Window::setCursorGrabAccum(GHOST_TInt32 x, GHOST_TInt32 y)
|
||||||
{
|
{
|
||||||
m_cursorGrabAccumPos[0]= x;
|
m_cursorGrabAccumPos[0] = x;
|
||||||
m_cursorGrabAccumPos[1]= y;
|
m_cursorGrabAccumPos[1] = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline GHOST_TStandardCursor GHOST_Window::getCursorShape() const
|
inline GHOST_TStandardCursor GHOST_Window::getCursorShape() const
|
||||||
|
|||||||
@@ -46,31 +46,31 @@ const GHOST_TInt32 GHOST_WindowCarbon::s_sizeRectSize = 16;
|
|||||||
#endif //GHOST_DRAW_CARBON_GUTTER
|
#endif //GHOST_DRAW_CARBON_GUTTER
|
||||||
|
|
||||||
static const GLint sPreferredFormatWindow[10] = {
|
static const GLint sPreferredFormatWindow[10] = {
|
||||||
AGL_RGBA,
|
AGL_RGBA,
|
||||||
AGL_DOUBLEBUFFER,
|
AGL_DOUBLEBUFFER,
|
||||||
AGL_ACCELERATED,
|
AGL_ACCELERATED,
|
||||||
AGL_DEPTH_SIZE, 32,
|
AGL_DEPTH_SIZE, 32,
|
||||||
AGL_NONE,
|
AGL_NONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLint sPreferredFormatFullScreen[11] = {
|
static const GLint sPreferredFormatFullScreen[11] = {
|
||||||
AGL_RGBA,
|
AGL_RGBA,
|
||||||
AGL_DOUBLEBUFFER,
|
AGL_DOUBLEBUFFER,
|
||||||
AGL_ACCELERATED,
|
AGL_ACCELERATED,
|
||||||
AGL_FULLSCREEN,
|
AGL_FULLSCREEN,
|
||||||
AGL_DEPTH_SIZE, 32,
|
AGL_DEPTH_SIZE, 32,
|
||||||
AGL_NONE,
|
AGL_NONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WindowRef ugly_hack=NULL;
|
WindowRef ugly_hack = NULL;
|
||||||
|
|
||||||
const EventTypeSpec kWEvents[] = {
|
const EventTypeSpec kWEvents[] = {
|
||||||
{ kEventClassWindow, kEventWindowZoom }, /* for new zoom behaviour */
|
{ kEventClassWindow, kEventWindowZoom }, /* for new zoom behaviour */
|
||||||
};
|
};
|
||||||
|
|
||||||
static OSStatus myWEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData)
|
static OSStatus myWEventHandlerProc(EventHandlerCallRef handler, EventRef event, void *userData)
|
||||||
{
|
{
|
||||||
WindowRef mywindow;
|
WindowRef mywindow;
|
||||||
GHOST_WindowCarbon *ghost_window;
|
GHOST_WindowCarbon *ghost_window;
|
||||||
@@ -78,7 +78,7 @@ static OSStatus myWEventHandlerProc(EventHandlerCallRef handler, EventRef event,
|
|||||||
int theState;
|
int theState;
|
||||||
|
|
||||||
if (::GetEventKind(event) == kEventWindowZoom) {
|
if (::GetEventKind(event) == kEventWindowZoom) {
|
||||||
err = ::GetEventParameter (event,kEventParamDirectObject,typeWindowRef,NULL,sizeof(mywindow),NULL, &mywindow);
|
err = ::GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(mywindow), NULL, &mywindow);
|
||||||
ghost_window = (GHOST_WindowCarbon *) GetWRefCon(mywindow);
|
ghost_window = (GHOST_WindowCarbon *) GetWRefCon(mywindow);
|
||||||
theState = ghost_window->getMac_windowState();
|
theState = ghost_window->getMac_windowState();
|
||||||
if (theState == 1)
|
if (theState == 1)
|
||||||
@@ -100,7 +100,7 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
|
|||||||
GHOST_TDrawingContextType type,
|
GHOST_TDrawingContextType type,
|
||||||
const bool stereoVisual,
|
const bool stereoVisual,
|
||||||
const GHOST_TUns16 numOfAASamples
|
const GHOST_TUns16 numOfAASamples
|
||||||
) :
|
) :
|
||||||
GHOST_Window(width, height, state, GHOST_kDrawingContextTypeNone),
|
GHOST_Window(width, height, state, GHOST_kDrawingContextTypeNone),
|
||||||
m_windowRef(0),
|
m_windowRef(0),
|
||||||
m_grafPtr(0),
|
m_grafPtr(0),
|
||||||
@@ -113,41 +113,44 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
|
|||||||
|
|
||||||
//fprintf(stderr," main screen top %i left %i height %i width %i\n", top, left, height, width);
|
//fprintf(stderr," main screen top %i left %i height %i width %i\n", top, left, height, width);
|
||||||
|
|
||||||
if (state >= GHOST_kWindowState8Normal ) {
|
if (state >= GHOST_kWindowState8Normal) {
|
||||||
if(state == GHOST_kWindowState8Normal) state= GHOST_kWindowStateNormal;
|
if (state == GHOST_kWindowState8Normal) state = GHOST_kWindowStateNormal;
|
||||||
else if(state == GHOST_kWindowState8Maximized) state= GHOST_kWindowStateMaximized;
|
else if (state == GHOST_kWindowState8Maximized) state = GHOST_kWindowStateMaximized;
|
||||||
else if(state == GHOST_kWindowState8Minimized) state= GHOST_kWindowStateMinimized;
|
else if (state == GHOST_kWindowState8Minimized) state = GHOST_kWindowStateMinimized;
|
||||||
else if(state == GHOST_kWindowState8FullScreen) state= GHOST_kWindowStateFullScreen;
|
else if (state == GHOST_kWindowState8FullScreen) state = GHOST_kWindowStateFullScreen;
|
||||||
|
|
||||||
// state = state - 8; this was the simple version of above code, doesnt work in gcc 4.0
|
// state = state - 8; this was the simple version of above code, doesnt work in gcc 4.0
|
||||||
|
|
||||||
setMac_windowState(1);
|
setMac_windowState(1);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
setMac_windowState(0);
|
setMac_windowState(0);
|
||||||
|
|
||||||
if (state != GHOST_kWindowStateFullScreen) {
|
if (state != GHOST_kWindowStateFullScreen) {
|
||||||
Rect bnds = { top, left, top+height, left+width };
|
Rect bnds = { top, left, top + height, left + width };
|
||||||
// Boolean visible = (state == GHOST_kWindowStateNormal) || (state == GHOST_kWindowStateMaximized); /*unused*/
|
// Boolean visible = (state == GHOST_kWindowStateNormal) || (state == GHOST_kWindowStateMaximized); /*unused*/
|
||||||
gen2mac(title, title255);
|
gen2mac(title, title255);
|
||||||
|
|
||||||
err = ::CreateNewWindow( kDocumentWindowClass,
|
err = ::CreateNewWindow(kDocumentWindowClass,
|
||||||
kWindowStandardDocumentAttributes+kWindowLiveResizeAttribute,
|
kWindowStandardDocumentAttributes + kWindowLiveResizeAttribute,
|
||||||
&bnds,
|
&bnds,
|
||||||
&m_windowRef);
|
&m_windowRef);
|
||||||
|
|
||||||
if ( err != noErr) {
|
if (err != noErr) {
|
||||||
fprintf(stderr," error creating window %i \n",(int)err);
|
fprintf(stderr, " error creating window %i \n", (int)err);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
::SetWRefCon(m_windowRef,(SInt32)this);
|
::SetWRefCon(m_windowRef, (SInt32) this);
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
err = InstallWindowEventHandler (m_windowRef, myWEventHandlerProc, GetEventTypeCount(kWEvents), kWEvents,NULL,NULL);
|
err = InstallWindowEventHandler(m_windowRef, myWEventHandlerProc, GetEventTypeCount(kWEvents), kWEvents, NULL, NULL);
|
||||||
if ( err != noErr) {
|
if (err != noErr) {
|
||||||
fprintf(stderr," error creating handler %i \n",(int)err);
|
fprintf(stderr, " error creating handler %i \n", (int)err);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// ::TransitionWindow (m_windowRef,kWindowZoomTransitionEffect,kWindowShowTransitionAction,NULL);
|
// ::TransitionWindow (m_windowRef,kWindowZoomTransitionEffect,kWindowShowTransitionAction,NULL);
|
||||||
::ShowWindow(m_windowRef);
|
::ShowWindow(m_windowRef);
|
||||||
::MoveWindow (m_windowRef, left, top,true);
|
::MoveWindow(m_windowRef, left, top, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,8 +160,8 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
|
|||||||
updateDrawingContext();
|
updateDrawingContext();
|
||||||
activateDrawingContext();
|
activateDrawingContext();
|
||||||
}
|
}
|
||||||
if(ugly_hack==NULL) {
|
if (ugly_hack == NULL) {
|
||||||
ugly_hack= m_windowRef;
|
ugly_hack = m_windowRef;
|
||||||
// when started from commandline, window remains in the back... also for play anim
|
// when started from commandline, window remains in the back... also for play anim
|
||||||
ProcessSerialNumber psn;
|
ProcessSerialNumber psn;
|
||||||
GetCurrentProcess(&psn);
|
GetCurrentProcess(&psn);
|
||||||
@@ -166,8 +169,8 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/*
|
#if 0
|
||||||
Rect bnds = { top, left, top+height, left+width };
|
Rect bnds = { top, left, top + height, left + width };
|
||||||
gen2mac("", title255);
|
gen2mac("", title255);
|
||||||
m_windowRef = ::NewCWindow(
|
m_windowRef = ::NewCWindow(
|
||||||
nil, // Storage
|
nil, // Storage
|
||||||
@@ -175,12 +178,12 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
|
|||||||
title255, // Title of the window
|
title255, // Title of the window
|
||||||
0, // Window initially visible
|
0, // Window initially visible
|
||||||
plainDBox, // procID
|
plainDBox, // procID
|
||||||
(WindowRef)-1L, // Put window before all other windows
|
(WindowRef) - 1L, // Put window before all other windows
|
||||||
0, // Window has minimize box
|
0, // Window has minimize box
|
||||||
(SInt32)this); // Store a pointer to the class in the refCon
|
(SInt32) this); // Store a pointer to the class in the refCon
|
||||||
*/
|
#endif
|
||||||
//GHOST_PRINT("GHOST_WindowCarbon::GHOST_WindowCarbon(): creating full-screen OpenGL context\n");
|
//GHOST_PRINT("GHOST_WindowCarbon::GHOST_WindowCarbon(): creating full-screen OpenGL context\n");
|
||||||
setDrawingContextType(GHOST_kDrawingContextTypeOpenGL);;installDrawingContext(GHOST_kDrawingContextTypeOpenGL);
|
setDrawingContextType(GHOST_kDrawingContextTypeOpenGL);; installDrawingContext(GHOST_kDrawingContextTypeOpenGL);
|
||||||
updateDrawingContext();
|
updateDrawingContext();
|
||||||
activateDrawingContext();
|
activateDrawingContext();
|
||||||
|
|
||||||
@@ -193,10 +196,10 @@ GHOST_WindowCarbon::~GHOST_WindowCarbon()
|
|||||||
{
|
{
|
||||||
if (m_customCursor) delete m_customCursor;
|
if (m_customCursor) delete m_customCursor;
|
||||||
|
|
||||||
if(ugly_hack==m_windowRef) ugly_hack= NULL;
|
if (ugly_hack == m_windowRef) ugly_hack = NULL;
|
||||||
|
|
||||||
// printf("GHOST_WindowCarbon::~GHOST_WindowCarbon(): removing drawing context\n");
|
// printf("GHOST_WindowCarbon::~GHOST_WindowCarbon(): removing drawing context\n");
|
||||||
if(ugly_hack==NULL) setDrawingContextType(GHOST_kDrawingContextTypeNone);
|
if (ugly_hack == NULL) setDrawingContextType(GHOST_kDrawingContextTypeNone);
|
||||||
if (m_windowRef) {
|
if (m_windowRef) {
|
||||||
::DisposeWindow(m_windowRef);
|
::DisposeWindow(m_windowRef);
|
||||||
m_windowRef = 0;
|
m_windowRef = 0;
|
||||||
@@ -265,8 +268,7 @@ void GHOST_WindowCarbon::getClientBounds(GHOST_Rect& bounds) const
|
|||||||
{
|
{
|
||||||
bounds.m_b -= s_sizeRectSize;
|
bounds.m_b -= s_sizeRectSize;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
bounds.m_t = bounds.m_b;
|
bounds.m_t = bounds.m_b;
|
||||||
}
|
}
|
||||||
#endif //GHOST_DRAW_CARBON_GUTTER
|
#endif //GHOST_DRAW_CARBON_GUTTER
|
||||||
@@ -291,8 +293,8 @@ GHOST_TSuccess GHOST_WindowCarbon::setClientHeight(GHOST_TUns32 height)
|
|||||||
GHOST_Rect cBnds, wBnds;
|
GHOST_Rect cBnds, wBnds;
|
||||||
getClientBounds(cBnds);
|
getClientBounds(cBnds);
|
||||||
#ifdef GHOST_DRAW_CARBON_GUTTER
|
#ifdef GHOST_DRAW_CARBON_GUTTER
|
||||||
if (((GHOST_TUns32)cBnds.getHeight()) != height+s_sizeRectSize) {
|
if (((GHOST_TUns32)cBnds.getHeight()) != height + s_sizeRectSize) {
|
||||||
::SizeWindow(m_windowRef, cBnds.getWidth(), height+s_sizeRectSize, true);
|
::SizeWindow(m_windowRef, cBnds.getWidth(), height + s_sizeRectSize, true);
|
||||||
}
|
}
|
||||||
#else //GHOST_DRAW_CARBON_GUTTER
|
#else //GHOST_DRAW_CARBON_GUTTER
|
||||||
if (((GHOST_TUns32)cBnds.getHeight()) != height) {
|
if (((GHOST_TUns32)cBnds.getHeight()) != height) {
|
||||||
@@ -310,8 +312,9 @@ GHOST_TSuccess GHOST_WindowCarbon::setClientSize(GHOST_TUns32 width, GHOST_TUns3
|
|||||||
getClientBounds(cBnds);
|
getClientBounds(cBnds);
|
||||||
#ifdef GHOST_DRAW_CARBON_GUTTER
|
#ifdef GHOST_DRAW_CARBON_GUTTER
|
||||||
if ((((GHOST_TUns32)cBnds.getWidth()) != width) ||
|
if ((((GHOST_TUns32)cBnds.getWidth()) != width) ||
|
||||||
(((GHOST_TUns32)cBnds.getHeight()) != height+s_sizeRectSize)) {
|
(((GHOST_TUns32)cBnds.getHeight()) != height + s_sizeRectSize))
|
||||||
::SizeWindow(m_windowRef, width, height+s_sizeRectSize, true);
|
{
|
||||||
|
::SizeWindow(m_windowRef, width, height + s_sizeRectSize, true);
|
||||||
}
|
}
|
||||||
#else //GHOST_DRAW_CARBON_GUTTER
|
#else //GHOST_DRAW_CARBON_GUTTER
|
||||||
if ((((GHOST_TUns32)cBnds.getWidth()) != width) ||
|
if ((((GHOST_TUns32)cBnds.getWidth()) != width) ||
|
||||||
@@ -418,8 +421,8 @@ GHOST_TSuccess GHOST_WindowCarbon::swapBuffers()
|
|||||||
{
|
{
|
||||||
#ifdef WAIT_FOR_VSYNC
|
#ifdef WAIT_FOR_VSYNC
|
||||||
/* wait for vsync, to avoid tearing artifacts */
|
/* wait for vsync, to avoid tearing artifacts */
|
||||||
long VBL = 1;
|
long VBL = 1;
|
||||||
CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &VBL);
|
CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &VBL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GHOST_TSuccess succeeded = GHOST_kSuccess;
|
GHOST_TSuccess succeeded = GHOST_kSuccess;
|
||||||
@@ -462,9 +465,9 @@ GHOST_TSuccess GHOST_WindowCarbon::activateDrawingContext()
|
|||||||
GLint b[4] =
|
GLint b[4] =
|
||||||
{
|
{
|
||||||
bnds.m_l,
|
bnds.m_l,
|
||||||
bnds.m_t+s_sizeRectSize,
|
bnds.m_t + s_sizeRectSize,
|
||||||
bnds.m_r-bnds.m_l,
|
bnds.m_r - bnds.m_l,
|
||||||
bnds.m_b-bnds.m_t
|
bnds.m_b - bnds.m_t
|
||||||
};
|
};
|
||||||
GLboolean result = ::aglSetInteger(m_aglCtx, AGL_BUFFER_RECT, b);
|
GLboolean result = ::aglSetInteger(m_aglCtx, AGL_BUFFER_RECT, b);
|
||||||
#endif //GHOST_DRAW_CARBON_GUTTER
|
#endif //GHOST_DRAW_CARBON_GUTTER
|
||||||
@@ -495,21 +498,21 @@ GHOST_TSuccess GHOST_WindowCarbon::installDrawingContext(GHOST_TDrawingContextTy
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL\n");
|
//GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL\n");
|
||||||
GDHandle device=::GetMainDevice();pixelFormat=::aglChoosePixelFormat(&device,1,sPreferredFormatFullScreen);
|
GDHandle device = ::GetMainDevice(); pixelFormat = ::aglChoosePixelFormat(&device, 1, sPreferredFormatFullScreen);
|
||||||
m_aglCtx = ::aglCreateContext(pixelFormat, 0);
|
m_aglCtx = ::aglCreateContext(pixelFormat, 0);
|
||||||
if (!m_aglCtx) break;
|
if (!m_aglCtx) break;
|
||||||
if (!s_firstaglCtx) s_firstaglCtx = m_aglCtx;
|
if (!s_firstaglCtx) s_firstaglCtx = m_aglCtx;
|
||||||
//GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): created OpenGL context\n");
|
//GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): created OpenGL context\n");
|
||||||
//::CGGetActiveDisplayList(0, NULL, &m_numDisplays)
|
//::CGGetActiveDisplayList(0, NULL, &m_numDisplays)
|
||||||
success = ::aglSetFullScreen(m_aglCtx, m_fullScreenWidth, m_fullScreenHeight, 75, 0) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure;
|
success = ::aglSetFullScreen(m_aglCtx, m_fullScreenWidth, m_fullScreenHeight, 75, 0) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure;
|
||||||
/*
|
#if 0
|
||||||
if (success == GHOST_kSuccess) {
|
if (success == GHOST_kSuccess) {
|
||||||
GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL succeeded\n");
|
GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL succeeded\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL failed\n");
|
GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL failed\n");
|
||||||
}
|
}
|
||||||
*/
|
#endif
|
||||||
}
|
}
|
||||||
::aglDestroyPixelFormat(pixelFormat);
|
::aglDestroyPixelFormat(pixelFormat);
|
||||||
}
|
}
|
||||||
@@ -578,7 +581,7 @@ void GHOST_WindowCarbon::gen2mac(const STR_String& in, Str255 out) const
|
|||||||
STR_String tempStr = in;
|
STR_String tempStr = in;
|
||||||
int num = tempStr.Length();
|
int num = tempStr.Length();
|
||||||
if (num > 255) num = 255;
|
if (num > 255) num = 255;
|
||||||
::memcpy(out+1, tempStr.Ptr(), num);
|
::memcpy(out + 1, tempStr.Ptr(), num);
|
||||||
out[0] = num;
|
out[0] = num;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -586,7 +589,7 @@ void GHOST_WindowCarbon::gen2mac(const STR_String& in, Str255 out) const
|
|||||||
void GHOST_WindowCarbon::mac2gen(const Str255 in, STR_String& out) const
|
void GHOST_WindowCarbon::mac2gen(const Str255 in, STR_String& out) const
|
||||||
{
|
{
|
||||||
char tmp[256];
|
char tmp[256];
|
||||||
::memcpy(tmp, in+1, in[0]);
|
::memcpy(tmp, in + 1, in[0]);
|
||||||
tmp[in[0]] = '\0';
|
tmp[in[0]] = '\0';
|
||||||
out = tmp;
|
out = tmp;
|
||||||
}
|
}
|
||||||
@@ -607,35 +610,36 @@ void GHOST_WindowCarbon::loadCursor(bool visible, GHOST_TStandardCursor cursor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cursor == GHOST_kStandardCursorCustom && m_customCursor) {
|
if (cursor == GHOST_kStandardCursorCustom && m_customCursor) {
|
||||||
::SetCursor( m_customCursor );
|
::SetCursor(m_customCursor);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
int carbon_cursor;
|
int carbon_cursor;
|
||||||
|
|
||||||
#define GCMAP(ghostCursor, carbonCursor) case ghostCursor: carbon_cursor = carbonCursor; break
|
#define GCMAP(ghostCursor, carbonCursor) case ghostCursor: carbon_cursor = carbonCursor; break
|
||||||
switch (cursor) {
|
switch (cursor) {
|
||||||
default:
|
default:
|
||||||
GCMAP( GHOST_kStandardCursorDefault, kThemeArrowCursor);
|
GCMAP(GHOST_kStandardCursorDefault, kThemeArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorRightArrow, kThemeAliasArrowCursor);
|
GCMAP(GHOST_kStandardCursorRightArrow, kThemeAliasArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorLeftArrow, kThemeArrowCursor);
|
GCMAP(GHOST_kStandardCursorLeftArrow, kThemeArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorInfo, kThemeArrowCursor);
|
GCMAP(GHOST_kStandardCursorInfo, kThemeArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorDestroy, kThemeArrowCursor);
|
GCMAP(GHOST_kStandardCursorDestroy, kThemeArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorHelp, kThemeArrowCursor);
|
GCMAP(GHOST_kStandardCursorHelp, kThemeArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorCycle, kThemeArrowCursor);
|
GCMAP(GHOST_kStandardCursorCycle, kThemeArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorSpray, kThemeArrowCursor);
|
GCMAP(GHOST_kStandardCursorSpray, kThemeArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorWait, kThemeWatchCursor);
|
GCMAP(GHOST_kStandardCursorWait, kThemeWatchCursor);
|
||||||
GCMAP( GHOST_kStandardCursorText, kThemeIBeamCursor);
|
GCMAP(GHOST_kStandardCursorText, kThemeIBeamCursor);
|
||||||
GCMAP( GHOST_kStandardCursorCrosshair, kThemeCrossCursor);
|
GCMAP(GHOST_kStandardCursorCrosshair, kThemeCrossCursor);
|
||||||
GCMAP( GHOST_kStandardCursorUpDown, kThemeClosedHandCursor);
|
GCMAP(GHOST_kStandardCursorUpDown, kThemeClosedHandCursor);
|
||||||
GCMAP( GHOST_kStandardCursorLeftRight, kThemeClosedHandCursor);
|
GCMAP(GHOST_kStandardCursorLeftRight, kThemeClosedHandCursor);
|
||||||
GCMAP( GHOST_kStandardCursorTopSide, kThemeArrowCursor);
|
GCMAP(GHOST_kStandardCursorTopSide, kThemeArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorBottomSide, kThemeArrowCursor);
|
GCMAP(GHOST_kStandardCursorBottomSide, kThemeArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorLeftSide, kThemeResizeLeftCursor);
|
GCMAP(GHOST_kStandardCursorLeftSide, kThemeResizeLeftCursor);
|
||||||
GCMAP( GHOST_kStandardCursorRightSide, kThemeResizeRightCursor);
|
GCMAP(GHOST_kStandardCursorRightSide, kThemeResizeRightCursor);
|
||||||
GCMAP( GHOST_kStandardCursorTopLeftCorner, kThemeArrowCursor);
|
GCMAP(GHOST_kStandardCursorTopLeftCorner, kThemeArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorTopRightCorner, kThemeArrowCursor);
|
GCMAP(GHOST_kStandardCursorTopRightCorner, kThemeArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorBottomRightCorner, kThemeArrowCursor);
|
GCMAP(GHOST_kStandardCursorBottomRightCorner, kThemeArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorBottomLeftCorner, kThemeArrowCursor);
|
GCMAP(GHOST_kStandardCursorBottomLeftCorner, kThemeArrowCursor);
|
||||||
GCMAP( GHOST_kStandardCursorCopy, kThemeCopyArrowCursor);
|
GCMAP(GHOST_kStandardCursorCopy, kThemeCopyArrowCursor);
|
||||||
};
|
};
|
||||||
#undef GCMAP
|
#undef GCMAP
|
||||||
|
|
||||||
@@ -677,9 +681,9 @@ GHOST_TSuccess GHOST_WindowCarbon::setWindowCursorShape(GHOST_TStandardCursor sh
|
|||||||
/** Reverse the bits in a GHOST_TUns8 */
|
/** Reverse the bits in a GHOST_TUns8 */
|
||||||
static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
|
static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
|
||||||
{
|
{
|
||||||
ch= ((ch>>1)&0x55) | ((ch<<1)&0xAA);
|
ch = ((ch >> 1) & 0x55) | ((ch << 1) & 0xAA);
|
||||||
ch= ((ch>>2)&0x33) | ((ch<<2)&0xCC);
|
ch = ((ch >> 2) & 0x33) | ((ch << 2) & 0xCC);
|
||||||
ch= ((ch>>4)&0x0F) | ((ch<<4)&0xF0);
|
ch = ((ch >> 4) & 0x0F) | ((ch << 4) & 0xF0);
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -688,10 +692,10 @@ static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
|
|||||||
/** Reverse the bits in a GHOST_TUns16 */
|
/** Reverse the bits in a GHOST_TUns16 */
|
||||||
static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
|
static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
|
||||||
{
|
{
|
||||||
shrt= ((shrt>>1)&0x5555) | ((shrt<<1)&0xAAAA);
|
shrt = ((shrt >> 1) & 0x5555) | ((shrt << 1) & 0xAAAA);
|
||||||
shrt= ((shrt>>2)&0x3333) | ((shrt<<2)&0xCCCC);
|
shrt = ((shrt >> 2) & 0x3333) | ((shrt << 2) & 0xCCCC);
|
||||||
shrt= ((shrt>>4)&0x0F0F) | ((shrt<<4)&0xF0F0);
|
shrt = ((shrt >> 4) & 0x0F0F) | ((shrt << 4) & 0xF0F0);
|
||||||
shrt= ((shrt>>8)&0x00FF) | ((shrt<<8)&0xFF00);
|
shrt = ((shrt >> 8) & 0x00FF) | ((shrt << 8) & 0xFF00);
|
||||||
return shrt;
|
return shrt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -708,13 +712,13 @@ GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 *bitma
|
|||||||
m_customCursor = new Cursor;
|
m_customCursor = new Cursor;
|
||||||
if (!m_customCursor) return GHOST_kFailure;
|
if (!m_customCursor) return GHOST_kFailure;
|
||||||
|
|
||||||
for (y=0; y<16; y++) {
|
for (y = 0; y < 16; y++) {
|
||||||
#if !defined(__LITTLE_ENDIAN__)
|
#if !defined(__LITTLE_ENDIAN__)
|
||||||
m_customCursor->data[y] = uns16ReverseBits((bitmap[2*y]<<0) | (bitmap[2*y+1]<<8));
|
m_customCursor->data[y] = uns16ReverseBits((bitmap[2 * y] << 0) | (bitmap[2 * y + 1] << 8));
|
||||||
m_customCursor->mask[y] = uns16ReverseBits((mask[2*y]<<0) | (mask[2*y+1]<<8));
|
m_customCursor->mask[y] = uns16ReverseBits((mask[2 * y] << 0) | (mask[2 * y + 1] << 8));
|
||||||
#else
|
#else
|
||||||
m_customCursor->data[y] = uns16ReverseBits((bitmap[2*y+1]<<0) | (bitmap[2*y]<<8));
|
m_customCursor->data[y] = uns16ReverseBits((bitmap[2 * y + 1] << 0) | (bitmap[2 * y] << 8));
|
||||||
m_customCursor->mask[y] = uns16ReverseBits((mask[2*y+1]<<0) | (mask[2*y]<<8));
|
m_customCursor->mask[y] = uns16ReverseBits((mask[2 * y + 1] << 0) | (mask[2 * y] << 8));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -732,7 +736,7 @@ GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 *bitma
|
|||||||
GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
|
GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
|
||||||
GHOST_TUns8 mask[16][2], int hotX, int hotY)
|
GHOST_TUns8 mask[16][2], int hotX, int hotY)
|
||||||
{
|
{
|
||||||
return setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*) mask, 16, 16, hotX, hotY, 0, 1);
|
return setWindowCustomCursorShape((GHOST_TUns8 *)bitmap, (GHOST_TUns8 *) mask, 16, 16, hotX, hotY, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -211,11 +211,15 @@ public:
|
|||||||
virtual short getMac_windowState();
|
virtual short getMac_windowState();
|
||||||
|
|
||||||
|
|
||||||
const GHOST_TabletData* GetTabletData()
|
const GHOST_TabletData *GetTabletData()
|
||||||
{ return &m_tablet; }
|
{
|
||||||
|
return &m_tablet;
|
||||||
|
}
|
||||||
|
|
||||||
GHOST_TabletData& GetCarbonTabletData()
|
GHOST_TabletData& GetCarbonTabletData()
|
||||||
{ return m_tablet; }
|
{
|
||||||
|
return m_tablet;
|
||||||
|
}
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Tries to install a rendering context in this window.
|
* Tries to install a rendering context in this window.
|
||||||
@@ -278,7 +282,7 @@ protected:
|
|||||||
/** The first created OpenGL context (for sharing display lists) */
|
/** The first created OpenGL context (for sharing display lists) */
|
||||||
static AGLContext s_firstaglCtx;
|
static AGLContext s_firstaglCtx;
|
||||||
|
|
||||||
Cursor* m_customCursor;
|
Cursor *m_customCursor;
|
||||||
|
|
||||||
GHOST_TabletData m_tablet;
|
GHOST_TabletData m_tablet;
|
||||||
|
|
||||||
@@ -286,14 +290,14 @@ protected:
|
|||||||
bool m_fullScreenDirty;
|
bool m_fullScreenDirty;
|
||||||
|
|
||||||
/** specific MacOs X full screen window setting as we use partially system mechanism
|
/** specific MacOs X full screen window setting as we use partially system mechanism
|
||||||
values : 0 not maximizable default
|
* values : 0 not maximizable default
|
||||||
1 normal state
|
* 1 normal state
|
||||||
2 maximized state
|
* 2 maximized state
|
||||||
|
*
|
||||||
this will be reworked when rebuilding GHOST carbon to use new OS X apis
|
* this will be reworked when rebuilding GHOST carbon to use new OS X apis
|
||||||
in order to be unified with GHOST fullscreen/maximised settings
|
* in order to be unified with GHOST fullscreen/maximised settings
|
||||||
|
*
|
||||||
(lukep)
|
* (lukep)
|
||||||
**/
|
**/
|
||||||
|
|
||||||
short mac_windowState;
|
short mac_windowState;
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public:
|
|||||||
* Returns the associated NSWindow object
|
* Returns the associated NSWindow object
|
||||||
* @return The associated NSWindow object
|
* @return The associated NSWindow object
|
||||||
*/
|
*/
|
||||||
virtual void* getOSWindow() const;
|
virtual void *getOSWindow() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the title displayed in the title bar.
|
* Sets the title displayed in the title bar.
|
||||||
@@ -204,7 +204,7 @@ public:
|
|||||||
* Gets the screen the window is displayed in
|
* Gets the screen the window is displayed in
|
||||||
* @return The NSScreen object
|
* @return The NSScreen object
|
||||||
*/
|
*/
|
||||||
NSScreen* getScreen();
|
NSScreen *getScreen();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the state of the window (normal, minimized, maximized).
|
* Sets the state of the window (normal, minimized, maximized).
|
||||||
@@ -242,11 +242,15 @@ public:
|
|||||||
virtual void loadCursor(bool visible, GHOST_TStandardCursor cursor) const;
|
virtual void loadCursor(bool visible, GHOST_TStandardCursor cursor) const;
|
||||||
|
|
||||||
|
|
||||||
const GHOST_TabletData* GetTabletData()
|
const GHOST_TabletData *GetTabletData()
|
||||||
{ return &m_tablet; }
|
{
|
||||||
|
return &m_tablet;
|
||||||
|
}
|
||||||
|
|
||||||
GHOST_TabletData& GetCocoaTabletData()
|
GHOST_TabletData& GetCocoaTabletData()
|
||||||
{ return m_tablet; }
|
{
|
||||||
|
return m_tablet;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the progress bar value displayed in the window/application icon
|
* Sets the progress bar value displayed in the window/application icon
|
||||||
@@ -320,7 +324,7 @@ protected:
|
|||||||
/** The first created OpenGL context (for sharing display lists) */
|
/** The first created OpenGL context (for sharing display lists) */
|
||||||
static NSOpenGLContext *s_firstOpenGLcontext;
|
static NSOpenGLContext *s_firstOpenGLcontext;
|
||||||
|
|
||||||
NSCursor* m_customCursor;
|
NSCursor *m_customCursor;
|
||||||
|
|
||||||
GHOST_TabletData m_tablet;
|
GHOST_TabletData m_tablet;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ GHOST_WindowManager::~GHOST_WindowManager()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowManager::addWindow(GHOST_IWindow* window)
|
GHOST_TSuccess GHOST_WindowManager::addWindow(GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success = GHOST_kFailure;
|
GHOST_TSuccess success = GHOST_kFailure;
|
||||||
if (window) {
|
if (window) {
|
||||||
@@ -71,7 +71,7 @@ GHOST_TSuccess GHOST_WindowManager::addWindow(GHOST_IWindow* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowManager::removeWindow(const GHOST_IWindow* window)
|
GHOST_TSuccess GHOST_WindowManager::removeWindow(const GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success = GHOST_kFailure;
|
GHOST_TSuccess success = GHOST_kFailure;
|
||||||
if (window) {
|
if (window) {
|
||||||
@@ -79,7 +79,7 @@ GHOST_TSuccess GHOST_WindowManager::removeWindow(const GHOST_IWindow* window)
|
|||||||
endFullScreen();
|
endFullScreen();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::vector<GHOST_IWindow*>::iterator result = find(m_windows.begin(), m_windows.end(), window);
|
std::vector<GHOST_IWindow *>::iterator result = find(m_windows.begin(), m_windows.end(), window);
|
||||||
if (result != m_windows.end()) {
|
if (result != m_windows.end()) {
|
||||||
setWindowInactive(window);
|
setWindowInactive(window);
|
||||||
m_windows.erase(result);
|
m_windows.erase(result);
|
||||||
@@ -91,7 +91,7 @@ GHOST_TSuccess GHOST_WindowManager::removeWindow(const GHOST_IWindow* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GHOST_WindowManager::getWindowFound(const GHOST_IWindow* window) const
|
bool GHOST_WindowManager::getWindowFound(const GHOST_IWindow *window) const
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if (window) {
|
if (window) {
|
||||||
@@ -99,7 +99,7 @@ bool GHOST_WindowManager::getWindowFound(const GHOST_IWindow* window) const
|
|||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::vector<GHOST_IWindow*>::const_iterator result = find(m_windows.begin(), m_windows.end(), window);
|
std::vector<GHOST_IWindow *>::const_iterator result = find(m_windows.begin(), m_windows.end(), window);
|
||||||
if (result != m_windows.end()) {
|
if (result != m_windows.end()) {
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
@@ -115,13 +115,13 @@ bool GHOST_WindowManager::getFullScreen(void) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_IWindow* GHOST_WindowManager::getFullScreenWindow(void) const
|
GHOST_IWindow *GHOST_WindowManager::getFullScreenWindow(void) const
|
||||||
{
|
{
|
||||||
return m_fullScreenWindow;
|
return m_fullScreenWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowManager::beginFullScreen(GHOST_IWindow* window,
|
GHOST_TSuccess GHOST_WindowManager::beginFullScreen(GHOST_IWindow *window,
|
||||||
bool stereoVisual)
|
bool stereoVisual)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success = GHOST_kFailure;
|
GHOST_TSuccess success = GHOST_kFailure;
|
||||||
@@ -157,7 +157,7 @@ GHOST_TSuccess GHOST_WindowManager::endFullScreen(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowManager::setActiveWindow(GHOST_IWindow* window)
|
GHOST_TSuccess GHOST_WindowManager::setActiveWindow(GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success = GHOST_kSuccess;
|
GHOST_TSuccess success = GHOST_kSuccess;
|
||||||
if (window != m_activeWindow) {
|
if (window != m_activeWindow) {
|
||||||
@@ -172,13 +172,13 @@ GHOST_TSuccess GHOST_WindowManager::setActiveWindow(GHOST_IWindow* window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_IWindow* GHOST_WindowManager::getActiveWindow(void) const
|
GHOST_IWindow *GHOST_WindowManager::getActiveWindow(void) const
|
||||||
{
|
{
|
||||||
return m_activeWindow;
|
return m_activeWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GHOST_WindowManager::setWindowInactive(const GHOST_IWindow* window)
|
void GHOST_WindowManager::setWindowInactive(const GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
if (window == m_activeWindow) {
|
if (window == m_activeWindow) {
|
||||||
m_activeWindow = 0;
|
m_activeWindow = 0;
|
||||||
@@ -192,9 +192,9 @@ std::vector<GHOST_IWindow *> &GHOST_WindowManager::getWindows()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_IWindow* GHOST_WindowManager::getWindowAssociatedWithOSWindow(void* osWindow)
|
GHOST_IWindow *GHOST_WindowManager::getWindowAssociatedWithOSWindow(void *osWindow)
|
||||||
{
|
{
|
||||||
std::vector<GHOST_IWindow*>::iterator iter;
|
std::vector<GHOST_IWindow *>::iterator iter;
|
||||||
|
|
||||||
for (iter = m_windows.begin(); iter != m_windows.end(); iter++) {
|
for (iter = m_windows.begin(); iter != m_windows.end(); iter++) {
|
||||||
if ((*iter)->getOSWindow() == osWindow)
|
if ((*iter)->getOSWindow() == osWindow)
|
||||||
@@ -207,7 +207,7 @@ GHOST_IWindow* GHOST_WindowManager::getWindowAssociatedWithOSWindow(void* osWind
|
|||||||
bool GHOST_WindowManager::getAnyModifiedState()
|
bool GHOST_WindowManager::getAnyModifiedState()
|
||||||
{
|
{
|
||||||
bool isAnyModified = false;
|
bool isAnyModified = false;
|
||||||
std::vector<GHOST_IWindow*>::iterator iter;
|
std::vector<GHOST_IWindow *>::iterator iter;
|
||||||
|
|
||||||
for (iter = m_windows.begin(); iter != m_windows.end(); iter++) {
|
for (iter = m_windows.begin(); iter != m_windows.end(); iter++) {
|
||||||
if ((*iter)->getModifiedState())
|
if ((*iter)->getModifiedState())
|
||||||
|
|||||||
@@ -63,21 +63,21 @@ public:
|
|||||||
* @param window Pointer to the window to be added.
|
* @param window Pointer to the window to be added.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess addWindow(GHOST_IWindow* window);
|
virtual GHOST_TSuccess addWindow(GHOST_IWindow *window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a window from our list.
|
* Remove a window from our list.
|
||||||
* @param window Pointer to the window to be removed.
|
* @param window Pointer to the window to be removed.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess removeWindow(const GHOST_IWindow* window);
|
virtual GHOST_TSuccess removeWindow(const GHOST_IWindow *window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the window is in our list.
|
* Returns whether the window is in our list.
|
||||||
* @param window Pointer to the window to query.
|
* @param window Pointer to the window to query.
|
||||||
* @return A boolean indicator.
|
* @return A boolean indicator.
|
||||||
*/
|
*/
|
||||||
virtual bool getWindowFound(const GHOST_IWindow* window) const;
|
virtual bool getWindowFound(const GHOST_IWindow *window) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether one of the windows is fullscreen.
|
* Returns whether one of the windows is fullscreen.
|
||||||
@@ -89,14 +89,14 @@ public:
|
|||||||
* Returns pointer to the full-screen window.
|
* Returns pointer to the full-screen window.
|
||||||
* @return The fll-screen window (0 if not in full-screen).
|
* @return The fll-screen window (0 if not in full-screen).
|
||||||
*/
|
*/
|
||||||
virtual GHOST_IWindow* getFullScreenWindow(void) const;
|
virtual GHOST_IWindow *getFullScreenWindow(void) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activates fullscreen mode for a window.
|
* Activates fullscreen mode for a window.
|
||||||
* @param window The window displayed fullscreen.
|
* @param window The window displayed fullscreen.
|
||||||
* @return Indication of success.
|
* @return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess beginFullScreen(GHOST_IWindow* window, const bool stereoVisual);
|
virtual GHOST_TSuccess beginFullScreen(GHOST_IWindow *window, const bool stereoVisual);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes fullscreen mode down.
|
* Closes fullscreen mode down.
|
||||||
@@ -109,21 +109,21 @@ public:
|
|||||||
* There can be only one window active which should be in the current window list.
|
* There can be only one window active which should be in the current window list.
|
||||||
* @param window The new active window.
|
* @param window The new active window.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess setActiveWindow(GHOST_IWindow* window);
|
virtual GHOST_TSuccess setActiveWindow(GHOST_IWindow *window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the active window (the window receiving events).
|
* Returns the active window (the window receiving events).
|
||||||
* There can be only one window active which should be in the current window list.
|
* There can be only one window active which should be in the current window list.
|
||||||
* @return window The active window (or NULL if there is none).
|
* @return window The active window (or NULL if there is none).
|
||||||
*/
|
*/
|
||||||
virtual GHOST_IWindow* getActiveWindow(void) const;
|
virtual GHOST_IWindow *getActiveWindow(void) const;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set this window to be inactive (not receiving events).
|
* Set this window to be inactive (not receiving events).
|
||||||
* @param window The window to decativate.
|
* @param window The window to decativate.
|
||||||
*/
|
*/
|
||||||
virtual void setWindowInactive(const GHOST_IWindow* window);
|
virtual void setWindowInactive(const GHOST_IWindow *window);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,7 +140,7 @@ public:
|
|||||||
* @param osWindow The OS window object/handle
|
* @param osWindow The OS window object/handle
|
||||||
* @return The associated window, null if none corresponds
|
* @return The associated window, null if none corresponds
|
||||||
*/
|
*/
|
||||||
virtual GHOST_IWindow* getWindowAssociatedWithOSWindow(void* osWindow);
|
virtual GHOST_IWindow *getWindowAssociatedWithOSWindow(void *osWindow);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if any windows has a modified status
|
* Return true if any windows has a modified status
|
||||||
@@ -150,16 +150,16 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** The list of windows managed */
|
/** The list of windows managed */
|
||||||
std::vector<GHOST_IWindow*> m_windows;
|
std::vector<GHOST_IWindow *> m_windows;
|
||||||
|
|
||||||
/** Window in fullscreen state. There can be only one of this which is not in or window list. */
|
/** Window in fullscreen state. There can be only one of this which is not in or window list. */
|
||||||
GHOST_IWindow* m_fullScreenWindow;
|
GHOST_IWindow *m_fullScreenWindow;
|
||||||
|
|
||||||
/** The active window. */
|
/** The active window. */
|
||||||
GHOST_IWindow* m_activeWindow;
|
GHOST_IWindow *m_activeWindow;
|
||||||
|
|
||||||
/** Window that was active before entering fullscreen state. */
|
/** Window that was active before entering fullscreen state. */
|
||||||
GHOST_IWindow* m_activeWindowBeforeFullScreen;
|
GHOST_IWindow *m_activeWindowBeforeFullScreen;
|
||||||
|
|
||||||
#ifdef WITH_CXX_GUARDEDALLOC
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ public:
|
|||||||
const bool stereoVisual,
|
const bool stereoVisual,
|
||||||
const GHOST_TUns16 numOfAASamples
|
const GHOST_TUns16 numOfAASamples
|
||||||
) :
|
) :
|
||||||
GHOST_Window(width,height,state,type,stereoVisual,numOfAASamples),
|
GHOST_Window(width, height, state, type, stereoVisual, numOfAASamples),
|
||||||
m_system (system)
|
m_system(system)
|
||||||
{
|
{
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
}
|
}
|
||||||
@@ -87,8 +87,8 @@ protected:
|
|||||||
GHOST_TSuccess setOrder(GHOST_TWindowOrder order) { return GHOST_kSuccess; }
|
GHOST_TSuccess setOrder(GHOST_TWindowOrder order) { return GHOST_kSuccess; }
|
||||||
|
|
||||||
|
|
||||||
private :
|
private:
|
||||||
GHOST_SystemNULL * m_system;
|
GHOST_SystemNULL *m_system;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include "SDL_mouse.h"
|
#include "SDL_mouse.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
static SDL_GLContext s_firstContext= NULL;
|
static SDL_GLContext s_firstContext = NULL;
|
||||||
|
|
||||||
GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
|
GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
|
||||||
const STR_String& title,
|
const STR_String& title,
|
||||||
@@ -43,17 +43,17 @@ GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
|
|||||||
const GHOST_TUns16 numOfAASamples
|
const GHOST_TUns16 numOfAASamples
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
GHOST_Window(width,height,state,type,stereoVisual,numOfAASamples),
|
GHOST_Window(width, height, state, type, stereoVisual, numOfAASamples),
|
||||||
m_system (system),
|
m_system(system),
|
||||||
m_invalid_window(false),
|
m_invalid_window(false),
|
||||||
m_sdl_custom_cursor(NULL)
|
m_sdl_custom_cursor(NULL)
|
||||||
{
|
{
|
||||||
m_sdl_win= SDL_CreateWindow(title,
|
m_sdl_win = SDL_CreateWindow(title,
|
||||||
left,
|
left,
|
||||||
top,
|
top,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
SDL_WINDOW_RESIZABLE|SDL_WINDOW_OPENGL|SDL_WINDOW_SHOWN);
|
SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
|
||||||
|
|
||||||
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
|
||||||
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
|
||||||
@@ -64,7 +64,7 @@ GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
|
|||||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||||
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
|
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
|
||||||
|
|
||||||
m_sdl_glcontext= SDL_GL_CreateContext(m_sdl_win);
|
m_sdl_glcontext = SDL_GL_CreateContext(m_sdl_win);
|
||||||
|
|
||||||
//fprintf(stderr, "Ignoring Xlib error: error code %d request code %d\n",
|
//fprintf(stderr, "Ignoring Xlib error: error code %d request code %d\n",
|
||||||
// theEvent->error_code, theEvent->request_code);
|
// theEvent->error_code, theEvent->request_code);
|
||||||
@@ -74,7 +74,7 @@ GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
|
|||||||
|
|
||||||
GHOST_WindowSDL::~GHOST_WindowSDL()
|
GHOST_WindowSDL::~GHOST_WindowSDL()
|
||||||
{
|
{
|
||||||
if(m_sdl_custom_cursor) {
|
if (m_sdl_custom_cursor) {
|
||||||
SDL_FreeCursor(m_sdl_custom_cursor);
|
SDL_FreeCursor(m_sdl_custom_cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,28 +93,28 @@ GHOST_WindowSDL::installDrawingContext(GHOST_TDrawingContextType type)
|
|||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GHOST_kDrawingContextTypeOpenGL:
|
case GHOST_kDrawingContextTypeOpenGL:
|
||||||
m_sdl_glcontext= SDL_GL_CreateContext(m_sdl_win);
|
m_sdl_glcontext = SDL_GL_CreateContext(m_sdl_win);
|
||||||
|
|
||||||
if (m_sdl_glcontext != NULL) {
|
if (m_sdl_glcontext != NULL) {
|
||||||
if (!s_firstContext) {
|
if (!s_firstContext) {
|
||||||
s_firstContext= m_sdl_glcontext;
|
s_firstContext = m_sdl_glcontext;
|
||||||
}
|
}
|
||||||
|
|
||||||
success= (SDL_GL_MakeCurrent(m_sdl_win, m_sdl_glcontext) < 0) ?
|
success = (SDL_GL_MakeCurrent(m_sdl_win, m_sdl_glcontext) < 0) ?
|
||||||
GHOST_kFailure : GHOST_kSuccess;
|
GHOST_kFailure : GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
success= GHOST_kFailure;
|
success = GHOST_kFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GHOST_kDrawingContextTypeNone:
|
case GHOST_kDrawingContextTypeNone:
|
||||||
success= GHOST_kSuccess;
|
success = GHOST_kSuccess;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
success= GHOST_kFailure;
|
success = GHOST_kFailure;
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ GHOST_WindowSDL::invalidate(void)
|
|||||||
|
|
||||||
if (m_invalid_window == false) {
|
if (m_invalid_window == false) {
|
||||||
m_system->addDirtyWindow(this);
|
m_system->addDirtyWindow(this);
|
||||||
m_invalid_window= true;
|
m_invalid_window = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
@@ -161,8 +161,8 @@ GHOST_WindowSDL::swapBuffers()
|
|||||||
GHOST_TSuccess
|
GHOST_TSuccess
|
||||||
GHOST_WindowSDL::activateDrawingContext()
|
GHOST_WindowSDL::activateDrawingContext()
|
||||||
{
|
{
|
||||||
if (m_sdl_glcontext !=NULL) {
|
if (m_sdl_glcontext != NULL) {
|
||||||
int status=SDL_GL_MakeCurrent(m_sdl_win, m_sdl_glcontext);
|
int status = SDL_GL_MakeCurrent(m_sdl_win, m_sdl_glcontext);
|
||||||
(void)status;
|
(void)status;
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
@@ -177,10 +177,10 @@ GHOST_WindowSDL::removeDrawingContext()
|
|||||||
|
|
||||||
if (m_sdl_glcontext != NULL) {
|
if (m_sdl_glcontext != NULL) {
|
||||||
SDL_GL_DeleteContext(m_sdl_glcontext);
|
SDL_GL_DeleteContext(m_sdl_glcontext);
|
||||||
success= GHOST_kSuccess;
|
success = GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
success= GHOST_kFailure;
|
success = GHOST_kFailure;
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,7 @@ GHOST_WindowSDL::removeDrawingContext()
|
|||||||
GHOST_TSuccess
|
GHOST_TSuccess
|
||||||
GHOST_WindowSDL::setState(GHOST_TWindowState state)
|
GHOST_WindowSDL::setState(GHOST_TWindowState state)
|
||||||
{
|
{
|
||||||
switch(state) {
|
switch (state) {
|
||||||
case GHOST_kWindowStateNormal:
|
case GHOST_kWindowStateNormal:
|
||||||
SDL_SetWindowFullscreen(m_sdl_win, SDL_FALSE);
|
SDL_SetWindowFullscreen(m_sdl_win, SDL_FALSE);
|
||||||
SDL_RestoreWindow(m_sdl_win);
|
SDL_RestoreWindow(m_sdl_win);
|
||||||
@@ -215,11 +215,11 @@ GHOST_WindowSDL::setState(GHOST_TWindowState state)
|
|||||||
GHOST_TWindowState
|
GHOST_TWindowState
|
||||||
GHOST_WindowSDL::getState() const
|
GHOST_WindowSDL::getState() const
|
||||||
{
|
{
|
||||||
Uint32 flags= SDL_GetWindowFlags(m_sdl_win);
|
Uint32 flags = SDL_GetWindowFlags(m_sdl_win);
|
||||||
|
|
||||||
if(flags & SDL_WINDOW_FULLSCREEN) return GHOST_kWindowStateFullScreen;
|
if (flags & SDL_WINDOW_FULLSCREEN) return GHOST_kWindowStateFullScreen;
|
||||||
else if(flags & SDL_WINDOW_MAXIMIZED) return GHOST_kWindowStateMaximized;
|
else if (flags & SDL_WINDOW_MAXIMIZED) return GHOST_kWindowStateMaximized;
|
||||||
else if(flags & SDL_WINDOW_MINIMIZED) return GHOST_kWindowStateMinimized;
|
else if (flags & SDL_WINDOW_MINIMIZED) return GHOST_kWindowStateMinimized;
|
||||||
return GHOST_kWindowStateNormal;
|
return GHOST_kWindowStateNormal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ GHOST_WindowSDL::setTitle(const STR_String& title)
|
|||||||
void
|
void
|
||||||
GHOST_WindowSDL::getTitle(STR_String& title) const
|
GHOST_WindowSDL::getTitle(STR_String& title) const
|
||||||
{
|
{
|
||||||
title= SDL_GetWindowTitle(m_sdl_win);
|
title = SDL_GetWindowTitle(m_sdl_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -252,10 +252,10 @@ GHOST_WindowSDL::getClientBounds(GHOST_Rect& bounds) const
|
|||||||
SDL_GetWindowSize(m_sdl_win, &w, &h);
|
SDL_GetWindowSize(m_sdl_win, &w, &h);
|
||||||
SDL_GetWindowPosition(m_sdl_win, &x, &y);
|
SDL_GetWindowPosition(m_sdl_win, &x, &y);
|
||||||
|
|
||||||
bounds.m_l= x;
|
bounds.m_l = x;
|
||||||
bounds.m_r= x + w;
|
bounds.m_r = x + w;
|
||||||
bounds.m_t= y;
|
bounds.m_t = y;
|
||||||
bounds.m_b= y + h;
|
bounds.m_b = y + h;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess
|
GHOST_TSuccess
|
||||||
@@ -285,7 +285,7 @@ GHOST_WindowSDL::setClientSize(GHOST_TUns32 width,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GHOST_WindowSDL::screenToClient( GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY ) const
|
GHOST_WindowSDL::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
|
||||||
{
|
{
|
||||||
/* XXXSDL_WEAK_ABS_COORDS */
|
/* XXXSDL_WEAK_ABS_COORDS */
|
||||||
int x_win, y_win;
|
int x_win, y_win;
|
||||||
@@ -295,7 +295,7 @@ GHOST_WindowSDL::screenToClient( GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt3
|
|||||||
outY = inY - y_win;
|
outY = inY - y_win;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
GHOST_WindowSDL::clientToScreen( GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY ) const
|
GHOST_WindowSDL::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const
|
||||||
{
|
{
|
||||||
/* XXXSDL_WEAK_ABS_COORDS */
|
/* XXXSDL_WEAK_ABS_COORDS */
|
||||||
int x_win, y_win;
|
int x_win, y_win;
|
||||||
@@ -306,148 +306,148 @@ GHOST_WindowSDL::clientToScreen( GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt3
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* mouse cursor */
|
/* mouse cursor */
|
||||||
static unsigned char sdl_std_cursor_mask_xterm[]= {0xef,0x01,0xff,0x01,0xff,0x01,0x7c,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x38,0x00,0x7c,0x00,0xff,0x01,0xff,0x01,0xef,0x01,};
|
static unsigned char sdl_std_cursor_mask_xterm[] = {0xef, 0x01, 0xff, 0x01, 0xff, 0x01, 0x7c, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xff, 0x01, 0xff, 0x01, 0xef, 0x01, };
|
||||||
static unsigned char sdl_std_cursor_xterm[]= {0x00,0x77,0x00,0x1c,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x1c,0x00,0x77,0x00,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_xterm[] = {0x00, 0x77, 0x00, 0x1c, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x1c, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_xterm 9
|
#define sdl_std_cursor_WIDTH_xterm 9
|
||||||
#define sdl_std_cursor_HEIGHT_xterm 16
|
#define sdl_std_cursor_HEIGHT_xterm 16
|
||||||
#define sdl_std_cursor_HOT_X_xterm -3
|
#define sdl_std_cursor_HOT_X_xterm -3
|
||||||
#define sdl_std_cursor_HOT_Y_xterm -7
|
#define sdl_std_cursor_HOT_Y_xterm -7
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_watch[]= {0xfc,0x0f,0xfc,0x0f,0xfc,0x0f,0xfe,0x1f,0xff,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0xfe,0x1f,0xfc,0x0f,0xfc,0x0f,0xfc,0x0f,};
|
static unsigned char sdl_std_cursor_mask_watch[] = {0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfe, 0x1f, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xfe, 0x1f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, };
|
||||||
static unsigned char sdl_std_cursor_watch[]= {0xf8,0x07,0xf8,0x07,0xf8,0x07,0xfc,0x0f,0x86,0x18,0x83,0x30,0x81,0xe0,0xc1,0xe1,0xc1,0xe1,0x21,0xe0,0x13,0x30,0x06,0x18,0xfc,0x0f,0xf8,0x07,0xf8,0x07,0xf8,0x07,};
|
static unsigned char sdl_std_cursor_watch[] = {0xf8, 0x07, 0xf8, 0x07, 0xf8, 0x07, 0xfc, 0x0f, 0x86, 0x18, 0x83, 0x30, 0x81, 0xe0, 0xc1, 0xe1, 0xc1, 0xe1, 0x21, 0xe0, 0x13, 0x30, 0x06, 0x18, 0xfc, 0x0f, 0xf8, 0x07, 0xf8, 0x07, 0xf8, 0x07, };
|
||||||
#define sdl_std_cursor_WIDTH_watch 16
|
#define sdl_std_cursor_WIDTH_watch 16
|
||||||
#define sdl_std_cursor_HEIGHT_watch 16
|
#define sdl_std_cursor_HEIGHT_watch 16
|
||||||
#define sdl_std_cursor_HOT_X_watch -15
|
#define sdl_std_cursor_HOT_X_watch -15
|
||||||
#define sdl_std_cursor_HOT_Y_watch -7
|
#define sdl_std_cursor_HOT_Y_watch -7
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_umbrella[]= {0xe8,0x76,0xfb,0xdf,0xfd,0x3f,0xfe,0xff,0xff,0x3f,0xff,0xff,0xcf,0x79,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x07,0xc0,0x07,0xc0,0x07,0xc0,0x07,0x80,0x03,};
|
static unsigned char sdl_std_cursor_mask_umbrella[] = {0xe8, 0x76, 0xfb, 0xdf, 0xfd, 0x3f, 0xfe, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xcf, 0x79, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0x80, 0x03, };
|
||||||
static unsigned char sdl_std_cursor_umbrella[]= {0x88,0x04,0x20,0x0a,0xc9,0x32,0xf2,0x09,0x4c,0x06,0x43,0x18,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x01,0x40,0x01,0x80,0x00,0x00,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_umbrella[] = {0x88, 0x04, 0x20, 0x0a, 0xc9, 0x32, 0xf2, 0x09, 0x4c, 0x06, 0x43, 0x18, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x01, 0x40, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_umbrella 16
|
#define sdl_std_cursor_WIDTH_umbrella 16
|
||||||
#define sdl_std_cursor_HEIGHT_umbrella 16
|
#define sdl_std_cursor_HEIGHT_umbrella 16
|
||||||
#define sdl_std_cursor_HOT_X_umbrella -7
|
#define sdl_std_cursor_HOT_X_umbrella -7
|
||||||
#define sdl_std_cursor_HOT_Y_umbrella -12
|
#define sdl_std_cursor_HOT_Y_umbrella -12
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_top_side[]= {0xff,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f,0xc0,0x01,0xe0,0x03,0xf0,0x07,0xf8,0x0f,0xdc,0x1d,0xcc,0x19,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,};
|
static unsigned char sdl_std_cursor_mask_top_side[] = {0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xdc, 0x1d, 0xcc, 0x19, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, };
|
||||||
static unsigned char sdl_std_cursor_top_side[]= {0xff,0x1f,0xff,0x1f,0x00,0x00,0x40,0x00,0xe0,0x00,0x50,0x01,0x48,0x02,0x44,0x04,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_top_side[] = {0xff, 0x1f, 0xff, 0x1f, 0x00, 0x00, 0x40, 0x00, 0xe0, 0x00, 0x50, 0x01, 0x48, 0x02, 0x44, 0x04, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_top_side 15
|
#define sdl_std_cursor_WIDTH_top_side 15
|
||||||
#define sdl_std_cursor_HEIGHT_top_side 16
|
#define sdl_std_cursor_HEIGHT_top_side 16
|
||||||
#define sdl_std_cursor_HOT_X_top_side -6
|
#define sdl_std_cursor_HOT_X_top_side -6
|
||||||
#define sdl_std_cursor_HOT_Y_top_side -14
|
#define sdl_std_cursor_HOT_Y_top_side -14
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_top_right_corner[]= {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf0,0xfc,0xf7,0xfc,0xf7,0xfc,0xf7,0xc0,0xf7,0xe0,0xf7,0x70,0xf7,0x38,0xf7,0x1c,0xf7,0x0c,0xf7,0x00,0xf0,0x00,0xf0,};
|
static unsigned char sdl_std_cursor_mask_top_right_corner[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf0, 0xfc, 0xf7, 0xfc, 0xf7, 0xfc, 0xf7, 0xc0, 0xf7, 0xe0, 0xf7, 0x70, 0xf7, 0x38, 0xf7, 0x1c, 0xf7, 0x0c, 0xf7, 0x00, 0xf0, 0x00, 0xf0, };
|
||||||
static unsigned char sdl_std_cursor_top_right_corner[]= {0xff,0x3f,0xff,0x3f,0x00,0x30,0x00,0x30,0x00,0x30,0xfc,0x31,0x80,0x31,0x40,0x31,0x20,0x31,0x10,0x31,0x08,0x31,0x04,0x31,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_top_right_corner[] = {0xff, 0x3f, 0xff, 0x3f, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0xfc, 0x31, 0x80, 0x31, 0x40, 0x31, 0x20, 0x31, 0x10, 0x31, 0x08, 0x31, 0x04, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_top_right_corner 16
|
#define sdl_std_cursor_WIDTH_top_right_corner 16
|
||||||
#define sdl_std_cursor_HEIGHT_top_right_corner 16
|
#define sdl_std_cursor_HEIGHT_top_right_corner 16
|
||||||
#define sdl_std_cursor_HOT_X_top_right_corner -13
|
#define sdl_std_cursor_HOT_X_top_right_corner -13
|
||||||
#define sdl_std_cursor_HOT_Y_top_right_corner -14
|
#define sdl_std_cursor_HOT_Y_top_right_corner -14
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_top_left_corner[]= {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0xef,0x3f,0xef,0x3f,0xef,0x3f,0xef,0x03,0xef,0x07,0xef,0x0e,0xef,0x1c,0xef,0x38,0xef,0x30,0x0f,0x00,0x0f,0x00,};
|
static unsigned char sdl_std_cursor_mask_top_left_corner[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0xef, 0x3f, 0xef, 0x3f, 0xef, 0x3f, 0xef, 0x03, 0xef, 0x07, 0xef, 0x0e, 0xef, 0x1c, 0xef, 0x38, 0xef, 0x30, 0x0f, 0x00, 0x0f, 0x00, };
|
||||||
static unsigned char sdl_std_cursor_top_left_corner[]= {0xff,0x3f,0xff,0x3f,0x03,0x00,0x03,0x00,0x03,0x00,0xe3,0x0f,0x63,0x00,0xa3,0x00,0x23,0x01,0x23,0x02,0x23,0x04,0x23,0x08,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_top_left_corner[] = {0xff, 0x3f, 0xff, 0x3f, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0xe3, 0x0f, 0x63, 0x00, 0xa3, 0x00, 0x23, 0x01, 0x23, 0x02, 0x23, 0x04, 0x23, 0x08, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_top_left_corner 16
|
#define sdl_std_cursor_WIDTH_top_left_corner 16
|
||||||
#define sdl_std_cursor_HEIGHT_top_left_corner 16
|
#define sdl_std_cursor_HEIGHT_top_left_corner 16
|
||||||
#define sdl_std_cursor_HOT_X_top_left_corner 0
|
#define sdl_std_cursor_HOT_X_top_left_corner 0
|
||||||
#define sdl_std_cursor_HOT_Y_top_left_corner -14
|
#define sdl_std_cursor_HOT_Y_top_left_corner -14
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_spraycan[]= {0x00,0x0c,0x18,0x0d,0x7c,0x0d,0x7c,0x0d,0x7e,0x0d,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,};
|
static unsigned char sdl_std_cursor_mask_spraycan[] = {0x00, 0x0c, 0x18, 0x0d, 0x7c, 0x0d, 0x7c, 0x0d, 0x7e, 0x0d, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, };
|
||||||
static unsigned char sdl_std_cursor_spraycan[]= {0x00,0x06,0x80,0x00,0x2c,0x06,0x9e,0x00,0x16,0x06,0x3f,0x00,0x21,0x00,0x27,0x00,0x25,0x00,0x27,0x00,0x25,0x00,0x27,0x00,0x27,0x00,0x21,0x00,0x21,0x00,0x3f,0x00,};
|
static unsigned char sdl_std_cursor_spraycan[] = {0x00, 0x06, 0x80, 0x00, 0x2c, 0x06, 0x9e, 0x00, 0x16, 0x06, 0x3f, 0x00, 0x21, 0x00, 0x27, 0x00, 0x25, 0x00, 0x27, 0x00, 0x25, 0x00, 0x27, 0x00, 0x27, 0x00, 0x21, 0x00, 0x21, 0x00, 0x3f, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_spraycan 12
|
#define sdl_std_cursor_WIDTH_spraycan 12
|
||||||
#define sdl_std_cursor_HEIGHT_spraycan 16
|
#define sdl_std_cursor_HEIGHT_spraycan 16
|
||||||
#define sdl_std_cursor_HOT_X_spraycan -9
|
#define sdl_std_cursor_HOT_X_spraycan -9
|
||||||
#define sdl_std_cursor_HOT_Y_spraycan -14
|
#define sdl_std_cursor_HOT_Y_spraycan -14
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_sb_v_double_arrow[]= {0x38,0x00,0x7c,0x00,0xfe,0x00,0xff,0x01,0xff,0x01,0x7c,0x00,0x7c,0x00,0x7c,0x00,0x7c,0x00,0x7c,0x00,0xff,0x01,0xff,0x01,0xfe,0x00,0x7c,0x00,0x38,0x00,};
|
static unsigned char sdl_std_cursor_mask_sb_v_double_arrow[] = {0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00, 0xff, 0x01, 0xff, 0x01, 0x7c, 0x00, 0x7c, 0x00, 0x7c, 0x00, 0x7c, 0x00, 0x7c, 0x00, 0xff, 0x01, 0xff, 0x01, 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, };
|
||||||
static unsigned char sdl_std_cursor_sb_v_double_arrow[]= {0x10,0x00,0x38,0x00,0x7c,0x00,0xfe,0x00,0x28,0x00,0x28,0x00,0x28,0x00,0x28,0x00,0x28,0x00,0x28,0x00,0x28,0x00,0xfe,0x00,0x7c,0x00,0x38,0x00,0x10,0x00,};
|
static unsigned char sdl_std_cursor_sb_v_double_arrow[] = {0x10, 0x00, 0x38, 0x00, 0x7c, 0x00, 0xfe, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0xfe, 0x00, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_sb_v_double_arrow 9
|
#define sdl_std_cursor_WIDTH_sb_v_double_arrow 9
|
||||||
#define sdl_std_cursor_HEIGHT_sb_v_double_arrow 15
|
#define sdl_std_cursor_HEIGHT_sb_v_double_arrow 15
|
||||||
#define sdl_std_cursor_HOT_X_sb_v_double_arrow -3
|
#define sdl_std_cursor_HOT_X_sb_v_double_arrow -3
|
||||||
#define sdl_std_cursor_HOT_Y_sb_v_double_arrow -8
|
#define sdl_std_cursor_HOT_Y_sb_v_double_arrow -8
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_sb_h_double_arrow[]= {0x18,0x0c,0x1c,0x1c,0xfe,0x3f,0xff,0x7f,0xff,0x7f,0xff,0x7f,0xfe,0x3f,0x1c,0x1c,0x18,0x0c,};
|
static unsigned char sdl_std_cursor_mask_sb_h_double_arrow[] = {0x18, 0x0c, 0x1c, 0x1c, 0xfe, 0x3f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xfe, 0x3f, 0x1c, 0x1c, 0x18, 0x0c, };
|
||||||
static unsigned char sdl_std_cursor_sb_h_double_arrow[]= {0x00,0x00,0x08,0x08,0x0c,0x18,0xfe,0x3f,0x0f,0x78,0xfe,0x3f,0x0c,0x18,0x08,0x08,0x00,0x00};
|
static unsigned char sdl_std_cursor_sb_h_double_arrow[] = {0x00, 0x00, 0x08, 0x08, 0x0c, 0x18, 0xfe, 0x3f, 0x0f, 0x78, 0xfe, 0x3f, 0x0c, 0x18, 0x08, 0x08, 0x00, 0x00};
|
||||||
#define sdl_std_cursor_WIDTH_sb_h_double_arrow 15
|
#define sdl_std_cursor_WIDTH_sb_h_double_arrow 15
|
||||||
#define sdl_std_cursor_HEIGHT_sb_h_double_arrow 9
|
#define sdl_std_cursor_HEIGHT_sb_h_double_arrow 9
|
||||||
#define sdl_std_cursor_HOT_X_sb_h_double_arrow -7
|
#define sdl_std_cursor_HOT_X_sb_h_double_arrow -7
|
||||||
#define sdl_std_cursor_HOT_Y_sb_h_double_arrow -4
|
#define sdl_std_cursor_HOT_Y_sb_h_double_arrow -4
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_right_side[]= {0x00,0xf0,0x00,0xf0,0xc0,0xf0,0xc0,0xf1,0x80,0xf3,0x00,0xf7,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xf7,0x80,0xf3,0xc0,0xf1,0xc0,0xf0,0x00,0xf0,0x00,0xf0,};
|
static unsigned char sdl_std_cursor_mask_right_side[] = {0x00, 0xf0, 0x00, 0xf0, 0xc0, 0xf0, 0xc0, 0xf1, 0x80, 0xf3, 0x00, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xf7, 0x80, 0xf3, 0xc0, 0xf1, 0xc0, 0xf0, 0x00, 0xf0, 0x00, 0xf0, };
|
||||||
static unsigned char sdl_std_cursor_right_side[]= {0x00,0x30,0x00,0x30,0x40,0x30,0x80,0x30,0x00,0x31,0x00,0x32,0xff,0x37,0x00,0x32,0x00,0x31,0x80,0x30,0x40,0x30,0x00,0x30,0x00,0x30,0x00,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_right_side[] = {0x00, 0x30, 0x00, 0x30, 0x40, 0x30, 0x80, 0x30, 0x00, 0x31, 0x00, 0x32, 0xff, 0x37, 0x00, 0x32, 0x00, 0x31, 0x80, 0x30, 0x40, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_right_side 16
|
#define sdl_std_cursor_WIDTH_right_side 16
|
||||||
#define sdl_std_cursor_HEIGHT_right_side 15
|
#define sdl_std_cursor_HEIGHT_right_side 15
|
||||||
#define sdl_std_cursor_HOT_X_right_side -13
|
#define sdl_std_cursor_HOT_X_right_side -13
|
||||||
#define sdl_std_cursor_HOT_Y_right_side -7
|
#define sdl_std_cursor_HOT_Y_right_side -7
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_right_ptr[]= {0x00,0x03,0x80,0x03,0xc0,0x03,0xe0,0x03,0xf0,0x03,0xf8,0x03,0xfc,0x03,0xfe,0x03,0xff,0x03,0xff,0x03,0xf8,0x03,0xbc,0x03,0x3c,0x03,0x1e,0x00,0x1e,0x00,0x0c,0x00,};
|
static unsigned char sdl_std_cursor_mask_right_ptr[] = {0x00, 0x03, 0x80, 0x03, 0xc0, 0x03, 0xe0, 0x03, 0xf0, 0x03, 0xf8, 0x03, 0xfc, 0x03, 0xfe, 0x03, 0xff, 0x03, 0xff, 0x03, 0xf8, 0x03, 0xbc, 0x03, 0x3c, 0x03, 0x1e, 0x00, 0x1e, 0x00, 0x0c, 0x00, };
|
||||||
static unsigned char sdl_std_cursor_right_ptr[]= {0x00,0x80,0x00,0xc0,0x00,0xe0,0x00,0xf0,0x00,0xf8,0x00,0xfc,0x00,0xfe,0x00,0xff,0x00,0xf8,0x00,0xd8,0x00,0x8c,0x00,0x0c,0x00,0x06,0x00,0x06,0x00,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_right_ptr[] = {0x00, 0x80, 0x00, 0xc0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 0xf8, 0x00, 0xfc, 0x00, 0xfe, 0x00, 0xff, 0x00, 0xf8, 0x00, 0xd8, 0x00, 0x8c, 0x00, 0x0c, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_right_ptr 10
|
#define sdl_std_cursor_WIDTH_right_ptr 10
|
||||||
#define sdl_std_cursor_HEIGHT_right_ptr 16
|
#define sdl_std_cursor_HEIGHT_right_ptr 16
|
||||||
#define sdl_std_cursor_HOT_X_right_ptr -7
|
#define sdl_std_cursor_HOT_X_right_ptr -7
|
||||||
#define sdl_std_cursor_HOT_Y_right_ptr -14
|
#define sdl_std_cursor_HOT_Y_right_ptr -14
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_question_arrow[]= {0xf8,0x00,0xfc,0x01,0xfe,0x03,0xff,0x07,0x8f,0x07,0x9f,0x07,0xde,0x07,0xfc,0x03,0xf8,0x01,0xf8,0x00,0xf8,0x00,0xfc,0x01,0xfe,0x03,0xfc,0x01,0xf8,0x00,0x70,0x00,};
|
static unsigned char sdl_std_cursor_mask_question_arrow[] = {0xf8, 0x00, 0xfc, 0x01, 0xfe, 0x03, 0xff, 0x07, 0x8f, 0x07, 0x9f, 0x07, 0xde, 0x07, 0xfc, 0x03, 0xf8, 0x01, 0xf8, 0x00, 0xf8, 0x00, 0xfc, 0x01, 0xfe, 0x03, 0xfc, 0x01, 0xf8, 0x00, 0x70, 0x00, };
|
||||||
static unsigned char sdl_std_cursor_question_arrow[]= {0x7c,0x00,0xfe,0x00,0xc7,0x01,0x83,0x01,0x87,0x01,0xc6,0x01,0xe0,0x00,0x78,0x00,0x38,0x00,0x28,0x00,0x28,0x00,0xee,0x00,0x6c,0x00,0x38,0x00,0x10,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_question_arrow[] = {0x7c, 0x00, 0xfe, 0x00, 0xc7, 0x01, 0x83, 0x01, 0x87, 0x01, 0xc6, 0x01, 0xe0, 0x00, 0x78, 0x00, 0x38, 0x00, 0x28, 0x00, 0x28, 0x00, 0xee, 0x00, 0x6c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_question_arrow 11
|
#define sdl_std_cursor_WIDTH_question_arrow 11
|
||||||
#define sdl_std_cursor_HEIGHT_question_arrow 16
|
#define sdl_std_cursor_HEIGHT_question_arrow 16
|
||||||
#define sdl_std_cursor_HOT_X_question_arrow -4
|
#define sdl_std_cursor_HOT_X_question_arrow -4
|
||||||
#define sdl_std_cursor_HOT_Y_question_arrow -8
|
#define sdl_std_cursor_HOT_Y_question_arrow -8
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_pirate[]= {0xf0,0x03,0xf8,0x07,0xfc,0x0f,0xfe,0x1f,0xfe,0x1f,0xfc,0x0f,0xf8,0x07,0xf1,0x83,0xf1,0xe3,0xf3,0xf3,0xef,0x39,0x1e,0x1e,0xe0,0x01,0xfe,0xc7,0xff,0xff,0x0f,0x7c,};
|
static unsigned char sdl_std_cursor_mask_pirate[] = {0xf0, 0x03, 0xf8, 0x07, 0xfc, 0x0f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfc, 0x0f, 0xf8, 0x07, 0xf1, 0x83, 0xf1, 0xe3, 0xf3, 0xf3, 0xef, 0x39, 0x1e, 0x1e, 0xe0, 0x01, 0xfe, 0xc7, 0xff, 0xff, 0x0f, 0x7c, };
|
||||||
static unsigned char sdl_std_cursor_pirate[]= {0xe0,0x01,0xf0,0x03,0xf8,0x07,0xcc,0x0c,0xcc,0x0c,0xf8,0x07,0xf0,0x03,0xe0,0x01,0xe1,0x21,0xe1,0x61,0xc2,0x10,0x1c,0x0e,0xe0,0x01,0xf8,0x47,0x0f,0x7c,0x01,0x20,};
|
static unsigned char sdl_std_cursor_pirate[] = {0xe0, 0x01, 0xf0, 0x03, 0xf8, 0x07, 0xcc, 0x0c, 0xcc, 0x0c, 0xf8, 0x07, 0xf0, 0x03, 0xe0, 0x01, 0xe1, 0x21, 0xe1, 0x61, 0xc2, 0x10, 0x1c, 0x0e, 0xe0, 0x01, 0xf8, 0x47, 0x0f, 0x7c, 0x01, 0x20, };
|
||||||
#define sdl_std_cursor_WIDTH_pirate 16
|
#define sdl_std_cursor_WIDTH_pirate 16
|
||||||
#define sdl_std_cursor_HEIGHT_pirate 16
|
#define sdl_std_cursor_HEIGHT_pirate 16
|
||||||
#define sdl_std_cursor_HOT_X_pirate -7
|
#define sdl_std_cursor_HOT_X_pirate -7
|
||||||
#define sdl_std_cursor_HOT_Y_pirate -4
|
#define sdl_std_cursor_HOT_Y_pirate -4
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_left_side[]= {0x0f,0x00,0x0f,0x00,0x0f,0x03,0x8f,0x03,0xcf,0x01,0xef,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xef,0x00,0xcf,0x01,0x8f,0x03,0x0f,0x03,0x0f,0x00,0x0f,0x00,};
|
static unsigned char sdl_std_cursor_mask_left_side[] = {0x0f, 0x00, 0x0f, 0x00, 0x0f, 0x03, 0x8f, 0x03, 0xcf, 0x01, 0xef, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x00, 0xcf, 0x01, 0x8f, 0x03, 0x0f, 0x03, 0x0f, 0x00, 0x0f, 0x00, };
|
||||||
static unsigned char sdl_std_cursor_left_side[]= {0x03,0x00,0x03,0x00,0x83,0x00,0x43,0x00,0x23,0x00,0x13,0x00,0xfb,0x3f,0x13,0x00,0x23,0x00,0x43,0x00,0x83,0x00,0x03,0x00,0x03,0x00,0x00,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_left_side[] = {0x03, 0x00, 0x03, 0x00, 0x83, 0x00, 0x43, 0x00, 0x23, 0x00, 0x13, 0x00, 0xfb, 0x3f, 0x13, 0x00, 0x23, 0x00, 0x43, 0x00, 0x83, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_left_side 16
|
#define sdl_std_cursor_WIDTH_left_side 16
|
||||||
#define sdl_std_cursor_HEIGHT_left_side 15
|
#define sdl_std_cursor_HEIGHT_left_side 15
|
||||||
#define sdl_std_cursor_HOT_X_left_side 0
|
#define sdl_std_cursor_HOT_X_left_side 0
|
||||||
#define sdl_std_cursor_HOT_Y_left_side -7
|
#define sdl_std_cursor_HOT_Y_left_side -7
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_left_ptr[]= {0x03,0x00,0x07,0x00,0x0f,0x00,0x1f,0x00,0x3f,0x00,0x7f,0x00,0xff,0x00,0xff,0x01,0xff,0x03,0xff,0x03,0x7f,0x00,0xf7,0x00,0xf3,0x00,0xe0,0x01,0xe0,0x01,0xc0,0x00,};
|
static unsigned char sdl_std_cursor_mask_left_ptr[] = {0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00, 0x3f, 0x00, 0x7f, 0x00, 0xff, 0x00, 0xff, 0x01, 0xff, 0x03, 0xff, 0x03, 0x7f, 0x00, 0xf7, 0x00, 0xf3, 0x00, 0xe0, 0x01, 0xe0, 0x01, 0xc0, 0x00, };
|
||||||
static unsigned char sdl_std_cursor_left_ptr[]= {0x00,0x00,0x02,0x00,0x06,0x00,0x0e,0x00,0x1e,0x00,0x3e,0x00,0x7e,0x00,0xfe,0x00,0xfe,0x00,0x3e,0x00,0x36,0x00,0x62,0x00,0x60,0x00,0xc0,0x00,0xc0,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_left_ptr[] = {0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x1e, 0x00, 0x3e, 0x00, 0x7e, 0x00, 0xfe, 0x00, 0xfe, 0x00, 0x3e, 0x00, 0x36, 0x00, 0x62, 0x00, 0x60, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_left_ptr 10
|
#define sdl_std_cursor_WIDTH_left_ptr 10
|
||||||
#define sdl_std_cursor_HEIGHT_left_ptr 16
|
#define sdl_std_cursor_HEIGHT_left_ptr 16
|
||||||
#define sdl_std_cursor_HOT_X_left_ptr -8
|
#define sdl_std_cursor_HOT_X_left_ptr -8
|
||||||
#define sdl_std_cursor_HOT_Y_left_ptr -14
|
#define sdl_std_cursor_HOT_Y_left_ptr -14
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_exchange[]= {0xe3,0x07,0xf7,0x0f,0xff,0x1f,0xff,0x3f,0x3f,0x38,0xff,0x30,0xff,0x00,0xff,0x00,0x00,0xff,0x00,0xff,0x0c,0xfe,0x1c,0xfc,0xfc,0xff,0xf8,0xff,0xf0,0xef,0xe0,0xc7,};
|
static unsigned char sdl_std_cursor_mask_exchange[] = {0xe3, 0x07, 0xf7, 0x0f, 0xff, 0x1f, 0xff, 0x3f, 0x3f, 0x38, 0xff, 0x30, 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, 0x0c, 0xfe, 0x1c, 0xfc, 0xfc, 0xff, 0xf8, 0xff, 0xf0, 0xef, 0xe0, 0xc7, };
|
||||||
static unsigned char sdl_std_cursor_exchange[]= {0xf1,0x03,0xfb,0x07,0x1f,0x0c,0x09,0x08,0x19,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x00,0x26,0x04,0x24,0x0c,0x3e,0xf8,0x37,0xf0,0x23,0x00,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_exchange[] = {0xf1, 0x03, 0xfb, 0x07, 0x1f, 0x0c, 0x09, 0x08, 0x19, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x26, 0x04, 0x24, 0x0c, 0x3e, 0xf8, 0x37, 0xf0, 0x23, 0x00, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_exchange 16
|
#define sdl_std_cursor_WIDTH_exchange 16
|
||||||
#define sdl_std_cursor_HEIGHT_exchange 16
|
#define sdl_std_cursor_HEIGHT_exchange 16
|
||||||
#define sdl_std_cursor_HOT_X_exchange -6
|
#define sdl_std_cursor_HOT_X_exchange -6
|
||||||
#define sdl_std_cursor_HOT_Y_exchange -8
|
#define sdl_std_cursor_HOT_Y_exchange -8
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_crosshair[]= {0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,};
|
static unsigned char sdl_std_cursor_mask_crosshair[] = {0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, };
|
||||||
static unsigned char sdl_std_cursor_crosshair[]= {0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x7f,0xff,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_crosshair[] = {0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x7f, 0xff, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_crosshair 16
|
#define sdl_std_cursor_WIDTH_crosshair 16
|
||||||
#define sdl_std_cursor_HEIGHT_crosshair 16
|
#define sdl_std_cursor_HEIGHT_crosshair 16
|
||||||
#define sdl_std_cursor_HOT_X_crosshair -7
|
#define sdl_std_cursor_HOT_X_crosshair -7
|
||||||
#define sdl_std_cursor_HOT_Y_crosshair -8
|
#define sdl_std_cursor_HOT_Y_crosshair -8
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_bottom_side[]= {0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xc0,0x01,0xcc,0x19,0xdc,0x1d,0xf8,0x0f,0xf0,0x07,0xe0,0x03,0xc0,0x01,0xff,0x7f,0xff,0x7f,0xff,0x7f,0xff,0x7f,};
|
static unsigned char sdl_std_cursor_mask_bottom_side[] = {0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xcc, 0x19, 0xdc, 0x1d, 0xf8, 0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, };
|
||||||
static unsigned char sdl_std_cursor_bottom_side[]= {0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x44,0x04,0x48,0x02,0x50,0x01,0xe0,0x00,0x40,0x00,0x00,0x00,0xff,0x1f,0xff,0x1f,0x00,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_bottom_side[] = {0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x44, 0x04, 0x48, 0x02, 0x50, 0x01, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0xff, 0x1f, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_bottom_side 15
|
#define sdl_std_cursor_WIDTH_bottom_side 15
|
||||||
#define sdl_std_cursor_HEIGHT_bottom_side 16
|
#define sdl_std_cursor_HEIGHT_bottom_side 16
|
||||||
#define sdl_std_cursor_HOT_X_bottom_side -6
|
#define sdl_std_cursor_HOT_X_bottom_side -6
|
||||||
#define sdl_std_cursor_HOT_Y_bottom_side -1
|
#define sdl_std_cursor_HOT_Y_bottom_side -1
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_bottom_right_corner[]= {0x00,0xf0,0x00,0xf0,0x0c,0xf7,0x1c,0xf7,0x38,0xf7,0x70,0xf7,0xe0,0xf7,0xc0,0xf7,0xfc,0xf7,0xfc,0xf7,0xfc,0xf7,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,};
|
static unsigned char sdl_std_cursor_mask_bottom_right_corner[] = {0x00, 0xf0, 0x00, 0xf0, 0x0c, 0xf7, 0x1c, 0xf7, 0x38, 0xf7, 0x70, 0xf7, 0xe0, 0xf7, 0xc0, 0xf7, 0xfc, 0xf7, 0xfc, 0xf7, 0xfc, 0xf7, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, };
|
||||||
static unsigned char sdl_std_cursor_bottom_right_corner[]= {0x00,0x30,0x00,0x30,0x04,0x31,0x08,0x31,0x10,0x31,0x20,0x31,0x40,0x31,0x80,0x31,0xfc,0x31,0x00,0x30,0x00,0x30,0x00,0x30,0xff,0x3f,0xff,0x3f,0x00,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_bottom_right_corner[] = {0x00, 0x30, 0x00, 0x30, 0x04, 0x31, 0x08, 0x31, 0x10, 0x31, 0x20, 0x31, 0x40, 0x31, 0x80, 0x31, 0xfc, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0xff, 0x3f, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_bottom_right_corner 16
|
#define sdl_std_cursor_WIDTH_bottom_right_corner 16
|
||||||
#define sdl_std_cursor_HEIGHT_bottom_right_corner 16
|
#define sdl_std_cursor_HEIGHT_bottom_right_corner 16
|
||||||
#define sdl_std_cursor_HOT_X_bottom_right_corner -13
|
#define sdl_std_cursor_HOT_X_bottom_right_corner -13
|
||||||
#define sdl_std_cursor_HOT_Y_bottom_right_corner -1
|
#define sdl_std_cursor_HOT_Y_bottom_right_corner -1
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_bottom_left_corner[]= {0x0f,0x00,0x0f,0x00,0xef,0x30,0xef,0x38,0xef,0x1c,0xef,0x0e,0xef,0x07,0xef,0x03,0xef,0x3f,0xef,0x3f,0xef,0x3f,0x0f,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,};
|
static unsigned char sdl_std_cursor_mask_bottom_left_corner[] = {0x0f, 0x00, 0x0f, 0x00, 0xef, 0x30, 0xef, 0x38, 0xef, 0x1c, 0xef, 0x0e, 0xef, 0x07, 0xef, 0x03, 0xef, 0x3f, 0xef, 0x3f, 0xef, 0x3f, 0x0f, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, };
|
||||||
static unsigned char sdl_std_cursor_bottom_left_corner[]= {0x03,0x00,0x03,0x00,0x23,0x08,0x23,0x04,0x23,0x02,0x23,0x01,0xa3,0x00,0x63,0x00,0xe3,0x0f,0x03,0x00,0x03,0x00,0x03,0x00,0xff,0x3f,0xff,0x3f,0x00,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_bottom_left_corner[] = {0x03, 0x00, 0x03, 0x00, 0x23, 0x08, 0x23, 0x04, 0x23, 0x02, 0x23, 0x01, 0xa3, 0x00, 0x63, 0x00, 0xe3, 0x0f, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0xff, 0x3f, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_bottom_left_corner 16
|
#define sdl_std_cursor_WIDTH_bottom_left_corner 16
|
||||||
#define sdl_std_cursor_HEIGHT_bottom_left_corner 16
|
#define sdl_std_cursor_HEIGHT_bottom_left_corner 16
|
||||||
#define sdl_std_cursor_HOT_X_bottom_left_corner 0
|
#define sdl_std_cursor_HOT_X_bottom_left_corner 0
|
||||||
#define sdl_std_cursor_HOT_Y_bottom_left_corner -1
|
#define sdl_std_cursor_HOT_Y_bottom_left_corner -1
|
||||||
|
|
||||||
static unsigned char sdl_std_cursor_mask_arrow[]= {0x00,0xe0,0x00,0xf8,0x00,0xfe,0x80,0x7f,0xe0,0x7f,0xf8,0x3f,0xfc,0x3f,0xfc,0x1f,0xe0,0x1f,0xf0,0x0f,0xf8,0x0f,0x7c,0x07,0x3e,0x07,0x1f,0x02,0x0e,0x00,0x04,0x00,};
|
static unsigned char sdl_std_cursor_mask_arrow[] = {0x00, 0xe0, 0x00, 0xf8, 0x00, 0xfe, 0x80, 0x7f, 0xe0, 0x7f, 0xf8, 0x3f, 0xfc, 0x3f, 0xfc, 0x1f, 0xe0, 0x1f, 0xf0, 0x0f, 0xf8, 0x0f, 0x7c, 0x07, 0x3e, 0x07, 0x1f, 0x02, 0x0e, 0x00, 0x04, 0x00, };
|
||||||
static unsigned char sdl_std_cursor_arrow[]= {0x00,0x30,0x00,0x3c,0x00,0x1f,0xc0,0x1f,0xf0,0x0f,0xfc,0x0f,0xc0,0x07,0xe0,0x07,0x70,0x03,0x38,0x03,0x1c,0x01,0x0e,0x01,0x07,0x00,0x02,0x00,0x00,0x00,0x00,0x00,};
|
static unsigned char sdl_std_cursor_arrow[] = {0x00, 0x30, 0x00, 0x3c, 0x00, 0x1f, 0xc0, 0x1f, 0xf0, 0x0f, 0xfc, 0x0f, 0xc0, 0x07, 0xe0, 0x07, 0x70, 0x03, 0x38, 0x03, 0x1c, 0x01, 0x0e, 0x01, 0x07, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, };
|
||||||
#define sdl_std_cursor_WIDTH_arrow 16
|
#define sdl_std_cursor_WIDTH_arrow 16
|
||||||
#define sdl_std_cursor_HEIGHT_arrow 16
|
#define sdl_std_cursor_HEIGHT_arrow 16
|
||||||
#define sdl_std_cursor_HOT_X_arrow -13
|
#define sdl_std_cursor_HOT_X_arrow -13
|
||||||
@@ -455,7 +455,7 @@ static unsigned char sdl_std_cursor_arrow[]= {0x00,0x30,0x00,0x3c,0x00,0x1f,0xc0
|
|||||||
/* end cursor data */
|
/* end cursor data */
|
||||||
|
|
||||||
|
|
||||||
static SDL_Cursor *sdl_std_cursor_array[(int)GHOST_kStandardCursorNumCursors]= {0};
|
static SDL_Cursor *sdl_std_cursor_array[(int)GHOST_kStandardCursorNumCursors] = {0};
|
||||||
|
|
||||||
/* utility function mostly a copy of SDL_CreateCursor but allows us to change
|
/* utility function mostly a copy of SDL_CreateCursor but allows us to change
|
||||||
* color and supports blenders flipped bits */
|
* color and supports blenders flipped bits */
|
||||||
@@ -471,16 +471,16 @@ sdl_ghost_CreateCursor(const Uint8 *data,
|
|||||||
SDL_Cursor *cursor;
|
SDL_Cursor *cursor;
|
||||||
int x, y;
|
int x, y;
|
||||||
Uint32 *pixel;
|
Uint32 *pixel;
|
||||||
Uint8 datab= 0, maskb= 0;
|
Uint8 datab = 0, maskb = 0;
|
||||||
const Uint32 black= 0xFF000000;
|
const Uint32 black = 0xFF000000;
|
||||||
const Uint32 white= 0xFFFFFFFF;
|
const Uint32 white = 0xFFFFFFFF;
|
||||||
const Uint32 transparent= 0x00000000;
|
const Uint32 transparent = 0x00000000;
|
||||||
|
|
||||||
/* Make sure the width is a multiple of 8 */
|
/* Make sure the width is a multiple of 8 */
|
||||||
w= ((w + 7) & ~7);
|
w = ((w + 7) & ~7);
|
||||||
|
|
||||||
/* Create the surface from a bitmap */
|
/* Create the surface from a bitmap */
|
||||||
surface= SDL_CreateRGBSurface(0, w, h, 32,
|
surface = SDL_CreateRGBSurface(0, w, h, 32,
|
||||||
0x00FF0000,
|
0x00FF0000,
|
||||||
0x0000FF00,
|
0x0000FF00,
|
||||||
0x000000FF,
|
0x000000FF,
|
||||||
@@ -488,29 +488,29 @@ sdl_ghost_CreateCursor(const Uint8 *data,
|
|||||||
if (!surface) {
|
if (!surface) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
for (y= 0; y < h; ++y) {
|
for (y = 0; y < h; ++y) {
|
||||||
pixel= (Uint32 *) ((Uint8 *) surface->pixels + y * surface->pitch);
|
pixel = (Uint32 *) ((Uint8 *) surface->pixels + y * surface->pitch);
|
||||||
for (x= 0; x < w; ++x) {
|
for (x = 0; x < w; ++x) {
|
||||||
if ((x % 8) == 0) {
|
if ((x % 8) == 0) {
|
||||||
datab= *data++;
|
datab = *data++;
|
||||||
maskb= *mask++;
|
maskb = *mask++;
|
||||||
|
|
||||||
/* reverse bit order */
|
/* reverse bit order */
|
||||||
datab= (datab * 0x0202020202ULL & 0x010884422010ULL) % 1023;
|
datab = (datab * 0x0202020202ULL & 0x010884422010ULL) % 1023;
|
||||||
maskb= (maskb * 0x0202020202ULL & 0x010884422010ULL) % 1023;
|
maskb = (maskb * 0x0202020202ULL & 0x010884422010ULL) % 1023;
|
||||||
}
|
}
|
||||||
if (maskb & 0x80) {
|
if (maskb & 0x80) {
|
||||||
*pixel++= (datab & 0x80) ? white : black;
|
*pixel++ = (datab & 0x80) ? white : black;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*pixel++= (datab & 0x80) ? white : transparent;
|
*pixel++ = (datab & 0x80) ? white : transparent;
|
||||||
}
|
}
|
||||||
datab <<= 1;
|
datab <<= 1;
|
||||||
maskb <<= 1;
|
maskb <<= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor= SDL_CreateColorCursor(surface, hot_x, hot_y);
|
cursor = SDL_CreateColorCursor(surface, hot_x, hot_y);
|
||||||
|
|
||||||
SDL_FreeSurface(surface);
|
SDL_FreeSurface(surface);
|
||||||
|
|
||||||
@@ -522,9 +522,9 @@ static void sdl_cursor_init(void)
|
|||||||
{
|
{
|
||||||
|
|
||||||
#define DEF_CURSOR(name, ind) \
|
#define DEF_CURSOR(name, ind) \
|
||||||
assert(\
|
assert( \
|
||||||
(\
|
( \
|
||||||
sdl_std_cursor_array[(int)ind]= \
|
sdl_std_cursor_array[(int)ind] = \
|
||||||
sdl_ghost_CreateCursor(sdl_std_cursor_##name, \
|
sdl_ghost_CreateCursor(sdl_std_cursor_##name, \
|
||||||
sdl_std_cursor_mask_##name, \
|
sdl_std_cursor_mask_##name, \
|
||||||
sdl_std_cursor_WIDTH_##name, \
|
sdl_std_cursor_WIDTH_##name, \
|
||||||
@@ -554,8 +554,8 @@ static void sdl_cursor_init(void)
|
|||||||
DEF_CURSOR(top_left_corner, GHOST_kStandardCursorTopLeftCorner);
|
DEF_CURSOR(top_left_corner, GHOST_kStandardCursorTopLeftCorner);
|
||||||
DEF_CURSOR(top_right_corner, GHOST_kStandardCursorTopRightCorner);
|
DEF_CURSOR(top_right_corner, GHOST_kStandardCursorTopRightCorner);
|
||||||
DEF_CURSOR(bottom_right_corner, GHOST_kStandardCursorBottomRightCorner);
|
DEF_CURSOR(bottom_right_corner, GHOST_kStandardCursorBottomRightCorner);
|
||||||
DEF_CURSOR(bottom_left_corner , GHOST_kStandardCursorBottomLeftCorner);
|
DEF_CURSOR(bottom_left_corner, GHOST_kStandardCursorBottomLeftCorner);
|
||||||
DEF_CURSOR(arrow , GHOST_kStandardCursorCopy);
|
DEF_CURSOR(arrow, GHOST_kStandardCursorCopy);
|
||||||
//DEF_CURSOR(arrow, GHOST_kStandardCursorCustom);
|
//DEF_CURSOR(arrow, GHOST_kStandardCursorCustom);
|
||||||
DEF_CURSOR(arrow, GHOST_kStandardCursorPencil);
|
DEF_CURSOR(arrow, GHOST_kStandardCursorPencil);
|
||||||
|
|
||||||
@@ -575,7 +575,7 @@ GHOST_WindowSDL::setWindowCursorGrab(GHOST_TGrabCursorMode mode)
|
|||||||
GHOST_TSuccess
|
GHOST_TSuccess
|
||||||
GHOST_WindowSDL::setWindowCursorShape(GHOST_TStandardCursor shape)
|
GHOST_WindowSDL::setWindowCursorShape(GHOST_TStandardCursor shape)
|
||||||
{
|
{
|
||||||
if(sdl_std_cursor_array[0] == NULL) {
|
if (sdl_std_cursor_array[0] == NULL) {
|
||||||
sdl_cursor_init();
|
sdl_cursor_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -605,11 +605,11 @@ GHOST_WindowSDL::setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
|
|||||||
int hotX, int hotY,
|
int hotX, int hotY,
|
||||||
int fg_color, int bg_color)
|
int fg_color, int bg_color)
|
||||||
{
|
{
|
||||||
if(m_sdl_custom_cursor) {
|
if (m_sdl_custom_cursor) {
|
||||||
SDL_FreeCursor(m_sdl_custom_cursor);
|
SDL_FreeCursor(m_sdl_custom_cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sdl_custom_cursor= sdl_ghost_CreateCursor((const Uint8 *)bitmap,
|
m_sdl_custom_cursor = sdl_ghost_CreateCursor((const Uint8 *)bitmap,
|
||||||
(const Uint8 *)mask,
|
(const Uint8 *)mask,
|
||||||
sizex, sizex,
|
sizex, sizex,
|
||||||
hotX, hotY);
|
hotX, hotY);
|
||||||
|
|||||||
@@ -44,17 +44,19 @@ class STR_String;
|
|||||||
|
|
||||||
class GHOST_WindowSDL : public GHOST_Window
|
class GHOST_WindowSDL : public GHOST_Window
|
||||||
{
|
{
|
||||||
private :
|
private:
|
||||||
GHOST_SystemSDL * m_system;
|
GHOST_SystemSDL *m_system;
|
||||||
bool m_invalid_window;
|
bool m_invalid_window;
|
||||||
|
|
||||||
SDL_Window * m_sdl_win;
|
SDL_Window *m_sdl_win;
|
||||||
SDL_GLContext m_sdl_glcontext;
|
SDL_GLContext m_sdl_glcontext;
|
||||||
SDL_Cursor * m_sdl_custom_cursor;
|
SDL_Cursor *m_sdl_custom_cursor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
const GHOST_TabletData* GetTabletData() { return NULL; }
|
const GHOST_TabletData *GetTabletData() {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
GHOST_WindowSDL(GHOST_SystemSDL *system,
|
GHOST_WindowSDL(GHOST_SystemSDL *system,
|
||||||
const STR_String& title,
|
const STR_String& title,
|
||||||
@@ -158,7 +160,11 @@ protected:
|
|||||||
GHOST_TWindowState
|
GHOST_TWindowState
|
||||||
getState() const;
|
getState() const;
|
||||||
|
|
||||||
GHOST_TSuccess setOrder(GHOST_TWindowOrder order) { return GHOST_kSuccess; } // TODO
|
GHOST_TSuccess setOrder(GHOST_TWindowOrder order)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return GHOST_kSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wchar_t* GHOST_WindowWin32::s_windowClassName = L"GHOST_WindowClass";
|
wchar_t *GHOST_WindowWin32::s_windowClassName = L"GHOST_WindowClass";
|
||||||
const int GHOST_WindowWin32::s_maxTitleLength = 128;
|
const int GHOST_WindowWin32::s_maxTitleLength = 128;
|
||||||
HGLRC GHOST_WindowWin32::s_firsthGLRc = NULL;
|
HGLRC GHOST_WindowWin32::s_firsthGLRc = NULL;
|
||||||
HDC GHOST_WindowWin32::s_firstHDC = NULL;
|
HDC GHOST_WindowWin32::s_firstHDC = NULL;
|
||||||
@@ -113,7 +113,7 @@ static PIXELFORMATDESCRIPTOR sPreferredFormat = {
|
|||||||
static int is_crappy_intel_card(void)
|
static int is_crappy_intel_card(void)
|
||||||
{
|
{
|
||||||
int crappy = 0;
|
int crappy = 0;
|
||||||
const char *vendor = (const char*)glGetString(GL_VENDOR);
|
const char *vendor = (const char *)glGetString(GL_VENDOR);
|
||||||
|
|
||||||
if (strstr(vendor, "Intel"))
|
if (strstr(vendor, "Intel"))
|
||||||
crappy = 1;
|
crappy = 1;
|
||||||
@@ -122,7 +122,7 @@ static int is_crappy_intel_card(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GHOST_WindowWin32::GHOST_WindowWin32(
|
GHOST_WindowWin32::GHOST_WindowWin32(
|
||||||
GHOST_SystemWin32 * system,
|
GHOST_SystemWin32 *system,
|
||||||
const STR_String& title,
|
const STR_String& title,
|
||||||
GHOST_TInt32 left,
|
GHOST_TInt32 left,
|
||||||
GHOST_TInt32 top,
|
GHOST_TInt32 top,
|
||||||
@@ -135,9 +135,9 @@ GHOST_WindowWin32::GHOST_WindowWin32(
|
|||||||
GHOST_TEmbedderWindowID parentwindowhwnd,
|
GHOST_TEmbedderWindowID parentwindowhwnd,
|
||||||
GHOST_TSuccess msEnabled,
|
GHOST_TSuccess msEnabled,
|
||||||
int msPixelFormat)
|
int msPixelFormat)
|
||||||
:
|
:
|
||||||
GHOST_Window(width, height, state, GHOST_kDrawingContextTypeNone,
|
GHOST_Window(width, height, state, GHOST_kDrawingContextTypeNone,
|
||||||
stereoVisual,numOfAASamples),
|
stereoVisual, numOfAASamples),
|
||||||
m_system(system),
|
m_system(system),
|
||||||
m_hDC(0),
|
m_hDC(0),
|
||||||
m_hGlRc(0),
|
m_hGlRc(0),
|
||||||
@@ -170,15 +170,16 @@ GHOST_WindowWin32::GHOST_WindowWin32(
|
|||||||
|
|
||||||
versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||||
|
|
||||||
if(!GetVersionEx((OSVERSIONINFO *)&versionInfo)) {
|
if (!GetVersionEx((OSVERSIONINFO *)&versionInfo)) {
|
||||||
versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||||
if(GetVersionEx((OSVERSIONINFO*)&versionInfo)) {
|
if (GetVersionEx((OSVERSIONINFO *)&versionInfo)) {
|
||||||
if((versionInfo.dwMajorVersion==6 && versionInfo.dwMinorVersion>=1) || versionInfo.dwMajorVersion >= 7) {
|
if ((versionInfo.dwMajorVersion == 6 && versionInfo.dwMinorVersion >= 1) || versionInfo.dwMajorVersion >= 7) {
|
||||||
hasMinVersionForTaskbar = true;
|
hasMinVersionForTaskbar = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if((versionInfo.dwMajorVersion==6 && versionInfo.dwMinorVersion>=1) || versionInfo.dwMajorVersion >= 7) {
|
else {
|
||||||
|
if ((versionInfo.dwMajorVersion == 6 && versionInfo.dwMinorVersion >= 1) || versionInfo.dwMajorVersion >= 7) {
|
||||||
hasMinVersionForTaskbar = true;
|
hasMinVersionForTaskbar = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,41 +189,41 @@ GHOST_WindowWin32::GHOST_WindowWin32(
|
|||||||
MONITORINFO monitor;
|
MONITORINFO monitor;
|
||||||
GHOST_TUns32 tw, th;
|
GHOST_TUns32 tw, th;
|
||||||
|
|
||||||
width += GetSystemMetrics(SM_CXSIZEFRAME)*2;
|
width += GetSystemMetrics(SM_CXSIZEFRAME) * 2;
|
||||||
height += GetSystemMetrics(SM_CYSIZEFRAME)*2 + GetSystemMetrics(SM_CYCAPTION);
|
height += GetSystemMetrics(SM_CYSIZEFRAME) * 2 + GetSystemMetrics(SM_CYCAPTION);
|
||||||
|
|
||||||
rect.left = left;
|
rect.left = left;
|
||||||
rect.right = left + width;
|
rect.right = left + width;
|
||||||
rect.top = top;
|
rect.top = top;
|
||||||
rect.bottom = top + height;
|
rect.bottom = top + height;
|
||||||
|
|
||||||
monitor.cbSize=sizeof(monitor);
|
monitor.cbSize = sizeof(monitor);
|
||||||
monitor.dwFlags=0;
|
monitor.dwFlags = 0;
|
||||||
|
|
||||||
// take taskbar into account
|
// take taskbar into account
|
||||||
GetMonitorInfo(MonitorFromRect(&rect,MONITOR_DEFAULTTONEAREST),&monitor);
|
GetMonitorInfo(MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST), &monitor);
|
||||||
|
|
||||||
th = monitor.rcWork.bottom - monitor.rcWork.top;
|
th = monitor.rcWork.bottom - monitor.rcWork.top;
|
||||||
tw = monitor.rcWork.right - monitor.rcWork.left;
|
tw = monitor.rcWork.right - monitor.rcWork.left;
|
||||||
|
|
||||||
if(tw < width)
|
if (tw < width)
|
||||||
{
|
{
|
||||||
width = tw;
|
width = tw;
|
||||||
left = monitor.rcWork.left;
|
left = monitor.rcWork.left;
|
||||||
}
|
}
|
||||||
else if(monitor.rcWork.right < left + (int)width)
|
else if (monitor.rcWork.right < left + (int)width)
|
||||||
left = monitor.rcWork.right - width;
|
left = monitor.rcWork.right - width;
|
||||||
else if(left < monitor.rcWork.left)
|
else if (left < monitor.rcWork.left)
|
||||||
left = monitor.rcWork.left;
|
left = monitor.rcWork.left;
|
||||||
|
|
||||||
if(th < height)
|
if (th < height)
|
||||||
{
|
{
|
||||||
height = th;
|
height = th;
|
||||||
top = monitor.rcWork.top;
|
top = monitor.rcWork.top;
|
||||||
}
|
}
|
||||||
else if(monitor.rcWork.bottom < top + (int)height)
|
else if (monitor.rcWork.bottom < top + (int)height)
|
||||||
top = monitor.rcWork.bottom - height;
|
top = monitor.rcWork.bottom - height;
|
||||||
else if(top < monitor.rcWork.top)
|
else if (top < monitor.rcWork.top)
|
||||||
top = monitor.rcWork.top;
|
top = monitor.rcWork.top;
|
||||||
|
|
||||||
int wintype = WS_OVERLAPPEDWINDOW;
|
int wintype = WS_OVERLAPPEDWINDOW;
|
||||||
@@ -236,7 +237,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
|
|||||||
height = rect.bottom - rect.top;
|
height = rect.bottom - rect.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t * title_16 = alloc_utf16_from_8((char*)(const char*)title,0);
|
wchar_t *title_16 = alloc_utf16_from_8((char *)(const char *)title, 0);
|
||||||
m_hWnd = ::CreateWindowW(
|
m_hWnd = ::CreateWindowW(
|
||||||
s_windowClassName, // pointer to registered class name
|
s_windowClassName, // pointer to registered class name
|
||||||
title_16, // pointer to window name
|
title_16, // pointer to window name
|
||||||
@@ -252,7 +253,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
|
|||||||
free(title_16);
|
free(title_16);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wchar_t * title_16 = alloc_utf16_from_8((char*)(const char*)title,0);
|
wchar_t *title_16 = alloc_utf16_from_8((char *)(const char *)title, 0);
|
||||||
m_hWnd = ::CreateWindowW(
|
m_hWnd = ::CreateWindowW(
|
||||||
s_windowClassName, // pointer to registered class name
|
s_windowClassName, // pointer to registered class name
|
||||||
title_16, // pointer to window name
|
title_16, // pointer to window name
|
||||||
@@ -272,12 +273,12 @@ GHOST_WindowWin32::GHOST_WindowWin32(
|
|||||||
// Note that OleInitialize(0) has to be called prior to this. Done in GHOST_SystemWin32.
|
// Note that OleInitialize(0) has to be called prior to this. Done in GHOST_SystemWin32.
|
||||||
m_dropTarget = new GHOST_DropTargetWin32(this, m_system);
|
m_dropTarget = new GHOST_DropTargetWin32(this, m_system);
|
||||||
// Store a pointer to this class in the window structure
|
// Store a pointer to this class in the window structure
|
||||||
::SetWindowLongPtr(m_hWnd, GWL_USERDATA, (LONG_PTR)this);
|
::SetWindowLongPtr(m_hWnd, GWL_USERDATA, (LONG_PTR) this);
|
||||||
|
|
||||||
// Store the device context
|
// Store the device context
|
||||||
m_hDC = ::GetDC(m_hWnd);
|
m_hDC = ::GetDC(m_hWnd);
|
||||||
|
|
||||||
if(!s_firstHDC) {
|
if (!s_firstHDC) {
|
||||||
s_firstHDC = m_hDC;
|
s_firstHDC = m_hDC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,8 +305,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
|
|||||||
// Force an initial paint of the window
|
// Force an initial paint of the window
|
||||||
::UpdateWindow(m_hWnd);
|
::UpdateWindow(m_hWnd);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
//invalidate the window
|
//invalidate the window
|
||||||
m_hWnd = 0;
|
m_hWnd = 0;
|
||||||
}
|
}
|
||||||
@@ -322,8 +322,8 @@ GHOST_WindowWin32::GHOST_WindowWin32(
|
|||||||
|
|
||||||
m_wintab = ::LoadLibrary("Wintab32.dll");
|
m_wintab = ::LoadLibrary("Wintab32.dll");
|
||||||
if (m_wintab) {
|
if (m_wintab) {
|
||||||
GHOST_WIN32_WTInfo fpWTInfo = ( GHOST_WIN32_WTInfo ) ::GetProcAddress( m_wintab, "WTInfoA" );
|
GHOST_WIN32_WTInfo fpWTInfo = (GHOST_WIN32_WTInfo) ::GetProcAddress(m_wintab, "WTInfoA");
|
||||||
GHOST_WIN32_WTOpen fpWTOpen = ( GHOST_WIN32_WTOpen ) ::GetProcAddress( m_wintab, "WTOpenA" );
|
GHOST_WIN32_WTOpen fpWTOpen = (GHOST_WIN32_WTOpen) ::GetProcAddress(m_wintab, "WTOpenA");
|
||||||
|
|
||||||
// let's see if we can initialize tablet here
|
// let's see if we can initialize tablet here
|
||||||
/* check if WinTab available. */
|
/* check if WinTab available. */
|
||||||
@@ -335,7 +335,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
|
|||||||
// Open a Wintab context
|
// Open a Wintab context
|
||||||
|
|
||||||
// Get default context information
|
// Get default context information
|
||||||
fpWTInfo( WTI_DEFCONTEXT, 0, &lc );
|
fpWTInfo(WTI_DEFCONTEXT, 0, &lc);
|
||||||
|
|
||||||
// Open the context
|
// Open the context
|
||||||
lc.lcPktData = PACKETDATA;
|
lc.lcPktData = PACKETDATA;
|
||||||
@@ -343,18 +343,18 @@ GHOST_WindowWin32::GHOST_WindowWin32(
|
|||||||
lc.lcOptions |= CXO_MESSAGES | CXO_SYSTEM;
|
lc.lcOptions |= CXO_MESSAGES | CXO_SYSTEM;
|
||||||
|
|
||||||
/* Set the entire tablet as active */
|
/* Set the entire tablet as active */
|
||||||
fpWTInfo(WTI_DEVICES,DVC_X,&TabletX);
|
fpWTInfo(WTI_DEVICES, DVC_X, &TabletX);
|
||||||
fpWTInfo(WTI_DEVICES,DVC_Y,&TabletY);
|
fpWTInfo(WTI_DEVICES, DVC_Y, &TabletY);
|
||||||
|
|
||||||
/* get the max pressure, to divide into a float */
|
/* get the max pressure, to divide into a float */
|
||||||
BOOL pressureSupport = fpWTInfo (WTI_DEVICES, DVC_NPRESSURE, &Pressure);
|
BOOL pressureSupport = fpWTInfo(WTI_DEVICES, DVC_NPRESSURE, &Pressure);
|
||||||
if (pressureSupport)
|
if (pressureSupport)
|
||||||
m_maxPressure = Pressure.axMax;
|
m_maxPressure = Pressure.axMax;
|
||||||
else
|
else
|
||||||
m_maxPressure = 0;
|
m_maxPressure = 0;
|
||||||
|
|
||||||
/* get the max tilt axes, to divide into floats */
|
/* get the max tilt axes, to divide into floats */
|
||||||
BOOL tiltSupport = fpWTInfo (WTI_DEVICES, DVC_ORIENTATION, &Orientation);
|
BOOL tiltSupport = fpWTInfo(WTI_DEVICES, DVC_ORIENTATION, &Orientation);
|
||||||
if (tiltSupport) {
|
if (tiltSupport) {
|
||||||
/* does the tablet support azimuth ([0]) and altitude ([1]) */
|
/* does the tablet support azimuth ([0]) and altitude ([1]) */
|
||||||
if (Orientation[0].axResolution && Orientation[1].axResolution) {
|
if (Orientation[0].axResolution && Orientation[1].axResolution) {
|
||||||
@@ -368,7 +368,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fpWTOpen) {
|
if (fpWTOpen) {
|
||||||
m_tablet = fpWTOpen( m_hWnd, &lc, TRUE );
|
m_tablet = fpWTOpen(m_hWnd, &lc, TRUE);
|
||||||
if (m_tablet) {
|
if (m_tablet) {
|
||||||
m_tabletData = new GHOST_TabletData();
|
m_tabletData = new GHOST_TabletData();
|
||||||
m_tabletData->Active = GHOST_kTabletModeNone;
|
m_tabletData->Active = GHOST_kTabletModeNone;
|
||||||
@@ -377,23 +377,23 @@ GHOST_WindowWin32::GHOST_WindowWin32(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasMinVersionForTaskbar)
|
if (hasMinVersionForTaskbar)
|
||||||
CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList ,(LPVOID*)&m_Bar);
|
CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (LPVOID *)&m_Bar);
|
||||||
else
|
else
|
||||||
m_Bar=NULL;
|
m_Bar = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GHOST_WindowWin32::~GHOST_WindowWin32()
|
GHOST_WindowWin32::~GHOST_WindowWin32()
|
||||||
{
|
{
|
||||||
if(m_Bar)
|
if (m_Bar)
|
||||||
{
|
{
|
||||||
m_Bar->SetProgressState(m_hWnd, TBPF_NOPROGRESS);
|
m_Bar->SetProgressState(m_hWnd, TBPF_NOPROGRESS);
|
||||||
m_Bar->Release();
|
m_Bar->Release();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (m_wintab) {
|
if (m_wintab) {
|
||||||
GHOST_WIN32_WTClose fpWTClose = ( GHOST_WIN32_WTClose ) ::GetProcAddress( m_wintab, "WTClose" );
|
GHOST_WIN32_WTClose fpWTClose = (GHOST_WIN32_WTClose) ::GetProcAddress(m_wintab, "WTClose");
|
||||||
if (fpWTClose) {
|
if (fpWTClose) {
|
||||||
if (m_tablet)
|
if (m_tablet)
|
||||||
fpWTClose(m_tablet);
|
fpWTClose(m_tablet);
|
||||||
@@ -439,17 +439,17 @@ HWND GHOST_WindowWin32::getHWND() const
|
|||||||
|
|
||||||
void GHOST_WindowWin32::setTitle(const STR_String& title)
|
void GHOST_WindowWin32::setTitle(const STR_String& title)
|
||||||
{
|
{
|
||||||
wchar_t * title_16 = alloc_utf16_from_8((char*)(const char*)title, 0);
|
wchar_t *title_16 = alloc_utf16_from_8((char *)(const char *)title, 0);
|
||||||
::SetWindowTextW(m_hWnd, (wchar_t*)title_16);
|
::SetWindowTextW(m_hWnd, (wchar_t *)title_16);
|
||||||
free(title_16);
|
free(title_16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GHOST_WindowWin32::getTitle(STR_String& title) const
|
void GHOST_WindowWin32::getTitle(STR_String& title) const
|
||||||
{
|
{
|
||||||
char buf[s_maxTitleLength];/*CHANGE + never used yet*/
|
char buf[s_maxTitleLength]; /*CHANGE + never used yet*/
|
||||||
::GetWindowText(m_hWnd, buf, s_maxTitleLength);
|
::GetWindowText(m_hWnd, buf, s_maxTitleLength);
|
||||||
STR_String temp (buf);
|
STR_String temp(buf);
|
||||||
title = buf;
|
title = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,30 +468,33 @@ void GHOST_WindowWin32::getWindowBounds(GHOST_Rect& bounds) const
|
|||||||
void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const
|
void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
GHOST_TWindowState state= this->getState();
|
GHOST_TWindowState state = this->getState();
|
||||||
LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE);
|
LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE);
|
||||||
int sm_cysizeframe = GetSystemMetrics(SM_CYSIZEFRAME);
|
int sm_cysizeframe = GetSystemMetrics(SM_CYSIZEFRAME);
|
||||||
::GetWindowRect(m_hWnd, &rect);
|
::GetWindowRect(m_hWnd, &rect);
|
||||||
|
|
||||||
if((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE)) {
|
if ((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE)) {
|
||||||
if(state==GHOST_kWindowStateMaximized) {
|
if (state == GHOST_kWindowStateMaximized) {
|
||||||
// in maximized state we don't have borders on the window
|
// in maximized state we don't have borders on the window
|
||||||
bounds.m_b = rect.bottom-GetSystemMetrics(SM_CYCAPTION)- sm_cysizeframe*2;
|
bounds.m_b = rect.bottom - GetSystemMetrics(SM_CYCAPTION) - sm_cysizeframe * 2;
|
||||||
bounds.m_l = rect.left + sm_cysizeframe;
|
bounds.m_l = rect.left + sm_cysizeframe;
|
||||||
bounds.m_r = rect.right - sm_cysizeframe;
|
bounds.m_r = rect.right - sm_cysizeframe;
|
||||||
bounds.m_t = rect.top;
|
bounds.m_t = rect.top;
|
||||||
} else if (state == GHOST_kWindowStateEmbedded) {
|
}
|
||||||
|
else if (state == GHOST_kWindowStateEmbedded) {
|
||||||
bounds.m_b = rect.bottom;
|
bounds.m_b = rect.bottom;
|
||||||
bounds.m_l = rect.left;
|
bounds.m_l = rect.left;
|
||||||
bounds.m_r = rect.right;
|
bounds.m_r = rect.right;
|
||||||
bounds.m_t = rect.top;
|
bounds.m_t = rect.top;
|
||||||
} else {
|
}
|
||||||
bounds.m_b = rect.bottom-GetSystemMetrics(SM_CYCAPTION)-sm_cysizeframe*2;
|
else {
|
||||||
|
bounds.m_b = rect.bottom - GetSystemMetrics(SM_CYCAPTION) - sm_cysizeframe * 2;
|
||||||
bounds.m_l = rect.left;
|
bounds.m_l = rect.left;
|
||||||
bounds.m_r = rect.right-sm_cysizeframe*2;
|
bounds.m_r = rect.right - sm_cysizeframe * 2;
|
||||||
bounds.m_t = rect.top;
|
bounds.m_t = rect.top;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bounds.m_b = rect.bottom;
|
bounds.m_b = rect.bottom;
|
||||||
bounds.m_l = rect.left;
|
bounds.m_l = rect.left;
|
||||||
bounds.m_r = rect.right;
|
bounds.m_r = rect.right;
|
||||||
@@ -574,7 +577,7 @@ GHOST_TWindowState GHOST_WindowWin32::getState() const
|
|||||||
}
|
}
|
||||||
else if (::IsZoomed(m_hWnd)) {
|
else if (::IsZoomed(m_hWnd)) {
|
||||||
LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE);
|
LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE);
|
||||||
if((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE))
|
if ((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE))
|
||||||
state = GHOST_kWindowStateMaximized;
|
state = GHOST_kWindowStateMaximized;
|
||||||
else
|
else
|
||||||
state = GHOST_kWindowStateFullScreen;
|
state = GHOST_kWindowStateFullScreen;
|
||||||
@@ -753,7 +756,7 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
|
|||||||
// If this window has multisample enabled, use the supplied format
|
// If this window has multisample enabled, use the supplied format
|
||||||
if (m_multisampleEnabled)
|
if (m_multisampleEnabled)
|
||||||
{
|
{
|
||||||
if (SetPixelFormat(m_hDC, m_msPixelFormat, &sPreferredFormat)==FALSE)
|
if (SetPixelFormat(m_hDC, m_msPixelFormat, &sPreferredFormat) == FALSE)
|
||||||
{
|
{
|
||||||
success = GHOST_kFailure;
|
success = GHOST_kFailure;
|
||||||
break;
|
break;
|
||||||
@@ -802,9 +805,8 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
|
|||||||
printf("Failed to get a context....\n");
|
printf("Failed to get a context....\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (m_stereoVisual)
|
||||||
if(m_stereoVisual)
|
|
||||||
sPreferredFormat.dwFlags |= PFD_STEREO;
|
sPreferredFormat.dwFlags |= PFD_STEREO;
|
||||||
|
|
||||||
// Attempt to match device context pixel format to the preferred format
|
// Attempt to match device context pixel format to the preferred format
|
||||||
@@ -880,7 +882,7 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
|
|||||||
// Create a new window
|
// Create a new window
|
||||||
GHOST_TWindowState new_state = getState();
|
GHOST_TWindowState new_state = getState();
|
||||||
|
|
||||||
m_nextWindow = new GHOST_WindowWin32((GHOST_SystemWin32*)GHOST_ISystem::getSystem(),
|
m_nextWindow = new GHOST_WindowWin32((GHOST_SystemWin32 *)GHOST_ISystem::getSystem(),
|
||||||
m_title,
|
m_title,
|
||||||
m_left,
|
m_left,
|
||||||
m_top,
|
m_top,
|
||||||
@@ -897,7 +899,8 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
|
|||||||
// Return failure so we can trash this window.
|
// Return failure so we can trash this window.
|
||||||
success = GHOST_kFailure;
|
success = GHOST_kFailure;
|
||||||
break;
|
break;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
m_multisampleEnabled = GHOST_kSuccess;
|
m_multisampleEnabled = GHOST_kSuccess;
|
||||||
printf("Multisample failed to initialized\n");
|
printf("Multisample failed to initialized\n");
|
||||||
success = GHOST_kSuccess;
|
success = GHOST_kSuccess;
|
||||||
@@ -925,7 +928,7 @@ GHOST_TSuccess GHOST_WindowWin32::removeDrawingContext()
|
|||||||
case GHOST_kDrawingContextTypeOpenGL:
|
case GHOST_kDrawingContextTypeOpenGL:
|
||||||
// we shouldn't remove the drawing context if it's the first OpenGL context
|
// we shouldn't remove the drawing context if it's the first OpenGL context
|
||||||
// If we do, we get corrupted drawing. See #19997
|
// If we do, we get corrupted drawing. See #19997
|
||||||
if (m_hGlRc && m_hGlRc!=s_firsthGLRc) {
|
if (m_hGlRc && m_hGlRc != s_firsthGLRc) {
|
||||||
success = ::wglDeleteContext(m_hGlRc) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
|
success = ::wglDeleteContext(m_hGlRc) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
|
||||||
m_hGlRc = 0;
|
m_hGlRc = 0;
|
||||||
}
|
}
|
||||||
@@ -944,30 +947,29 @@ GHOST_TSuccess GHOST_WindowWin32::removeDrawingContext()
|
|||||||
|
|
||||||
void GHOST_WindowWin32::lostMouseCapture()
|
void GHOST_WindowWin32::lostMouseCapture()
|
||||||
{
|
{
|
||||||
if(m_hasMouseCaptured)
|
if (m_hasMouseCaptured)
|
||||||
{ m_hasGrabMouse = false;
|
{ m_hasGrabMouse = false;
|
||||||
m_nPressedButtons = 0;
|
m_nPressedButtons = 0;
|
||||||
m_hasMouseCaptured = false;
|
m_hasMouseCaptured = false; };
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_WindowWin32::registerMouseClickEvent(int press)
|
void GHOST_WindowWin32::registerMouseClickEvent(int press)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch(press)
|
switch (press)
|
||||||
{
|
{
|
||||||
case 0: m_nPressedButtons++; break;
|
case 0: m_nPressedButtons++; break;
|
||||||
case 1: if(m_nPressedButtons) m_nPressedButtons--; break;
|
case 1: if (m_nPressedButtons) m_nPressedButtons--; break;
|
||||||
case 2: m_hasGrabMouse=true; break;
|
case 2: m_hasGrabMouse = true; break;
|
||||||
case 3: m_hasGrabMouse=false; break;
|
case 3: m_hasGrabMouse = false; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!m_nPressedButtons && !m_hasGrabMouse && m_hasMouseCaptured)
|
if (!m_nPressedButtons && !m_hasGrabMouse && m_hasMouseCaptured)
|
||||||
{
|
{
|
||||||
::ReleaseCapture();
|
::ReleaseCapture();
|
||||||
m_hasMouseCaptured = false;
|
m_hasMouseCaptured = false;
|
||||||
}
|
}
|
||||||
else if((m_nPressedButtons || m_hasGrabMouse) && !m_hasMouseCaptured)
|
else if ((m_nPressedButtons || m_hasGrabMouse) && !m_hasMouseCaptured)
|
||||||
{
|
{
|
||||||
::SetCapture(m_hWnd);
|
::SetCapture(m_hWnd);
|
||||||
m_hasMouseCaptured = true;
|
m_hasMouseCaptured = true;
|
||||||
@@ -979,15 +981,16 @@ void GHOST_WindowWin32::registerMouseClickEvent(int press)
|
|||||||
void GHOST_WindowWin32::loadCursor(bool visible, GHOST_TStandardCursor cursor) const
|
void GHOST_WindowWin32::loadCursor(bool visible, GHOST_TStandardCursor cursor) const
|
||||||
{
|
{
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
while (::ShowCursor(FALSE) >= 0);
|
while (::ShowCursor(FALSE) >= 0) ;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
while (::ShowCursor(TRUE) < 0);
|
while (::ShowCursor(TRUE) < 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor == GHOST_kStandardCursorCustom && m_customCursor) {
|
if (cursor == GHOST_kStandardCursorCustom && m_customCursor) {
|
||||||
::SetCursor( m_customCursor );
|
::SetCursor(m_customCursor);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// Convert GHOST cursor to Windows OEM cursor
|
// Convert GHOST cursor to Windows OEM cursor
|
||||||
bool success = true;
|
bool success = true;
|
||||||
LPCSTR id;
|
LPCSTR id;
|
||||||
@@ -1035,22 +1038,22 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCursorVisibility(bool visible)
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWin32::setWindowCursorGrab(GHOST_TGrabCursorMode mode)
|
GHOST_TSuccess GHOST_WindowWin32::setWindowCursorGrab(GHOST_TGrabCursorMode mode)
|
||||||
{
|
{
|
||||||
if(mode != GHOST_kGrabDisable) {
|
if (mode != GHOST_kGrabDisable) {
|
||||||
if(mode != GHOST_kGrabNormal) {
|
if (mode != GHOST_kGrabNormal) {
|
||||||
m_system->getCursorPosition(m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
|
m_system->getCursorPosition(m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
|
||||||
setCursorGrabAccum(0, 0);
|
setCursorGrabAccum(0, 0);
|
||||||
|
|
||||||
if(mode == GHOST_kGrabHide)
|
if (mode == GHOST_kGrabHide)
|
||||||
setWindowCursorVisibility(false);
|
setWindowCursorVisibility(false);
|
||||||
}
|
}
|
||||||
registerMouseClickEvent(2);
|
registerMouseClickEvent(2);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (m_cursorGrab==GHOST_kGrabHide) {
|
if (m_cursorGrab == GHOST_kGrabHide) {
|
||||||
m_system->setCursorPosition(m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
|
m_system->setCursorPosition(m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
|
||||||
setWindowCursorVisibility(true);
|
setWindowCursorVisibility(true);
|
||||||
}
|
}
|
||||||
if(m_cursorGrab != GHOST_kGrabNormal) {
|
if (m_cursorGrab != GHOST_kGrabNormal) {
|
||||||
/* use to generate a mouse move event, otherwise the last event
|
/* use to generate a mouse move event, otherwise the last event
|
||||||
* blender gets can be outside the screen causing menus not to show
|
* blender gets can be outside the screen causing menus not to show
|
||||||
* properly unless the user moves the mouse */
|
* properly unless the user moves the mouse */
|
||||||
@@ -1061,7 +1064,7 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCursorGrab(GHOST_TGrabCursorMode mode
|
|||||||
|
|
||||||
/* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
|
/* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
|
||||||
setCursorGrabAccum(0, 0);
|
setCursorGrabAccum(0, 0);
|
||||||
m_cursorGrabBounds.m_l= m_cursorGrabBounds.m_r= -1; /* disable */
|
m_cursorGrabBounds.m_l = m_cursorGrabBounds.m_r = -1; /* disable */
|
||||||
registerMouseClickEvent(3);
|
registerMouseClickEvent(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1085,20 +1088,20 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCursorShape(GHOST_TStandardCursor cur
|
|||||||
void GHOST_WindowWin32::processWin32TabletInitEvent()
|
void GHOST_WindowWin32::processWin32TabletInitEvent()
|
||||||
{
|
{
|
||||||
if (m_wintab) {
|
if (m_wintab) {
|
||||||
GHOST_WIN32_WTInfo fpWTInfo = ( GHOST_WIN32_WTInfo ) ::GetProcAddress( m_wintab, "WTInfoA" );
|
GHOST_WIN32_WTInfo fpWTInfo = (GHOST_WIN32_WTInfo) ::GetProcAddress(m_wintab, "WTInfoA");
|
||||||
|
|
||||||
// let's see if we can initialize tablet here
|
// let's see if we can initialize tablet here
|
||||||
/* check if WinTab available. */
|
/* check if WinTab available. */
|
||||||
if (fpWTInfo) {
|
if (fpWTInfo) {
|
||||||
AXIS Pressure, Orientation[3]; /* The maximum tablet size */
|
AXIS Pressure, Orientation[3]; /* The maximum tablet size */
|
||||||
|
|
||||||
BOOL pressureSupport = fpWTInfo (WTI_DEVICES, DVC_NPRESSURE, &Pressure);
|
BOOL pressureSupport = fpWTInfo(WTI_DEVICES, DVC_NPRESSURE, &Pressure);
|
||||||
if (pressureSupport)
|
if (pressureSupport)
|
||||||
m_maxPressure = Pressure.axMax;
|
m_maxPressure = Pressure.axMax;
|
||||||
else
|
else
|
||||||
m_maxPressure = 0;
|
m_maxPressure = 0;
|
||||||
|
|
||||||
BOOL tiltSupport = fpWTInfo (WTI_DEVICES, DVC_ORIENTATION, &Orientation);
|
BOOL tiltSupport = fpWTInfo(WTI_DEVICES, DVC_ORIENTATION, &Orientation);
|
||||||
if (tiltSupport) {
|
if (tiltSupport) {
|
||||||
/* does the tablet support azimuth ([0]) and altitude ([1]) */
|
/* does the tablet support azimuth ([0]) and altitude ([1]) */
|
||||||
if (Orientation[0].axResolution && Orientation[1].axResolution) {
|
if (Orientation[0].axResolution && Orientation[1].axResolution) {
|
||||||
@@ -1119,7 +1122,7 @@ void GHOST_WindowWin32::processWin32TabletEvent(WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
PACKET pkt;
|
PACKET pkt;
|
||||||
if (m_wintab) {
|
if (m_wintab) {
|
||||||
GHOST_WIN32_WTPacket fpWTPacket = ( GHOST_WIN32_WTPacket ) ::GetProcAddress( m_wintab, "WTPacket" );
|
GHOST_WIN32_WTPacket fpWTPacket = (GHOST_WIN32_WTPacket) ::GetProcAddress(m_wintab, "WTPacket");
|
||||||
if (fpWTPacket) {
|
if (fpWTPacket) {
|
||||||
if (fpWTPacket((HCTX)lParam, wParam, &pkt)) {
|
if (fpWTPacket((HCTX)lParam, wParam, &pkt)) {
|
||||||
if (m_tabletData) {
|
if (m_tabletData) {
|
||||||
@@ -1139,7 +1142,8 @@ void GHOST_WindowWin32::processWin32TabletEvent(WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
if (m_maxPressure > 0) {
|
if (m_maxPressure > 0) {
|
||||||
m_tabletData->Pressure = (float)pkt.pkNormalPressure / (float)m_maxPressure;
|
m_tabletData->Pressure = (float)pkt.pkNormalPressure / (float)m_maxPressure;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
m_tabletData->Pressure = 1.0f;
|
m_tabletData->Pressure = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1149,33 +1153,34 @@ void GHOST_WindowWin32::processWin32TabletEvent(WPARAM wParam, LPARAM lParam)
|
|||||||
float altRad, azmRad; /* in radians */
|
float altRad, azmRad; /* in radians */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
from the wintab spec:
|
* from the wintab spec:
|
||||||
orAzimuth Specifies the clockwise rotation of the
|
* orAzimuth Specifies the clockwise rotation of the
|
||||||
cursor about the z axis through a full circular range.
|
* cursor about the z axis through a full circular range.
|
||||||
|
*
|
||||||
orAltitude Specifies the angle with the x-y plane
|
* orAltitude Specifies the angle with the x-y plane
|
||||||
through a signed, semicircular range. Positive values
|
* through a signed, semicircular range. Positive values
|
||||||
specify an angle upward toward the positive z axis;
|
* specify an angle upward toward the positive z axis;
|
||||||
negative values specify an angle downward toward the negative z axis.
|
* negative values specify an angle downward toward the negative z axis.
|
||||||
|
*
|
||||||
wintab.h defines .orAltitude as a UINT but documents .orAltitude
|
* wintab.h defines .orAltitude as a UINT but documents .orAltitude
|
||||||
as positive for upward angles and negative for downward angles.
|
* as positive for upward angles and negative for downward angles.
|
||||||
WACOM uses negative altitude values to show that the pen is inverted;
|
* WACOM uses negative altitude values to show that the pen is inverted;
|
||||||
therefore we cast .orAltitude as an (int) and then use the absolute value.
|
* therefore we cast .orAltitude as an (int) and then use the absolute value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* convert raw fixed point data to radians */
|
/* convert raw fixed point data to radians */
|
||||||
altRad = (float)((fabs((float)ort.orAltitude)/(float)m_maxAltitude) * M_PI/2.0);
|
altRad = (float)((fabs((float)ort.orAltitude) / (float)m_maxAltitude) * M_PI / 2.0);
|
||||||
azmRad = (float)(((float)ort.orAzimuth/(float)m_maxAzimuth) * M_PI*2.0);
|
azmRad = (float)(((float)ort.orAzimuth / (float)m_maxAzimuth) * M_PI * 2.0);
|
||||||
|
|
||||||
/* find length of the stylus' projected vector on the XY plane */
|
/* find length of the stylus' projected vector on the XY plane */
|
||||||
vecLen = cos(altRad);
|
vecLen = cos(altRad);
|
||||||
|
|
||||||
/* from there calculate X and Y components based on azimuth */
|
/* from there calculate X and Y components based on azimuth */
|
||||||
m_tabletData->Xtilt = sin(azmRad) * vecLen;
|
m_tabletData->Xtilt = sin(azmRad) * vecLen;
|
||||||
m_tabletData->Ytilt = (float)(sin(M_PI/2.0 - azmRad) * vecLen);
|
m_tabletData->Ytilt = (float)(sin(M_PI / 2.0 - azmRad) * vecLen);
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
m_tabletData->Xtilt = 0.0f;
|
m_tabletData->Xtilt = 0.0f;
|
||||||
m_tabletData->Ytilt = 0.0f;
|
m_tabletData->Ytilt = 0.0f;
|
||||||
}
|
}
|
||||||
@@ -1188,26 +1193,26 @@ void GHOST_WindowWin32::processWin32TabletEvent(WPARAM wParam, LPARAM lParam)
|
|||||||
/** Reverse the bits in a GHOST_TUns8 */
|
/** Reverse the bits in a GHOST_TUns8 */
|
||||||
static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
|
static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
|
||||||
{
|
{
|
||||||
ch= ((ch>>1)&0x55) | ((ch<<1)&0xAA);
|
ch = ((ch >> 1) & 0x55) | ((ch << 1) & 0xAA);
|
||||||
ch= ((ch>>2)&0x33) | ((ch<<2)&0xCC);
|
ch = ((ch >> 2) & 0x33) | ((ch << 2) & 0xCC);
|
||||||
ch= ((ch>>4)&0x0F) | ((ch<<4)&0xF0);
|
ch = ((ch >> 4) & 0x0F) | ((ch << 4) & 0xF0);
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Reverse the bits in a GHOST_TUns16 */
|
/** Reverse the bits in a GHOST_TUns16 */
|
||||||
static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
|
static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
|
||||||
{
|
{
|
||||||
shrt= ((shrt>>1)&0x5555) | ((shrt<<1)&0xAAAA);
|
shrt = ((shrt >> 1) & 0x5555) | ((shrt << 1) & 0xAAAA);
|
||||||
shrt= ((shrt>>2)&0x3333) | ((shrt<<2)&0xCCCC);
|
shrt = ((shrt >> 2) & 0x3333) | ((shrt << 2) & 0xCCCC);
|
||||||
shrt= ((shrt>>4)&0x0F0F) | ((shrt<<4)&0xF0F0);
|
shrt = ((shrt >> 4) & 0x0F0F) | ((shrt << 4) & 0xF0F0);
|
||||||
shrt= ((shrt>>8)&0x00FF) | ((shrt<<8)&0xFF00);
|
shrt = ((shrt >> 8) & 0x00FF) | ((shrt << 8) & 0xFF00);
|
||||||
return shrt;
|
return shrt;
|
||||||
}
|
}
|
||||||
GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
|
GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
|
||||||
GHOST_TUns8 mask[16][2],
|
GHOST_TUns8 mask[16][2],
|
||||||
int hotX, int hotY)
|
int hotX, int hotY)
|
||||||
{
|
{
|
||||||
return setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*)mask,
|
return setWindowCustomCursorShape((GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask,
|
||||||
16, 16, hotX, hotY, 0, 1);
|
16, 16, hotX, hotY, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1220,8 +1225,8 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
|
|||||||
GHOST_TUns32 fullBitRow, fullMaskRow;
|
GHOST_TUns32 fullBitRow, fullMaskRow;
|
||||||
int x, y, cols;
|
int x, y, cols;
|
||||||
|
|
||||||
cols=sizeX/8; /* Num of whole bytes per row (width of bm/mask) */
|
cols = sizeX / 8; /* Num of whole bytes per row (width of bm/mask) */
|
||||||
if (sizeX%8) cols++;
|
if (sizeX % 8) cols++;
|
||||||
|
|
||||||
if (m_customCursor) {
|
if (m_customCursor) {
|
||||||
DestroyCursor(m_customCursor);
|
DestroyCursor(m_customCursor);
|
||||||
@@ -1231,17 +1236,17 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
|
|||||||
memset(&andData, 0xFF, sizeof(andData));
|
memset(&andData, 0xFF, sizeof(andData));
|
||||||
memset(&xorData, 0, sizeof(xorData));
|
memset(&xorData, 0, sizeof(xorData));
|
||||||
|
|
||||||
for (y=0; y<sizeY; y++) {
|
for (y = 0; y < sizeY; y++) {
|
||||||
fullBitRow=0;
|
fullBitRow = 0;
|
||||||
fullMaskRow=0;
|
fullMaskRow = 0;
|
||||||
for (x=cols-1; x>=0; x--){
|
for (x = cols - 1; x >= 0; x--) {
|
||||||
fullBitRow<<=8;
|
fullBitRow <<= 8;
|
||||||
fullMaskRow<<=8;
|
fullMaskRow <<= 8;
|
||||||
fullBitRow |= uns8ReverseBits(bitmap[cols*y + x]);
|
fullBitRow |= uns8ReverseBits(bitmap[cols * y + x]);
|
||||||
fullMaskRow |= uns8ReverseBits( mask[cols*y + x]);
|
fullMaskRow |= uns8ReverseBits(mask[cols * y + x]);
|
||||||
}
|
}
|
||||||
xorData[y]= fullBitRow & fullMaskRow;
|
xorData[y] = fullBitRow & fullMaskRow;
|
||||||
andData[y]= ~fullMaskRow;
|
andData[y] = ~fullMaskRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_customCursor = ::CreateCursor(::GetModuleHandle(0), hotX, hotY, 32, 32, andData, xorData);
|
m_customCursor = ::CreateCursor(::GetModuleHandle(0), hotX, hotY, 32, 32, andData, xorData);
|
||||||
@@ -1260,7 +1265,7 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
|
|||||||
GHOST_TSuccess GHOST_WindowWin32::setProgressBar(float progress)
|
GHOST_TSuccess GHOST_WindowWin32::setProgressBar(float progress)
|
||||||
{
|
{
|
||||||
/*SetProgressValue sets state to TBPF_NORMAL automaticly*/
|
/*SetProgressValue sets state to TBPF_NORMAL automaticly*/
|
||||||
if(m_Bar && S_OK == m_Bar->SetProgressValue(m_hWnd,10000*progress,10000))
|
if (m_Bar && S_OK == m_Bar->SetProgressValue(m_hWnd, 10000 * progress, 10000))
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
|
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
@@ -1268,7 +1273,7 @@ GHOST_TSuccess GHOST_WindowWin32::setProgressBar(float progress)
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_WindowWin32::endProgressBar()
|
GHOST_TSuccess GHOST_WindowWin32::endProgressBar()
|
||||||
{
|
{
|
||||||
if(m_Bar && S_OK == m_Bar->SetProgressState(m_hWnd,TBPF_NOPROGRESS))
|
if (m_Bar && S_OK == m_Bar->SetProgressState(m_hWnd, TBPF_NOPROGRESS))
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
|
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
@@ -1285,12 +1290,14 @@ static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd)
|
|||||||
|
|
||||||
/* cull unusable pixel formats */
|
/* cull unusable pixel formats */
|
||||||
/* if no formats can be found, can we determine why it was rejected? */
|
/* if no formats can be found, can we determine why it was rejected? */
|
||||||
if( !(pfd.dwFlags & PFD_SUPPORT_OPENGL) ||
|
if (!(pfd.dwFlags & PFD_SUPPORT_OPENGL) ||
|
||||||
!(pfd.dwFlags & PFD_DRAW_TO_WINDOW) ||
|
!(pfd.dwFlags & PFD_DRAW_TO_WINDOW) ||
|
||||||
!(pfd.dwFlags & PFD_DOUBLEBUFFER) || /* Blender _needs_ this */
|
!(pfd.dwFlags & PFD_DOUBLEBUFFER) || /* Blender _needs_ this */
|
||||||
( pfd.cDepthBits <= 8 ) ||
|
(pfd.cDepthBits <= 8) ||
|
||||||
!(pfd.iPixelType == PFD_TYPE_RGBA))
|
!(pfd.iPixelType == PFD_TYPE_RGBA))
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
weight = 1; /* it's usable */
|
weight = 1; /* it's usable */
|
||||||
|
|
||||||
@@ -1301,10 +1308,10 @@ static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd)
|
|||||||
weight += pfd.cColorBits - 8;
|
weight += pfd.cColorBits - 8;
|
||||||
|
|
||||||
/* want swap copy capability -- it matters a lot */
|
/* want swap copy capability -- it matters a lot */
|
||||||
if(pfd.dwFlags & PFD_SWAP_COPY) weight += 16;
|
if (pfd.dwFlags & PFD_SWAP_COPY) weight += 16;
|
||||||
|
|
||||||
/* but if it's a generic (not accelerated) view, it's really bad */
|
/* but if it's a generic (not accelerated) view, it's really bad */
|
||||||
if(pfd.dwFlags & PFD_GENERIC_FORMAT) weight /= 10;
|
if (pfd.dwFlags & PFD_GENERIC_FORMAT) weight /= 10;
|
||||||
|
|
||||||
return weight;
|
return weight;
|
||||||
}
|
}
|
||||||
@@ -1318,27 +1325,27 @@ static int EnumPixelFormats(HDC hdc)
|
|||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
|
|
||||||
/* we need a device context to do anything */
|
/* we need a device context to do anything */
|
||||||
if(!hdc) return 0;
|
if (!hdc) return 0;
|
||||||
|
|
||||||
iPixelFormat = 1; /* careful! PFD numbers are 1 based, not zero based */
|
iPixelFormat = 1; /* careful! PFD numbers are 1 based, not zero based */
|
||||||
|
|
||||||
/* obtain detailed information about
|
/* obtain detailed information about
|
||||||
the device context's first pixel format */
|
* the device context's first pixel format */
|
||||||
n = 1+::DescribePixelFormat(hdc, iPixelFormat,
|
n = 1 + ::DescribePixelFormat(hdc, iPixelFormat,
|
||||||
sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||||
|
|
||||||
/* choose a pixel format using the useless Windows function in case
|
/* choose a pixel format using the useless Windows function in case
|
||||||
we come up empty handed */
|
we come up empty handed */
|
||||||
iPixelFormat = ::ChoosePixelFormat( hdc, &sPreferredFormat );
|
iPixelFormat = ::ChoosePixelFormat(hdc, &sPreferredFormat);
|
||||||
|
|
||||||
if(!iPixelFormat) return 0; /* couldn't find one to use */
|
if (!iPixelFormat) return 0; /* couldn't find one to use */
|
||||||
|
|
||||||
for(i=1; i<=n; i++) { /* not the idiom, but it's right */
|
for (i = 1; i <= n; i++) { /* not the idiom, but it's right */
|
||||||
::DescribePixelFormat( hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd );
|
::DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||||
w = WeightPixelFormat(pfd);
|
w = WeightPixelFormat(pfd);
|
||||||
// be strict on stereo
|
// be strict on stereo
|
||||||
if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) {
|
if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) {
|
||||||
if(w > weight) {
|
if (w > weight) {
|
||||||
weight = w;
|
weight = w;
|
||||||
iPixelFormat = i;
|
iPixelFormat = i;
|
||||||
}
|
}
|
||||||
@@ -1346,10 +1353,10 @@ static int EnumPixelFormats(HDC hdc)
|
|||||||
}
|
}
|
||||||
if (weight == 0) {
|
if (weight == 0) {
|
||||||
// we could find the correct stereo setting, just find any suitable format
|
// we could find the correct stereo setting, just find any suitable format
|
||||||
for(i=1; i<=n; i++) { /* not the idiom, but it's right */
|
for (i = 1; i <= n; i++) { /* not the idiom, but it's right */
|
||||||
::DescribePixelFormat( hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd );
|
::DescribePixelFormat(hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||||
w = WeightPixelFormat(pfd);
|
w = WeightPixelFormat(pfd);
|
||||||
if(w > weight) {
|
if (w > weight) {
|
||||||
weight = w;
|
weight = w;
|
||||||
iPixelFormat = i;
|
iPixelFormat = i;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ class GHOST_SystemWin32;
|
|||||||
class GHOST_DropTargetWin32;
|
class GHOST_DropTargetWin32;
|
||||||
|
|
||||||
// typedefs for WinTab functions to allow dynamic loading
|
// typedefs for WinTab functions to allow dynamic loading
|
||||||
typedef UINT (API * GHOST_WIN32_WTInfo) ( UINT, UINT, LPVOID );
|
typedef UINT (API * GHOST_WIN32_WTInfo)(UINT, UINT, LPVOID);
|
||||||
typedef HCTX (API * GHOST_WIN32_WTOpen) (HWND, LPLOGCONTEXTA, BOOL);
|
typedef HCTX (API * GHOST_WIN32_WTOpen)(HWND, LPLOGCONTEXTA, BOOL);
|
||||||
typedef BOOL (API * GHOST_WIN32_WTClose) (HCTX);
|
typedef BOOL (API * GHOST_WIN32_WTClose)(HCTX);
|
||||||
typedef BOOL (API * GHOST_WIN32_WTPacket) (HCTX, UINT, LPVOID);
|
typedef BOOL (API * GHOST_WIN32_WTPacket)(HCTX, UINT, LPVOID);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GHOST window on M$ Windows OSs.
|
* GHOST window on M$ Windows OSs.
|
||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
* @param numOfAASamples Number of samples used for AA (zero if no AA)
|
* @param numOfAASamples Number of samples used for AA (zero if no AA)
|
||||||
*/
|
*/
|
||||||
GHOST_WindowWin32(
|
GHOST_WindowWin32(
|
||||||
GHOST_SystemWin32 * system,
|
GHOST_SystemWin32 *system,
|
||||||
const STR_String& title,
|
const STR_String& title,
|
||||||
GHOST_TInt32 left,
|
GHOST_TInt32 left,
|
||||||
GHOST_TInt32 top,
|
GHOST_TInt32 top,
|
||||||
@@ -91,7 +91,7 @@ public:
|
|||||||
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
|
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
|
||||||
const bool stereoVisual = false,
|
const bool stereoVisual = false,
|
||||||
const GHOST_TUns16 numOfAASamples = 0,
|
const GHOST_TUns16 numOfAASamples = 0,
|
||||||
GHOST_TEmbedderWindowID parentWindowHwnd=0,
|
GHOST_TEmbedderWindowID parentWindowHwnd = 0,
|
||||||
GHOST_TSuccess msEnabled = GHOST_kFailure,
|
GHOST_TSuccess msEnabled = GHOST_kFailure,
|
||||||
int msPixelFormat = 0
|
int msPixelFormat = 0
|
||||||
);
|
);
|
||||||
@@ -236,7 +236,9 @@ public:
|
|||||||
* Returns the name of the window class.
|
* Returns the name of the window class.
|
||||||
* @return The name of the window class.
|
* @return The name of the window class.
|
||||||
*/
|
*/
|
||||||
static wchar_t* getWindowClassName() { return s_windowClassName; }
|
static wchar_t *getWindowClassName() {
|
||||||
|
return s_windowClassName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a mouse click event (should be called
|
* Register a mouse click event (should be called
|
||||||
@@ -264,8 +266,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
void loadCursor(bool visible, GHOST_TStandardCursor cursorShape) const;
|
void loadCursor(bool visible, GHOST_TStandardCursor cursorShape) const;
|
||||||
|
|
||||||
const GHOST_TabletData* GetTabletData()
|
const GHOST_TabletData *GetTabletData()
|
||||||
{ return m_tabletData; }
|
{
|
||||||
|
return m_tabletData;
|
||||||
|
}
|
||||||
|
|
||||||
void processWin32TabletInitEvent();
|
void processWin32TabletInitEvent();
|
||||||
void processWin32TabletEvent(WPARAM wParam, LPARAM lParam);
|
void processWin32TabletEvent(WPARAM wParam, LPARAM lParam);
|
||||||
@@ -325,9 +329,9 @@ protected:
|
|||||||
);
|
);
|
||||||
|
|
||||||
/** Pointer to system */
|
/** Pointer to system */
|
||||||
GHOST_SystemWin32 * m_system;
|
GHOST_SystemWin32 *m_system;
|
||||||
/** Pointer to COM IDropTarget implementor */
|
/** Pointer to COM IDropTarget implementor */
|
||||||
GHOST_DropTargetWin32 * m_dropTarget;
|
GHOST_DropTargetWin32 *m_dropTarget;
|
||||||
/** Window handle. */
|
/** Window handle. */
|
||||||
HWND m_hWnd;
|
HWND m_hWnd;
|
||||||
/** Device context handle. */
|
/** Device context handle. */
|
||||||
@@ -349,16 +353,16 @@ protected:
|
|||||||
HCURSOR m_customCursor;
|
HCURSOR m_customCursor;
|
||||||
|
|
||||||
/** ITaskbarList3 structure for progress bar*/
|
/** ITaskbarList3 structure for progress bar*/
|
||||||
ITaskbarList3 * m_Bar;
|
ITaskbarList3 *m_Bar;
|
||||||
|
|
||||||
static wchar_t* s_windowClassName;
|
static wchar_t *s_windowClassName;
|
||||||
static const int s_maxTitleLength;
|
static const int s_maxTitleLength;
|
||||||
|
|
||||||
/** WinTab dll handle */
|
/** WinTab dll handle */
|
||||||
HMODULE m_wintab;
|
HMODULE m_wintab;
|
||||||
|
|
||||||
/** Tablet data for GHOST */
|
/** Tablet data for GHOST */
|
||||||
GHOST_TabletData* m_tabletData;
|
GHOST_TabletData *m_tabletData;
|
||||||
|
|
||||||
/** Stores the Tablet context if detected Tablet features using WinTab.dll */
|
/** Stores the Tablet context if detected Tablet features using WinTab.dll */
|
||||||
HCTX m_tablet;
|
HCTX m_tablet;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user