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:
2012-05-26 22:22:45 +00:00
606 changed files with 34730 additions and 29015 deletions

View File

@@ -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)

View File

@@ -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']:

View File

@@ -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++'

View File

@@ -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

View File

@@ -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)),

View File

@@ -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))

View File

@@ -11,39 +11,41 @@ Intro
.. code-block:: python .. code-block:: python
# 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

View File

@@ -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

View File

@@ -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,52 +285,55 @@ 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()) {
bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render(); for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end(); ++b_ob) {
uint ob_layer = get_layer(b_ob->layers()); bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
uint ob_layer = get_layer(b_ob->layers());
if(!hide && (ob_layer & scene_layer)) { if(!hide && (ob_layer & scene_layer)) {
if(b_ob->is_duplicator()) { if(b_ob->is_duplicator()) {
/* dupli objects */ /* dupli objects */
object_create_duplilist(*b_ob, b_scene); object_create_duplilist(*b_ob, b_scene);
BL::Object::dupli_list_iterator b_dup; BL::Object::dupli_list_iterator b_dup;
int b_index = 0; int b_index = 0;
for(b_ob->dupli_list.begin(b_dup); b_dup != b_ob->dupli_list.end(); ++b_dup) { for(b_ob->dupli_list.begin(b_dup); b_dup != b_ob->dupli_list.end(); ++b_dup) {
Transform tfm = get_transform(b_dup->matrix()); Transform tfm = get_transform(b_dup->matrix());
BL::Object b_dup_ob = b_dup->object(); BL::Object b_dup_ob = b_dup->object();
bool dup_hide = (b_v3d)? b_dup_ob.hide(): b_dup_ob.hide_render(); bool dup_hide = (b_v3d)? b_dup_ob.hide(): b_dup_ob.hide_render();
if(!(b_dup->hide() || dup_hide)) if(!(b_dup->hide() || dup_hide))
sync_object(*b_ob, b_index, b_dup_ob, tfm, ob_layer, motion); sync_object(*b_ob, b_index, b_dup_ob, tfm, ob_layer, motion);
b_index++; b_index++;
} }
object_free_duplilist(*b_ob); object_free_duplilist(*b_ob);
hide = true;
}
/* check if we should render or hide particle emitter */
BL::Object::particle_systems_iterator b_psys;
bool render_emitter = false;
for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys) {
if(b_psys->settings().use_render_emitter()) {
hide = false;
render_emitter = true;
}
else if(!render_emitter)
hide = true; hide = true;
} }
if(!hide) { /* check if we should render or hide particle emitter */
/* object itself */ BL::Object::particle_systems_iterator b_psys;
Transform tfm = get_transform(b_ob->matrix_world()); bool render_emitter = false;
sync_object(*b_ob, 0, *b_ob, tfm, ob_layer, motion);
for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys) {
if(b_psys->settings().use_render_emitter()) {
hide = false;
render_emitter = true;
}
else if(!render_emitter)
hide = true;
}
if(!hide) {
/* object itself */
Transform tfm = get_transform(b_ob->matrix_world());
sync_object(*b_ob, 0, *b_ob, tfm, ob_layer, motion);
}
} }
} }
} }

View File

@@ -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());

View File

@@ -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

View File

@@ -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)

View File

@@ -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);

View File

@@ -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

View File

@@ -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,

View File

@@ -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);
}
}
}
} }
} }

View File

@@ -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()

View File

@@ -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)

View File

@@ -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

View File

@@ -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;

View File

@@ -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__ */

View File

@@ -86,9 +86,12 @@ set(SRC
intern/solver_interface.h intern/solver_interface.h
intern/solver_relax.h intern/solver_relax.h
intern/utilities.h intern/utilities.h
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

View File

@@ -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

View File

@@ -30,7 +30,7 @@
* \brief GHOST C-API function and type declarations. * \brief GHOST C-API function and type declarations.
*/ */
#ifndef __GHOST_C_API_H__ #ifndef __GHOST_C_API_H__
#define __GHOST_C_API_H__ #define __GHOST_C_API_H__
#include "GHOST_Types.h" #include "GHOST_Types.h"
@@ -113,10 +113,10 @@ extern GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
* @return A timer task (0 if timer task installation failed). * @return A timer task (0 if timer task installation failed).
*/ */
extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle, extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
GHOST_TUns64 delay, GHOST_TUns64 delay,
GHOST_TUns64 interval, GHOST_TUns64 interval,
GHOST_TimerProcPtr timerProc, GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData); GHOST_TUserDataPtr userData);
/** /**
* Removes a timer. * Removes a timer.
@@ -125,11 +125,11 @@ extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle, 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,15 +166,15 @@ 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,
GHOST_TUns32 height, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TWindowState state,
GHOST_TDrawingContextType type, GHOST_TDrawingContextType type,
const int stereoVisual, const int stereoVisual,
const GHOST_TUns16 numOfAASamples); const GHOST_TUns16 numOfAASamples);
/** /**
* Returns the window user data. * Returns the window user data.
@@ -189,7 +189,7 @@ extern GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandl
* @param data The window user data. * @param data The window user data.
*/ */
extern void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, extern void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle,
GHOST_TUserDataPtr userdata); GHOST_TUserDataPtr userdata);
/** /**
* Dispose a window. * Dispose a window.
@@ -198,7 +198,7 @@ extern void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle,
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle, extern GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle windowhandle); GHOST_WindowHandle windowhandle);
/** /**
* Returns whether a window is valid. * Returns whether a window is valid.
@@ -207,7 +207,7 @@ extern GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
* @return Indication of validity. * @return Indication of validity.
*/ */
extern int GHOST_ValidWindow(GHOST_SystemHandle systemhandle, extern int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle windowhandle); GHOST_WindowHandle windowhandle);
/** /**
* Begins full screen mode. * Begins full screen mode.
@@ -217,8 +217,8 @@ 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);
/** /**
* Ends full screen mode. * Ends full screen mode.
@@ -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.
@@ -261,7 +261,7 @@ extern int GHOST_DispatchEvents(GHOST_SystemHandle systemhandle);
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle,
GHOST_EventConsumerHandle consumerhandle); GHOST_EventConsumerHandle consumerhandle);
/** /**
* Remove the given event consumer to our list. * Remove the given event consumer to our list.
@@ -270,11 +270,11 @@ extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle,
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle, 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.
@@ -307,7 +307,7 @@ extern GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandl
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle, extern GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
GHOST_TStandardCursor cursorshape); GHOST_TStandardCursor cursorshape);
/** /**
* Set the shape of the cursor to a custom cursor. * Set the shape of the cursor to a custom cursor.
@@ -319,10 +319,10 @@ extern GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle, extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
GHOST_TUns8 bitmap[16][2], GHOST_TUns8 bitmap[16][2],
GHOST_TUns8 mask[16][2], GHOST_TUns8 mask[16][2],
int hotX, int hotX,
int hotY); int hotY);
/** /**
* Set the shape of the cursor to a custom cursor of specified size. * Set the shape of the cursor to a custom cursor of specified size.
* @param windowhandle The handle to the window * @param windowhandle The handle to the window
@@ -333,13 +333,13 @@ extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle
* @param hotY The Y coordinate of the cursor hotspot. * @param hotY The Y coordinate of the cursor hotspot.
* @param fg_color, bg_color Colors of the cursor * @param fg_color, bg_color Colors of the cursor
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle, extern GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
GHOST_TUns8 *bitmap, GHOST_TUns8 *bitmap,
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.
@@ -355,7 +355,7 @@ extern int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle);
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle, extern GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle,
int visible); int visible);
/** /**
* Returns the current location of the cursor (location in screen coordinates) * Returns the current location of the cursor (location in screen coordinates)
@@ -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).
@@ -377,8 +377,8 @@ extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle, extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TInt32 x, GHOST_TInt32 x,
GHOST_TInt32 y); GHOST_TInt32 y);
/** /**
* Grabs the cursor for a modal operation, to keep receiving * Grabs the cursor for a modal operation, to keep receiving
@@ -390,12 +390,12 @@ extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
* @return Indication of success. * @return Indication of success.
*/ */
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).
@@ -405,8 +405,8 @@ extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
* @return Indication of success. * @return Indication of success.
*/ */
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).
@@ -416,13 +416,13 @@ extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
* @return Indication of success. * @return Indication of success.
*/ */
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
@@ -472,7 +472,7 @@ extern GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhand
* @param timerProc The timer callback. * @param timerProc The timer callback.
*/ */
extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle, extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
GHOST_TimerProcPtr timerProc); GHOST_TimerProcPtr timerProc);
/** /**
* Returns the timer user data. * Returns the timer user data.
@@ -487,7 +487,7 @@ extern GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timer
* @param data The timer user data. * @param data The timer user data.
*/ */
extern void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle, extern void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
GHOST_TUserDataPtr userData); GHOST_TUserDataPtr userData);
/** /**
* Returns indication as to whether the window is valid. * Returns indication as to whether the window is valid.
@@ -510,7 +510,7 @@ extern GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle
* @return Indication as to whether installation has succeeded. * @return Indication as to whether installation has succeeded.
*/ */
extern GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle, extern GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle,
GHOST_TDrawingContextType type); GHOST_TDrawingContextType type);
/** /**
* Sets the title displayed in the title bar. * Sets the title displayed in the title bar.
@@ -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.
@@ -558,7 +558,7 @@ void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle);
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle,
GHOST_TUns32 width); GHOST_TUns32 width);
/** /**
* Resizes client rectangle height. * Resizes client rectangle height.
@@ -567,7 +567,7 @@ extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle,
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle,
GHOST_TUns32 height); GHOST_TUns32 height);
/** /**
* Resizes client rectangle. * Resizes client rectangle.
@@ -577,8 +577,8 @@ extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle,
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle, extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
GHOST_TUns32 width, GHOST_TUns32 width,
GHOST_TUns32 height); GHOST_TUns32 height);
/** /**
* Converts a point in screen coordinates to client rectangle coordinates * Converts a point in screen coordinates to client rectangle coordinates
@@ -589,10 +589,10 @@ extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
* @param outY The y-coordinate in the client rectangle. * @param outY The y-coordinate in the client rectangle.
*/ */
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
@@ -603,10 +603,10 @@ extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
* @param outY The y-coordinate on the screen. * @param outY The y-coordinate on the screen.
*/ */
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).
@@ -622,7 +622,7 @@ extern GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle);
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle, extern GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
GHOST_TWindowState state); GHOST_TWindowState state);
/** /**
@@ -632,7 +632,7 @@ extern GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle,
GHOST_TUns8 isUnsavedChanges); GHOST_TUns8 isUnsavedChanges);
/** /**
* Sets the order of the window (bottom, top). * Sets the order of the window (bottom, top).
@@ -641,7 +641,7 @@ extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhand
* @return Indication of success. * @return Indication of success.
*/ */
extern GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle, extern GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle,
GHOST_TWindowOrder order); GHOST_TWindowOrder order);
/** /**
* Swaps front and back buffers of a window. * Swaps front and back buffers of a window.
@@ -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.
@@ -708,10 +708,10 @@ extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
* @param b requested bottom coordinate of the rectangle * @param b requested bottom coordinate of the rectangle
*/ */
extern void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle, extern void GHOST_SetRectangle(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);
/** /**
* Returns whether this rectangle is empty. * Returns whether this rectangle is empty.
@@ -736,7 +736,7 @@ extern GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehand
* @param i The amount of offset given to each extreme (negative values shrink the rectangle). * @param i The amount of offset given to each extreme (negative values shrink the rectangle).
*/ */
extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 i); GHOST_TInt32 i);
/** /**
* Does a union of the rectangle given and this rectangle. * Does a union of the rectangle given and this rectangle.
@@ -745,7 +745,7 @@ extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle,
* @param r The rectangle that is input for the union operation. * @param r The rectangle that is input for the union operation.
*/ */
extern void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle, extern void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle); GHOST_RectangleHandle anotherrectanglehandle);
/** /**
* Grows the rectangle to included a point. * Grows the rectangle to included a point.
@@ -754,8 +754,8 @@ extern void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
* @param y The y-coordinate of the point. * @param y The y-coordinate of the point.
*/ */
extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x, GHOST_TInt32 x,
GHOST_TInt32 y); GHOST_TInt32 y);
/** /**
* Returns whether the point is inside this rectangle. * Returns whether the point is inside this rectangle.
@@ -766,8 +766,8 @@ extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
* @return intean value (true if point is inside). * @return intean value (true if point is inside).
*/ */
extern GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle, extern GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x, GHOST_TInt32 x,
GHOST_TInt32 y); GHOST_TInt32 y);
/** /**
* Returns whether the rectangle is inside this rectangle. * Returns whether the rectangle is inside this rectangle.
@@ -776,7 +776,7 @@ extern GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehan
* @return visibility (not, partially or fully visible). * @return visibility (not, partially or fully visible).
*/ */
extern GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle, extern GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle); GHOST_RectangleHandle anotherrectanglehandle);
/** /**
* Sets rectangle members. * Sets rectangle members.
@@ -786,8 +786,8 @@ extern GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rect
* @param cy requested center y-coordinate of the rectangle * @param cy requested center y-coordinate of the rectangle
*/ */
extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle, extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx, GHOST_TInt32 cx,
GHOST_TInt32 cy); GHOST_TInt32 cy);
/** /**
* Sets rectangle members. * Sets rectangle members.
@@ -800,10 +800,10 @@ extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
* @param h requested height of the rectangle * @param h requested height of the rectangle
*/ */
extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle, extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx, GHOST_TInt32 cx,
GHOST_TInt32 cy, GHOST_TInt32 cy,
GHOST_TInt32 w, GHOST_TInt32 w,
GHOST_TInt32 h); GHOST_TInt32 h);
/** /**
* Clips a rectangle. * Clips a rectangle.
@@ -814,14 +814,14 @@ extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
* @return whether clipping has occurred * @return whether clipping has occurred
*/ */
extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle, extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle); GHOST_RectangleHandle anotherrectanglehandle);
/** /**
* Return the data from the clipboad * Return the data from the clipboad
* @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

View File

@@ -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
}; };

View File

@@ -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:

View File

@@ -129,12 +129,12 @@ class GHOST_IEventConsumer;
* There should be only one system class in an application. * There should be only one system class in an application.
* Therefore, the routines to create and dispose the system are static. * Therefore, the routines to create and dispose the system are static.
* Provides: * Provides:
* -# Time(r) management. * -# Time(r) management.
* -# Display/window management (windows are only created on the main display). * -# Display/window management (windows are only created on the main display).
* -# Event management. * -# Event management.
* -# Cursor shape management (no custom cursors for now). * -# Cursor shape management (no custom cursors for now).
* -# Access to the state of the mouse buttons and the keyboard. * -# Access to the state of the mouse buttons and the keyboard.
* -# Menus for windows with events generated when they are accessed (this is * -# Menus for windows with events generated when they are accessed (this is
* work in progress). * work in progress).
* @author Maarten Gribnau * @author Maarten Gribnau
* @date May 30, 2001 * @date May 30, 2001
@@ -158,25 +158,27 @@ 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:
/*************************************************************************************** /***************************************************************************************
** Time(r) functionality ** Time(r) functionality
***************************************************************************************/ ***************************************************************************************/
/** /**
* Returns the system time. * Returns the system time.
@@ -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,17 +208,17 @@ 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
***************************************************************************************/ ***************************************************************************************/
/** /**
* Returns the number of displays on this system. * Returns the number of displays on this system.
* @return The number of displays. * @return The number of displays.
*/ */
virtual GHOST_TUns8 getNumDisplays() const = 0; virtual GHOST_TUns8 getNumDisplays() const = 0;
/** /**
* Returns the dimensions of the main display on this system. * Returns the dimensions of the main display on this system.
@@ -237,30 +239,30 @@ public:
* @param type The type of drawing context installed in this window. * @param type The type of drawing context installed in this window.
* @param stereoVisual Create a stereo visual for quad buffered stereo. * @param stereoVisual Create a stereo visual for quad buffered stereo.
* @param numOfAASamples Number of samples used for AA (zero if no AA) * @param numOfAASamples Number of samples used for AA (zero if no AA)
* @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) = 0; const GHOST_TEmbedderWindowID parentWindow = 0) = 0;
/** /**
* Dispose a window. * Dispose a window.
* @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.
@@ -294,8 +296,8 @@ public:
virtual bool getFullScreen(void) = 0; virtual bool getFullScreen(void) = 0;
/*************************************************************************************** /***************************************************************************************
** 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.
@@ -315,18 +317,18 @@ 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
***************************************************************************************/ ***************************************************************************************/
/** /**
* Returns the current location of the cursor (location in screen coordinates) * Returns the current location of the cursor (location in screen coordinates)
@@ -346,8 +348,8 @@ public:
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) = 0; virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) = 0;
/*************************************************************************************** /***************************************************************************************
** 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).
@@ -377,15 +379,15 @@ public:
virtual int toggleConsole(int action) = 0; virtual int toggleConsole(int action) = 0;
/*************************************************************************************** /***************************************************************************************
** Access to clipboard. ** Access to clipboard.
***************************************************************************************/ ***************************************************************************************/
/** /**
* Returns the selection buffer * Returns the selection buffer
* @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
}; };

View File

@@ -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

View File

@@ -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
}; };

View File

@@ -70,13 +70,13 @@ public:
* Returns indication as to whether the window is valid. * Returns indication as to whether the window is valid.
* @return The validity of the window. * @return The validity of the window.
*/ */
virtual bool getValid() const = 0; virtual bool getValid() const = 0;
/** /**
* 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.
@@ -108,33 +108,33 @@ public:
* These are screen coordinates. * These are screen coordinates.
* @param bounds The bounding rectangle of the window. * @param bounds The bounding rectangle of the window.
*/ */
virtual void getWindowBounds(GHOST_Rect& bounds) const = 0; virtual void getWindowBounds(GHOST_Rect& bounds) const = 0;
/** /**
* Returns the client rectangle dimensions. * Returns the client rectangle dimensions.
* The left and top members of the rectangle are always zero. * The left and top members of the rectangle are always zero.
* @param bounds The bounding rectangle of the client area of the window. * @param bounds The bounding rectangle of the client area of the window.
*/ */
virtual void getClientBounds(GHOST_Rect& bounds) const = 0; virtual void getClientBounds(GHOST_Rect& bounds) const = 0;
/** /**
* Resizes client rectangle width. * Resizes client rectangle width.
* @param width The new width of the client area of the window. * @param width The new width of the client area of the window.
*/ */
virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0; virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0;
/** /**
* Resizes client rectangle height. * Resizes client rectangle height.
* @param height The new height of the client area of the window. * @param height The new height of the client area of the window.
*/ */
virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0; virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0;
/** /**
* Resizes client rectangle. * Resizes client rectangle.
* @param width The new width of the client area of the window. * @param width The new width of the client area of the window.
* @param height The new height of the client area of the window. * @param height The new height of the client area of the window.
*/ */
virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0; virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0;
/** /**
* Converts a point in screen coordinates to client rectangle coordinates * Converts a point in screen coordinates to client rectangle coordinates
@@ -143,7 +143,7 @@ public:
* @param outX The x-coordinate in the client rectangle. * @param outX The x-coordinate in the client rectangle.
* @param outY The y-coordinate in the client rectangle. * @param outY The y-coordinate in the client rectangle.
*/ */
virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0; virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
/** /**
* Converts a point in screen coordinates to client rectangle coordinates * Converts a point in screen coordinates to client rectangle coordinates
@@ -152,7 +152,7 @@ public:
* @param outX The x-coordinate on the screen. * @param outX The x-coordinate on the screen.
* @param outY The y-coordinate on the screen. * @param outY The y-coordinate on the screen.
*/ */
virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0; virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const = 0;
/** /**
* 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
@@ -232,14 +232,14 @@ 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
***************************************************************************************/ ***************************************************************************************/
/** /**
* 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 % * @param progress The progress %
*/ */
virtual GHOST_TSuccess setProgressBar(float progress) = 0; virtual GHOST_TSuccess setProgressBar(float progress) = 0;
@@ -250,8 +250,8 @@ public:
virtual GHOST_TSuccess endProgressBar() = 0; virtual GHOST_TSuccess endProgressBar() = 0;
/*************************************************************************************** /***************************************************************************************
** Cursor management functionality ** Cursor management functionality
***************************************************************************************/ ***************************************************************************************/
/** /**
* Returns the current cursor shape. * Returns the current cursor shape.
@@ -275,15 +275,15 @@ public:
* @return Indication of success. * @return Indication of success.
*/ */
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2], virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
GHOST_TUns8 mask[16][2], GHOST_TUns8 mask[16][2],
int hotX, int hotX,
int hotY) = 0; int hotY) = 0;
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap, virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
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) = 0; int fg_color, int bg_color) = 0;
/** /**
* Returns the visibility state of the cursor. * Returns the visibility state of the cursor.

View File

@@ -30,7 +30,7 @@
*/ */
#ifndef __GHOST_PATH_API_H__ #ifndef __GHOST_PATH_API_H__
#define __GHOST_PATH_API_H__ #define __GHOST_PATH_API_H__
#include "GHOST_Types.h" #include "GHOST_Types.h"
@@ -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
} }

View File

@@ -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.
@@ -155,7 +158,7 @@ public:
* @param cx requested center x-coordinate of the rectangle * @param cx requested center x-coordinate of the rectangle
* @param cy requested center y-coordinate of the rectangle * @param cy requested center y-coordinate of the rectangle
*/ */
virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy); virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy);
/** /**
* Sets rectangle members. * Sets rectangle members.
@@ -166,7 +169,7 @@ public:
* @param w requested width of the rectangle * @param w requested width of the rectangle
* @param h requested height of the rectangle * @param h requested height of the rectangle
*/ */
virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy, GHOST_TInt32 w, GHOST_TInt32 h); virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy, GHOST_TInt32 w, GHOST_TInt32 h);
/** /**
* Clips a rectangle. * Clips a rectangle.
@@ -175,7 +178,7 @@ public:
* @param r the rectangle to clip * @param r the rectangle to clip
* @return whether clipping has occurred * @return whether clipping has occurred
*/ */
virtual bool clip(GHOST_Rect& r) const; virtual bool clip(GHOST_Rect& r) const;
/** Left coordinate of the rectangle */ /** Left coordinate of the rectangle */
GHOST_TInt32 m_l; GHOST_TInt32 m_l;
@@ -209,7 +212,7 @@ inline void GHOST_Rect::set(GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOS
m_l = l; m_t = t; m_r = r; m_b = b; m_l = l; m_t = t; m_r = r; m_b = b;
} }
inline bool GHOST_Rect::isEmpty() const inline bool GHOST_Rect::isEmpty() const
{ {
return (getWidth() == 0) || (getHeight() == 0); return (getWidth() == 0) || (getHeight() == 0);
} }
@@ -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

View File

@@ -39,22 +39,22 @@
#define GHOST_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name #define GHOST_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
typedef char GHOST_TInt8; typedef char GHOST_TInt8;
typedef unsigned char GHOST_TUns8; typedef unsigned char GHOST_TUns8;
typedef short GHOST_TInt16; typedef short GHOST_TInt16;
typedef unsigned short GHOST_TUns16; typedef unsigned short GHOST_TUns16;
typedef int GHOST_TInt32; typedef int GHOST_TInt32;
typedef unsigned int GHOST_TUns32; typedef unsigned int GHOST_TUns32;
#if defined(WIN32) && !defined(FREE_WINDOWS) #if defined(WIN32) && !defined(FREE_WINDOWS)
typedef __int64 GHOST_TInt64; typedef __int64 GHOST_TInt64;
typedef unsigned __int64 GHOST_TUns64; typedef unsigned __int64 GHOST_TUns64;
#else #else
typedef long long GHOST_TInt64; 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
{ {
@@ -77,9 +77,9 @@ typedef enum {
typedef struct GHOST_TabletData { typedef struct GHOST_TabletData {
GHOST_TTabletMode Active; /* 0=None, 1=Stylus, 2=Eraser */ GHOST_TTabletMode Active; /* 0=None, 1=Stylus, 2=Eraser */
float Pressure; /* range 0.0 (not touching) to 1.0 (full pressure) */ float Pressure; /* range 0.0 (not touching) to 1.0 (full pressure) */
float Xtilt; /* range 0.0 (upright) to 1.0 (tilted fully against the tablet surface) */ float Xtilt; /* range 0.0 (upright) to 1.0 (tilted fully against the tablet surface) */
float Ytilt; /* as above */ float Ytilt; /* as above */
} GHOST_TabletData; } GHOST_TabletData;
@@ -152,14 +152,14 @@ typedef enum {
typedef enum { typedef enum {
GHOST_kEventUnknown = 0, GHOST_kEventUnknown = 0,
GHOST_kEventCursorMove, /// Mouse move event GHOST_kEventCursorMove, /// Mouse move event
GHOST_kEventButtonDown, /// Mouse button event GHOST_kEventButtonDown, /// Mouse button event
GHOST_kEventButtonUp, /// Mouse button event GHOST_kEventButtonUp, /// Mouse button event
GHOST_kEventWheel, /// Mouse wheel event GHOST_kEventWheel, /// Mouse wheel event
GHOST_kEventTrackpad, /// Trackpad event GHOST_kEventTrackpad, /// Trackpad event
GHOST_kEventNDOFMotion, /// N degree of freedom device motion event GHOST_kEventNDOFMotion, /// N degree of freedom device motion event
GHOST_kEventNDOFButton, /// N degree of freedom device button event GHOST_kEventNDOFButton, /// N degree of freedom device button event
GHOST_kEventKeyDown, GHOST_kEventKeyDown,
GHOST_kEventKeyUp, GHOST_kEventKeyUp,
@@ -289,8 +289,8 @@ typedef enum {
GHOST_kKeyRightControl, GHOST_kKeyRightControl,
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,
@@ -363,13 +363,13 @@ typedef enum {
} GHOST_TKey; } GHOST_TKey;
typedef enum { typedef enum {
GHOST_kGrabDisable = 0, /* grab not set */ GHOST_kGrabDisable = 0, /* grab not set */
GHOST_kGrabNormal, /* no cursor adjustments */ GHOST_kGrabNormal, /* no cursor adjustments */
GHOST_kGrabWrap, /* wrap the mouse location to prevent limiting screen bounds */ GHOST_kGrabWrap, /* wrap the mouse location to prevent limiting screen bounds */
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] */
@@ -448,14 +448,14 @@ typedef struct {
// These use blender standard view coordinates, with positive rotations being CCW about the axis. // These use blender standard view coordinates, with positive rotations being CCW about the axis.
float tx, ty, tz; // translation float tx, ty, tz; // translation
float rx, ry, rz; // rotation: float rx, ry, rz; // rotation:
// axis = (rx,ry,rz).normalized // axis = (rx,ry,rz).normalized
// amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg] // amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg]
float dt; // time since previous NDOF Motion event float dt; // time since previous NDOF Motion event
GHOST_TProgress progress; // Starting, InProgress or Finishing (for modal handlers) GHOST_TProgress progress; // Starting, InProgress or Finishing (for modal handlers)
} 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;
@@ -464,7 +464,7 @@ typedef struct {
typedef struct { typedef struct {
/** The key code. */ /** The key code. */
GHOST_TKey key; GHOST_TKey key;
/* ascii / utf8: both should always be set when possible, /* ascii / utf8: both should always be set when possible,
* - ascii may be '\0' however if the user presses a non ascii key * - ascii may be '\0' however if the user presses a non ascii key
@@ -476,20 +476,20 @@ typedef struct {
* use ascii, unicode is ignored - campbell. * use ascii, unicode is ignored - campbell.
*/ */
/** The ascii code for the key event ('\0' if none). */ /** The ascii code for the key event ('\0' if none). */
char ascii; char ascii;
/** The unicode character. if the length is 6, not NULL terminated if all 6 are set */ /** The unicode character. if the length is 6, not NULL terminated if all 6 are set */
char utf8_buf[6]; char utf8_buf[6];
} GHOST_TEventKeyData; } GHOST_TEventKeyData;
typedef struct { typedef struct {
/** Number of pixels on a line. */ /** Number of pixels on a line. */
GHOST_TUns32 xPixels; GHOST_TUns32 xPixels;
/** Number of lines. */ /** Number of lines. */
GHOST_TUns32 yPixels; GHOST_TUns32 yPixels;
/** Numberof bits per pixel. */ /** Numberof bits per pixel. */
GHOST_TUns32 bpp; GHOST_TUns32 bpp;
/** Refresh rate (in Hertz). */ /** Refresh rate (in Hertz). */
GHOST_TUns32 frequency; GHOST_TUns32 frequency;
} GHOST_DisplaySetting; } GHOST_DisplaySetting;
@@ -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__

View File

@@ -42,37 +42,38 @@ GHOST_Buttons::GHOST_Buttons()
bool GHOST_Buttons::get(GHOST_TButtonMask mask) const bool GHOST_Buttons::get(GHOST_TButtonMask mask) const
{ {
switch (mask) { switch (mask) {
case GHOST_kButtonMaskLeft: case GHOST_kButtonMaskLeft:
return m_ButtonLeft; return m_ButtonLeft;
case GHOST_kButtonMaskMiddle: case GHOST_kButtonMaskMiddle:
return m_ButtonMiddle; return m_ButtonMiddle;
case GHOST_kButtonMaskRight: case GHOST_kButtonMaskRight:
return m_ButtonRight; return m_ButtonRight;
default: default:
return false; return false;
} }
} }
void GHOST_Buttons::set(GHOST_TButtonMask mask, bool down) void GHOST_Buttons::set(GHOST_TButtonMask mask, bool down)
{ {
switch (mask) { switch (mask) {
case GHOST_kButtonMaskLeft: case GHOST_kButtonMaskLeft:
m_ButtonLeft = down; break; m_ButtonLeft = down; break;
case GHOST_kButtonMaskMiddle: case GHOST_kButtonMaskMiddle:
m_ButtonMiddle = down; break; m_ButtonMiddle = down; break;
case GHOST_kButtonMaskRight: case GHOST_kButtonMaskRight:
m_ButtonRight = down; break; m_ButtonRight = down; break;
default: default:
break; break;
} }
} }
void GHOST_Buttons::clear() void GHOST_Buttons::clear()
{ {
m_ButtonLeft = false; m_ButtonLeft = false;
m_ButtonMiddle = false; m_ButtonMiddle = false;
m_ButtonRight = false; m_ButtonRight = false;
} }
GHOST_Buttons::~GHOST_Buttons() {} GHOST_Buttons::~GHOST_Buttons() {
}

View File

@@ -69,9 +69,9 @@ struct GHOST_Buttons {
*/ */
virtual void clear(); virtual void clear();
GHOST_TUns8 m_ButtonLeft : 1; GHOST_TUns8 m_ButtonLeft : 1;
GHOST_TUns8 m_ButtonMiddle : 1; GHOST_TUns8 m_ButtonMiddle : 1;
GHOST_TUns8 m_ButtonRight : 1; GHOST_TUns8 m_ButtonRight : 1;
}; };
#endif // __GHOST_BUTTONS_H__ #endif // __GHOST_BUTTONS_H__

View File

@@ -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();
} }
@@ -89,12 +89,12 @@ GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle, GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
GHOST_TUns64 delay, GHOST_TUns64 delay,
GHOST_TUns64 interval, GHOST_TUns64 interval,
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);
} }
@@ -102,10 +102,10 @@ 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,46 +133,46 @@ 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,
GHOST_TUns32 height, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TWindowState state,
GHOST_TDrawingContextType type, GHOST_TDrawingContextType type,
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;
return (GHOST_WindowHandle) system->createWindow(title, left, top, width, height, return (GHOST_WindowHandle) system->createWindow(title, left, top, width, height,
state, type, bstereoVisual, numOfAASamples); state, type, bstereoVisual, numOfAASamples);
} }
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);
} }
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);
} }
@@ -180,10 +180,10 @@ 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();
} }
@@ -284,45 +284,45 @@ 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);
} }
GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle, GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
GHOST_TUns8 bitmap[16][2], GHOST_TUns8 bitmap[16][2],
GHOST_TUns8 mask[16][2], GHOST_TUns8 mask[16][2],
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);
} }
GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle, GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
GHOST_TUns8 *bitmap, GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask, GHOST_TUns8 *mask,
int sizex, int sizex,
int sizey, int sizey,
int hotX, int hotX,
int hotY, int hotY,
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);
} }
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();
} }
@@ -330,20 +330,20 @@ 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);
} }
@@ -351,23 +351,23 @@ GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle, 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);
} }
GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle, 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;
@@ -396,12 +396,12 @@ 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();
} }
@@ -462,9 +462,9 @@ 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,17 +473,17 @@ 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();
} }
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();
} }
@@ -509,9 +509,9 @@ 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,26 +519,26 @@ 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());
return ctitle; return ctitle;
} }
@@ -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,15 +572,15 @@ 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;
} }
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);
} }
@@ -588,9 +588,9 @@ 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);
} }
@@ -598,10 +598,10 @@ GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle,
GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle, 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);
} }
@@ -609,12 +609,12 @@ 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);
} }
@@ -622,12 +622,12 @@ 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();
} }
@@ -644,9 +644,9 @@ 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,16 +654,16 @@ 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);
} }
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,54 +690,54 @@ 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;
} }
void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle, void GHOST_SetRectangle(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*)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;
@@ -767,37 +767,37 @@ 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);
} }
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);
} }
void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, 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);
} }
GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x, GHOST_TInt32 x,
GHOST_TInt32 y) GHOST_TInt32 y)
{ {
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;
@@ -806,11 +806,11 @@ GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle, GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle) GHOST_RectangleHandle anotherrectanglehandle)
{ {
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;
} }
@@ -818,56 +818,56 @@ GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectangleha
void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle, 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);
} }
void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle, void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx, GHOST_TInt32 cx,
GHOST_TInt32 cy, GHOST_TInt32 cy,
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);
} }
GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle) GHOST_RectangleHandle anotherrectanglehandle)
{ {
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);
} }

View File

@@ -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;
} }

View File

@@ -51,8 +51,8 @@ public:
* @param userData The data passed back though the call-back routine. * @param userData The data passed back though the call-back routine.
*/ */
GHOST_CallbackEventConsumer( GHOST_CallbackEventConsumer(
GHOST_EventCallbackProcPtr eventCallback, GHOST_EventCallbackProcPtr eventCallback,
GHOST_TUserDataPtr userData); GHOST_TUserDataPtr userData);
/** /**
* Destructor. * Destructor.
@@ -66,13 +66,13 @@ 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. */
GHOST_EventCallbackProcPtr m_eventCallback; GHOST_EventCallbackProcPtr m_eventCallback;
/** The data passed back though the call-back routine. */ /** The data passed back though the call-back routine. */
GHOST_TUserDataPtr m_userData; GHOST_TUserDataPtr m_userData;
}; };
#endif // __GHOST_CALLBACKEVENTCONSUMER_H__ #endif // __GHOST_CALLBACKEVENTCONSUMER_H__

View File

@@ -41,8 +41,8 @@
GHOST_DisplayManager::GHOST_DisplayManager( GHOST_DisplayManager::GHOST_DisplayManager(
void) void)
: m_settingsInitialized(false) : m_settingsInitialized(false)
{ {
} }
@@ -54,7 +54,7 @@ GHOST_DisplayManager::~GHOST_DisplayManager(void)
GHOST_TSuccess GHOST_TSuccess
GHOST_DisplayManager::initialize( GHOST_DisplayManager::initialize(
void) void)
{ {
GHOST_TSuccess success; GHOST_TSuccess success;
if (!m_settingsInitialized) { if (!m_settingsInitialized) {
@@ -70,7 +70,7 @@ GHOST_DisplayManager::initialize(
GHOST_TSuccess GHOST_TSuccess
GHOST_DisplayManager::getNumDisplays( GHOST_DisplayManager::getNumDisplays(
GHOST_TUns8& /*numDisplays*/) const GHOST_TUns8& /*numDisplays*/) const
{ {
// Don't know if we have a display... // Don't know if we have a display...
return GHOST_kFailure; return GHOST_kFailure;
@@ -79,8 +79,8 @@ GHOST_DisplayManager::getNumDisplays(
GHOST_TSuccess GHOST_TSuccess
GHOST_DisplayManager::getNumDisplaySettings( GHOST_DisplayManager::getNumDisplaySettings(
GHOST_TUns8 display, GHOST_TUns8 display,
GHOST_TInt32& numSettings) const GHOST_TInt32& numSettings) const
{ {
GHOST_TSuccess success; GHOST_TSuccess success;
@@ -101,9 +101,9 @@ GHOST_DisplayManager::getNumDisplaySettings(
GHOST_TSuccess GHOST_TSuccess
GHOST_DisplayManager::getDisplaySetting( GHOST_DisplayManager::getDisplaySetting(
GHOST_TUns8 display, GHOST_TUns8 display,
GHOST_TInt32 index, GHOST_TInt32 index,
GHOST_DisplaySetting& setting) const GHOST_DisplaySetting& setting) const
{ {
GHOST_TSuccess success; GHOST_TSuccess success;
@@ -124,8 +124,8 @@ GHOST_DisplayManager::getDisplaySetting(
GHOST_TSuccess GHOST_TSuccess
GHOST_DisplayManager::getCurrentDisplaySetting( GHOST_DisplayManager::getCurrentDisplaySetting(
GHOST_TUns8 /*display*/, GHOST_TUns8 /*display*/,
GHOST_DisplaySetting& /*setting*/) const GHOST_DisplaySetting& /*setting*/) const
{ {
return GHOST_kFailure; return GHOST_kFailure;
} }
@@ -133,8 +133,8 @@ GHOST_DisplayManager::getCurrentDisplaySetting(
GHOST_TSuccess GHOST_TSuccess
GHOST_DisplayManager::setCurrentDisplaySetting( GHOST_DisplayManager::setCurrentDisplaySetting(
GHOST_TUns8 /*display*/, GHOST_TUns8 /*display*/,
const GHOST_DisplaySetting& /*setting*/) const GHOST_DisplaySetting& /*setting*/)
{ {
return GHOST_kFailure; return GHOST_kFailure;
} }
@@ -142,18 +142,18 @@ GHOST_DisplayManager::setCurrentDisplaySetting(
GHOST_TSuccess GHOST_TSuccess
GHOST_DisplayManager::findMatch( GHOST_DisplayManager::findMatch(
GHOST_TUns8 display, GHOST_TUns8 display,
const GHOST_DisplaySetting& setting, const GHOST_DisplaySetting& setting,
GHOST_DisplaySetting& match) const GHOST_DisplaySetting& match) const
{ {
GHOST_TSuccess success = GHOST_kSuccess; GHOST_TSuccess success = GHOST_kSuccess;
GHOST_ASSERT(m_settingsInitialized, "GHOST_DisplayManager::findMatch(): m_settingsInitialized=false"); GHOST_ASSERT(m_settingsInitialized, "GHOST_DisplayManager::findMatch(): m_settingsInitialized=false");
int criteria[4] = { int criteria[4] = {
(int)setting.xPixels, (int)setting.xPixels,
(int)setting.yPixels, (int)setting.yPixels,
(int)setting.bpp, (int)setting.bpp,
(int)setting.frequency (int)setting.frequency
}; };
int capabilities[4]; int capabilities[4];
double field, score; double field, score;
@@ -195,7 +195,7 @@ GHOST_DisplayManager::findMatch(
GHOST_TSuccess GHOST_TSuccess
GHOST_DisplayManager::initializeSettings( GHOST_DisplayManager::initializeSettings(
void) void)
{ {
GHOST_TUns8 numDisplays; GHOST_TUns8 numDisplays;
GHOST_TSuccess success = getNumDisplays(numDisplays); GHOST_TSuccess success = getNumDisplays(numDisplays);

View File

@@ -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,19 +81,19 @@ 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);
setting.bpp = getValue(displayModeValues, kCGDisplayBitsPerPixel); setting.bpp = getValue(displayModeValues, kCGDisplayBitsPerPixel);
setting.frequency = getValue(displayModeValues, kCGDisplayRefreshRate); setting.frequency = getValue(displayModeValues, kCGDisplayRefreshRate);
#ifdef GHOST_DEBUG #ifdef GHOST_DEBUG
printf("display mode: width=%d, height=%d, bpp=%d, frequency=%d\n", setting.xPixels, setting.yPixels, setting.bpp, setting.frequency); printf("display mode: width=%d, height=%d, bpp=%d, frequency=%d\n", setting.xPixels, setting.yPixels, setting.bpp, setting.frequency);
@@ -105,14 +105,14 @@ 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]);
setting.xPixels = getValue(displayModeValues, kCGDisplayWidth); setting.xPixels = getValue(displayModeValues, kCGDisplayWidth);
setting.yPixels = getValue(displayModeValues, kCGDisplayHeight); setting.yPixels = getValue(displayModeValues, kCGDisplayHeight);
setting.bpp = getValue(displayModeValues, kCGDisplayBitsPerPixel); setting.bpp = getValue(displayModeValues, kCGDisplayBitsPerPixel);
setting.frequency = getValue(displayModeValues, kCGDisplayRefreshRate); setting.frequency = getValue(displayModeValues, kCGDisplayRefreshRate);
#ifdef GHOST_DEBUG #ifdef GHOST_DEBUG
printf("current display mode: width=%d, height=%d, bpp=%d, frequency=%d\n", setting.xPixels, setting.yPixels, setting.bpp, setting.frequency); printf("current display mode: width=%d, height=%d, bpp=%d, frequency=%d\n", setting.xPixels, setting.yPixels, setting.bpp, setting.frequency);
@@ -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");
@@ -135,12 +135,12 @@ GHOST_TSuccess GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(GHOST_TUns8
#endif // GHOST_DEBUG #endif // GHOST_DEBUG
CFDictionaryRef displayModeValues = ::CGDisplayBestModeForParametersAndRefreshRate( CFDictionaryRef displayModeValues = ::CGDisplayBestModeForParametersAndRefreshRate(
m_displayIDs[display], m_displayIDs[display],
(size_t)setting.bpp, (size_t)setting.bpp,
(size_t)setting.xPixels, (size_t)setting.xPixels,
(size_t)setting.yPixels, (size_t)setting.yPixels,
(CGRefreshRate)setting.frequency, (CGRefreshRate)setting.frequency,
NULL); NULL);
#ifdef GHOST_DEBUG #ifdef GHOST_DEBUG
printf("GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(): switching to:\n"); printf("GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(): switching to:\n");
@@ -158,20 +158,20 @@ GHOST_TSuccess GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(GHOST_TUns8
long GHOST_DisplayManagerCarbon::getValue(CFDictionaryRef values, CFStringRef key) const long GHOST_DisplayManagerCarbon::getValue(CFDictionaryRef values, CFStringRef key) const
{ {
CFNumberRef numberValue = (CFNumberRef) CFDictionaryGetValue(values, key); CFNumberRef numberValue = (CFNumberRef) CFDictionaryGetValue(values, key);
if (!numberValue) if (!numberValue)
{ {
return -1; return -1;
} }
long intValue; long intValue;
if (!CFNumberGetValue(numberValue, kCFNumberLongType, &intValue)) if (!CFNumberGetValue(numberValue, kCFNumberLongType, &intValue))
{ {
return -1; return -1;
} }
return intValue; return intValue;
} }

View File

@@ -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;
}; };

View File

@@ -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;
}; };

View File

@@ -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;
} }
@@ -140,8 +140,10 @@ GHOST_DisplayManagerSDL:: setCurrentDisplaySetting(GHOST_TUns8 display,
SDL_GetDisplayMode(display, i, &mode); SDL_GetDisplayMode(display, i, &mode);
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;
@@ -175,7 +177,7 @@ GHOST_DisplayManagerSDL:: setCurrentDisplaySetting(GHOST_TUns8 display,
} }
else { else {
/* this is a problem for the BGE player :S, perhaps SDL2 will resolve at some point. /* this is a problem for the BGE player :S, perhaps SDL2 will resolve at some point.
* we really need SDL_SetDisplayModeForDisplay() to become an API func! - campbell */ * we really need SDL_SetDisplayModeForDisplay() to become an API func! - campbell */
printf("no windows available, cant fullscreen"); printf("no windows available, cant fullscreen");
/* do not fail, we will try again later when the window is created - wander */ /* do not fail, we will try again later when the window is created - wander */

View File

@@ -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;
}; };

View File

@@ -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,16 +79,16 @@ 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)) {
#ifdef GHOST_DEBUG #ifdef GHOST_DEBUG
printf("display mode: width=%d, height=%d, bpp=%d, frequency=%d\n", dm.dmPelsWidth, dm.dmPelsHeight, dm.dmBitsPerPel, dm.dmDisplayFrequency); printf("display mode: width=%d, height=%d, bpp=%d, frequency=%d\n", dm.dmPelsWidth, dm.dmPelsHeight, dm.dmBitsPerPel, dm.dmDisplayFrequency);
#endif // GHOST_DEBUG #endif // GHOST_DEBUG
setting.xPixels = dm.dmPelsWidth; setting.xPixels = dm.dmPelsWidth;
setting.yPixels = dm.dmPelsHeight; setting.yPixels = dm.dmPelsHeight;
setting.bpp = dm.dmBitsPerPel; setting.bpp = dm.dmBitsPerPel;
/* When you call the EnumDisplaySettings function, the dmDisplayFrequency member /* When you call the EnumDisplaySettings function, the dmDisplayFrequency member
* may return with the value 0 or 1. These values represent the display hardware's * may return with the value 0 or 1. These values represent the display hardware's
* default refresh rate. This default rate is typically set by switches on a display * default refresh rate. This default rate is typically set by switches on a display
@@ -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);
@@ -127,21 +127,22 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(GHOST_TUns8 d
int i = 0; int i = 0;
while (::EnumDisplaySettings(NULL, i++, &dm)) { while (::EnumDisplaySettings(NULL, i++, &dm)) {
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");
printf(" dmBitsPerPel=%d\n", dm.dmBitsPerPel); printf(" dmBitsPerPel=%d\n", dm.dmBitsPerPel);
@@ -154,31 +155,31 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(GHOST_TUns8 d
#ifdef GHOST_DEBUG #ifdef GHOST_DEBUG
switch (status) switch (status)
{ {
case DISP_CHANGE_SUCCESSFUL: case DISP_CHANGE_SUCCESSFUL:
printf("display change: The settings change was successful.\n"); printf("display change: The settings change was successful.\n");
break; break;
case DISP_CHANGE_RESTART: case DISP_CHANGE_RESTART:
printf("display change: The computer must be restarted in order for the graphics mode to work.\n"); printf("display change: The computer must be restarted in order for the graphics mode to work.\n");
break; break;
case DISP_CHANGE_BADFLAGS: case DISP_CHANGE_BADFLAGS:
printf("display change: An invalid set of flags was passed in.\n"); printf("display change: An invalid set of flags was passed in.\n");
break; break;
case DISP_CHANGE_BADPARAM: case DISP_CHANGE_BADPARAM:
printf("display change: An invalid parameter was passed in. This can include an invalid flag or combination of flags.\n"); printf("display change: An invalid parameter was passed in. This can include an invalid flag or combination of flags.\n");
break; break;
case DISP_CHANGE_FAILED: case DISP_CHANGE_FAILED:
printf("display change: The display driver failed the specified graphics mode.\n"); printf("display change: The display driver failed the specified graphics mode.\n");
break; break;
case DISP_CHANGE_BADMODE: case DISP_CHANGE_BADMODE:
printf("display change: The graphics mode is not supported.\n"); printf("display change: The graphics mode is not supported.\n");
break; break;
case DISP_CHANGE_NOTUPDATED: case DISP_CHANGE_NOTUPDATED:
printf("display change: Windows NT: Unable to write settings to the registry.\n"); printf("display change: Windows NT: Unable to write settings to the registry.\n");
break; break;
default: default:
printf("display change: Return value invalid\n"); printf("display change: Return value invalid\n");
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;
} }

View File

@@ -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();
@@ -63,23 +63,22 @@ 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);
@@ -357,16 +353,16 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char * &out)
out = NULL; //caller should free if != NULL out = NULL; //caller should free if != NULL
// Get the required size. // Get the required size.
size = ::WideCharToMultiByte(CP_ACP, //System Default Codepage size = ::WideCharToMultiByte(CP_ACP, //System Default Codepage
0x00000400, // WC_NO_BEST_FIT_CHARS 0x00000400, // WC_NO_BEST_FIT_CHARS
in, in,
-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!!!");
@@ -382,15 +378,15 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char * &out)
} }
size = ::WideCharToMultiByte(CP_ACP, size = ::WideCharToMultiByte(CP_ACP,
0x00000400, 0x00000400,
in, in,
-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,15 +404,15 @@ 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,
0, 0,
(LPTSTR)&s, (LPTSTR)&s,
0, 0,
NULL) NULL)
) )
{ {
printf("\nLastError: (%d) %s\n", (int)err, s); printf("\nLastError: (%d) %s\n", (int)err, s);
LocalFree(s); LocalFree(s);

View File

@@ -47,22 +47,22 @@ 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.
* - Communicating target feedback to the source so the source application * - Communicating target feedback to the source so the source application
* can provide appropriate visual feedback such as setting the cursor. * can provide appropriate visual feedback such as setting the cursor.
* - Implementing drag scrolling. * - Implementing drag scrolling.
* - Registering and revoking its application windows as drop targets. * - Registering and revoking its application windows as drop targets.
* *
* The IDropTarget interface contains methods that handle all these * The IDropTarget interface contains methods that handle all these
* responsibilities except registering and revoking the application window * responsibilities except registering and revoking the application window
@@ -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 '?'.
@@ -143,16 +143,15 @@ private:
/* Private member variables */ /* Private member variables */
/* COM reference count. */ /* COM reference count. */
LONG m_cRef; LONG m_cRef;
/* 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__

View File

@@ -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;
}; };

View File

@@ -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;

View File

@@ -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;

View File

@@ -83,8 +83,8 @@ 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)
{ {
m_dragnDropEventData.x = x; m_dragnDropEventData.x = x;
@@ -102,22 +102,22 @@ 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);
} }
break; break;
case GHOST_kDragnDropTypeString: case GHOST_kDragnDropTypeString:
free(m_dragnDropEventData.data); free(m_dragnDropEventData.data);
break; break;
default: default:
break; break;

View File

@@ -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;
} }

View File

@@ -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,16 +194,16 @@ 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");
/* /*
* Found an event for this window, remove it. * Found an event for this window, remove it.
* The iterator will become invalid. * The iterator will become invalid.
@@ -213,23 +212,22 @@ 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");
/* /*
* Found an event of this type for the window, remove it. * Found an event of this type for the window, remove it.
* The iterator will become invalid. * The iterator will become invalid.
@@ -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();
} }

View File

@@ -64,21 +64,21 @@ public:
* Returns the number of events currently on the stack. * Returns the number of events currently on the stack.
* @return The number of events on the stack. * @return The number of events on the stack.
*/ */
virtual GHOST_TUns32 getNumEvents(); virtual GHOST_TUns32 getNumEvents();
/** /**
* Returns the number of events of a certain type currently on the stack. * Returns the number of events of a certain type currently on the stack.
* @param type The type of events to be counted. * @param type The type of events to be counted.
* @return The number of events on the stack of this type. * @return The number of events on the stack of this type.
*/ */
virtual GHOST_TUns32 getNumEvents(GHOST_TEventType type); virtual GHOST_TUns32 getNumEvents(GHOST_TEventType type);
/** /**
* Return the event at the top of the stack without removal. * Return the event at the top of the stack without removal.
* 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,23 +113,23 @@ 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.
* @param window The window to remove events for. * @param window The window to remove events for.
*/ */
virtual void virtual void
removeWindowEvents( removeWindowEvents(
GHOST_IWindow* window GHOST_IWindow *window
); );
/** /**
* Removes all events of a certain type from the stack. * Removes all events of a certain type from the stack.
@@ -138,11 +138,11 @@ public:
* @param type The type of events to be removed. * @param type The type of events to be removed.
* @param window The window to remove the events for. * @param window The window to remove the events for.
*/ */
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;

View File

@@ -32,31 +32,30 @@
class GHOST_EventNDOFMotion : public GHOST_Event class GHOST_EventNDOFMotion : public GHOST_Event
{
protected:
GHOST_TEventNDOFMotionData m_axisData;
public:
GHOST_EventNDOFMotion(GHOST_TUns64 time, GHOST_IWindow *window)
: GHOST_Event(time, GHOST_kEventNDOFMotion, window)
{ {
protected: m_data = &m_axisData;
GHOST_TEventNDOFMotionData m_axisData; }
};
public:
GHOST_EventNDOFMotion(GHOST_TUns64 time, GHOST_IWindow* window)
: GHOST_Event(time, GHOST_kEventNDOFMotion, window)
{
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:
GHOST_EventNDOFButton(GHOST_TUns64 time, GHOST_IWindow* window)
: GHOST_Event(time, GHOST_kEventNDOFButton, window)
{
m_data = &m_buttonData;
}
};
public:
GHOST_EventNDOFButton(GHOST_TUns64 time, GHOST_IWindow *window)
: GHOST_Event(time, GHOST_kEventNDOFButton, window)
{
m_data = &m_buttonData;
}
};
#endif // __GHOST_EVENTNDOF_H__ #endif // __GHOST_EVENTNDOF_H__

View File

@@ -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;
@@ -48,136 +48,136 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event)
std::cout << "\nGHOST_EventPrinter::processEvent, time: " << (GHOST_TInt32)event->getTime() << ", type: "; std::cout << "\nGHOST_EventPrinter::processEvent, time: " << (GHOST_TInt32)event->getTime() << ", type: ";
switch (event->getType()) { switch (event->getType()) {
case GHOST_kEventUnknown: case GHOST_kEventUnknown:
std::cout << "GHOST_kEventUnknown"; handled = false; std::cout << "GHOST_kEventUnknown"; handled = false;
break; break;
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;
} }
break; break;
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;
} }
break; break;
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;
} }
break; break;
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:
break; break;
} }
} }
break; break;
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!!";
} }
break; break;
case GHOST_kEventQuit: case GHOST_kEventQuit:
std::cout << "GHOST_kEventQuit"; std::cout << "GHOST_kEventQuit";
break; break;
case GHOST_kEventWindowClose: case GHOST_kEventWindowClose:
std::cout << "GHOST_kEventWindowClose"; std::cout << "GHOST_kEventWindowClose";
break; break;
case GHOST_kEventWindowActivate: case GHOST_kEventWindowActivate:
std::cout << "GHOST_kEventWindowActivate"; std::cout << "GHOST_kEventWindowActivate";
break; break;
case GHOST_kEventWindowDeactivate: case GHOST_kEventWindowDeactivate:
std::cout << "GHOST_kEventWindowDeactivate"; std::cout << "GHOST_kEventWindowDeactivate";
break; break;
case GHOST_kEventWindowUpdate: case GHOST_kEventWindowUpdate:
std::cout << "GHOST_kEventWindowUpdate"; std::cout << "GHOST_kEventWindowUpdate";
break; break;
case GHOST_kEventWindowSize: case GHOST_kEventWindowSize:
std::cout << "GHOST_kEventWindowSize"; std::cout << "GHOST_kEventWindowSize";
break; break;
default: default:
std::cout << "not found"; handled = false; std::cout << "not found"; handled = false;
break; break;
} }
return handled; return handled;
} }
@@ -187,154 +187,159 @@ 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 */ }
/* This should really test XK_F11 but that doesn't work */ else if (key == 268828432) { /* solaris keyboards are messed up */
/* 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 */ }
/* This should really test XK_F12 but that doesn't work */ else if (key == 268828433) { /* solaris keyboards are messed up */
/* 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";
break; break;
case GHOST_kKeyTab: case GHOST_kKeyTab:
tstr = "Tab"; tstr = "Tab";
break; break;
case GHOST_kKeyLinefeed: case GHOST_kKeyLinefeed:
tstr = "Linefeed"; tstr = "Linefeed";
break; break;
case GHOST_kKeyClear: case GHOST_kKeyClear:
tstr = "Clear"; tstr = "Clear";
break; break;
case GHOST_kKeyEnter: case GHOST_kKeyEnter:
tstr = "Enter"; tstr = "Enter";
break; break;
case GHOST_kKeyEsc: case GHOST_kKeyEsc:
tstr = "Esc"; tstr = "Esc";
break; break;
case GHOST_kKeySpace: case GHOST_kKeySpace:
tstr = "Space"; tstr = "Space";
break; break;
case GHOST_kKeyQuote: case GHOST_kKeyQuote:
tstr = "Quote"; tstr = "Quote";
break; break;
case GHOST_kKeyBackslash: case GHOST_kKeyBackslash:
tstr = "\\"; tstr = "\\";
break; break;
case GHOST_kKeyAccentGrave: case GHOST_kKeyAccentGrave:
tstr = "`"; tstr = "`";
break; break;
case GHOST_kKeyLeftShift: case GHOST_kKeyLeftShift:
tstr = "LeftShift"; tstr = "LeftShift";
break; break;
case GHOST_kKeyRightShift: case GHOST_kKeyRightShift:
tstr = "RightShift"; tstr = "RightShift";
break; break;
case GHOST_kKeyLeftControl: case GHOST_kKeyLeftControl:
tstr = "LeftControl"; tstr = "LeftControl";
break; break;
case GHOST_kKeyRightControl: case GHOST_kKeyRightControl:
tstr = "RightControl"; tstr = "RightControl";
break; break;
case GHOST_kKeyLeftAlt: case GHOST_kKeyLeftAlt:
tstr = "LeftAlt"; tstr = "LeftAlt";
break; break;
case GHOST_kKeyRightAlt: case GHOST_kKeyRightAlt:
tstr = "RightAlt"; tstr = "RightAlt";
break; break;
case GHOST_kKeyOS: case GHOST_kKeyOS:
tstr = "OS"; tstr = "OS";
break; break;
case GHOST_kKeyGrLess: case GHOST_kKeyGrLess:
// PC german! // PC german!
tstr = "GrLess"; tstr = "GrLess";
break; break;
case GHOST_kKeyCapsLock: case GHOST_kKeyCapsLock:
tstr = "CapsLock"; tstr = "CapsLock";
break; break;
case GHOST_kKeyNumLock: case GHOST_kKeyNumLock:
tstr = "NumLock"; tstr = "NumLock";
break; break;
case GHOST_kKeyScrollLock: case GHOST_kKeyScrollLock:
tstr = "ScrollLock"; tstr = "ScrollLock";
break; break;
case GHOST_kKeyLeftArrow: case GHOST_kKeyLeftArrow:
tstr = "LeftArrow"; tstr = "LeftArrow";
break; break;
case GHOST_kKeyRightArrow: case GHOST_kKeyRightArrow:
tstr = "RightArrow"; tstr = "RightArrow";
break; break;
case GHOST_kKeyUpArrow: case GHOST_kKeyUpArrow:
tstr = "UpArrow"; tstr = "UpArrow";
break; break;
case GHOST_kKeyDownArrow: case GHOST_kKeyDownArrow:
tstr = "DownArrow"; tstr = "DownArrow";
break; break;
case GHOST_kKeyPrintScreen: case GHOST_kKeyPrintScreen:
tstr = "PrintScreen"; tstr = "PrintScreen";
break; break;
case GHOST_kKeyPause: case GHOST_kKeyPause:
tstr = "Pause"; tstr = "Pause";
break; break;
case GHOST_kKeyInsert: case GHOST_kKeyInsert:
tstr = "Insert"; tstr = "Insert";
break; break;
case GHOST_kKeyDelete: case GHOST_kKeyDelete:
tstr = "Delete"; tstr = "Delete";
break; break;
case GHOST_kKeyHome: case GHOST_kKeyHome:
tstr = "Home"; tstr = "Home";
break; break;
case GHOST_kKeyEnd: case GHOST_kKeyEnd:
tstr = "End"; tstr = "End";
break; break;
case GHOST_kKeyUpPage: case GHOST_kKeyUpPage:
tstr = "UpPage"; tstr = "UpPage";
break; break;
case GHOST_kKeyDownPage: case GHOST_kKeyDownPage:
tstr = "DownPage"; tstr = "DownPage";
break; break;
case GHOST_kKeyNumpadPeriod: case GHOST_kKeyNumpadPeriod:
tstr = "NumpadPeriod"; tstr = "NumpadPeriod";
break; break;
case GHOST_kKeyNumpadEnter: case GHOST_kKeyNumpadEnter:
tstr = "NumpadEnter"; tstr = "NumpadEnter";
break; break;
case GHOST_kKeyNumpadPlus: case GHOST_kKeyNumpadPlus:
tstr = "NumpadPlus"; tstr = "NumpadPlus";
break; break;
case GHOST_kKeyNumpadMinus: case GHOST_kKeyNumpadMinus:
tstr = "NumpadMinus"; tstr = "NumpadMinus";
break; break;
case GHOST_kKeyNumpadAsterisk: case GHOST_kKeyNumpadAsterisk:
tstr = "NumpadAsterisk"; tstr = "NumpadAsterisk";
break; break;
case GHOST_kKeyNumpadSlash: case GHOST_kKeyNumpadSlash:
tstr = "NumpadSlash"; tstr = "NumpadSlash";
break; break;
case GHOST_kKeyMediaPlay: case GHOST_kKeyMediaPlay:
tstr = "MediaPlayPause"; tstr = "MediaPlayPause";
break; break;
case GHOST_kKeyMediaStop: case GHOST_kKeyMediaStop:
tstr = "MediaStop"; tstr = "MediaStop";
break; break;
case GHOST_kKeyMediaFirst: case GHOST_kKeyMediaFirst:
tstr = "MediaFirst"; tstr = "MediaFirst";
break; break;
case GHOST_kKeyMediaLast: case GHOST_kKeyMediaLast:
tstr = "MediaLast"; tstr = "MediaLast";
break; break;
default: default:
tstr = "unknown"; tstr = "unknown";
break; break;
} }
sprintf(str, "%s", tstr); sprintf(str, "%s", tstr);

View File

@@ -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:
/** /**
@@ -57,7 +57,7 @@ protected:
* @param key The GHOST key code to convert. * @param key The GHOST key code to convert.
* @param str The GHOST key code converted to a readable string. * @param str The GHOST key code converted to a readable string.
*/ */
void getKeyString(GHOST_TKey key, char str[32]) const; void getKeyString(GHOST_TKey key, char str[32]) const;
}; };
#endif // __GHOST_EVENTPRINTER_H__ #endif // __GHOST_EVENTPRINTER_H__

View File

@@ -51,9 +51,10 @@ 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;
} }
~GHOST_EventString() ~GHOST_EventString()

View File

@@ -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)

View File

@@ -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;

View File

@@ -40,25 +40,25 @@
#include "GHOST_ISystem.h" #include "GHOST_ISystem.h"
#ifdef WITH_HEADLESS #ifdef WITH_HEADLESS
# include "GHOST_SystemNULL.h" # include "GHOST_SystemNULL.h"
#elif defined(WITH_GHOST_SDL) #elif defined(WITH_GHOST_SDL)
# include "GHOST_SystemSDL.h" # include "GHOST_SystemSDL.h"
#elif defined(WIN32) #elif defined(WIN32)
# include "GHOST_SystemWin32.h" # include "GHOST_SystemWin32.h"
#else #else
# ifdef __APPLE__ # ifdef __APPLE__
# ifdef GHOST_COCOA # ifdef GHOST_COCOA
# include "GHOST_SystemCocoa.h" # include "GHOST_SystemCocoa.h"
# else # else
# include "GHOST_SystemCarbon.h" # include "GHOST_SystemCarbon.h"
# endif # endif
# else # else
# include "GHOST_SystemX11.h" # include "GHOST_SystemX11.h"
# endif # endif
#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,17 +70,17 @@ 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;
} }

View File

@@ -40,21 +40,21 @@
#include "GHOST_ISystemPaths.h" #include "GHOST_ISystemPaths.h"
#ifdef WIN32 #ifdef WIN32
# include "GHOST_SystemPathsWin32.h" # include "GHOST_SystemPathsWin32.h"
#else #else
# ifdef __APPLE__ # ifdef __APPLE__
# ifdef GHOST_COCOA # ifdef GHOST_COCOA
# include "GHOST_SystemPathsCocoa.h" # include "GHOST_SystemPathsCocoa.h"
# else # else
# include "GHOST_SystemPathsCarbon.h" # include "GHOST_SystemPathsCarbon.h"
# endif # endif
# else # else
# include "GHOST_SystemPathsX11.h" # include "GHOST_SystemPathsX11.h"
# endif # endif
#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,17 +62,17 @@ 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();

View File

@@ -52,17 +52,17 @@ GHOST_TKey GHOST_ModifierKeys::getModifierKeyCode(GHOST_TModifierKeyMask mask)
{ {
GHOST_TKey key; GHOST_TKey key;
switch (mask) { switch (mask) {
case GHOST_kModifierKeyLeftShift: key = GHOST_kKeyLeftShift; break; case GHOST_kModifierKeyLeftShift: key = GHOST_kKeyLeftShift; break;
case GHOST_kModifierKeyRightShift: key = GHOST_kKeyRightShift; break; case GHOST_kModifierKeyRightShift: key = GHOST_kKeyRightShift; break;
case GHOST_kModifierKeyLeftAlt: key = GHOST_kKeyLeftAlt; break; case GHOST_kModifierKeyLeftAlt: key = GHOST_kKeyLeftAlt; break;
case GHOST_kModifierKeyRightAlt: key = GHOST_kKeyRightAlt; break; case GHOST_kModifierKeyRightAlt: key = GHOST_kKeyRightAlt; break;
case GHOST_kModifierKeyLeftControl: key = GHOST_kKeyLeftControl; break; case GHOST_kModifierKeyLeftControl: key = GHOST_kKeyLeftControl; break;
case GHOST_kModifierKeyRightControl: key = GHOST_kKeyRightControl; break; case GHOST_kModifierKeyRightControl: key = GHOST_kKeyRightControl; break;
case GHOST_kModifierKeyOS: key = GHOST_kKeyOS; break; case GHOST_kModifierKeyOS: key = GHOST_kKeyOS; break;
default: default:
// Should not happen // Should not happen
key = GHOST_kKeyUnknown; key = GHOST_kKeyUnknown;
break; break;
} }
return key; return key;
} }
@@ -70,69 +70,69 @@ GHOST_TKey GHOST_ModifierKeys::getModifierKeyCode(GHOST_TModifierKeyMask mask)
bool GHOST_ModifierKeys::get(GHOST_TModifierKeyMask mask) const bool GHOST_ModifierKeys::get(GHOST_TModifierKeyMask mask) const
{ {
switch (mask) { switch (mask) {
case GHOST_kModifierKeyLeftShift: case GHOST_kModifierKeyLeftShift:
return m_LeftShift; return m_LeftShift;
case GHOST_kModifierKeyRightShift: case GHOST_kModifierKeyRightShift:
return m_RightShift; return m_RightShift;
case GHOST_kModifierKeyLeftAlt: case GHOST_kModifierKeyLeftAlt:
return m_LeftAlt; return m_LeftAlt;
case GHOST_kModifierKeyRightAlt: case GHOST_kModifierKeyRightAlt:
return m_RightAlt; return m_RightAlt;
case GHOST_kModifierKeyLeftControl: case GHOST_kModifierKeyLeftControl:
return m_LeftControl; return m_LeftControl;
case GHOST_kModifierKeyRightControl: case GHOST_kModifierKeyRightControl:
return m_RightControl; return m_RightControl;
case GHOST_kModifierKeyOS: case GHOST_kModifierKeyOS:
return m_OS; return m_OS;
default: default:
return false; return false;
} }
} }
void GHOST_ModifierKeys::set(GHOST_TModifierKeyMask mask, bool down) void GHOST_ModifierKeys::set(GHOST_TModifierKeyMask mask, bool down)
{ {
switch (mask) { switch (mask) {
case GHOST_kModifierKeyLeftShift: case GHOST_kModifierKeyLeftShift:
m_LeftShift = down; break; m_LeftShift = down; break;
case GHOST_kModifierKeyRightShift: case GHOST_kModifierKeyRightShift:
m_RightShift = down; break; m_RightShift = down; break;
case GHOST_kModifierKeyLeftAlt: case GHOST_kModifierKeyLeftAlt:
m_LeftAlt = down; break; m_LeftAlt = down; break;
case GHOST_kModifierKeyRightAlt: case GHOST_kModifierKeyRightAlt:
m_RightAlt = down; break; m_RightAlt = down; break;
case GHOST_kModifierKeyLeftControl: case GHOST_kModifierKeyLeftControl:
m_LeftControl = down; break; m_LeftControl = down; break;
case GHOST_kModifierKeyRightControl: case GHOST_kModifierKeyRightControl:
m_RightControl = down; break; m_RightControl = down; break;
case GHOST_kModifierKeyOS: case GHOST_kModifierKeyOS:
m_OS = down; break; m_OS = down; break;
default: default:
break; break;
} }
} }
void GHOST_ModifierKeys::clear() void GHOST_ModifierKeys::clear()
{ {
m_LeftShift = false; m_LeftShift = false;
m_RightShift = false; m_RightShift = false;
m_LeftAlt = false; m_LeftAlt = false;
m_RightAlt = false; m_RightAlt = false;
m_LeftControl = false; m_LeftControl = false;
m_RightControl = false; m_RightControl = false;
m_OS = false; m_OS = false;
} }
bool GHOST_ModifierKeys::equals(const GHOST_ModifierKeys& keys) const bool GHOST_ModifierKeys::equals(const GHOST_ModifierKeys& keys) const
{ {
return (m_LeftShift == keys.m_LeftShift) && return (m_LeftShift == keys.m_LeftShift) &&
(m_RightShift == keys.m_RightShift) && (m_RightShift == keys.m_RightShift) &&
(m_LeftAlt == keys.m_LeftAlt) && (m_LeftAlt == keys.m_LeftAlt) &&
(m_RightAlt == keys.m_RightAlt) && (m_RightAlt == keys.m_RightAlt) &&
(m_LeftControl == keys.m_LeftControl) && (m_LeftControl == keys.m_LeftControl) &&
(m_RightControl == keys.m_RightControl) && (m_RightControl == keys.m_RightControl) &&
(m_OS == keys.m_OS); (m_OS == keys.m_OS);
} }

View File

@@ -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.
*/ */

View File

@@ -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

View File

@@ -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];

View File

@@ -28,7 +28,7 @@
GHOST_NDOFManagerWin32::GHOST_NDOFManagerWin32(GHOST_System& sys) GHOST_NDOFManagerWin32::GHOST_NDOFManagerWin32(GHOST_System& sys)
: GHOST_NDOFManager(sys) : GHOST_NDOFManager(sys)
{ {
setDeadZone(0.1f); setDeadZone(0.1f);
} }

View File

@@ -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);
} }

View File

@@ -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;
} }

View File

@@ -45,12 +45,12 @@
GHOST_System::GHOST_System() GHOST_System::GHOST_System()
: m_displayManager(0), : m_displayManager(0),
m_timerManager(0), m_timerManager(0),
m_windowManager(0), m_windowManager(0),
m_eventManager(0) m_eventManager(0)
#ifdef WITH_INPUT_NDOF #ifdef WITH_INPUT_NDOF
, m_ndofManager(0) , m_ndofManager(0)
#endif #endif
{ {
} }
@@ -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,14 +132,14 @@ 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;
GHOST_ASSERT(m_windowManager, "GHOST_System::beginFullScreen(): invalid window manager") GHOST_ASSERT(m_windowManager, "GHOST_System::beginFullScreen(): invalid window manager")
@@ -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,20 +356,20 @@ 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,
stereoVisual, stereoVisual,
numOfAASamples); numOfAASamples);
success = *window == 0 ? GHOST_kFailure : GHOST_kSuccess; success = *window == 0 ? GHOST_kFailure : GHOST_kSuccess;
} }
return success; return success;
} }
int GHOST_System::confirmQuit(GHOST_IWindow * window) const int GHOST_System::confirmQuit(GHOST_IWindow *window) const
{ {
return 1; return 1;
} }

View File

@@ -76,8 +76,8 @@ protected:
public: public:
/*************************************************************************************** /***************************************************************************************
** Time(r) functionality ** Time(r) functionality
***************************************************************************************/ ***************************************************************************************/
/** /**
* Returns the system time. * Returns the system time.
@@ -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,11 +107,11 @@ 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
***************************************************************************************/ ***************************************************************************************/
/** /**
* Inherited from GHOST_ISystem but left pure virtual * Inherited from GHOST_ISystem but left pure virtual
@@ -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.
@@ -169,13 +169,13 @@ public:
/*************************************************************************************** /***************************************************************************************
** Event management functionality ** Event management functionality
***************************************************************************************/ ***************************************************************************************/
/** /**
* Inherited from GHOST_ISystem but left pure virtual * Inherited from GHOST_ISystem but left pure virtual
* *
* virtual bool processEvents(bool waitForEvent) = 0; * virtual bool processEvents(bool waitForEvent) = 0;
*/ */
@@ -192,18 +192,18 @@ 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
***************************************************************************************/ ***************************************************************************************/
/** Inherited from GHOST_ISystem but left pure virtual /** Inherited from GHOST_ISystem but left pure virtual
* GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const = 0; * GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const = 0;
@@ -211,8 +211,8 @@ public:
*/ */
/*************************************************************************************** /***************************************************************************************
** 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).
@@ -231,8 +231,8 @@ public:
virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const; virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const;
/*************************************************************************************** /***************************************************************************************
** Other (internal) functionality. ** Other (internal) functionality.
***************************************************************************************/ ***************************************************************************************/
/** /**
* Pushes an event on the stack. * Pushes an event on the stack.
@@ -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
/** /**
@@ -285,23 +285,23 @@ public:
/** /**
* Returns the selection buffer * Returns the selection buffer
* @param selection Only used on X11 * @param selection Only used on X11
* @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
* @param buffer The buffer to copy to the clipboard * @param buffer The buffer to copy to the clipboard
* @param selection The clipboard to copy too only used on X11 * @param selection The clipboard to copy too only used on X11
*/ */
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0; virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
/** /**
* 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;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -84,7 +84,7 @@ public:
* Returns the number of displays on this system. * Returns the number of displays on this system.
* @return The number of displays. * @return The number of displays.
*/ */
virtual GHOST_TUns8 getNumDisplays() const; virtual GHOST_TUns8 getNumDisplays() const;
/** /**
* Returns the dimensions of the main display on this system. * Returns the dimensions of the main display on this system.
@@ -103,29 +103,29 @@ public:
* @param height The height the window. * @param height The height the window.
* @param state The state of the window when opened. * @param state The state of the window when opened.
* @param type The type of drawing context installed in this window. * @param type The type of drawing context installed in this window.
* @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,
GHOST_TUns32 width, GHOST_TUns32 width,
GHOST_TUns32 height, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TWindowState state,
GHOST_TDrawingContextType type, GHOST_TDrawingContextType type,
const bool stereoVisual, const bool stereoVisual,
const GHOST_TUns16 numOfAASamples = 0, const GHOST_TUns16 numOfAASamples = 0,
const GHOST_TEmbedderWindowID parentWindow = 0 const GHOST_TEmbedderWindowID parentWindow = 0
); );
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);

View File

@@ -62,8 +62,8 @@ public:
~GHOST_SystemCocoa(); ~GHOST_SystemCocoa();
/*************************************************************************************** /***************************************************************************************
** Time(r) functionality ** Time(r) functionality
***************************************************************************************/ ***************************************************************************************/
/** /**
* Returns the system time. * Returns the system time.
@@ -74,14 +74,14 @@ public:
virtual GHOST_TUns64 getMilliSeconds() const; virtual GHOST_TUns64 getMilliSeconds() const;
/*************************************************************************************** /***************************************************************************************
** Display/window management functionality ** Display/window management functionality
***************************************************************************************/ ***************************************************************************************/
/** /**
* Returns the number of displays on this system. * Returns the number of displays on this system.
* @return The number of displays. * @return The number of displays.
*/ */
virtual GHOST_TUns8 getNumDisplays() const; virtual GHOST_TUns8 getNumDisplays() const;
/** /**
* Returns the dimensions of the main display on this system. * Returns the dimensions of the main display on this system.
@@ -102,25 +102,25 @@ public:
* @param type The type of drawing context installed in this window. * @param type The type of drawing context installed in this window.
* @param stereoVisual Stereo visual for quad buffered stereo. * @param stereoVisual Stereo visual for quad buffered stereo.
* @param numOfAASamples Number of samples used for AA (zero if no AA) * @param numOfAASamples Number of samples used for AA (zero if no AA)
* @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,
GHOST_TUns32 width, GHOST_TUns32 width,
GHOST_TUns32 height, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TWindowState state,
GHOST_TDrawingContextType type, 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
***************************************************************************************/ ***************************************************************************************/
/** /**
* Gets events from the system and stores them in the queue. * Gets events from the system and stores them in the queue.
@@ -151,11 +151,11 @@ 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
***************************************************************************************/ ***************************************************************************************/
/** /**
* Returns the current location of the cursor (location in screen coordinates) * Returns the current location of the cursor (location in screen coordinates)
@@ -174,8 +174,8 @@ public:
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y); virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
/*************************************************************************************** /***************************************************************************************
** Access to mouse button and keyboard states. ** Access to mouse button and keyboard states.
***************************************************************************************/ ***************************************************************************************/
/** /**
* Returns the state of all modifier keys. * Returns the state of all modifier keys.
@@ -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:

View File

@@ -66,19 +66,19 @@ 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,
GHOST_TUns32 width, GHOST_TUns32 width,
GHOST_TUns32 height, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TWindowState state,
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);
} }
}; };

View File

@@ -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;
}; };

View File

@@ -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 */

View File

@@ -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__

View File

@@ -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__

View File

@@ -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

View File

@@ -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;

View File

@@ -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

View File

@@ -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 static char user_path[PATH_MAX];
return (const GHOST_TUns8 *)getenv("HOME");
#else /* WITH_XDG_USER_DIRS */
const char *home = getenv("XDG_CONFIG_HOME");
if (home) { /* in blender 2.64, we migrate to XDG. to ensure the copy previous settings
return (const GHOST_TUns8 *)home; * operator works we give a different path depending on the requested version */
} if(version < 264) {
else { const char *home = getenv("HOME");
static char user_path[PATH_MAX];
home = getenv("HOME"); if(home) {
snprintf(user_path, sizeof(user_path), "%s/.blender/%s", home, versionstr);
if (home == NULL) { return (GHOST_TUns8*)user_path;
home = getpwuid(getuid())->pw_dir; }
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

View File

@@ -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

View File

@@ -39,18 +39,18 @@ 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); */
/* SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); */ /* SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); */
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
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);
} }
GHOST_SystemSDL::~GHOST_SystemSDL() GHOST_SystemSDL::~GHOST_SystemSDL()
@@ -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,97 +154,101 @@ 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,117 +348,117 @@ 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;
} }
if (g_event) { if (g_event) {
@@ -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,24 +497,24 @@ 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,
*w_start *w_start
); );
(*w_start)->validate(); (*w_start)->validate();
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);

View File

@@ -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();

File diff suppressed because it is too large Load Diff

View File

@@ -45,7 +45,7 @@
#include "GHOST_System.h" #include "GHOST_System.h"
#if defined(__CYGWIN32__) #if defined(__CYGWIN32__)
# define __int64 long long # define __int64 long long
#endif #endif
class GHOST_EventButton; class GHOST_EventButton;
@@ -93,7 +93,7 @@ public:
* Returns the number of displays on this system. * Returns the number of displays on this system.
* @return The number of displays. * @return The number of displays.
*/ */
virtual GHOST_TUns8 getNumDisplays() const; virtual GHOST_TUns8 getNumDisplays() const;
/** /**
* Returns the dimensions of the main display on this system. * Returns the dimensions of the main display on this system.
@@ -114,16 +114,16 @@ public:
* @param type The type of drawing context installed in this window. * @param type The type of drawing context installed in this window.
* @param stereoVisual Stereo visual for quad buffered stereo. * @param stereoVisual Stereo visual for quad buffered stereo.
* @param numOfAASamples Number of samples used for AA (zero if no AA) * @param numOfAASamples Number of samples used for AA (zero if no AA)
* @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
/** /**
@@ -342,14 +342,14 @@ protected:
static LRESULT WINAPI s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); static LRESULT WINAPI s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
/** /**
* Toggles console * Toggles console
* @action 0 - Hides * @action 0 - Hides
* 1 - Shows * 1 - Shows
* 2 - Toggles * 2 - Toggles
* 3 - Hides if it runs not from command line * 3 - Hides if it runs not from command line
* * - Does nothing * * - Does nothing
* @return current status (1 -visible, 0 - hidden) * @return current status (1 -visible, 0 - hidden)
*/ */
int toggleConsole(int action); int toggleConsole(int action);
/** The current state of the modifier keys. */ /** The current state of the modifier keys. */
@@ -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;
} }

View File

@@ -19,54 +19,54 @@
// 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__
#define __ITaskbarList3_INTERFACE_DEFINED__ #define __ITaskbarList3_INTERFACE_DEFINED__
typedef enum THUMBBUTTONFLAGS {THBF_ENABLED = 0, THBF_DISABLED = 0x1, THBF_DISMISSONCLICK = 0x2, THBF_NOBACKGROUND = 0x4, THBF_HIDDEN = 0x8, THBF_NONINTERACTIVE = 0x10} THUMBBUTTONFLAGS; typedef enum THUMBBUTTONFLAGS {THBF_ENABLED = 0, THBF_DISABLED = 0x1, THBF_DISMISSONCLICK = 0x2, THBF_NOBACKGROUND = 0x4, THBF_HIDDEN = 0x8, THBF_NONINTERACTIVE = 0x10} THUMBBUTTONFLAGS;
typedef enum THUMBBUTTONMASK {THB_BITMAP = 0x1, THB_ICON = 0x2, THB_TOOLTIP = 0x4, THB_FLAGS = 0x8} THUMBBUTTONMASK; typedef enum THUMBBUTTONMASK {THB_BITMAP = 0x1, THB_ICON = 0x2, THB_TOOLTIP = 0x4, THB_FLAGS = 0x8} THUMBBUTTONMASK;
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__*/

View File

@@ -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;
} }
} }

View File

@@ -64,13 +64,13 @@ public:
* Returns the number of timer tasks. * Returns the number of timer tasks.
* @return The number of events on the stack. * @return The number of events on the stack.
*/ */
virtual GHOST_TUns32 getNumTimers(); virtual GHOST_TUns32 getNumTimers();
/** /**
* 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;
}; };

View File

@@ -56,11 +56,11 @@ public:
GHOST_TimerProcPtr timerProc, GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData = 0) GHOST_TUserDataPtr userData = 0)
: m_start(start), : m_start(start),
m_interval(interval), m_interval(interval),
m_next(start), m_next(start),
m_timerProc(timerProc), m_timerProc(timerProc),
m_userData(userData), m_userData(userData),
m_auxData(0) m_auxData(0)
{ {
} }

View File

@@ -40,12 +40,12 @@
GHOST_Window::GHOST_Window( GHOST_Window::GHOST_Window(
GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TUns32 width, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TWindowState state,
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),
@@ -58,14 +58,14 @@ GHOST_Window::GHOST_Window(
m_progressBarVisible = false; m_progressBarVisible = false;
m_cursorGrabAccumPos[0] = 0; m_cursorGrabAccumPos[0] = 0;
m_cursorGrabAccumPos[1] = 0; m_cursorGrabAccumPos[1] = 0;
m_fullScreen = state == GHOST_kWindowStateFullScreen; m_fullScreen = state == GHOST_kWindowStateFullScreen;
if (m_fullScreen) { if (m_fullScreen) {
m_fullScreenWidth = width; m_fullScreenWidth = width;
m_fullScreenHeight = height; m_fullScreenHeight = height;
} }
} }
@@ -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;
} }

View File

@@ -83,12 +83,12 @@ 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_Window( GHOST_Window(
GHOST_TUns32 width, GHOST_TUns32 width,
GHOST_TUns32 height, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TWindowState state,
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);
/** /**
* @section Interface inherited from GHOST_IWindow left for derived class * @section Interface inherited from GHOST_IWindow left for derived class
@@ -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.
@@ -145,15 +145,15 @@ public:
* @return Indication of success. * @return Indication of success.
*/ */
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2], virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
GHOST_TUns8 mask[16][2], GHOST_TUns8 mask[16][2],
int hotX, int hotX,
int hotY); int hotY);
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap, virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
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.
@@ -187,15 +187,19 @@ public:
virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect& bounds); virtual GHOST_TSuccess getCursorGrabBounds(GHOST_Rect& bounds);
/** /**
* 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
@@ -295,7 +301,7 @@ protected:
int hotX, int hotY) = 0; int hotX, int hotY) = 0;
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
int szx, int szy, int hotX, int hotY, int fg, int bg) = 0; int szx, int szy, int hotX, int hotY, int fg, int bg) = 0;
/** The the of drawing context installed in this window. */ /** The the of drawing context installed in this window. */
GHOST_TDrawingContextType m_drawingContextType; GHOST_TDrawingContextType m_drawingContextType;
@@ -365,8 +371,8 @@ inline GHOST_TGrabCursorMode GHOST_Window::getCursorGrabMode() const
inline bool GHOST_Window::getCursorGrabModeIsWarp() const inline bool GHOST_Window::getCursorGrabModeIsWarp() const
{ {
return (m_cursorGrab == GHOST_kGrabWrap) || return (m_cursorGrab == GHOST_kGrabWrap) ||
(m_cursorGrab == GHOST_kGrabHide); (m_cursorGrab == GHOST_kGrabHide);
} }
inline void GHOST_Window::getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const inline void GHOST_Window::getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const
@@ -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

View File

@@ -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)
@@ -91,16 +91,16 @@ static OSStatus myWEventHandlerProc(EventHandlerCallRef handler, EventRef event,
} }
GHOST_WindowCarbon::GHOST_WindowCarbon( GHOST_WindowCarbon::GHOST_WindowCarbon(
const STR_String& title, const STR_String& title,
GHOST_TInt32 left, GHOST_TInt32 left,
GHOST_TInt32 top, GHOST_TInt32 top,
GHOST_TUns32 width, GHOST_TUns32 width,
GHOST_TUns32 height, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TWindowState state,
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),
@@ -108,84 +108,87 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
m_customCursor(0), m_customCursor(0),
m_fullScreenDirty(false) m_fullScreenDirty(false)
{ {
Str255 title255; Str255 title255;
OSStatus err; OSStatus err;
//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) {
fprintf(stderr," error creating window %i \n",(int)err);
} else {
::SetWRefCon(m_windowRef,(SInt32)this); if (err != noErr) {
fprintf(stderr, " error creating window %i \n", (int)err);
}
else {
::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);
} }
} }
if (m_windowRef) { if (m_windowRef) {
m_grafPtr = ::GetWindowPort(m_windowRef); m_grafPtr = ::GetWindowPort(m_windowRef);
setDrawingContextType(type); setDrawingContextType(type);
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);
SetFrontProcess(&psn); SetFrontProcess(&psn);
} }
} }
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
&bnds, // Bounding rectangle of the window &bnds, // Bounding rectangle of the window
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();
m_tablet.Active = GHOST_kTabletModeNone; m_tablet.Active = GHOST_kTabletModeNone;
} }
} }
@@ -193,44 +196,44 @@ 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;
} }
} }
bool GHOST_WindowCarbon::getValid() const bool GHOST_WindowCarbon::getValid() const
{ {
bool valid; bool valid;
if (!m_fullScreen) { if (!m_fullScreen) {
valid = (m_windowRef != 0) && (m_grafPtr != 0) && ::IsValidWindowPtr(m_windowRef); valid = (m_windowRef != 0) && (m_grafPtr != 0) && ::IsValidWindowPtr(m_windowRef);
} }
else { else {
valid = true; valid = true;
} }
return valid; return valid;
} }
void GHOST_WindowCarbon::setTitle(const STR_String& title) void GHOST_WindowCarbon::setTitle(const STR_String& title)
{ {
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setTitle(): window invalid") GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setTitle(): window invalid")
Str255 title255; Str255 title255;
gen2mac(title, title255); gen2mac(title, title255);
::SetWTitle(m_windowRef, title255); ::SetWTitle(m_windowRef, title255);
} }
void GHOST_WindowCarbon::getTitle(STR_String& title) const void GHOST_WindowCarbon::getTitle(STR_String& title) const
{ {
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getTitle(): window invalid") GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getTitle(): window invalid")
Str255 title255; Str255 title255;
::GetWTitle(m_windowRef, title255); ::GetWTitle(m_windowRef, title255);
mac2gen(title255, title); mac2gen(title255, title);
} }
@@ -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) ||
@@ -346,11 +349,11 @@ void GHOST_WindowCarbon::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOS
Point point; Point point;
point.h = inX; point.h = inX;
point.v = inY; point.v = inY;
GrafPtr oldPort; GrafPtr oldPort;
::GetPort(&oldPort); ::GetPort(&oldPort);
::SetPort(m_grafPtr); ::SetPort(m_grafPtr);
::GlobalToLocal(&point); ::GlobalToLocal(&point);
::SetPort(oldPort); ::SetPort(oldPort);
outX = point.h; outX = point.h;
outY = point.v; outY = point.v;
} }
@@ -362,11 +365,11 @@ void GHOST_WindowCarbon::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOS
Point point; Point point;
point.h = inX; point.h = inX;
point.v = inY; point.v = inY;
GrafPtr oldPort; GrafPtr oldPort;
::GetPort(&oldPort); ::GetPort(&oldPort);
::SetPort(m_grafPtr); ::SetPort(m_grafPtr);
::LocalToGlobal(&point); ::LocalToGlobal(&point);
::SetPort(oldPort); ::SetPort(oldPort);
outX = point.h; outX = point.h;
outY = point.v; outY = point.v;
} }
@@ -375,38 +378,38 @@ void GHOST_WindowCarbon::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOS
GHOST_TSuccess GHOST_WindowCarbon::setState(GHOST_TWindowState state) GHOST_TSuccess GHOST_WindowCarbon::setState(GHOST_TWindowState state)
{ {
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setState(): window invalid") GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setState(): window invalid")
switch (state) { switch (state) {
case GHOST_kWindowStateMinimized: case GHOST_kWindowStateMinimized:
::HideWindow(m_windowRef); ::HideWindow(m_windowRef);
break; break;
case GHOST_kWindowStateModified: case GHOST_kWindowStateModified:
SetWindowModified(m_windowRef, 1); SetWindowModified(m_windowRef, 1);
break; break;
case GHOST_kWindowStateUnModified: case GHOST_kWindowStateUnModified:
SetWindowModified(m_windowRef, 0); SetWindowModified(m_windowRef, 0);
break; break;
case GHOST_kWindowStateMaximized: case GHOST_kWindowStateMaximized:
case GHOST_kWindowStateNormal: case GHOST_kWindowStateNormal:
default: default:
::ShowWindow(m_windowRef); ::ShowWindow(m_windowRef);
break; break;
} }
return GHOST_kSuccess; return GHOST_kSuccess;
} }
GHOST_TSuccess GHOST_WindowCarbon::setOrder(GHOST_TWindowOrder order) GHOST_TSuccess GHOST_WindowCarbon::setOrder(GHOST_TWindowOrder order)
{ {
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setOrder(): window invalid") GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setOrder(): window invalid")
if (order == GHOST_kWindowOrderTop) { if (order == GHOST_kWindowOrderTop) {
//::BringToFront(m_windowRef); is wrong, front window should be active for input too //::BringToFront(m_windowRef); is wrong, front window should be active for input too
::SelectWindow(m_windowRef); ::SelectWindow(m_windowRef);
} }
else { else {
/* doesnt work if you do this with a mouseclick */ /* doesnt work if you do this with a mouseclick */
::SendBehind(m_windowRef, nil); ::SendBehind(m_windowRef, nil);
} }
return GHOST_kSuccess; return GHOST_kSuccess;
} }
/*#define WAIT_FOR_VSYNC 1*/ /*#define WAIT_FOR_VSYNC 1*/
@@ -418,20 +421,20 @@ 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;
if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) { if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
if (m_aglCtx) { if (m_aglCtx) {
::aglSwapBuffers(m_aglCtx); ::aglSwapBuffers(m_aglCtx);
} }
else { else {
succeeded = GHOST_kFailure; succeeded = GHOST_kFailure;
} }
} }
return succeeded; return succeeded;
} }
GHOST_TSuccess GHOST_WindowCarbon::updateDrawingContext() GHOST_TSuccess GHOST_WindowCarbon::updateDrawingContext()
@@ -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
@@ -482,38 +485,38 @@ GHOST_TSuccess GHOST_WindowCarbon::installDrawingContext(GHOST_TDrawingContextTy
GHOST_TSuccess success = GHOST_kFailure; GHOST_TSuccess success = GHOST_kFailure;
switch (type) { switch (type) {
case GHOST_kDrawingContextTypeOpenGL: case GHOST_kDrawingContextTypeOpenGL:
{ {
if (!getValid()) break; if (!getValid()) break;
AGLPixelFormat pixelFormat; AGLPixelFormat pixelFormat;
if (!m_fullScreen) { if (!m_fullScreen) {
pixelFormat = ::aglChoosePixelFormat(0, 0, sPreferredFormatWindow); pixelFormat = ::aglChoosePixelFormat(0, 0, sPreferredFormatWindow);
m_aglCtx = ::aglCreateContext(pixelFormat, s_firstaglCtx); m_aglCtx = ::aglCreateContext(pixelFormat, s_firstaglCtx);
if (!m_aglCtx) break; if (!m_aglCtx) break;
if (!s_firstaglCtx) s_firstaglCtx = m_aglCtx; if (!s_firstaglCtx) s_firstaglCtx = m_aglCtx;
success = ::aglSetDrawable(m_aglCtx, m_grafPtr) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure; success = ::aglSetDrawable(m_aglCtx, m_grafPtr) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure;
}
else {
//GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL\n");
GDHandle device=::GetMainDevice();pixelFormat=::aglChoosePixelFormat(&device,1,sPreferredFormatFullScreen);
m_aglCtx = ::aglCreateContext(pixelFormat, 0);
if (!m_aglCtx) break;
if (!s_firstaglCtx) s_firstaglCtx = m_aglCtx;
//GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): created OpenGL context\n");
//::CGGetActiveDisplayList(0, NULL, &m_numDisplays)
success = ::aglSetFullScreen(m_aglCtx, m_fullScreenWidth, m_fullScreenHeight, 75, 0) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure;
/*
if (success == GHOST_kSuccess) {
GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL succeeded\n");
}
else {
GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL failed\n");
}
*/
}
::aglDestroyPixelFormat(pixelFormat);
} }
break; else {
//GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL\n");
GDHandle device = ::GetMainDevice(); pixelFormat = ::aglChoosePixelFormat(&device, 1, sPreferredFormatFullScreen);
m_aglCtx = ::aglCreateContext(pixelFormat, 0);
if (!m_aglCtx) break;
if (!s_firstaglCtx) s_firstaglCtx = m_aglCtx;
//GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): created OpenGL context\n");
//::CGGetActiveDisplayList(0, NULL, &m_numDisplays)
success = ::aglSetFullScreen(m_aglCtx, m_fullScreenWidth, m_fullScreenHeight, 75, 0) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure;
#if 0
if (success == GHOST_kSuccess) {
GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL succeeded\n");
}
else {
GHOST_PRINT("GHOST_WindowCarbon::installDrawingContext(): init full-screen OpenGL failed\n");
}
#endif
}
::aglDestroyPixelFormat(pixelFormat);
}
break;
case GHOST_kDrawingContextTypeNone: case GHOST_kDrawingContextTypeNone:
success = GHOST_kSuccess; success = GHOST_kSuccess;
@@ -532,9 +535,9 @@ GHOST_TSuccess GHOST_WindowCarbon::removeDrawingContext()
switch (m_drawingContextType) { switch (m_drawingContextType) {
case GHOST_kDrawingContextTypeOpenGL: case GHOST_kDrawingContextTypeOpenGL:
if (m_aglCtx) { if (m_aglCtx) {
aglSetCurrentContext(NULL); aglSetCurrentContext(NULL);
aglSetDrawable(m_aglCtx, NULL); aglSetDrawable(m_aglCtx, NULL);
//aglDestroyContext(m_aglCtx); //aglDestroyContext(m_aglCtx);
if (s_firstaglCtx == m_aglCtx) s_firstaglCtx = NULL; if (s_firstaglCtx == m_aglCtx) s_firstaglCtx = NULL;
success = ::aglDestroyContext(m_aglCtx) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure; success = ::aglDestroyContext(m_aglCtx) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure;
m_aglCtx = 0; m_aglCtx = 0;
@@ -553,22 +556,22 @@ GHOST_TSuccess GHOST_WindowCarbon::removeDrawingContext()
GHOST_TSuccess GHOST_WindowCarbon::invalidate() GHOST_TSuccess GHOST_WindowCarbon::invalidate()
{ {
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::invalidate(): window invalid") GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::invalidate(): window invalid")
if (!m_fullScreen) { if (!m_fullScreen) {
Rect rect; Rect rect;
::GetPortBounds(m_grafPtr, &rect); ::GetPortBounds(m_grafPtr, &rect);
::InvalWindowRect(m_windowRef, &rect); ::InvalWindowRect(m_windowRef, &rect);
} }
else { else {
//EventRef event; //EventRef event;
//OSStatus status = ::CreateEvent(NULL, kEventClassWindow, kEventWindowUpdate, 0, 0, &event); //OSStatus status = ::CreateEvent(NULL, kEventClassWindow, kEventWindowUpdate, 0, 0, &event);
//GHOST_PRINT("GHOST_WindowCarbon::invalidate(): created event " << status << " \n"); //GHOST_PRINT("GHOST_WindowCarbon::invalidate(): created event " << status << " \n");
//status = ::SetEventParameter(event, kEventParamDirectObject, typeWindowRef, sizeof(WindowRef), this); //status = ::SetEventParameter(event, kEventParamDirectObject, typeWindowRef, sizeof(WindowRef), this);
//GHOST_PRINT("GHOST_WindowCarbon::invalidate(): set event parameter " << status << " \n"); //GHOST_PRINT("GHOST_WindowCarbon::invalidate(): set event parameter " << status << " \n");
//status = ::PostEventToQueue(::GetMainEventQueue(), event, kEventPriorityStandard); //status = ::PostEventToQueue(::GetMainEventQueue(), event, kEventPriorityStandard);
//status = ::SendEventToEventTarget(event, ::GetApplicationEventTarget()); //status = ::SendEventToEventTarget(event, ::GetApplicationEventTarget());
//GHOST_PRINT("GHOST_WindowCarbon::invalidate(): added event to queue " << status << " \n"); //GHOST_PRINT("GHOST_WindowCarbon::invalidate(): added event to queue " << status << " \n");
m_fullScreenDirty = true; m_fullScreenDirty = true;
} }
return GHOST_kSuccess; return GHOST_kSuccess;
} }
@@ -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
@@ -646,7 +650,7 @@ void GHOST_WindowCarbon::loadCursor(bool visible, GHOST_TStandardCursor cursor)
bool GHOST_WindowCarbon::getFullScreenDirty() bool GHOST_WindowCarbon::getFullScreenDirty()
{ {
return m_fullScreen && m_fullScreenDirty; return m_fullScreen && m_fullScreenDirty;
} }
@@ -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,15 +692,15 @@ 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;
} }
GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color) int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color)
{ {
int y; int y;
@@ -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
} }
@@ -730,9 +734,9 @@ 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);
} }

View File

@@ -73,16 +73,16 @@ public:
* @param stereoVisual Stereo visual for quad buffered stereo. * @param stereoVisual Stereo visual for quad buffered stereo.
*/ */
GHOST_WindowCarbon( GHOST_WindowCarbon(
const STR_String& title, const STR_String& title,
GHOST_TInt32 left, GHOST_TInt32 left,
GHOST_TInt32 top, GHOST_TInt32 top,
GHOST_TUns32 width, GHOST_TUns32 width,
GHOST_TUns32 height, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TWindowState state,
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
); );
/** /**
* Destructor. * Destructor.
@@ -94,7 +94,7 @@ public:
* Returns indication as to whether the window is valid. * Returns indication as to whether the window is valid.
* @return The validity of the window. * @return The validity of the window.
*/ */
virtual bool getValid() const; virtual bool getValid() const;
/** /**
* Sets the title displayed in the title bar. * Sets the title displayed in the title bar.
@@ -113,33 +113,33 @@ public:
* The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen. * The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
* @param bounds The bounding rectangle of the window. * @param bounds The bounding rectangle of the window.
*/ */
virtual void getWindowBounds(GHOST_Rect& bounds) const; virtual void getWindowBounds(GHOST_Rect& bounds) const;
/** /**
* Returns the client rectangle dimensions. * Returns the client rectangle dimensions.
* The left and top members of the rectangle are always zero. * The left and top members of the rectangle are always zero.
* @param bounds The bounding rectangle of the cleient area of the window. * @param bounds The bounding rectangle of the cleient area of the window.
*/ */
virtual void getClientBounds(GHOST_Rect& bounds) const; virtual void getClientBounds(GHOST_Rect& bounds) const;
/** /**
* Resizes client rectangle width. * Resizes client rectangle width.
* @param width The new width of the client area of the window. * @param width The new width of the client area of the window.
*/ */
virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width); virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width);
/** /**
* Resizes client rectangle height. * Resizes client rectangle height.
* @param height The new height of the client area of the window. * @param height The new height of the client area of the window.
*/ */
virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height); virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height);
/** /**
* Resizes client rectangle. * Resizes client rectangle.
* @param width The new width of the client area of the window. * @param width The new width of the client area of the window.
* @param height The new height of the client area of the window. * @param height The new height of the client area of the window.
*/ */
virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height); virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height);
/** /**
* Returns the state of the window (normal, minimized, maximized). * Returns the state of the window (normal, minimized, maximized).
@@ -154,7 +154,7 @@ public:
* @param outX The x-coordinate in the client rectangle. * @param outX The x-coordinate in the client rectangle.
* @param outY The y-coordinate in the client rectangle. * @param outY The y-coordinate in the client rectangle.
*/ */
virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const; virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
/** /**
* Converts a point in screen coordinates to client rectangle coordinates * Converts a point in screen coordinates to client rectangle coordinates
@@ -163,7 +163,7 @@ public:
* @param outX The x-coordinate on the screen. * @param outX The x-coordinate on the screen.
* @param outY The y-coordinate on the screen. * @param outY The y-coordinate on the screen.
*/ */
virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const; virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
/** /**
* Sets the state of the window (normal, minimized, maximized). * Sets the state of the window (normal, minimized, maximized).
@@ -206,16 +206,20 @@ public:
*/ */
virtual bool getFullScreenDirty(); virtual bool getFullScreenDirty();
/* accessor for fullscreen window */ /* accessor for fullscreen window */
virtual void setMac_windowState(short value); virtual void setMac_windowState(short value);
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.
@@ -232,7 +236,7 @@ protected:
/** /**
* Invalidates the contents of this window. * Invalidates the contents of this window.
* @return Indication of success. * @return Indication of success.
*/ */
virtual GHOST_TSuccess invalidate(); virtual GHOST_TSuccess invalidate();
@@ -253,7 +257,7 @@ protected:
* native window system calls. * native window system calls.
*/ */
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color); int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color);
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY); virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY);
@@ -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,15 +290,15 @@ 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;

View File

@@ -74,17 +74,17 @@ 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_WindowCocoa( GHOST_WindowCocoa(
GHOST_SystemCocoa *systemCocoa, GHOST_SystemCocoa *systemCocoa,
const STR_String& title, const STR_String& title,
GHOST_TInt32 left, GHOST_TInt32 left,
GHOST_TInt32 bottom, GHOST_TInt32 bottom,
GHOST_TUns32 width, GHOST_TUns32 width,
GHOST_TUns32 height, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TWindowState state,
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
); );
/** /**
* Destructor. * Destructor.
@@ -96,13 +96,13 @@ public:
* Returns indication as to whether the window is valid. * Returns indication as to whether the window is valid.
* @return The validity of the window. * @return The validity of the window.
*/ */
virtual bool getValid() const; virtual bool getValid() const;
/** /**
* 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.
@@ -121,33 +121,33 @@ public:
* The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen. * The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.
* @param bounds The bounding rectangle of the window. * @param bounds The bounding rectangle of the window.
*/ */
virtual void getWindowBounds(GHOST_Rect& bounds) const; virtual void getWindowBounds(GHOST_Rect& bounds) const;
/** /**
* Returns the client rectangle dimensions. * Returns the client rectangle dimensions.
* The left and top members of the rectangle are always zero. * The left and top members of the rectangle are always zero.
* @param bounds The bounding rectangle of the cleient area of the window. * @param bounds The bounding rectangle of the cleient area of the window.
*/ */
virtual void getClientBounds(GHOST_Rect& bounds) const; virtual void getClientBounds(GHOST_Rect& bounds) const;
/** /**
* Resizes client rectangle width. * Resizes client rectangle width.
* @param width The new width of the client area of the window. * @param width The new width of the client area of the window.
*/ */
virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width); virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width);
/** /**
* Resizes client rectangle height. * Resizes client rectangle height.
* @param height The new height of the client area of the window. * @param height The new height of the client area of the window.
*/ */
virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height); virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height);
/** /**
* Resizes client rectangle. * Resizes client rectangle.
* @param width The new width of the client area of the window. * @param width The new width of the client area of the window.
* @param height The new height of the client area of the window. * @param height The new height of the client area of the window.
*/ */
virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height); virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height);
/** /**
* Returns the state of the window (normal, minimized, maximized). * Returns the state of the window (normal, minimized, maximized).
@@ -169,7 +169,7 @@ public:
* @param outX The x-coordinate in the client rectangle. * @param outX The x-coordinate in the client rectangle.
* @param outY The y-coordinate in the client rectangle. * @param outY The y-coordinate in the client rectangle.
*/ */
virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const; virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
/** /**
* Converts a point in screen coordinates to client rectangle coordinates * Converts a point in screen coordinates to client rectangle coordinates
@@ -178,7 +178,7 @@ public:
* @param outX The x-coordinate on the screen. * @param outX The x-coordinate on the screen.
* @param outY The y-coordinate on the screen. * @param outY The y-coordinate on the screen.
*/ */
virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const; virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
/** /**
* Converts a point in screen coordinates to client rectangle coordinates * Converts a point in screen coordinates to client rectangle coordinates
@@ -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
@@ -274,7 +278,7 @@ protected:
/** /**
* Invalidates the contents of this window. * Invalidates the contents of this window.
* @return Indication of success. * @return Indication of success.
*/ */
virtual GHOST_TSuccess invalidate(); virtual GHOST_TSuccess invalidate();
@@ -301,7 +305,7 @@ protected:
* native window system calls. * native window system calls.
*/ */
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color); int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color);
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY); virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY);
@@ -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;
}; };

View File

@@ -1441,7 +1441,7 @@ static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
} }
GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color) int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color)
{ {
int y,nbUns16; int y,nbUns16;
NSPoint hotSpotPoint; NSPoint hotSpotPoint;
@@ -1509,7 +1509,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
} }
GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TSuccess GHOST_WindowCocoa::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);
} }

View File

@@ -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,19 +91,19 @@ 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) {
if (getFullScreen() && (window == m_fullScreenWindow)) { if (getFullScreen() && (window == m_fullScreenWindow)) {
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;
} }
} }
} }
return found; return found;
} }
@@ -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;
@@ -151,13 +151,13 @@ GHOST_TSuccess GHOST_WindowManager::endFullScreen(void)
setActiveWindow(m_activeWindowBeforeFullScreen); setActiveWindow(m_activeWindowBeforeFullScreen);
} }
} }
success = GHOST_kSuccess; success = GHOST_kSuccess;
} }
return success; return success;
} }
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())

View File

@@ -63,40 +63,40 @@ 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.
* @return A boolean indicator. * @return A boolean indicator.
*/ */
virtual bool getFullScreen(void) const; virtual bool getFullScreen(void) const;
/** /**
* 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:

Some files were not shown because too many files have changed in this diff Show More