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

@ -103,8 +103,8 @@ enable_testing()
#-----------------------------------------------------------------------------
# Redirect output files
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE )
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib 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 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_XF86VMODE "Enable X11 video mode switching" 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
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_TEST "Build cycles test application" 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)
unset(PLATFORM_DEFAULT)
# disable for now, but plan to support on all platforms eventually
option(WITH_MEM_JEMALLOC "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
@ -1187,13 +1191,13 @@ elseif(APPLE)
endif()
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()
# note: i don't use xcode-select path on purpose, cause also /Applications/Xcode.app would be allowed
# absolute pathes are more foolproof here !
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(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
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(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
endif()
if(WITH_LIBS10.5)
@ -1365,7 +1369,7 @@ elseif(APPLE)
)
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
#set(PCRE ${LIBDIR}/pcre)
#set(PCRE_LIBPATH ${PCRE}/lib)

@ -553,7 +553,7 @@ if env['OURPLATFORM']!='darwin':
source=[os.path.join(dp, f) for f in df if not f.endswith(".pyc")]
# 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))
scriptinstall.append(env.Install(dir=dir,source=source))
if env['WITH_BF_CYCLES']:

@ -169,6 +169,11 @@ BF_BOOST_LIBPATH = BF_BOOST + '/lib'
WITH_BF_RAYOPTIMIZATION = True
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'
CXX = 'g++'

@ -869,12 +869,17 @@ class BlenderEnvironment(SConsEnvironment):
lenv.AddPostAction(prog,Action(AppIt,strfunction=my_appit_print))
elif os.sep == '/' and lenv['OURPLATFORM'] != 'linuxcross': # any unix (except cross-compilation)
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))
BlenderEnvironment.PyBundleActionAdded = True
elif lenv['OURPLATFORM'].startswith('win') or lenv['OURPLATFORM'] == 'linuxcross': # windows or cross-compilation
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))
BlenderEnvironment.PyBundleActionAdded = True
return prog

@ -134,7 +134,7 @@ def validate_arguments(args, bc):
'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC',
'BF_TWEAK_MODE', 'BF_SPLIT_SRC',
'WITHOUT_BF_INSTALL',
'WITHOUT_BF_PYTHON_INSTALL',
'WITHOUT_BF_PYTHON_INSTALL', 'WITHOUT_BF_PYTHON_UNPACK',
'WITHOUT_BF_OVERWRITE_INSTALL',
'WITH_BF_OPENMP', 'BF_OPENMP', 'BF_OPENMP_LIBPATH',
'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('WITHOUT_BF_INSTALL', 'dont install 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('BF_FANCY', 'Enable fancy output if true', True)),
(BoolVariable('BF_QUIET', 'Enable silent output if true', True)),

@ -28,7 +28,7 @@ This example script prints the vertices and UV's for each polygon, assumes the a
import bpy
me = bpy.context.object.data
uv_layer = me.uv.layers.active.data
uv_layer = me.uv_layers.active.data
for poly in me.polygons:
print("Polygon index: %d, length: %d" % (poly.index, poly.loop_total))

@ -11,39 +11,41 @@ Intro
.. code-block:: python
# 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:
import bge.render
import bge.logic
import bge
# scale sets the speed of motion
scale = 1.0, 0.5
co = bge.logic.getCurrentController()
obj = co.getOwner()
mouse = co.getSensor("Mouse")
lmotion = co.getActuator("LMove")
wmotion = co.getActuator("WMove")
obj = co.owner
mouse = co.sensors["Mouse"]
lmotion = co.actuators["LMove"]
wmotion = co.actuators["WMove"]
# Transform the mouse coordinates to see how far the mouse has moved.
def mousePos():
x = (bge.render.getWindowWidth() / 2 - mouse.getXPosition()) * scale[0]
y = (bge.render.getWindowHeight() / 2 - mouse.getYPosition()) * scale[1]
x = (bge.render.getWindowWidth() / 2 - mouse.position[0]) * scale[0]
y = (bge.render.getWindowHeight() / 2 - mouse.position[1]) * scale[1]
return (x, y)
pos = mousePos()
# 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
wmotion.setTorque(-pos[1], 0.0, 0.0, True)
lmotion.useLocalTorque = True
lmotion.torque = ((-pos[1], 0.0, 0.0))
# Activate both actuators
bge.logic.addActiveActuator(lmotion, True)
bge.logic.addActiveActuator(wmotion, True)
co.activate(lmotion)
co.activate(wmotion)
# 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

@ -99,9 +99,11 @@ Here are some examples ...
uv_lay = bm.loops.layers.uv.active
for face in bm.faces:
for loop in f.loops:
uv = loop[uv_lay]
print("Loop UV: %f, %f" % (uv.x, uv.y))
for loop in face.loops:
uv = loop[uv_lay].uv
print("Loop UV: %f, %f" % uv[:])
vert = loop.vert
print("Loop Vert: (%f,%f,%f)" % vert.co[:])
.. code-block:: python

@ -245,6 +245,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
/* object sync */
if(object_updated || (object->mesh && object->mesh->need_update)) {
object->name = b_ob.name().c_str();
object->instance_id = b_index;
object->pass_id = b_ob.pass_index();
object->tfm = tfm;
object->motion.pre = tfm;
@ -284,52 +285,55 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
/* object loop */
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) {
bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
uint ob_layer = get_layer(b_ob->layers());
for(; b_sce; b_sce = b_sce.background_set()) {
for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end(); ++b_ob) {
bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render();
uint ob_layer = get_layer(b_ob->layers());
if(!hide && (ob_layer & scene_layer)) {
if(b_ob->is_duplicator()) {
/* dupli objects */
object_create_duplilist(*b_ob, b_scene);
if(!hide && (ob_layer & scene_layer)) {
if(b_ob->is_duplicator()) {
/* dupli objects */
object_create_duplilist(*b_ob, b_scene);
BL::Object::dupli_list_iterator b_dup;
int b_index = 0;
BL::Object::dupli_list_iterator b_dup;
int b_index = 0;
for(b_ob->dupli_list.begin(b_dup); b_dup != b_ob->dupli_list.end(); ++b_dup) {
Transform tfm = get_transform(b_dup->matrix());
BL::Object b_dup_ob = b_dup->object();
bool dup_hide = (b_v3d)? b_dup_ob.hide(): b_dup_ob.hide_render();
for(b_ob->dupli_list.begin(b_dup); b_dup != b_ob->dupli_list.end(); ++b_dup) {
Transform tfm = get_transform(b_dup->matrix());
BL::Object b_dup_ob = b_dup->object();
bool dup_hide = (b_v3d)? b_dup_ob.hide(): b_dup_ob.hide_render();
if(!(b_dup->hide() || dup_hide))
sync_object(*b_ob, b_index, b_dup_ob, tfm, ob_layer, motion);
if(!(b_dup->hide() || dup_hide))
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;
}
}
if(!hide) {
/* object itself */
Transform tfm = get_transform(b_ob->matrix_world());
sync_object(*b_ob, 0, *b_ob, tfm, ob_layer, motion);
/* 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;
}
if(!hide) {
/* object itself */
Transform tfm = get_transform(b_ob->matrix_world());
sync_object(*b_ob, 0, *b_ob, tfm, ob_layer, motion);
}
}
}
}

@ -334,6 +334,10 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Shader
node = new LightFalloffNode();
break;
}
case BL::ShaderNode::type_OBJECT_INFO: {
node = new ObjectInfoNode();
break;
}
case BL::ShaderNode::type_TEX_IMAGE: {
BL::ShaderNodeTexImage b_image_node(b_node);
BL::Image b_image(b_image_node.image());

@ -117,6 +117,16 @@ __device_inline void object_dir_transform(KernelGlobals *kg, ShaderData *sd, flo
#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)
{
int offset = object*OBJECT_SIZE + OBJECT_PROPERTIES;
@ -134,5 +144,20 @@ __device_inline float object_pass_id(KernelGlobals *kg, int object)
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

@ -679,11 +679,6 @@ __device bool shader_transparent_shadow(KernelGlobals *kg, Intersection *isect)
}
#endif
__device int shader_pass_id(KernelGlobals *kg, ShaderData *sd)
{
return kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2 + 1);
}
/* Free ShaderData */
__device void shader_release(KernelGlobals *kg, ShaderData *sd)

@ -266,6 +266,9 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
case NODE_LIGHT_PATH:
svm_node_light_path(sd, stack, node.y, node.z, path_flag);
break;
case NODE_OBJECT_INFO:
svm_node_object_info(kg, sd, stack, node.y, node.z);
break;
#endif
case NODE_CONVERT:
svm_node_convert(sd, stack, node.y, node.z, node.w);

@ -74,5 +74,25 @@ __device void svm_node_geometry_bump_dy(ShaderData *sd, float *stack, uint type,
#endif
}
/* 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

@ -92,7 +92,8 @@ typedef enum NodeType {
NODE_RGB_RAMP = 5900,
NODE_RGB_CURVES = 6000,
NODE_MIN_MAX = 6100,
NODE_LIGHT_FALLOFF = 6200
NODE_LIGHT_FALLOFF = 6200,
NODE_OBJECT_INFO = 6300
} NodeType;
typedef enum NodeAttributeType {
@ -109,6 +110,13 @@ typedef enum NodeGeometry {
NODE_GEOM_uv
} NodeGeometry;
typedef enum NodeObjectInfo {
NODE_INFO_OB_LOCATION,
NODE_INFO_OB_INDEX,
NODE_INFO_MAT_INDEX,
NODE_INFO_OB_RANDOM
} NodeObjectInfo;
typedef enum NodeLightPath {
NODE_LP_camera = 0,
NODE_LP_shadow,

@ -325,6 +325,25 @@ void ShaderGraph::remove_proxy_nodes(vector<bool>& removed)
removed[proxy->id] = true;
}
/* remove useless mix closures nodes */
MixClosureNode *mix = dynamic_cast<MixClosureNode*>(node);
if(mix) {
if(mix->outputs[0]->links.size() && mix->inputs[1]->link == mix->inputs[2]->link) {
ShaderOutput *output = mix->inputs[1]->link;
vector<ShaderInput*> inputs = mix->outputs[0]->links;
foreach(ShaderInput *sock, mix->inputs)
if(sock->link)
disconnect(sock);
foreach(ShaderInput *input, inputs) {
disconnect(input);
connect(output, input);
}
}
}
}
}

@ -1699,7 +1699,7 @@ void LightPathNode::compile(OSLCompiler& compiler)
compiler.add(this, "node_light_path");
}
/* Light Path */
/* Light Falloff */
LightFalloffNode::LightFalloffNode()
: ShaderNode("light_path")
@ -1746,6 +1746,49 @@ void LightFalloffNode::compile(OSLCompiler& compiler)
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 */
ValueNode::ValueNode()

@ -285,6 +285,11 @@ public:
SHADER_NODE_CLASS(LightFalloffNode)
};
class ObjectInfoNode : public ShaderNode {
public:
SHADER_NODE_CLASS(ObjectInfoNode)
};
class ValueNode : public ShaderNode {
public:
SHADER_NODE_CLASS(ValueNode)

@ -23,6 +23,7 @@
#include "scene.h"
#include "util_foreach.h"
#include "util_hash.h"
#include "util_map.h"
#include "util_progress.h"
@ -36,6 +37,7 @@ Object::Object()
mesh = NULL;
tfm = transform_identity();
visibility = ~0;
instance_id = 0;
pass_id = 0;
bounds = BoundBox::empty;
motion.pre = transform_identity();
@ -164,6 +166,9 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
float surface_area = 0.0f;
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)) {
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+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) {
/* motion transformations, is world/object space depending if mesh

@ -41,6 +41,7 @@ public:
Transform tfm;
BoundBox bounds;
ustring name;
int instance_id;
int pass_id;
vector<ParamValue> attributes;
uint visibility;

@ -19,13 +19,15 @@
#ifndef __UTIL_HASH_H__
#define __UTIL_HASH_H__
#include "util_types.h"
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))))
unsigned int a, b, c;
uint a, b, c;
a = b = c = 0xdeadbeef + (2 << 2) + 13;
a += kx;
@ -44,11 +46,21 @@ static inline unsigned int hash_int_2d(unsigned int kx, unsigned int ky)
#undef rot
}
static inline unsigned int hash_int(unsigned int k)
static inline uint hash_int(uint k)
{
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
#endif /* __UTIL_HASH_H__ */

@ -86,9 +86,12 @@ set(SRC
intern/solver_interface.h
intern/solver_relax.h
intern/utilities.h
intern/globals.h
intern/globals.h
)
# elbeem has some harmless UNUSED warnings
remove_strict_flags()
add_definitions(
-DNOGUI
-DELBEEM_BLENDER=1

@ -108,10 +108,6 @@ if(WITH_INPUT_NDOF)
)
endif()
if(WITH_XDG_USER_DIRS)
add_definitions(-DWITH_XDG_USER_DIRS)
endif()
if(WITH_HEADLESS OR WITH_GHOST_SDL)
if(WITH_HEADLESS)
list(APPEND SRC

@ -30,7 +30,7 @@
* \brief GHOST C-API function and type declarations.
*/
#ifndef __GHOST_C_API_H__
#ifndef __GHOST_C_API_H__
#define __GHOST_C_API_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).
*/
extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData);
GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData);
/**
* Removes a timer.
@ -125,11 +125,11 @@ extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
* @return Indication of success.
*/
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.
@ -146,8 +146,8 @@ extern GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
* @return void.
*/
extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
GHOST_TUns32* width,
GHOST_TUns32* height);
GHOST_TUns32 *width,
GHOST_TUns32 *height);
/**
* 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).
*/
extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
const char* title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const int stereoVisual,
const GHOST_TUns16 numOfAASamples);
const char *title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const int stereoVisual,
const GHOST_TUns16 numOfAASamples);
/**
* Returns the window user data.
@ -189,7 +189,7 @@ extern GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandl
* @param data The window user data.
*/
extern void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle,
GHOST_TUserDataPtr userdata);
GHOST_TUserDataPtr userdata);
/**
* Dispose a window.
@ -198,7 +198,7 @@ extern void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle,
* @return Indication of success.
*/
extern GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle windowhandle);
GHOST_WindowHandle windowhandle);
/**
* Returns whether a window is valid.
@ -207,7 +207,7 @@ extern GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
* @return Indication of validity.
*/
extern int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle windowhandle);
GHOST_WindowHandle windowhandle);
/**
* 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.
*/
extern GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
GHOST_DisplaySetting* setting,
const int stereoVisual);
GHOST_DisplaySetting *setting,
const int stereoVisual);
/**
* Ends full screen mode.
@ -235,8 +235,8 @@ extern GHOST_TSuccess GHOST_EndFullScreen(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.
@ -261,7 +261,7 @@ extern int GHOST_DispatchEvents(GHOST_SystemHandle systemhandle);
* @return Indication of success.
*/
extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle,
GHOST_EventConsumerHandle consumerhandle);
GHOST_EventConsumerHandle consumerhandle);
/**
* Remove the given event consumer to our list.
@ -270,11 +270,11 @@ extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle,
* @return Indication of success.
*/
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
@ -290,8 +290,8 @@ extern GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle, floa
extern GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle);
/***************************************************************************************
** Cursor management functionality
***************************************************************************************/
** Cursor management functionality
***************************************************************************************/
/**
* Returns the current cursor shape.
@ -307,7 +307,7 @@ extern GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandl
* @return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
GHOST_TStandardCursor cursorshape);
GHOST_TStandardCursor cursorshape);
/**
* 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.
*/
extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
GHOST_TUns8 bitmap[16][2],
GHOST_TUns8 mask[16][2],
int hotX,
int hotY);
GHOST_TUns8 bitmap[16][2],
GHOST_TUns8 mask[16][2],
int hotX,
int hotY);
/**
* Set the shape of the cursor to a custom cursor of specified size.
* @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 fg_color, bg_color Colors of the cursor
* @return Indication of success.
*/
*/
extern GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex, int sizey,
int hotX, int hotY,
int fg_color, int bg_color );
GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex, int sizey,
int hotX, int hotY,
int fg_color, int bg_color);
/**
* Returns the visibility state of the cursor.
@ -355,7 +355,7 @@ extern int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle);
* @return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle,
int visible);
int visible);
/**
* 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.
*/
extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TInt32* x,
GHOST_TInt32* y);
GHOST_TInt32 *x,
GHOST_TInt32 *y);
/**
* 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.
*/
extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TInt32 x,
GHOST_TInt32 y);
GHOST_TInt32 x,
GHOST_TInt32 y);
/**
* 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.
*/
extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
GHOST_TGrabCursorMode mode,
int* bounds);
GHOST_TGrabCursorMode mode,
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).
@ -405,8 +405,8 @@ extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
* @return Indication of success.
*/
extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
GHOST_TModifierKeyMask mask,
int* isDown);
GHOST_TModifierKeyMask mask,
int *isDown);
/**
* 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.
*/
extern GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
GHOST_TButtonMask mask,
int* isDown);
GHOST_TButtonMask mask,
int *isDown);
/***************************************************************************************
** Drag'n'drop operations
***************************************************************************************/
** Drag'n'drop operations
***************************************************************************************/
/**
* 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.
*/
extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
GHOST_TimerProcPtr timerProc);
GHOST_TimerProcPtr timerProc);
/**
* Returns the timer user data.
@ -487,7 +487,7 @@ extern GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timer
* @param data The timer user data.
*/
extern void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
GHOST_TUserDataPtr userData);
GHOST_TUserDataPtr userData);
/**
* 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.
*/
extern GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle,
GHOST_TDrawingContextType type);
GHOST_TDrawingContextType type);
/**
* 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.
*/
extern void GHOST_SetTitle(GHOST_WindowHandle windowhandle,
const char* title);
const char *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
* @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.
@ -558,7 +558,7 @@ void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle);
* @return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle,
GHOST_TUns32 width);
GHOST_TUns32 width);
/**
* Resizes client rectangle height.
@ -567,7 +567,7 @@ extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle,
* @return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle,
GHOST_TUns32 height);
GHOST_TUns32 height);
/**
* Resizes client rectangle.
@ -577,8 +577,8 @@ extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle,
* @return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
GHOST_TUns32 width,
GHOST_TUns32 height);
GHOST_TUns32 width,
GHOST_TUns32 height);
/**
* 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.
*/
extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32* outX,
GHOST_TInt32* outY);
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY);
/**
* 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.
*/
extern void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32* outX,
GHOST_TInt32* outY);
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY);
/**
* 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.
*/
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.
*/
extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle,
GHOST_TUns8 isUnsavedChanges);
GHOST_TUns8 isUnsavedChanges);
/**
* Sets the order of the window (bottom, top).
@ -641,7 +641,7 @@ extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhand
* @return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle,
GHOST_TWindowOrder order);
GHOST_TWindowOrder order);
/**
* 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.
*/
extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32* l,
GHOST_TInt32* t,
GHOST_TInt32* r,
GHOST_TInt32* b);
GHOST_TInt32 *l,
GHOST_TInt32 *t,
GHOST_TInt32 *r,
GHOST_TInt32 *b);
/**
* 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
*/
extern void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 l,
GHOST_TInt32 t,
GHOST_TInt32 r,
GHOST_TInt32 b);
GHOST_TInt32 l,
GHOST_TInt32 t,
GHOST_TInt32 r,
GHOST_TInt32 b);
/**
* 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).
*/
extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 i);
GHOST_TInt32 i);
/**
* 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.
*/
extern void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle);
GHOST_RectangleHandle anotherrectanglehandle);
/**
* 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.
*/
extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x,
GHOST_TInt32 y);
GHOST_TInt32 x,
GHOST_TInt32 y);
/**
* 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).
*/
extern GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x,
GHOST_TInt32 y);
GHOST_TInt32 x,
GHOST_TInt32 y);
/**
* 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).
*/
extern GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle);
GHOST_RectangleHandle anotherrectanglehandle);
/**
* Sets rectangle members.
@ -786,8 +786,8 @@ extern GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rect
* @param cy requested center y-coordinate of the rectangle
*/
extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
GHOST_TInt32 cy);
GHOST_TInt32 cx,
GHOST_TInt32 cy);
/**
* Sets rectangle members.
@ -800,10 +800,10 @@ extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
* @param h requested height of the rectangle
*/
extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
GHOST_TInt32 cy,
GHOST_TInt32 w,
GHOST_TInt32 h);
GHOST_TInt32 cx,
GHOST_TInt32 cy,
GHOST_TInt32 w,
GHOST_TInt32 h);
/**
* Clips a rectangle.
@ -814,14 +814,14 @@ extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
* @return whether clipping has occurred
*/
extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle);
GHOST_RectangleHandle anotherrectanglehandle);
/**
* Return the data from the clipboad
* @param return the selection instead, X11 only feature
* @return clipboard data
*/
extern GHOST_TUns8* GHOST_getClipboard(int selection);
extern GHOST_TUns8 *GHOST_getClipboard(int selection);
/**
* Put data to the Clipboard

@ -77,7 +77,7 @@ public:
* or NULL if it is a 'system' event.
* @return The generating window.
*/
virtual GHOST_IWindow* getWindow() = 0;
virtual GHOST_IWindow *getWindow() = 0;
/**
* Returns the event data.
@ -87,8 +87,12 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_IEvent"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
void *operator new(size_t num_bytes) {
return MEM_mallocN(num_bytes, "GHOST:GHOST_IEvent");
}
void operator delete(void *mem) {
MEM_freeN(mem);
}
#endif
};

@ -61,7 +61,7 @@ public:
* @param event The event that can be handled or ignored.
* @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
public:

@ -129,12 +129,12 @@ class GHOST_IEventConsumer;
* There should be only one system class in an application.
* Therefore, the routines to create and dispose the system are static.
* Provides:
* -# Time(r) management.
* -# Display/window management (windows are only created on the main display).
* -# Event management.
* -# Cursor shape management (no custom cursors for now).
* -# Access to the state of the mouse buttons and the keyboard.
* -# Menus for windows with events generated when they are accessed (this is
* -# Time(r) management.
* -# Display/window management (windows are only created on the main display).
* -# Event management.
* -# Cursor shape management (no custom cursors for now).
* -# Access to the state of the mouse buttons and the keyboard.
* -# Menus for windows with events generated when they are accessed (this is
* work in progress).
* @author Maarten Gribnau
* @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).
* @return A pointer to the system.
*/
static GHOST_ISystem* getSystem();
static GHOST_ISystem *getSystem();
protected:
/**
* Constructor.
* Protected default constructor to force use of static createSystem member.
*/
GHOST_ISystem() {}
GHOST_ISystem() {
}
/**
* Destructor.
* Protected default constructor to force use of static dispose member.
*/
virtual ~GHOST_ISystem() {}
virtual ~GHOST_ISystem() {
}
public:
/***************************************************************************************
** Time(r) functionality
***************************************************************************************/
** Time(r) functionality
***************************************************************************************/
/**
* Returns the system time.
@ -196,7 +198,7 @@ public:
* @param userData Placeholder for user data.
* @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_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData = 0) = 0;
@ -206,17 +208,17 @@ public:
* @param timerTask Timer task to be removed.
* @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.
* @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.
@ -237,30 +239,30 @@ public:
* @param type The type of drawing context installed in this window.
* @param stereoVisual Create a stereo visual for quad buffered stereo.
* @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).
*/
virtual GHOST_IWindow* createWindow(
const STR_String& title,
GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TDrawingContextType type,
const bool stereoVisual = false,
const GHOST_TUns16 numOfAASamples = 0,
const GHOST_TEmbedderWindowID parentWindow = 0) = 0;
virtual GHOST_IWindow *createWindow(
const STR_String& title,
GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TDrawingContextType type,
const bool stereoVisual = false,
const GHOST_TUns16 numOfAASamples = 0,
const GHOST_TEmbedderWindowID parentWindow = 0) = 0;
/**
* Dispose a window.
* @param window Pointer to the window to be disposed.
* @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.
* @param window Pointer to the window to be checked.
* @return Indication of validity.
*/
virtual bool validWindow(GHOST_IWindow* window) = 0;
virtual bool validWindow(GHOST_IWindow *window) = 0;
/**
* Begins full screen mode.
@ -269,8 +271,8 @@ public:
* This window is invalid after full screen has been ended.
* @return Indication of success.
*/
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples=0) = 0;
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0) = 0;
/**
* Updates the resolution while in fullscreen mode.
@ -279,7 +281,7 @@ public:
*
* @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.
@ -294,8 +296,8 @@ public:
virtual bool getFullScreen(void) = 0;
/***************************************************************************************
** Event management functionality
***************************************************************************************/
** Event management functionality
***************************************************************************************/
/**
* Retrieves events from the system and stores them in the queue.
@ -315,18 +317,18 @@ public:
* @param consumer The event consumer to add.
* @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.
* @param consumer The event consumer to remove.
* @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)
@ -346,8 +348,8 @@ public:
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).
@ -377,15 +379,15 @@ public:
virtual int toggleConsole(int action) = 0;
/***************************************************************************************
** Access to clipboard.
***************************************************************************************/
** Access to clipboard.
***************************************************************************************/
/**
* Returns the selection 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
@ -396,7 +398,7 @@ public:
* Confirms quitting he program when there is just one window left open
* in the application
*/
virtual int confirmQuit(GHOST_IWindow * window) const = 0;
virtual int confirmQuit(GHOST_IWindow *window) const = 0;
protected:
/**
* Initialize the system.
@ -411,12 +413,16 @@ protected:
virtual GHOST_TSuccess exit() = 0;
/** The one and only system */
static GHOST_ISystem* m_system;
static GHOST_ISystem *m_system;
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_ISystem"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
void *operator new(size_t num_bytes) {
return MEM_mallocN(num_bytes, "GHOST:GHOST_ISystem");
}
void operator delete(void *mem) {
MEM_freeN(mem);
}
#endif
};

@ -52,50 +52,52 @@ public:
* Returns a pointer to the one and only system (nil if it hasn't been created).
* @return A pointer to the system.
*/
static GHOST_ISystemPaths* get();
static GHOST_ISystemPaths *get();
protected:
/**
* Constructor.
* Protected default constructor to force use of static createSystem member.
*/
GHOST_ISystemPaths() {}
GHOST_ISystemPaths() {
}
/**
* Destructor.
* Protected default constructor to force use of static dispose member.
*/
virtual ~GHOST_ISystemPaths() {}
virtual ~GHOST_ISystemPaths() {
}
public:
/**
* 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/).
*/
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.
* @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
* @return Unsigned char string pointing to the binary dir
*/
virtual const GHOST_TUns8* getBinaryDir() const = 0;
* Determine the directory of the current binary
* @return Unsigned char string pointing to the binary dir
*/
virtual const GHOST_TUns8 *getBinaryDir() const = 0;
/**
* 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:
/** The one and only system paths*/
static GHOST_ISystemPaths* m_systemPaths;
static GHOST_ISystemPaths *m_systemPaths;
};
#endif

@ -86,8 +86,12 @@ public:
#ifdef WITH_CXX_GUARDEDALLOC
public:
void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GHOST:GHOST_ITimerTask"); }
void operator delete( void *mem ) { MEM_freeN(mem); }
void *operator new(size_t num_bytes) {
return MEM_mallocN(num_bytes, "GHOST:GHOST_ITimerTask");
}
void operator delete(void *mem) {
MEM_freeN(mem);
}
#endif
};

@ -70,13 +70,13 @@ public:
* Returns indication as to whether the window is valid.
* @return The validity of the window.
*/
virtual bool getValid() const = 0;
virtual bool getValid() const = 0;
/**
* Returns 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.
@ -108,33 +108,33 @@ public:
* These are screen coordinates.
* @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.
* The left and top members of the rectangle are always zero.
* @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.
* @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.
* @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.
* @param width The new width 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
@ -143,7 +143,7 @@ public:
* @param outX The x-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
@ -152,7 +152,7 @@ public:
* @param outX The x-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
@ -232,14 +232,14 @@ public:
* Returns 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 %
*/
virtual GHOST_TSuccess setProgressBar(float progress) = 0;
@ -250,8 +250,8 @@ public:
virtual GHOST_TSuccess endProgressBar() = 0;
/***************************************************************************************
** Cursor management functionality
***************************************************************************************/
** Cursor management functionality
***************************************************************************************/
/**
* Returns the current cursor shape.
@ -275,15 +275,15 @@ public:
* @return Indication of success.
*/
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
GHOST_TUns8 mask[16][2],
int hotX,
int hotY) = 0;
GHOST_TUns8 mask[16][2],
int hotX,
int hotY) = 0;
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex, int sizey,
int hotX, int hotY,
int fg_color, int bg_color) = 0;
GHOST_TUns8 *mask,
int sizex, int sizey,
int hotX, int hotY,
int fg_color, int bg_color) = 0;
/**
* Returns the visibility state of the cursor.

@ -30,7 +30,7 @@
*/
#ifndef __GHOST_PATH_API_H__
#ifndef __GHOST_PATH_API_H__
#define __GHOST_PATH_API_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
* "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/).
*/
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 ~).
*/
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.
* @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
*/
extern void GHOST_addToSystemRecentFiles(const char* filename);
* Add the file to the operating system most recently used files
*/
extern void GHOST_addToSystemRecentFiles(const char *filename);
#ifdef __cplusplus
}

@ -55,20 +55,23 @@ public:
* @param r requested right 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)
: m_l(l), m_t(t), m_r(r), m_b(b) {}
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)
{}
/**
* Copy constructor.
* @param r rectangle to copy
*/
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.
*/
virtual ~GHOST_Rect() {};
virtual ~GHOST_Rect()
{};
/**
* Access to rectangle width.
@ -155,7 +158,7 @@ public:
* @param cx requested center x-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.
@ -166,7 +169,7 @@ public:
* @param w requested width 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.
@ -175,7 +178,7 @@ public:
* @param r the rectangle to clip
* @return whether clipping has occurred
*/
virtual bool clip(GHOST_Rect& r) const;
virtual bool clip(GHOST_Rect& r) const;
/** Left coordinate of the rectangle */
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;
}
inline bool GHOST_Rect::isEmpty() const
inline bool GHOST_Rect::isEmpty() const
{
return (getWidth() == 0) || (getHeight() == 0);
}
@ -237,18 +240,18 @@ inline void GHOST_Rect::unionPoint(GHOST_TInt32 x, GHOST_TInt32 y)
#include <stdio.h>
inline void GHOST_Rect::wrapPoint(GHOST_TInt32 &x, GHOST_TInt32 &y, GHOST_TInt32 ofs)
{
GHOST_TInt32 w= getWidth();
GHOST_TInt32 h= getHeight();
GHOST_TInt32 w = getWidth();
GHOST_TInt32 h = getHeight();
/* 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;
}
while(x-ofs < m_l) x+= w-(ofs*2);
while(y-ofs < m_t) y+= h-(ofs*2);
while(x+ofs > m_r) x-= w-(ofs*2);
while(y+ofs > m_b) y-= h-(ofs*2);
while (x - ofs < m_l) x += w - (ofs * 2);
while (y - ofs < m_t) y += h - (ofs * 2);
while (x + ofs > m_r) x -= w - (ofs * 2);
while (y + ofs > m_b) y -= h - (ofs * 2);
}
inline bool GHOST_Rect::isInside(GHOST_TInt32 x, GHOST_TInt32 y) const

@ -39,22 +39,22 @@
#define GHOST_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
typedef char GHOST_TInt8;
typedef unsigned char GHOST_TUns8;
typedef short GHOST_TInt16;
typedef unsigned short GHOST_TUns16;
typedef int GHOST_TInt32;
typedef unsigned int GHOST_TUns32;
typedef char GHOST_TInt8;
typedef unsigned char GHOST_TUns8;
typedef short GHOST_TInt16;
typedef unsigned short GHOST_TUns16;
typedef int GHOST_TInt32;
typedef unsigned int GHOST_TUns32;
#if defined(WIN32) && !defined(FREE_WINDOWS)
typedef __int64 GHOST_TInt64;
typedef unsigned __int64 GHOST_TUns64;
typedef __int64 GHOST_TInt64;
typedef unsigned __int64 GHOST_TUns64;
#else
typedef long long GHOST_TInt64;
typedef unsigned long long GHOST_TUns64;
typedef long long GHOST_TInt64;
typedef unsigned long long GHOST_TUns64;
#endif
typedef void* GHOST_TUserDataPtr;
typedef void *GHOST_TUserDataPtr;
typedef enum
{
@ -77,9 +77,9 @@ typedef enum {
typedef struct GHOST_TabletData {
GHOST_TTabletMode Active; /* 0=None, 1=Stylus, 2=Eraser */
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 Ytilt; /* as above */
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 Ytilt; /* as above */
} GHOST_TabletData;
@ -152,14 +152,14 @@ typedef enum {
typedef enum {
GHOST_kEventUnknown = 0,
GHOST_kEventCursorMove, /// Mouse move event
GHOST_kEventButtonDown, /// Mouse button event
GHOST_kEventButtonUp, /// Mouse button event
GHOST_kEventWheel, /// Mouse wheel event
GHOST_kEventTrackpad, /// Trackpad event
GHOST_kEventCursorMove, /// Mouse move event
GHOST_kEventButtonDown, /// Mouse button event
GHOST_kEventButtonUp, /// Mouse button event
GHOST_kEventWheel, /// Mouse wheel event
GHOST_kEventTrackpad, /// Trackpad event
GHOST_kEventNDOFMotion, /// N degree of freedom device motion event
GHOST_kEventNDOFButton, /// N degree of freedom device button event
GHOST_kEventNDOFMotion, /// N degree of freedom device motion event
GHOST_kEventNDOFButton, /// N degree of freedom device button event
GHOST_kEventKeyDown,
GHOST_kEventKeyUp,
@ -289,8 +289,8 @@ typedef enum {
GHOST_kKeyRightControl,
GHOST_kKeyLeftAlt,
GHOST_kKeyRightAlt,
GHOST_kKeyOS, // Command key on Apple, Windows key(s) on Windows
GHOST_kKeyGrLess , // German PC only!
GHOST_kKeyOS, // Command key on Apple, Windows key(s) on Windows
GHOST_kKeyGrLess, // German PC only!
GHOST_kKeyCapsLock,
GHOST_kKeyNumLock,
@ -363,13 +363,13 @@ typedef enum {
} GHOST_TKey;
typedef enum {
GHOST_kGrabDisable = 0, /* grab not set */
GHOST_kGrabNormal, /* no cursor adjustments */
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_kGrabDisable = 0, /* grab not set */
GHOST_kGrabNormal, /* no cursor adjustments */
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_TGrabCursorMode;
typedef void* GHOST_TEventDataPtr;
typedef void *GHOST_TEventDataPtr;
typedef struct {
/** The x-coordinate of the cursor position. */
@ -389,7 +389,7 @@ typedef struct {
} GHOST_TEventWheelData;
typedef enum {
GHOST_kTrackpadEventUnknown =0,
GHOST_kTrackpadEventUnknown = 0,
GHOST_kTrackpadEventScroll,
GHOST_kTrackpadEventRotate,
GHOST_kTrackpadEventSwipe, /* Reserved, not used for now */
@ -412,7 +412,7 @@ typedef struct {
typedef enum {
GHOST_kDragnDropTypeUnknown =0,
GHOST_kDragnDropTypeUnknown = 0,
GHOST_kDragnDropTypeFilenames, /*Array of strings representing file names (full path) */
GHOST_kDragnDropTypeString, /* Unformatted text UTF-8 string */
GHOST_kDragnDropTypeBitmap /*Bitmap image data */
@ -440,7 +440,7 @@ typedef enum {
GHOST_kInProgress,
GHOST_kFinishing,
GHOST_kFinished
} GHOST_TProgress;
} GHOST_TProgress;
typedef struct {
/** 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.
float tx, ty, tz; // translation
float rx, ry, rz; // rotation:
// axis = (rx,ry,rz).normalized
// amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg]
// axis = (rx,ry,rz).normalized
// amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg]
float dt; // time since previous NDOF Motion event
GHOST_TProgress progress; // Starting, InProgress or Finishing (for modal handlers)
} GHOST_TEventNDOFMotionData;
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 {
GHOST_TButtonAction action;
@ -464,7 +464,7 @@ typedef struct {
typedef struct {
/** The key code. */
GHOST_TKey key;
GHOST_TKey key;
/* ascii / utf8: both should always be set when possible,
* - 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.
*/
/** 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 */
char utf8_buf[6];
char utf8_buf[6];
} GHOST_TEventKeyData;
typedef struct {
/** Number of pixels on a line. */
GHOST_TUns32 xPixels;
GHOST_TUns32 xPixels;
/** Number of lines. */
GHOST_TUns32 yPixels;
GHOST_TUns32 yPixels;
/** Numberof bits per pixel. */
GHOST_TUns32 bpp;
GHOST_TUns32 bpp;
/** Refresh rate (in Hertz). */
GHOST_TUns32 frequency;
GHOST_TUns32 frequency;
} GHOST_DisplaySetting;
@ -509,10 +509,10 @@ typedef int GHOST_TEmbedderWindowID;
*/
#ifdef __cplusplus
class GHOST_ITimerTask;
typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask* task, GHOST_TUns64 time);
typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask *task, GHOST_TUns64 time);
#else
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 // __GHOST_TYPES_H__

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

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

@ -50,7 +50,7 @@
GHOST_SystemHandle GHOST_CreateSystem(void)
{
GHOST_ISystem::createSystem();
GHOST_ISystem* system = GHOST_ISystem::getSystem();
GHOST_ISystem *system = GHOST_ISystem::getSystem();
return (GHOST_SystemHandle)system;
}
@ -59,7 +59,7 @@ GHOST_SystemHandle GHOST_CreateSystem(void)
GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
return system->disposeSystem();
}
@ -68,20 +68,20 @@ GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback,
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)
{
delete ((GHOST_CallbackEventConsumer*)consumerhandle);
delete ((GHOST_CallbackEventConsumer *)consumerhandle);
return GHOST_kSuccess;
}
GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
return system->getMilliSeconds();
}
@ -89,12 +89,12 @@ GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerproc,
GHOST_TUserDataPtr userdata)
GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerproc,
GHOST_TUserDataPtr userdata)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
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_TimerTaskHandle timertaskhandle)
GHOST_TimerTaskHandle timertaskhandle)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle;
return system->removeTimer(timertask);
}
@ -114,7 +114,7 @@ GHOST_TSuccess GHOST_RemoveTimer(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();
}
@ -122,10 +122,10 @@ GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
GHOST_TUns32* width,
GHOST_TUns32* height)
GHOST_TUns32 *width,
GHOST_TUns32 *height)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
system->getMainDisplayDimensions(*width, *height);
}
@ -133,46 +133,46 @@ void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
const char* title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const int stereoVisual,
const GHOST_TUns16 numOfAASamples)
const char *title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const int stereoVisual,
const GHOST_TUns16 numOfAASamples)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
bool bstereoVisual;
if(stereoVisual)
if (stereoVisual)
bstereoVisual = true;
else
bstereoVisual = false;
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_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
return window->getUserData();
}
void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr userdata)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
window->setUserData(userdata);
}
GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle windowhandle)
GHOST_WindowHandle windowhandle)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
return system->disposeWindow(window);
}
@ -180,10 +180,10 @@ GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle windowhandle)
GHOST_WindowHandle windowhandle)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
return (int) system->validWindow(window);
}
@ -191,14 +191,14 @@ int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
GHOST_DisplaySetting* setting,
const int stereoVisual)
GHOST_DisplaySetting *setting,
const int stereoVisual)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_IWindow* window = NULL;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
GHOST_IWindow *window = NULL;
bool bstereoVisual;
if(stereoVisual)
if (stereoVisual)
bstereoVisual = true;
else
bstereoVisual = false;
@ -212,7 +212,7 @@ GHOST_WindowHandle GHOST_BeginFullScreen(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();
}
@ -221,7 +221,7 @@ GHOST_TSuccess GHOST_EndFullScreen(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();
}
@ -230,16 +230,16 @@ int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle)
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)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
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_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_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);
}
GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
return window->endProgressBar();
}
@ -276,7 +276,7 @@ GHOST_TSuccess GHOST_EndProgressBar(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();
}
@ -284,45 +284,45 @@ GHOST_TStandardCursor GHOST_GetCursorShape(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);
}
GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
GHOST_TUns8 bitmap[16][2],
GHOST_TUns8 mask[16][2],
int hotX,
int hotY)
GHOST_TUns8 bitmap[16][2],
GHOST_TUns8 mask[16][2],
int hotX,
int hotY)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
return window->setCustomCursorShape(bitmap, mask, hotX, hotY);
}
GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
int hotY,
int fg_color,
int bg_color)
GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
int hotY,
int fg_color,
int bg_color)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
return window->setCustomCursorShape(bitmap, mask, sizex, sizey,
hotX, hotY, fg_color, bg_color);
return window->setCustomCursorShape(bitmap, mask, sizex, sizey,
hotX, hotY, fg_color, bg_color);
}
int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
return (int) window->getCursorVisibility();
}
@ -330,20 +330,20 @@ int GHOST_GetCursorVisibility(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_TInt32* x,
GHOST_TInt32* y)
GHOST_TInt32 *x,
GHOST_TInt32 *y)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
return system->getCursorPosition(*x, *y);
}
@ -351,23 +351,23 @@ GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TInt32 x,
GHOST_TInt32 y)
GHOST_TInt32 x,
GHOST_TInt32 y)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
return system->setCursorPosition(x, y);
}
GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
GHOST_TGrabCursorMode mode,
int *bounds)
GHOST_TGrabCursorMode mode,
int *bounds)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
GHOST_Rect bounds_rect, bounds_win;
if(bounds) {
if (bounds) {
/* if this is X11 specific we need a function that converts */
window->getClientBounds(bounds_win);
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_TModifierKeyMask mask,
int* isDown)
GHOST_TModifierKeyMask mask,
int *isDown)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
GHOST_TSuccess result;
bool isdown= false;
bool isdown = false;
result = system->getModifierKeyState(mask, isdown);
*isDown = (int) isdown;
@ -396,12 +396,12 @@ GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
GHOST_TButtonMask mask,
int* isDown)
GHOST_TButtonMask mask,
int *isDown)
{
GHOST_ISystem* system = (GHOST_ISystem*) systemhandle;
GHOST_ISystem *system = (GHOST_ISystem *) systemhandle;
GHOST_TSuccess result;
bool isdown= false;
bool isdown = false;
result = system->getButtonState(mask, isdown);
*isDown = (int) isdown;
@ -412,7 +412,7 @@ GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
window->setAcceptDragOperation(canAccept);
}
@ -420,7 +420,7 @@ void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 c
GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
{
GHOST_IEvent* event = (GHOST_IEvent*) eventhandle;
GHOST_IEvent *event = (GHOST_IEvent *) eventhandle;
return event->getType();
}
@ -429,7 +429,7 @@ GHOST_TEventType GHOST_GetEventType(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();
}
@ -437,7 +437,7 @@ GHOST_TUns64 GHOST_GetEventTime(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();
}
@ -445,7 +445,7 @@ GHOST_WindowHandle GHOST_GetEventWindow(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();
}
@ -454,7 +454,7 @@ GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle)
GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle)
{
GHOST_ITimerTask* timertask = (GHOST_ITimerTask*) timertaskhandle;
GHOST_ITimerTask *timertask = (GHOST_ITimerTask *) timertaskhandle;
return timertask->getTimerProc();
}
@ -462,9 +462,9 @@ GHOST_TimerProcPtr GHOST_GetTimerProc(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);
}
@ -473,17 +473,17 @@ void GHOST_SetTimerProc(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();
}
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);
}
@ -492,7 +492,7 @@ void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
int GHOST_GetValid(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
return (int) window->getValid();
}
@ -501,7 +501,7 @@ int GHOST_GetValid(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();
}
@ -509,9 +509,9 @@ GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle windowh
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);
}
@ -519,26 +519,26 @@ GHOST_TSuccess GHOST_SetDrawingContextType(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);
}
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;
window->getTitle(title);
char *ctitle = (char*) malloc(title.Length() + 1);
char *ctitle = (char *) malloc(title.Length() + 1);
if (ctitle == NULL) return NULL;
strcpy(ctitle, title.Ptr());
return ctitle;
}
@ -546,8 +546,8 @@ char* GHOST_GetTitle(GHOST_WindowHandle windowhandle)
GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_Rect* rectangle = NULL;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
GHOST_Rect *rectangle = NULL;
rectangle = new GHOST_Rect();
window->getWindowBounds(*rectangle);
@ -559,8 +559,8 @@ GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle)
GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_Rect* rectangle = NULL;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
GHOST_Rect *rectangle = NULL;
rectangle = new GHOST_Rect();
window->getClientBounds(*rectangle);
@ -572,15 +572,15 @@ GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle)
void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle)
{
delete (GHOST_Rect*) rectanglehandle;
delete (GHOST_Rect *) rectanglehandle;
}
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);
}
@ -588,9 +588,9 @@ GHOST_TSuccess GHOST_SetClientWidth(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);
}
@ -598,10 +598,10 @@ GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle,
GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
GHOST_TUns32 width,
GHOST_TUns32 height)
GHOST_TUns32 width,
GHOST_TUns32 height)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
return window->setClientSize(width, height);
}
@ -609,12 +609,12 @@ GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32* outX,
GHOST_TInt32* outY)
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
window->screenToClient(inX, inY, *outX, *outY);
}
@ -622,12 +622,12 @@ void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32* outX,
GHOST_TInt32* outY)
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
window->clientToScreen(inX, inY, *outX, *outY);
}
@ -636,7 +636,7 @@ void GHOST_ClientToScreen(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();
}
@ -644,9 +644,9 @@ GHOST_TWindowState GHOST_GetWindowState(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);
}
@ -654,16 +654,16 @@ GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
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);
}
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);
}
@ -672,7 +672,7 @@ GHOST_TSuccess GHOST_SetWindowOrder(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();
}
@ -681,7 +681,7 @@ GHOST_TSuccess GHOST_SwapWindowBuffers(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();
}
@ -690,54 +690,54 @@ GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandl
GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
GHOST_IWindow *window = (GHOST_IWindow *) windowhandle;
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)
{
return ((GHOST_Rect*)rectanglehandle)->getWidth();
return ((GHOST_Rect *)rectanglehandle)->getWidth();
}
GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
{
return ((GHOST_Rect*)rectanglehandle)->getHeight();
return ((GHOST_Rect *)rectanglehandle)->getHeight();
}
void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32* l,
GHOST_TInt32* t,
GHOST_TInt32* r,
GHOST_TInt32* b)
GHOST_TInt32 *l,
GHOST_TInt32 *t,
GHOST_TInt32 *r,
GHOST_TInt32 *b)
{
GHOST_Rect *rect= (GHOST_Rect*) rectanglehandle;
*l= rect->m_l;
*t= rect->m_t;
*r= rect->m_r;
*b= rect->m_b;
GHOST_Rect *rect = (GHOST_Rect *) rectanglehandle;
*l = rect->m_l;
*t = rect->m_t;
*r = rect->m_r;
*b = rect->m_b;
}
void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 l,
GHOST_TInt32 t,
GHOST_TInt32 r,
GHOST_TInt32 b)
GHOST_TInt32 l,
GHOST_TInt32 t,
GHOST_TInt32 r,
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;
if (((GHOST_Rect*)rectanglehandle)->isEmpty())
if (((GHOST_Rect *)rectanglehandle)->isEmpty())
result = GHOST_kSuccess;
return result;
@ -758,7 +758,7 @@ GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle)
{
GHOST_TSuccess result = GHOST_kFailure;
if(((GHOST_Rect*)rectanglehandle)->isValid())
if (((GHOST_Rect *)rectanglehandle)->isValid())
result = GHOST_kSuccess;
return result;
@ -767,37 +767,37 @@ GHOST_TSuccess GHOST_IsValidRectangle(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,
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,
GHOST_TInt32 x,
GHOST_TInt32 y)
GHOST_TInt32 x,
GHOST_TInt32 y)
{
((GHOST_Rect*)rectanglehandle)->unionPoint(x, y);
((GHOST_Rect *)rectanglehandle)->unionPoint(x, y);
}
GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x,
GHOST_TInt32 y)
GHOST_TInt32 x,
GHOST_TInt32 y)
{
GHOST_TSuccess result = GHOST_kFailure;
if (((GHOST_Rect*)rectanglehandle)->isInside(x, y))
if (((GHOST_Rect *)rectanglehandle)->isInside(x, y))
result = GHOST_kSuccess;
return result;
@ -806,11 +806,11 @@ GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle)
GHOST_RectangleHandle anotherrectanglehandle)
{
GHOST_TVisibility visible = GHOST_kNotVisible;
visible = ((GHOST_Rect*)rectanglehandle)->getVisibility(*(GHOST_Rect*)anotherrectanglehandle);
visible = ((GHOST_Rect *)rectanglehandle)->getVisibility(*(GHOST_Rect *)anotherrectanglehandle);
return visible;
}
@ -818,56 +818,56 @@ GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectangleha
void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
GHOST_TInt32 cy)
GHOST_TInt32 cx,
GHOST_TInt32 cy)
{
((GHOST_Rect*)rectanglehandle)->setCenter(cx, cy);
((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy);
}
void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
GHOST_TInt32 cy,
GHOST_TInt32 w,
GHOST_TInt32 h)
GHOST_TInt32 cx,
GHOST_TInt32 cy,
GHOST_TInt32 w,
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_RectangleHandle anotherrectanglehandle)
GHOST_RectangleHandle anotherrectanglehandle)
{
GHOST_TSuccess result = GHOST_kFailure;
if (((GHOST_Rect*)rectanglehandle)->clip(*(GHOST_Rect*)anotherrectanglehandle))
if (((GHOST_Rect *)rectanglehandle)->clip(*(GHOST_Rect *)anotherrectanglehandle))
result = GHOST_kSuccess;
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);
}
void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
{
GHOST_ISystem* system = GHOST_ISystem::getSystem();
GHOST_ISystem *system = GHOST_ISystem::getSystem();
system->putClipboard(buffer, selection);
}
int GHOST_toggleConsole(int action)
{
GHOST_ISystem* system = GHOST_ISystem::getSystem();
GHOST_ISystem *system = GHOST_ISystem::getSystem();
return system->toggleConsole(action);
}
int GHOST_confirmQuit(GHOST_WindowHandle windowhandle){
GHOST_ISystem* system = GHOST_ISystem::getSystem();
return system->confirmQuit((GHOST_IWindow*) windowhandle);
GHOST_ISystem *system = GHOST_ISystem::getSystem();
return system->confirmQuit((GHOST_IWindow *) windowhandle);
}

@ -49,7 +49,7 @@ GHOST_CallbackEventConsumer::GHOST_CallbackEventConsumer(GHOST_EventCallbackProc
}
bool GHOST_CallbackEventConsumer::processEvent(GHOST_IEvent* event)
bool GHOST_CallbackEventConsumer::processEvent(GHOST_IEvent *event)
{
return m_eventCallback((GHOST_EventHandle)event, m_userData) != 0;
}

@ -51,8 +51,8 @@ public:
* @param userData The data passed back though the call-back routine.
*/
GHOST_CallbackEventConsumer(
GHOST_EventCallbackProcPtr eventCallback,
GHOST_TUserDataPtr userData);
GHOST_EventCallbackProcPtr eventCallback,
GHOST_TUserDataPtr userData);
/**
* Destructor.
@ -66,13 +66,13 @@ public:
* @param event The event that can be handled or ignored.
* @return Indication as to whether the event was handled.
*/
virtual bool processEvent(GHOST_IEvent* event);
virtual bool processEvent(GHOST_IEvent *event);
protected:
/** The call-back routine invoked. */
GHOST_EventCallbackProcPtr m_eventCallback;
GHOST_EventCallbackProcPtr m_eventCallback;
/** The data passed back though the call-back routine. */
GHOST_TUserDataPtr m_userData;
GHOST_TUserDataPtr m_userData;
};
#endif // __GHOST_CALLBACKEVENTCONSUMER_H__

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

@ -52,8 +52,8 @@ GHOST_DisplayManagerCarbon::GHOST_DisplayManagerCarbon(void)
}
if (m_numDisplays > 0)
{
m_displayIDs = new CGDirectDisplayID [m_numDisplays];
GHOST_ASSERT((m_displayIDs!=NULL), "GHOST_DisplayManagerCarbon::GHOST_DisplayManagerCarbon(): memory allocation failed");
m_displayIDs = new CGDirectDisplayID[m_numDisplays];
GHOST_ASSERT((m_displayIDs != NULL), "GHOST_DisplayManagerCarbon::GHOST_DisplayManagerCarbon(): memory allocation failed");
::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_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;
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_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;
CGDirectDisplayID d = m_displayIDs[display];
displayModes = ::CGDisplayAvailableModes(d);
//CFIndex numModes = ::CFArrayGetCount(displayModes);/*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.yPixels = getValue(displayModeValues, kCGDisplayHeight);
setting.bpp = getValue(displayModeValues, kCGDisplayBitsPerPixel);
setting.frequency = getValue(displayModeValues, kCGDisplayRefreshRate);
setting.xPixels = getValue(displayModeValues, kCGDisplayWidth);
setting.yPixels = getValue(displayModeValues, kCGDisplayHeight);
setting.bpp = getValue(displayModeValues, kCGDisplayBitsPerPixel);
setting.frequency = getValue(displayModeValues, kCGDisplayRefreshRate);
#ifdef GHOST_DEBUG
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_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]);
setting.xPixels = getValue(displayModeValues, kCGDisplayWidth);
setting.yPixels = getValue(displayModeValues, kCGDisplayHeight);
setting.bpp = getValue(displayModeValues, kCGDisplayBitsPerPixel);
setting.frequency = getValue(displayModeValues, kCGDisplayRefreshRate);
setting.xPixels = getValue(displayModeValues, kCGDisplayWidth);
setting.yPixels = getValue(displayModeValues, kCGDisplayHeight);
setting.bpp = getValue(displayModeValues, kCGDisplayBitsPerPixel);
setting.frequency = getValue(displayModeValues, kCGDisplayRefreshRate);
#ifdef GHOST_DEBUG
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_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
printf("GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(): requested settings:\n");
@ -135,12 +135,12 @@ GHOST_TSuccess GHOST_DisplayManagerCarbon::setCurrentDisplaySetting(GHOST_TUns8
#endif // GHOST_DEBUG
CFDictionaryRef displayModeValues = ::CGDisplayBestModeForParametersAndRefreshRate(
m_displayIDs[display],
(size_t)setting.bpp,
(size_t)setting.xPixels,
(size_t)setting.yPixels,
(CGRefreshRate)setting.frequency,
NULL);
m_displayIDs[display],
(size_t)setting.bpp,
(size_t)setting.xPixels,
(size_t)setting.yPixels,
(CGRefreshRate)setting.frequency,
NULL);
#ifdef GHOST_DEBUG
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
{
CFNumberRef numberValue = (CFNumberRef) CFDictionaryGetValue(values, key);
CFNumberRef numberValue = (CFNumberRef) CFDictionaryGetValue(values, key);
if (!numberValue)
{
return -1;
}
if (!numberValue)
{
return -1;
}
long intValue;
long intValue;
if (!CFNumberGetValue(numberValue, kCFNumberLongType, &intValue))
{
return -1;
}
if (!CFNumberGetValue(numberValue, kCFNumberLongType, &intValue))
{
return -1;
}
return intValue;
return intValue;
}

@ -108,7 +108,7 @@ protected:
/** Cached number of displays. */
CGDisplayCount m_numDisplays;
/** Cached display id's for each display. */
CGDirectDisplayID* m_displayIDs;
CGDirectDisplayID *m_displayIDs;
};

@ -43,7 +43,7 @@ public:
GHOST_TSuccess getCurrentDisplaySetting( GHOST_TUns8 display, GHOST_DisplaySetting& setting ) const { return getDisplaySetting(display,GHOST_TInt32(0),setting); }
GHOST_TSuccess setCurrentDisplaySetting( GHOST_TUns8 display, const GHOST_DisplaySetting& setting ){ return GHOST_kSuccess; }
private :
private:
GHOST_SystemNULL * m_system;
};

@ -45,7 +45,7 @@ GHOST_DisplayManagerSDL::GHOST_DisplayManagerSDL(GHOST_SystemSDL *system)
GHOST_TSuccess
GHOST_DisplayManagerSDL::getNumDisplays(GHOST_TUns8& numDisplays) const
{
numDisplays= SDL_GetNumVideoDisplays();
numDisplays = SDL_GetNumVideoDisplays();
return GHOST_kSuccess;
}
@ -140,8 +140,10 @@ GHOST_DisplayManagerSDL:: setCurrentDisplaySetting(GHOST_TUns8 display,
SDL_GetDisplayMode(display, i, &mode);
if (setting.xPixels > mode.w ||
setting.yPixels > mode.h)
setting.yPixels > mode.h)
{
continue;
}
x = setting.xPixels - mode.w;
y = setting.yPixels - mode.h;
@ -175,7 +177,7 @@ GHOST_DisplayManagerSDL:: setCurrentDisplaySetting(GHOST_TUns8 display,
}
else {
/* 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");
/* do not fail, we will try again later when the window is created - wander */

@ -68,8 +68,8 @@ public:
setCurrentDisplaySetting(GHOST_TUns8 display,
const GHOST_DisplaySetting& setting);
private :
GHOST_SystemSDL * m_system;
private:
GHOST_SystemSDL *m_system;
SDL_DisplayMode m_mode;
};

@ -67,7 +67,7 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplays(GHOST_TUns8& numDisplay
*/
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32& numSettings) const
{
GHOST_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;
DEVMODE 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_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;
DEVMODE dm;
if (::EnumDisplaySettings(NULL, index, &dm)) {
#ifdef GHOST_DEBUG
printf("display mode: width=%d, height=%d, bpp=%d, frequency=%d\n", dm.dmPelsWidth, dm.dmPelsHeight, dm.dmBitsPerPel, dm.dmDisplayFrequency);
#endif // GHOST_DEBUG
setting.xPixels = dm.dmPelsWidth;
setting.yPixels = dm.dmPelsHeight;
setting.bpp = dm.dmBitsPerPel;
setting.xPixels = dm.dmPelsWidth;
setting.yPixels = dm.dmPelsHeight;
setting.bpp = dm.dmBitsPerPel;
/* When you call the EnumDisplaySettings function, the dmDisplayFrequency member
* 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
@ -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_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);
}
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;
findMatch(display, setting, match);
@ -127,21 +127,22 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(GHOST_TUns8 d
int i = 0;
while (::EnumDisplaySettings(NULL, i++, &dm)) {
if ((dm.dmBitsPerPel == match.bpp) &&
(dm.dmPelsWidth == match.xPixels) &&
(dm.dmPelsHeight == match.yPixels) &&
(dm.dmDisplayFrequency == match.frequency)) {
(dm.dmPelsWidth == match.xPixels) &&
(dm.dmPelsHeight == match.yPixels) &&
(dm.dmDisplayFrequency == match.frequency))
{
break;
}
}
/*
dm.dmBitsPerPel = match.bpp;
dm.dmPelsWidth = match.xPixels;
dm.dmPelsHeight = match.yPixels;
dm.dmDisplayFrequency = match.frequency;
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
dm.dmSize = sizeof(DEVMODE);
dm.dmDriverExtra = 0;
*/
* dm.dmBitsPerPel = match.bpp;
* dm.dmPelsWidth = match.xPixels;
* dm.dmPelsHeight = match.yPixels;
* dm.dmDisplayFrequency = match.frequency;
* dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
* dm.dmSize = sizeof(DEVMODE);
* dm.dmDriverExtra = 0;
*/
#ifdef GHOST_DEBUG
printf("display change: Requested settings:\n");
printf(" dmBitsPerPel=%d\n", dm.dmBitsPerPel);
@ -154,31 +155,31 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(GHOST_TUns8 d
#ifdef GHOST_DEBUG
switch (status)
{
case DISP_CHANGE_SUCCESSFUL:
printf("display change: The settings change was successful.\n");
break;
case DISP_CHANGE_RESTART:
printf("display change: The computer must be restarted in order for the graphics mode to work.\n");
break;
case DISP_CHANGE_BADFLAGS:
printf("display change: An invalid set of flags was passed in.\n");
break;
case DISP_CHANGE_BADPARAM:
printf("display change: An invalid parameter was passed in. This can include an invalid flag or combination of flags.\n");
break;
case DISP_CHANGE_FAILED:
printf("display change: The display driver failed the specified graphics mode.\n");
break;
case DISP_CHANGE_BADMODE:
printf("display change: The graphics mode is not supported.\n");
break;
case DISP_CHANGE_NOTUPDATED:
printf("display change: Windows NT: Unable to write settings to the registry.\n");
break;
default:
printf("display change: Return value invalid\n");
break;
case DISP_CHANGE_SUCCESSFUL:
printf("display change: The settings change was successful.\n");
break;
case DISP_CHANGE_RESTART:
printf("display change: The computer must be restarted in order for the graphics mode to work.\n");
break;
case DISP_CHANGE_BADFLAGS:
printf("display change: An invalid set of flags was passed in.\n");
break;
case DISP_CHANGE_BADPARAM:
printf("display change: An invalid parameter was passed in. This can include an invalid flag or combination of flags.\n");
break;
case DISP_CHANGE_FAILED:
printf("display change: The display driver failed the specified graphics mode.\n");
break;
case DISP_CHANGE_BADMODE:
printf("display change: The graphics mode is not supported.\n");
break;
case DISP_CHANGE_NOTUPDATED:
printf("display change: Windows NT: Unable to write settings to the registry.\n");
break;
default:
printf("display change: Return value invalid\n");
break;
}
#endif // GHOST_DEBUG
return status == DISP_CHANGE_SUCCESSFUL? GHOST_kSuccess : GHOST_kFailure;
return status == DISP_CHANGE_SUCCESSFUL ? GHOST_kSuccess : GHOST_kFailure;
}

@ -43,10 +43,10 @@ void printLastError(void);
#endif // GHOST_DEBUG
GHOST_DropTargetWin32::GHOST_DropTargetWin32(GHOST_WindowWin32 * window, GHOST_SystemWin32 * system)
:
m_window(window),
m_system(system)
GHOST_DropTargetWin32::GHOST_DropTargetWin32(GHOST_WindowWin32 *window, GHOST_SystemWin32 *system)
:
m_window(window),
m_system(system)
{
m_cRef = 1;
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)
return E_INVALIDARG;
*ppvObj = NULL;
if(riid == IID_IUnknown || riid == IID_IDropTarget)
if (riid == IID_IUnknown || riid == IID_IDropTarget)
{
AddRef();
*ppvObj = (void*)this;
*ppvObj = (void *)this;
return S_OK;
}
else
{
else {
*ppvObj = 0;
return E_NOINTERFACE;
}
@ -102,13 +101,12 @@ ULONG __stdcall GHOST_DropTargetWin32::Release(void)
{
ULONG refs = ::InterlockedDecrement(&m_cRef);
if(refs == 0)
if (refs == 0)
{
delete this;
return 0;
}
else
{
else {
return refs;
}
}
@ -116,7 +114,7 @@ ULONG __stdcall GHOST_DropTargetWin32::Release(void)
/*
* 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
m_window->setAcceptDragOperation(true);
@ -130,14 +128,13 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragEnter(IDataObject * pDataObject, DW
/*
* 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);
}
else
{
else {
*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
* 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);
if(m_window->canAcceptDragOperation())
void *data = getGhostData(pDataObject);
if (m_window->canAcceptDragOperation())
{
*pdwEffect = allowedDropEffect(*pdwEffect);
}
else
{
else {
*pdwEffect = DROPEFFECT_NONE;
}
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;
return S_OK;
@ -185,27 +181,27 @@ HRESULT __stdcall GHOST_DropTargetWin32::Drop(IDataObject * pDataObject, DWORD g
DWORD GHOST_DropTargetWin32::allowedDropEffect(DWORD dwAllowed)
{
DWORD dwEffect = DROPEFFECT_NONE;
if(dwAllowed & DROPEFFECT_COPY)
if (dwAllowed & DROPEFFECT_COPY)
dwEffect = DROPEFFECT_COPY;
return dwEffect;
}
GHOST_TDragnDropTypes GHOST_DropTargetWin32::getGhostType(IDataObject * pDataObject)
GHOST_TDragnDropTypes GHOST_DropTargetWin32::getGhostType(IDataObject *pDataObject)
{
/* Text
* 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.
*/
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;
}
// Filesnames
fmtetc.cfFormat = CF_HDROP;
if(pDataObject->QueryGetData(&fmtetc) == S_OK)
if (pDataObject->QueryGetData(&fmtetc) == S_OK)
{
return GHOST_kDragnDropTypeFilenames;
}
@ -213,10 +209,10 @@ GHOST_TDragnDropTypes GHOST_DropTargetWin32::getGhostType(IDataObject * pDataObj
return GHOST_kDragnDropTypeUnknown;
}
void * GHOST_DropTargetWin32::getGhostData(IDataObject * pDataObject)
void *GHOST_DropTargetWin32::getGhostData(IDataObject *pDataObject)
{
GHOST_TDragnDropTypes type = getGhostType(pDataObject);
switch(type)
switch (type)
{
case GHOST_kDragnDropTypeFilenames:
return getDropDataAsFilenames(pDataObject);
@ -237,11 +233,11 @@ void * GHOST_DropTargetWin32::getGhostData(IDataObject * pDataObject)
return NULL;
}
void * GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject * pDataObject)
void *GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject *pDataObject)
{
UINT totfiles, nvalid=0;
WCHAR fpath [MAX_PATH];
char * temp_path;
UINT totfiles, nvalid = 0;
WCHAR fpath[MAX_PATH];
char *temp_path;
GHOST_TStringArray *strArray = NULL;
FORMATETC fmtetc = { CF_HDROP, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
STGMEDIUM stgmed;
@ -249,35 +245,35 @@ void * GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject * pDataObject)
// Check if dataobject supplies the format we want.
// 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)
{
::GlobalUnlock(stgmed.hGlobal);
return NULL;
}
strArray = (GHOST_TStringArray*) ::malloc(sizeof(GHOST_TStringArray));
strArray = (GHOST_TStringArray *) ::malloc(sizeof(GHOST_TStringArray));
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;
}
// Just ignore paths that could not be converted verbatim.
strArray->strings[nvalid] = (GHOST_TUns8*) temp_path;
strArray->count = nvalid+1;
strArray->strings[nvalid] = (GHOST_TUns8 *) temp_path;
strArray->count = nvalid + 1;
nvalid++;
}
}
@ -291,20 +287,20 @@ void * GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject * pDataObject)
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 };
STGMEDIUM stgmed;
// Try unicode first.
// 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);
if ( !(tmp_string = alloc_utf_8_from_16((wchar_t*)wstr, 0)) )
LPCWSTR wstr = (LPCWSTR) ::GlobalLock(stgmed.hGlobal);
if (!(tmp_string = alloc_utf_8_from_16((wchar_t *)wstr, 0)) )
{
::GlobalUnlock(stgmed.hGlobal);
return NULL;
@ -313,7 +309,7 @@ void * GHOST_DropTargetWin32::getDropDataAsString(IDataObject * pDataObject)
::GlobalUnlock(stgmed.hGlobal);
::ReleaseStgMedium(&stgmed);
#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
return tmp_string;
}
@ -321,20 +317,20 @@ void * GHOST_DropTargetWin32::getDropDataAsString(IDataObject * pDataObject)
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);
if ( !tmp_string )
tmp_string = (char *)::malloc(::strlen(str) + 1);
if (!tmp_string)
{
::GlobalUnlock(stgmed.hGlobal);
return NULL;
}
if ( !::strcpy(tmp_string, str) )
if (!::strcpy(tmp_string, str) )
{
::free(tmp_string);
::GlobalUnlock(stgmed.hGlobal);
@ -357,16 +353,16 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char * &out)
out = NULL; //caller should free if != NULL
// Get the required size.
size = ::WideCharToMultiByte(CP_ACP, //System Default Codepage
0x00000400, // WC_NO_BEST_FIT_CHARS
in,
-1, //-1 null terminated, makes output null terminated too.
NULL,
0,
NULL,NULL
);
size = ::WideCharToMultiByte(CP_ACP, //System Default Codepage
0x00000400, // WC_NO_BEST_FIT_CHARS
in,
-1, //-1 null terminated, makes output null terminated too.
NULL,
0,
NULL, NULL
);
if(!size)
if (!size)
{
#ifdef GHOST_DEBUG
::printLastError();
@ -374,7 +370,7 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char * &out)
return 0;
}
out = (char*)::malloc(size);
out = (char *)::malloc(size);
if (!out)
{
::printf("\nmalloc failed!!!");
@ -382,15 +378,15 @@ int GHOST_DropTargetWin32::WideCharToANSI(LPCWSTR in, char * &out)
}
size = ::WideCharToMultiByte(CP_ACP,
0x00000400,
in,
-1,
(LPSTR) out,
size,
NULL,NULL
);
0x00000400,
in,
-1,
(LPSTR) out,
size,
NULL, NULL
);
if(!size)
if (!size)
{
#ifdef GHOST_DEBUG
::printLastError();
@ -408,15 +404,15 @@ void printLastError(void)
DWORD err;
err = GetLastError();
if(FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
err,
0,
(LPTSTR)&s,
0,
NULL)
)
if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
err,
0,
(LPTSTR)&s,
0,
NULL)
)
{
printf("\nLastError: (%d) %s\n", (int)err, s);
LocalFree(s);

@ -47,22 +47,22 @@ public:
* inherited, directly or indirectly, from IUnknown. Therefore, the three
* methods in IUnknown are the first entries in the VTable for every interface.
*/
HRESULT __stdcall QueryInterface (REFIID riid, void ** ppvObj);
ULONG __stdcall AddRef (void);
ULONG __stdcall Release (void);
HRESULT __stdcall QueryInterface(REFIID riid, void **ppvObj);
ULONG __stdcall AddRef(void);
ULONG __stdcall Release(void);
/* IDropTarget implementation
+ The IDropTarget interface is one of the interfaces you implement to
provide drag-and-drop operations in your application. It contains methods
used in any application that can be a target for data during a
drag-and-drop operation. A drop-target application is responsible for:
* + The IDropTarget interface is one of the interfaces you implement to
* provide drag-and-drop operations in your application. It contains methods
* used in any application that can be a target for data during a
* drag-and-drop operation. A drop-target application is responsible for:
*
* - Determining the effect of the drop on the target application.
* - Incorporating any valid dropped data when the drop occurs.
* - Communicating target feedback to the source so the source application
* - Determining the effect of the drop on the target application.
* - Incorporating any valid dropped data when the drop occurs.
* - Communicating target feedback to the source so the source application
* can provide appropriate visual feedback such as setting the cursor.
* - Implementing drag scrolling.
* - Registering and revoking its application windows as drop targets.
* - Implementing drag scrolling.
* - Registering and revoking its application windows as drop targets.
*
* The IDropTarget interface contains methods that handle all these
* responsibilities except registering and revoking the application window
@ -70,10 +70,10 @@ public:
* RevokeDragDrop functions.
*/
HRESULT __stdcall DragEnter (IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect);
HRESULT __stdcall DragOver (DWORD grfKeyState, POINTL pt, DWORD * pdwEffect);
HRESULT __stdcall DragLeave (void);
HRESULT __stdcall Drop (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 DragLeave(void);
HRESULT __stdcall Drop(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
/**
* Constructor
@ -83,7 +83,7 @@ public:
* @param window The window to register as drop target.
* @param system The associated system.
*/
GHOST_DropTargetWin32(GHOST_WindowWin32 * window, GHOST_SystemWin32 * system);
GHOST_DropTargetWin32(GHOST_WindowWin32 *window, GHOST_SystemWin32 *system);
/**
* Destructor
@ -107,7 +107,7 @@ private:
* @param pDataObject Pointer to the DataObject.
* @return GHOST data type.
*/
GHOST_TDragnDropTypes getGhostType(IDataObject * pDataObject);
GHOST_TDragnDropTypes getGhostType(IDataObject *pDataObject);
/**
* Get data to pass in event.
@ -115,21 +115,21 @@ private:
* @param pDataObject Pointer to the DataObject.
* @return Pointer to data.
*/
void * getGhostData(IDataObject * pDataObject);
void *getGhostData(IDataObject *pDataObject);
/**
* Allocate data as file array to pass in event.
* @param pDataObject Pointer to the DataObject.
* @return Pointer to data.
*/
void * getDropDataAsFilenames(IDataObject * pDataObject);
void *getDropDataAsFilenames(IDataObject *pDataObject);
/**
* Allocate data as string to pass in event.
* @param pDataObject Pointer to the DataObject.
* @return Pointer to data.
*/
void * getDropDataAsString(IDataObject * pDataObject);
void *getDropDataAsString(IDataObject *pDataObject);
/**
* Convert Unicode to ANSI, replacing unconvertable chars with '?'.
@ -143,16 +143,15 @@ private:
/* Private member variables */
/* COM reference count. */
LONG m_cRef;
LONG m_cRef;
/* Handle of the associated window. */
HWND m_hWnd;
HWND m_hWnd;
/* The associated GHOST_WindowWin32. */
GHOST_WindowWin32 * m_window;
GHOST_WindowWin32 *m_window;
/* The System. */
GHOST_SystemWin32 * m_system;
GHOST_SystemWin32 *m_system;
/* Data type of the dragged object */
GHOST_TDragnDropTypes m_draggedObjectType;
};
#endif // __GHOST_DROPTARGETWIN32_H__

@ -50,7 +50,7 @@ public:
* @param type The type of this 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)
{
}
@ -78,7 +78,7 @@ public:
* or NULL if it is a 'system' event.
* @return The generating window.
*/
virtual GHOST_IWindow* getWindow()
virtual GHOST_IWindow *getWindow()
{
return m_window;
}
@ -98,7 +98,7 @@ protected:
/** The time this event was generated. */
GHOST_TUns64 m_time;
/** Pointer to the generating window. */
GHOST_IWindow* m_window;
GHOST_IWindow *m_window;
/** Pointer to the event data. */
GHOST_TEventDataPtr m_data;
};

@ -51,7 +51,7 @@ public:
* @param y The y-coordinate of the location the cursor was at at the time of the event.
* @param 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)
{
m_buttonEventData.button = button;

@ -50,7 +50,7 @@ public:
* @param x The x-coordinate of the location the cursor was at at the time of the event.
* @param 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)
{
m_cursorEventData.x = x;

@ -83,8 +83,8 @@ public:
GHOST_EventDragnDrop(GHOST_TUns64 time,
GHOST_TEventType type,
GHOST_TDragnDropTypes dataType,
GHOST_IWindow* window,
int x, int y, GHOST_TEventDataPtr data)
GHOST_IWindow *window,
int x, int y, GHOST_TEventDataPtr data)
: GHOST_Event(time, type, window)
{
m_dragnDropEventData.x = x;
@ -102,22 +102,22 @@ public:
switch (m_dragnDropEventData.dataType) {
case GHOST_kDragnDropTypeBitmap:
IMB_freeImBuf((ImBuf*)m_dragnDropEventData.data);
IMB_freeImBuf((ImBuf *)m_dragnDropEventData.data);
break;
case GHOST_kDragnDropTypeFilenames:
{
GHOST_TStringArray *strArray = (GHOST_TStringArray*)m_dragnDropEventData.data;
GHOST_TStringArray *strArray = (GHOST_TStringArray *)m_dragnDropEventData.data;
int i;
for (i=0;i<strArray->count;i++)
for (i = 0; i < strArray->count; i++)
free(strArray->strings[i]);
free(strArray);
}
break;
break;
case GHOST_kDragnDropTypeString:
free(m_dragnDropEventData.data);
break;
break;
default:
break;

@ -51,13 +51,13 @@ public:
*/
GHOST_EventKey(GHOST_TUns64 msec,
GHOST_TEventType type,
GHOST_IWindow* window,
GHOST_IWindow *window,
GHOST_TKey key)
: GHOST_Event(msec, type, window)
{
m_keyEventData.key = key;
m_keyEventData.ascii = '\0';
m_keyEventData.utf8_buf[0]= '\0';
m_keyEventData.utf8_buf[0] = '\0';
m_data = &m_keyEventData;
}
@ -70,7 +70,7 @@ public:
*/
GHOST_EventKey(GHOST_TUns64 msec,
GHOST_TEventType type,
GHOST_IWindow* window,
GHOST_IWindow *window,
GHOST_TKey key,
char ascii,
const char utf8_buf[6])
@ -79,7 +79,7 @@ public:
m_keyEventData.key = key;
m_keyEventData.ascii = ascii;
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;
}

@ -51,10 +51,9 @@ GHOST_EventManager::~GHOST_EventManager()
{
disposeEvents();
TConsumerVector::iterator iter= m_consumers.begin();
while (iter != m_consumers.end())
{
GHOST_IEventConsumer* consumer = *iter;
TConsumerVector::iterator iter = m_consumers.begin();
while (iter != m_consumers.end()) {
GHOST_IEventConsumer *consumer = *iter;
delete consumer;
m_consumers.erase(iter);
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) {
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_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;
if (event) {
@ -127,7 +126,7 @@ bool GHOST_EventManager::dispatchEvent(GHOST_IEvent* event)
bool GHOST_EventManager::dispatchEvent()
{
GHOST_IEvent* event = popEvent();
GHOST_IEvent *event = popEvent();
bool handled = false;
if (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_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_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;
iter = m_events.begin();
while (iter != m_events.end())
{
GHOST_IEvent* event = *iter;
GHOST_IEvent *event = *iter;
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.
* The iterator will become invalid.
@ -213,23 +212,22 @@ void GHOST_EventManager::removeWindowEvents(GHOST_IWindow* window)
m_events.erase(iter);
iter = m_events.begin();
}
else
{
else {
iter++;
}
}
}
void GHOST_EventManager::removeTypeEvents(GHOST_TEventType type, GHOST_IWindow* window)
void GHOST_EventManager::removeTypeEvents(GHOST_TEventType type, GHOST_IWindow *window)
{
TEventStack::iterator iter;
iter = m_events.begin();
while (iter != m_events.end())
{
GHOST_IEvent* event = *iter;
GHOST_IEvent *event = *iter;
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.
* The iterator will become invalid.
@ -238,17 +236,16 @@ void GHOST_EventManager::removeTypeEvents(GHOST_TEventType type, GHOST_IWindow*
m_events.erase(iter);
iter = m_events.begin();
}
else
{
else {
iter++;
}
}
}
GHOST_IEvent* GHOST_EventManager::popEvent()
GHOST_IEvent *GHOST_EventManager::popEvent()
{
GHOST_IEvent* event = peekEvent();
GHOST_IEvent *event = peekEvent();
if (event) {
m_events.pop_back();
}

@ -64,21 +64,21 @@ public:
* Returns the number of events currently 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.
* @param type The type of events to be counted.
* @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.
* Do not delete the event!
* @return The event at the top of the stack.
*/
virtual GHOST_IEvent* peekEvent();
virtual GHOST_IEvent *peekEvent();
/**
* Pushes an event on the stack.
@ -86,13 +86,13 @@ public:
* Do not delete the event!
* @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.
* @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.
@ -113,23 +113,23 @@ public:
* @param consumer The consumer added to the list.
* @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.
* @param consumer The consumer removed from the list.
* @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.
* @param window The window to remove events for.
*/
virtual void
virtual void
removeWindowEvents(
GHOST_IWindow* window
);
GHOST_IWindow *window
);
/**
* 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 window The window to remove the events for.
*/
virtual void
virtual void
removeTypeEvents(
GHOST_TEventType type,
GHOST_IWindow* window = 0
);
GHOST_TEventType type,
GHOST_IWindow *window = 0
);
protected:
/**
@ -150,7 +150,7 @@ protected:
* Delete the event after use!
* @return The event at the top of the stack.
*/
virtual GHOST_IEvent* popEvent();
virtual GHOST_IEvent *popEvent();
/**
* Removes all events from the stack.
@ -158,13 +158,13 @@ protected:
virtual void disposeEvents();
/** A stack with events. */
typedef std::deque<GHOST_IEvent*> TEventStack;
typedef std::deque<GHOST_IEvent *> TEventStack;
/** The event stack. */
std::deque<GHOST_IEvent*> m_events;
std::deque<GHOST_IEvent *> m_events;
/** A vector with event consumers. */
typedef std::vector<GHOST_IEventConsumer*> TConsumerVector;
typedef std::vector<GHOST_IEventConsumer *> TConsumerVector;
/** The list with event consumers. */
TConsumerVector m_consumers;

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

@ -38,7 +38,7 @@
#include <stdio.h>
bool GHOST_EventPrinter::processEvent(GHOST_IEvent* event)
bool GHOST_EventPrinter::processEvent(GHOST_IEvent *event)
{
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: ";
switch (event->getType()) {
case GHOST_kEventUnknown:
std::cout << "GHOST_kEventUnknown"; handled = false;
break;
case GHOST_kEventUnknown:
std::cout << "GHOST_kEventUnknown"; handled = false;
break;
case GHOST_kEventButtonUp:
case GHOST_kEventButtonUp:
{
GHOST_TEventButtonData* buttonData = (GHOST_TEventButtonData*)((GHOST_IEvent*)event)->getData();
std::cout << "GHOST_kEventCursorButtonUp, button: " << buttonData->button;
GHOST_TEventButtonData *buttonData = (GHOST_TEventButtonData *)((GHOST_IEvent *)event)->getData();
std::cout << "GHOST_kEventCursorButtonUp, button: " << buttonData->button;
}
break;
case GHOST_kEventButtonDown:
case GHOST_kEventButtonDown:
{
GHOST_TEventButtonData* buttonData = (GHOST_TEventButtonData*)((GHOST_IEvent*)event)->getData();
std::cout << "GHOST_kEventButtonDown, button: " << buttonData->button;
GHOST_TEventButtonData *buttonData = (GHOST_TEventButtonData *)((GHOST_IEvent *)event)->getData();
std::cout << "GHOST_kEventButtonDown, button: " << buttonData->button;
}
break;
case GHOST_kEventWheel:
case GHOST_kEventWheel:
{
GHOST_TEventWheelData* wheelData = (GHOST_TEventWheelData*)((GHOST_IEvent*)event)->getData();
std::cout << "GHOST_kEventWheel, z: " << wheelData->z;
GHOST_TEventWheelData *wheelData = (GHOST_TEventWheelData *)((GHOST_IEvent *)event)->getData();
std::cout << "GHOST_kEventWheel, z: " << wheelData->z;
}
break;
case GHOST_kEventCursorMove:
case GHOST_kEventCursorMove:
{
GHOST_TEventCursorData* cursorData = (GHOST_TEventCursorData*)((GHOST_IEvent*)event)->getData();
std::cout << "GHOST_kEventCursorMove, (x,y): (" << cursorData->x << "," << cursorData->y << ")";
GHOST_TEventCursorData *cursorData = (GHOST_TEventCursorData *)((GHOST_IEvent *)event)->getData();
std::cout << "GHOST_kEventCursorMove, (x,y): (" << cursorData->x << "," << cursorData->y << ")";
}
break;
case GHOST_kEventKeyUp:
case GHOST_kEventKeyUp:
{
GHOST_TEventKeyData* keyData = (GHOST_TEventKeyData*)((GHOST_IEvent*)event)->getData();
char str[32]= {'\0'};
getKeyString(keyData->key, str);
std::cout << "GHOST_kEventKeyUp, key: " << str;
GHOST_TEventKeyData *keyData = (GHOST_TEventKeyData *)((GHOST_IEvent *)event)->getData();
char str[32] = {'\0'};
getKeyString(keyData->key, str);
std::cout << "GHOST_kEventKeyUp, key: " << str;
}
break;
case GHOST_kEventKeyDown:
case GHOST_kEventKeyDown:
{
GHOST_TEventKeyData* keyData = (GHOST_TEventKeyData*)((GHOST_IEvent*)event)->getData();
char str[32]= {'\0'};
getKeyString(keyData->key, str);
std::cout << "GHOST_kEventKeyDown, key: " << str;
GHOST_TEventKeyData *keyData = (GHOST_TEventKeyData *)((GHOST_IEvent *)event)->getData();
char str[32] = {'\0'};
getKeyString(keyData->key, str);
std::cout << "GHOST_kEventKeyDown, key: " << str;
}
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 << " mouse at x=" << dragnDropData->x << " y=" << dragnDropData->y;
}
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 << " mouse at x=" << dragnDropData->x << " y=" << dragnDropData->y;
}
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;
}
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 << " mouse at x=" << dragnDropData->x << " y=" << dragnDropData->y;
switch (dragnDropData->dataType) {
case GHOST_kDragnDropTypeString:
std::cout << " type : GHOST_kDragnDropTypeString,";
std::cout << "\n String received = " << (char*)dragnDropData->data;
std::cout << "\n String received = " << (char *)dragnDropData->data;
break;
case GHOST_kDragnDropTypeFilenames:
{
GHOST_TStringArray *strArray = (GHOST_TStringArray*)dragnDropData->data;
GHOST_TStringArray *strArray = (GHOST_TStringArray *)dragnDropData->data;
int i;
std::cout << " type : GHOST_kDragnDropTypeFilenames,";
std::cout << "\n Received " << strArray->count << " filename" << (strArray->count > 1 ? "s:" : ":");
for (i=0;i<strArray->count;i++)
std::cout << "\n File[" << i << "] : " << strArray->strings[i];
for (i = 0; i < strArray->count; i++)
std::cout << "\n File["<< i << "] : " << strArray->strings[i];
}
break;
break;
default:
break;
}
}
break;
case GHOST_kEventOpenMainFile:
case GHOST_kEventOpenMainFile:
{
GHOST_TEventDataPtr eventData = ((GHOST_IEvent*)event)->getData();
GHOST_TEventDataPtr eventData = ((GHOST_IEvent *)event)->getData();
if (eventData)
std::cout << "GHOST_kEventOpenMainFile for path : " << (char*)eventData;
std::cout << "GHOST_kEventOpenMainFile for path : " << (char *)eventData;
else
std::cout << "GHOST_kEventOpenMainFile with no path specified!!";
}
break;
case GHOST_kEventQuit:
std::cout << "GHOST_kEventQuit";
break;
case GHOST_kEventWindowClose:
std::cout << "GHOST_kEventWindowClose";
break;
case GHOST_kEventWindowActivate:
std::cout << "GHOST_kEventWindowActivate";
break;
case GHOST_kEventWindowDeactivate:
std::cout << "GHOST_kEventWindowDeactivate";
break;
case GHOST_kEventWindowUpdate:
std::cout << "GHOST_kEventWindowUpdate";
break;
case GHOST_kEventWindowSize:
std::cout << "GHOST_kEventWindowSize";
break;
case GHOST_kEventQuit:
std::cout << "GHOST_kEventQuit";
break;
case GHOST_kEventWindowClose:
std::cout << "GHOST_kEventWindowClose";
break;
case GHOST_kEventWindowActivate:
std::cout << "GHOST_kEventWindowActivate";
break;
case GHOST_kEventWindowDeactivate:
std::cout << "GHOST_kEventWindowDeactivate";
break;
case GHOST_kEventWindowUpdate:
std::cout << "GHOST_kEventWindowUpdate";
break;
case GHOST_kEventWindowSize:
std::cout << "GHOST_kEventWindowSize";
break;
default:
std::cout << "not found"; handled = false;
break;
default:
std::cout << "not found"; handled = false;
break;
}
return handled;
}
@ -187,154 +187,159 @@ void GHOST_EventPrinter::getKeyString(GHOST_TKey key, char str[32]) const
{
if ((key >= GHOST_kKeyComma) && (key <= GHOST_kKeyRightBracket)) {
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));
#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");
} 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");
#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);
} else {
const char *tstr= NULL;
}
else {
const char *tstr = NULL;
switch (key) {
case GHOST_kKeyBackSpace:
tstr = "BackSpace";
break;
case GHOST_kKeyTab:
tstr = "Tab";
break;
case GHOST_kKeyLinefeed:
tstr = "Linefeed";
break;
case GHOST_kKeyClear:
tstr = "Clear";
break;
case GHOST_kKeyEnter:
tstr = "Enter";
break;
case GHOST_kKeyEsc:
tstr = "Esc";
break;
case GHOST_kKeySpace:
tstr = "Space";
break;
case GHOST_kKeyQuote:
tstr = "Quote";
break;
case GHOST_kKeyBackslash:
tstr = "\\";
break;
case GHOST_kKeyAccentGrave:
tstr = "`";
break;
case GHOST_kKeyLeftShift:
tstr = "LeftShift";
break;
case GHOST_kKeyRightShift:
tstr = "RightShift";
break;
case GHOST_kKeyLeftControl:
tstr = "LeftControl";
break;
case GHOST_kKeyRightControl:
tstr = "RightControl";
break;
case GHOST_kKeyLeftAlt:
tstr = "LeftAlt";
break;
case GHOST_kKeyRightAlt:
tstr = "RightAlt";
break;
case GHOST_kKeyOS:
tstr = "OS";
break;
case GHOST_kKeyGrLess:
// PC german!
tstr = "GrLess";
break;
case GHOST_kKeyCapsLock:
tstr = "CapsLock";
break;
case GHOST_kKeyNumLock:
tstr = "NumLock";
break;
case GHOST_kKeyScrollLock:
tstr = "ScrollLock";
break;
case GHOST_kKeyLeftArrow:
tstr = "LeftArrow";
break;
case GHOST_kKeyRightArrow:
tstr = "RightArrow";
break;
case GHOST_kKeyUpArrow:
tstr = "UpArrow";
break;
case GHOST_kKeyDownArrow:
tstr = "DownArrow";
break;
case GHOST_kKeyPrintScreen:
tstr = "PrintScreen";
break;
case GHOST_kKeyPause:
tstr = "Pause";
break;
case GHOST_kKeyInsert:
tstr = "Insert";
break;
case GHOST_kKeyDelete:
tstr = "Delete";
break;
case GHOST_kKeyHome:
tstr = "Home";
break;
case GHOST_kKeyEnd:
tstr = "End";
break;
case GHOST_kKeyUpPage:
tstr = "UpPage";
break;
case GHOST_kKeyDownPage:
tstr = "DownPage";
break;
case GHOST_kKeyNumpadPeriod:
tstr = "NumpadPeriod";
break;
case GHOST_kKeyNumpadEnter:
tstr = "NumpadEnter";
break;
case GHOST_kKeyNumpadPlus:
tstr = "NumpadPlus";
break;
case GHOST_kKeyNumpadMinus:
tstr = "NumpadMinus";
break;
case GHOST_kKeyNumpadAsterisk:
tstr = "NumpadAsterisk";
break;
case GHOST_kKeyNumpadSlash:
tstr = "NumpadSlash";
break;
case GHOST_kKeyMediaPlay:
tstr = "MediaPlayPause";
break;
case GHOST_kKeyMediaStop:
tstr = "MediaStop";
break;
case GHOST_kKeyMediaFirst:
tstr = "MediaFirst";
break;
case GHOST_kKeyMediaLast:
tstr = "MediaLast";
break;
default:
tstr = "unknown";
break;
case GHOST_kKeyBackSpace:
tstr = "BackSpace";
break;
case GHOST_kKeyTab:
tstr = "Tab";
break;
case GHOST_kKeyLinefeed:
tstr = "Linefeed";
break;
case GHOST_kKeyClear:
tstr = "Clear";
break;
case GHOST_kKeyEnter:
tstr = "Enter";
break;
case GHOST_kKeyEsc:
tstr = "Esc";
break;
case GHOST_kKeySpace:
tstr = "Space";
break;
case GHOST_kKeyQuote:
tstr = "Quote";
break;
case GHOST_kKeyBackslash:
tstr = "\\";
break;
case GHOST_kKeyAccentGrave:
tstr = "`";
break;
case GHOST_kKeyLeftShift:
tstr = "LeftShift";
break;
case GHOST_kKeyRightShift:
tstr = "RightShift";
break;
case GHOST_kKeyLeftControl:
tstr = "LeftControl";
break;
case GHOST_kKeyRightControl:
tstr = "RightControl";
break;
case GHOST_kKeyLeftAlt:
tstr = "LeftAlt";
break;
case GHOST_kKeyRightAlt:
tstr = "RightAlt";
break;
case GHOST_kKeyOS:
tstr = "OS";
break;
case GHOST_kKeyGrLess:
// PC german!
tstr = "GrLess";
break;
case GHOST_kKeyCapsLock:
tstr = "CapsLock";
break;
case GHOST_kKeyNumLock:
tstr = "NumLock";
break;
case GHOST_kKeyScrollLock:
tstr = "ScrollLock";
break;
case GHOST_kKeyLeftArrow:
tstr = "LeftArrow";
break;
case GHOST_kKeyRightArrow:
tstr = "RightArrow";
break;
case GHOST_kKeyUpArrow:
tstr = "UpArrow";
break;
case GHOST_kKeyDownArrow:
tstr = "DownArrow";
break;
case GHOST_kKeyPrintScreen:
tstr = "PrintScreen";
break;
case GHOST_kKeyPause:
tstr = "Pause";
break;
case GHOST_kKeyInsert:
tstr = "Insert";
break;
case GHOST_kKeyDelete:
tstr = "Delete";
break;
case GHOST_kKeyHome:
tstr = "Home";
break;
case GHOST_kKeyEnd:
tstr = "End";
break;
case GHOST_kKeyUpPage:
tstr = "UpPage";
break;
case GHOST_kKeyDownPage:
tstr = "DownPage";
break;
case GHOST_kKeyNumpadPeriod:
tstr = "NumpadPeriod";
break;
case GHOST_kKeyNumpadEnter:
tstr = "NumpadEnter";
break;
case GHOST_kKeyNumpadPlus:
tstr = "NumpadPlus";
break;
case GHOST_kKeyNumpadMinus:
tstr = "NumpadMinus";
break;
case GHOST_kKeyNumpadAsterisk:
tstr = "NumpadAsterisk";
break;
case GHOST_kKeyNumpadSlash:
tstr = "NumpadSlash";
break;
case GHOST_kKeyMediaPlay:
tstr = "MediaPlayPause";
break;
case GHOST_kKeyMediaStop:
tstr = "MediaStop";
break;
case GHOST_kKeyMediaFirst:
tstr = "MediaFirst";
break;
case GHOST_kKeyMediaLast:
tstr = "MediaLast";
break;
default:
tstr = "unknown";
break;
}
sprintf(str, "%s", tstr);

@ -49,7 +49,7 @@ public:
* @param event The event that can be handled or not.
* @return Indication as to whether the event was handled.
*/
virtual bool processEvent(GHOST_IEvent* event);
virtual bool processEvent(GHOST_IEvent *event);
protected:
/**
@ -57,7 +57,7 @@ protected:
* @param key The GHOST key code to convert.
* @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__

@ -51,9 +51,10 @@ public:
* @param window The generating window (or NULL if system 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_Event(msec, type, window) {
m_data = data_ptr;
GHOST_EventString(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow *window, GHOST_TEventDataPtr data_ptr)
: GHOST_Event(msec, type, window)
{
m_data = data_ptr;
}
~GHOST_EventString()

@ -51,7 +51,7 @@ public:
* @param y The y-delta of the pan event.
*/
GHOST_EventTrackpad(GHOST_TUns64 msec,
GHOST_IWindow* window,
GHOST_IWindow *window,
GHOST_TTrackpadEventSubTypes subtype,
GHOST_TInt32 x, GHOST_TInt32 y,
GHOST_TInt32 deltaX, GHOST_TInt32 deltaY)

@ -51,7 +51,7 @@ public:
* @param type The type of this event.
* @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)
{
m_wheelEventData.z = z;

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

@ -40,21 +40,21 @@
#include "GHOST_ISystemPaths.h"
#ifdef WIN32
# include "GHOST_SystemPathsWin32.h"
# include "GHOST_SystemPathsWin32.h"
#else
# ifdef __APPLE__
# ifdef GHOST_COCOA
# include "GHOST_SystemPathsCocoa.h"
# else
# include "GHOST_SystemPathsCarbon.h"
# endif
# else
# include "GHOST_SystemPathsX11.h"
# endif
# ifdef __APPLE__
# ifdef GHOST_COCOA
# include "GHOST_SystemPathsCocoa.h"
# else
# include "GHOST_SystemPathsCarbon.h"
# endif
# else
# include "GHOST_SystemPathsX11.h"
# endif
#endif
GHOST_ISystemPaths* GHOST_ISystemPaths::m_systemPaths = 0;
GHOST_ISystemPaths *GHOST_ISystemPaths::m_systemPaths = 0;
GHOST_TSuccess GHOST_ISystemPaths::create()
@ -62,17 +62,17 @@ GHOST_TSuccess GHOST_ISystemPaths::create()
GHOST_TSuccess success;
if (!m_systemPaths) {
#ifdef WIN32
m_systemPaths = new GHOST_SystemPathsWin32 ();
m_systemPaths = new GHOST_SystemPathsWin32();
#else
# ifdef __APPLE__
# ifdef GHOST_COCOA
m_systemPaths = new GHOST_SystemPathsCocoa ();
# else
m_systemPaths = new GHOST_SystemPathsCarbon ();
# endif
# else
m_systemPaths = new GHOST_SystemPathsX11 ();
# endif
# ifdef __APPLE__
# ifdef GHOST_COCOA
m_systemPaths = new GHOST_SystemPathsCocoa();
# else
m_systemPaths = new GHOST_SystemPathsCarbon();
# endif
# else
m_systemPaths = new GHOST_SystemPathsX11();
# endif
#endif
success = m_systemPaths != 0 ? GHOST_kSuccess : GHOST_kFailure;
}
@ -95,7 +95,7 @@ GHOST_TSuccess GHOST_ISystemPaths::dispose()
return success;
}
GHOST_ISystemPaths* GHOST_ISystemPaths::get()
GHOST_ISystemPaths *GHOST_ISystemPaths::get()
{
if (!m_systemPaths) {
create();

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

@ -41,8 +41,7 @@
* @author Maarten Gribnau
* @date May 17, 2001
*/
struct GHOST_ModifierKeys
{
struct GHOST_ModifierKeys {
/**
* Constructor.
*/

@ -32,12 +32,12 @@
#ifdef DEBUG_NDOF_MOTION
// printable version of each GHOST_TProgress value
static const char* progress_string[] =
{"not started","starting","in progress","finishing","finished"};
static const char *progress_string[] =
{"not started", "starting", "in progress", "finishing", "finished"};
#endif
#ifdef DEBUG_NDOF_BUTTONS
static const char* ndof_button_names[] = {
static const char *ndof_button_names[] = {
// used internally, never sent
"NDOF_BUTTON_NONE",
// 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;
}
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,
"rogue button trying to escape NDOF manager");
"rogue button trying to escape NDOF manager");
GHOST_EventNDOFButton* event = new GHOST_EventNDOFButton(time, window);
GHOST_TEventNDOFButtonData* data = (GHOST_TEventNDOFButtonData*) event->getData();
GHOST_EventNDOFButton *event = new GHOST_EventNDOFButton(time, window);
GHOST_TEventNDOFButtonData *data = (GHOST_TEventNDOFButtonData *) event->getData();
data->action = press ? GHOST_kPress : GHOST_kRelease;
data->button = button;
@ -327,10 +327,10 @@ void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button, bool press, GHOST_T
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_EventKey* event = new GHOST_EventKey(time, type, window, key);
GHOST_EventKey *event = new GHOST_EventKey(time, type, window, key);
#ifdef DEBUG_NDOF_BUTTONS
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)
{
GHOST_IWindow* window = m_system.getWindowManager()->getActiveWindow();
GHOST_IWindow *window = m_system.getWindowManager()->getActiveWindow();
#ifdef DEBUG_NDOF_BUTTONS
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);
}
static bool atHomePosition(GHOST_TEventNDOFMotionData* ndof)
static bool atHomePosition(GHOST_TEventNDOFMotionData *ndof)
{
#define HOME(foo) (ndof->foo == 0.f)
return HOME(tx) && HOME(ty) && HOME(tz) && HOME(rx) && HOME(ry) && HOME(rz);
#undef HOME
}
static bool nearHomePosition(GHOST_TEventNDOFMotionData* ndof, float threshold)
static bool nearHomePosition(GHOST_TEventNDOFMotionData *ndof, float threshold)
{
if (threshold == 0.f) {
return atHomePosition(ndof);
@ -429,14 +429,14 @@ bool GHOST_NDOFManager::sendMotionEvent()
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) {
return false; // delivery will fail, so don't bother sending
}
GHOST_EventNDOFMotion* event = new GHOST_EventNDOFMotion(m_motionTime, window);
GHOST_TEventNDOFMotionData* data = (GHOST_TEventNDOFMotionData*) event->getData();
GHOST_EventNDOFMotion *event = new GHOST_EventNDOFMotion(m_motionTime, window);
GHOST_TEventNDOFMotionData *data = (GHOST_TEventNDOFMotionData *) event->getData();
// scale axis values here to normalize them to around +/- 1
// they are scaled again for overall sensitivity in the WM based on user prefs

@ -44,7 +44,7 @@ typedef enum {
NDOF_Spaceball5000,
NDOF_SpaceTraveler
} NDOF_DeviceT;
} NDOF_DeviceT;
// NDOF device button event types
typedef enum {
@ -100,7 +100,7 @@ typedef enum {
NDOF_BUTTON_C,
// the end
NDOF_BUTTON_LAST
} NDOF_ButtonT;
} NDOF_ButtonT;
class GHOST_NDOFManager
{
@ -149,13 +149,13 @@ protected:
GHOST_System& m_system;
private:
void sendButtonEvent(NDOF_ButtonT, bool press, GHOST_TUns64 time, GHOST_IWindow*);
void sendKeyEvent(GHOST_TKey, 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 *);
NDOF_DeviceT m_deviceType;
int m_buttonCount;
int m_buttonMask;
const NDOF_ButtonT* m_hidMap;
const NDOF_ButtonT *m_hidMap;
short m_translation[3];
short m_rotation[3];

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

@ -45,27 +45,27 @@ GHOST_TSuccess GHOST_DisposeSystemPaths(void)
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();
return systemPaths ? systemPaths->getSystemDir() : 0;
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
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();
return systemPaths ? systemPaths->getUserDir() : 0; /* shouldn't be NULL */
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
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 */
}
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) {
systemPaths->addToSystemRecentFiles(filename);
}

@ -97,10 +97,10 @@ GHOST_TVisibility GHOST_Rect::getVisibility(GHOST_Rect& r) const
void GHOST_Rect::setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy)
{
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_r += offset;
offset = cy - (m_t + (m_b - m_t)/2);
offset = cy - (m_t + (m_b - m_t) / 2);
m_t += offset;
m_b += offset;
}

@ -45,12 +45,12 @@
GHOST_System::GHOST_System()
: m_displayManager(0),
m_timerManager(0),
m_windowManager(0),
m_eventManager(0)
: m_displayManager(0),
m_timerManager(0),
m_windowManager(0),
m_eventManager(0)
#ifdef WITH_INPUT_NDOF
, m_ndofManager(0)
, m_ndofManager(0)
#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_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData)
{
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 (m_timerManager->addTimer(timer) == GHOST_kSuccess) {
// 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;
if (timerTask) {
success = m_timerManager->removeTimer((GHOST_TimerTask*)timerTask);
success = m_timerManager->removeTimer((GHOST_TimerTask *)timerTask);
}
return success;
}
GHOST_TSuccess GHOST_System::disposeWindow(GHOST_IWindow* window)
GHOST_TSuccess GHOST_System::disposeWindow(GHOST_IWindow *window)
{
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);
}
GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples)
{
GHOST_TSuccess success = GHOST_kFailure;
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);
if (success == GHOST_kSuccess) {
//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) {
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_ASSERT(m_windowManager, "GHOST_System::updateFullScreen(): invalid window manager");
if(m_displayManager) {
if (m_displayManager) {
if (m_windowManager->getFullScreen()) {
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;
if (m_eventManager) {
@ -245,7 +245,7 @@ GHOST_TSuccess GHOST_System::addEventConsumer(GHOST_IEventConsumer* consumer)
return success;
}
GHOST_TSuccess GHOST_System::removeEventConsumer(GHOST_IEventConsumer* consumer)
GHOST_TSuccess GHOST_System::removeEventConsumer(GHOST_IEventConsumer *consumer)
{
GHOST_TSuccess success;
if (m_eventManager) {
@ -257,7 +257,7 @@ GHOST_TSuccess GHOST_System::removeEventConsumer(GHOST_IEventConsumer* consumer)
return success;
}
GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent* event)
GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent *event)
{
GHOST_TSuccess success;
if (m_eventManager) {
@ -296,9 +296,9 @@ GHOST_TSuccess GHOST_System::getButtonState(GHOST_TButtonMask mask, bool& isDown
GHOST_TSuccess GHOST_System::init()
{
m_timerManager = new GHOST_TimerManager ();
m_windowManager = new GHOST_WindowManager ();
m_eventManager = new GHOST_EventManager ();
m_timerManager = new GHOST_TimerManager();
m_windowManager = new GHOST_WindowManager();
m_eventManager = new GHOST_EventManager();
#ifdef GHOST_DEBUG
if (m_eventManager) {
@ -309,7 +309,8 @@ GHOST_TSuccess GHOST_System::init()
if (m_timerManager && m_windowManager && m_eventManager) {
return GHOST_kSuccess;
} else {
}
else {
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_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);
if (success) {
//GHOST_PRINT("GHOST_System::createFullScreenWindow(): creating full-screen window\n");
*window = (GHOST_Window*)createWindow(
STR_String (""),
0, 0, settings.xPixels, settings.yPixels,
GHOST_kWindowStateFullScreen,
GHOST_kDrawingContextTypeOpenGL,
stereoVisual,
numOfAASamples);
*window = (GHOST_Window *)createWindow(
STR_String(""),
0, 0, settings.xPixels, settings.yPixels,
GHOST_kWindowStateFullScreen,
GHOST_kDrawingContextTypeOpenGL,
stereoVisual,
numOfAASamples);
success = *window == 0 ? GHOST_kFailure : GHOST_kSuccess;
}
return success;
}
int GHOST_System::confirmQuit(GHOST_IWindow * window) const
int GHOST_System::confirmQuit(GHOST_IWindow *window) const
{
return 1;
}

@ -76,8 +76,8 @@ protected:
public:
/***************************************************************************************
** Time(r) functionality
***************************************************************************************/
** Time(r) functionality
***************************************************************************************/
/**
* Returns the system time.
@ -97,7 +97,7 @@ public:
* @param userData Placeholder for user data.
* @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_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData = 0);
@ -107,11 +107,11 @@ public:
* @param timerTask Timer task to be removed.
* @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
@ -126,14 +126,14 @@ public:
* @param window Pointer to the window to be disposed.
* @return Indication of success.
*/
virtual GHOST_TSuccess disposeWindow(GHOST_IWindow* window);
virtual GHOST_TSuccess disposeWindow(GHOST_IWindow *window);
/**
* Returns whether a window is valid.
* @param window Pointer to the window to be checked.
* @return Indication of validity.
*/
virtual bool validWindow(GHOST_IWindow* window);
virtual bool validWindow(GHOST_IWindow *window);
/**
* Begins full screen mode.
@ -143,8 +143,8 @@ public:
* This window is invalid after full screen has been ended.
* @return Indication of success.
*/
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples=0);
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0);
/**
* Updates the resolution while in fullscreen mode.
@ -153,7 +153,7 @@ public:
*
* @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.
@ -169,13 +169,13 @@ public:
/***************************************************************************************
** Event management functionality
***************************************************************************************/
** Event management functionality
***************************************************************************************/
/**
* 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.
* @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.
* @param consumer The event consumer to remove.
* @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
* 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).
@ -231,8 +231,8 @@ public:
virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const;
/***************************************************************************************
** Other (internal) functionality.
***************************************************************************************/
** Other (internal) functionality.
***************************************************************************************/
/**
* Pushes an event on the stack.
@ -240,32 +240,32 @@ public:
* Do not delete the event!
* @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.
* @return The timer manager.
*/
inline virtual GHOST_TimerManager* getTimerManager() const;
inline virtual GHOST_TimerManager *getTimerManager() const;
/**
* Returns 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.
* @return A pointer to our window manager.
*/
virtual inline GHOST_WindowManager* getWindowManager() const;
virtual inline GHOST_WindowManager *getWindowManager() const;
#ifdef WITH_INPUT_NDOF
/**
* Returns 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
/**
@ -285,23 +285,23 @@ public:
/**
* Returns the selection buffer
* @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
* @param buffer The buffer to copy to the clipboard
* @param selection The clipboard to copy too only used on X11
*/
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
/**
* Put data to the Clipboard
* @param buffer The buffer to copy to the clipboard
* @param selection The clipboard to copy too only used on X11
*/
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
/**
/**
* Confirms quitting he program when there is just one window left open
* 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.
* @return Indication of success.
*/
virtual GHOST_TSuccess createFullScreenWindow(GHOST_Window** window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples=0);
virtual GHOST_TSuccess createFullScreenWindow(GHOST_Window **window,
const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0);
/** The display manager (platform dependant). */
GHOST_DisplayManager* m_displayManager;
GHOST_DisplayManager *m_displayManager;
/** The timer manager. */
GHOST_TimerManager* m_timerManager;
GHOST_TimerManager *m_timerManager;
/** The window manager. */
GHOST_WindowManager* m_windowManager;
GHOST_WindowManager *m_windowManager;
/** The event manager. */
GHOST_EventManager* m_eventManager;
GHOST_EventManager *m_eventManager;
#ifdef WITH_INPUT_NDOF
/** The N-degree of freedom device manager */
GHOST_NDOFManager* m_ndofManager;
GHOST_NDOFManager *m_ndofManager;
#endif
/** Prints all the events. */
#ifdef GHOST_DEBUG
GHOST_EventPrinter* m_eventPrinter;
GHOST_EventPrinter *m_eventPrinter;
#endif // GHOST_DEBUG
/** Settings of the display before the display went fullscreen. */
GHOST_DisplaySetting m_preFullScreenSetting;
};
inline GHOST_TimerManager* GHOST_System::getTimerManager() const
inline GHOST_TimerManager *GHOST_System::getTimerManager() const
{
return m_timerManager;
}
inline GHOST_EventManager* GHOST_System::getEventManager() const
inline GHOST_EventManager *GHOST_System::getEventManager() const
{
return m_eventManager;
}
inline GHOST_WindowManager* GHOST_System::getWindowManager() const
inline GHOST_WindowManager *GHOST_System::getWindowManager() const
{
return m_windowManager;
}
#ifdef WITH_INPUT_NDOF
inline GHOST_NDOFManager* GHOST_System::getNDOFManager() const
inline GHOST_NDOFManager *GHOST_System::getNDOFManager() const
{
return m_ndofManager;
}

File diff suppressed because it is too large Load Diff

@ -84,7 +84,7 @@ public:
* Returns the number of displays on this system.
* @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.
@ -103,29 +103,29 @@ public:
* @param height The height the window.
* @param state The state of the window when opened.
* @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).
*/
virtual GHOST_IWindow* createWindow(
const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const bool stereoVisual,
const GHOST_TUns16 numOfAASamples = 0,
const GHOST_TEmbedderWindowID parentWindow = 0
);
virtual GHOST_IWindow *createWindow(
const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const bool stereoVisual,
const GHOST_TUns16 numOfAASamples = 0,
const GHOST_TEmbedderWindowID parentWindow = 0
);
virtual GHOST_TSuccess beginFullScreen(
const GHOST_DisplaySetting& setting,
GHOST_IWindow** window,
const bool stereoVisual
);
const GHOST_DisplaySetting& setting,
GHOST_IWindow **window,
const bool stereoVisual
);
virtual GHOST_TSuccess endFullScreen( void );
virtual GHOST_TSuccess endFullScreen(void);
/***************************************************************************************
** Event management functionality
@ -181,7 +181,7 @@ public:
* @param selection Indicate which buffer to return
* @return Returns the selected buffer
*/
virtual GHOST_TUns8* getClipboard(bool selection) const;
virtual GHOST_TUns8 *getClipboard(bool selection) const;
/**
* Puts buffer to system clipboard
@ -193,7 +193,9 @@ public:
/**
* @see GHOST_ISystem
*/
int toggleConsole(int action) { return 0; }
int toggleConsole(int action) {
return 0;
}
protected:
/**
@ -258,7 +260,7 @@ protected:
/**
* 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 */
static OSErr sAEHandlerLaunch(const AppleEvent *event, AppleEvent *reply, SInt32 refCon);

@ -62,8 +62,8 @@ public:
~GHOST_SystemCocoa();
/***************************************************************************************
** Time(r) functionality
***************************************************************************************/
** Time(r) functionality
***************************************************************************************/
/**
* Returns the system time.
@ -74,14 +74,14 @@ public:
virtual GHOST_TUns64 getMilliSeconds() const;
/***************************************************************************************
** Display/window management functionality
***************************************************************************************/
** Display/window management functionality
***************************************************************************************/
/**
* Returns the number of displays on this system.
* @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.
@ -102,25 +102,25 @@ public:
* @param type The type of drawing context installed in this window.
* @param stereoVisual Stereo visual for quad buffered stereo.
* @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).
*/
virtual GHOST_IWindow* createWindow(
const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const bool stereoVisual = false,
const GHOST_TUns16 numOfAASamples = 0,
const GHOST_TEmbedderWindowID parentWindow = 0
);
virtual GHOST_IWindow *createWindow(
const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const bool stereoVisual = false,
const GHOST_TUns16 numOfAASamples = 0,
const GHOST_TEmbedderWindowID parentWindow = 0
);
/***************************************************************************************
** Event management functionality
***************************************************************************************/
** Event management functionality
***************************************************************************************/
/**
* Gets events from the system and stores them in the queue.
@ -151,11 +151,11 @@ public:
* @return Indication whether the event was handled.
*/
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)
@ -174,8 +174,8 @@ public:
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.
@ -196,7 +196,7 @@ public:
* @param selection Indicate which buffer to return
* @return Returns the selected buffer
*/
virtual GHOST_TUns8* getClipboard(bool selection) const;
virtual GHOST_TUns8 *getClipboard(bool selection) const;
/**
* Puts buffer to system clipboard
@ -211,7 +211,7 @@ public:
* @param window The window on which the event occurred
* @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)
@ -227,7 +227,9 @@ public:
/**
* @see GHOST_ISystem
*/
int toggleConsole(int action) { return 0; }
int toggleConsole(int action) {
return 0;
}
protected:

@ -66,19 +66,19 @@ public:
return GHOST_kFailure;
}
GHOST_IWindow* createWindow(
const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
bool stereoVisual,
const GHOST_TUns16 numOfAASamples,
const GHOST_TEmbedderWindowID parentWindow
) {
return new GHOST_WindowNULL (this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1);
GHOST_IWindow *createWindow(
const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
bool stereoVisual,
const GHOST_TUns16 numOfAASamples,
const GHOST_TEmbedderWindowID parentWindow)
{
return new GHOST_WindowNULL(this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1);
}
};

@ -40,40 +40,40 @@ protected:
* Constructor.
* Protected default constructor to force use of static createSystem member.
*/
GHOST_SystemPaths(){};
GHOST_SystemPaths() {};
/**
* Destructor.
* Protected default constructor to force use of static dispose member.
*/
virtual ~GHOST_SystemPaths(){};
virtual ~GHOST_SystemPaths() {};
public:
/**
* 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/).
*/
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.
* @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
* @return Unsigned char string pointing to the binary dir
*/
virtual const GHOST_TUns8* getBinaryDir() const = 0;
* Determine the directory of the current binary
* @return Unsigned char string pointing to the binary dir
*/
virtual const GHOST_TUns8 *getBinaryDir() const = 0;
/**
* Add the file to the operating system most recently used files
*/
virtual void addToSystemRecentFiles(const char* filename) const = 0;
virtual void addToSystemRecentFiles(const char *filename) const = 0;
};

@ -44,27 +44,29 @@ GHOST_SystemPathsCarbon::~GHOST_SystemPathsCarbon()
{
}
const GHOST_TUns8* GHOST_SystemPathsCarbon::getSystemDir() const
const GHOST_TUns8 *GHOST_SystemPathsCarbon::getSystemDir(int, const char *versionstr) const
{
return (GHOST_TUns8*)"/Library/Application Support";
static char systemPath[1024];
snprintf(systemPath, sizeof(systemPath), "/Library/Application Support/Blender/%s", versionstr);
return (GHOST_TUns8*)systemPath;
}
const GHOST_TUns8* GHOST_SystemPathsCarbon::getUserDir() const
const GHOST_TUns8 *GHOST_SystemPathsCarbon::getUserDir(int, const char *versionstr) const
{
static char usrPath[256] = "";
char* env = getenv("HOME");
static char usrPath[1024];
char *env = getenv("HOME");
if (env) {
strncpy(usrPath, env, 245);
usrPath[245]=0;
strcat(usrPath, "/Library/Application Support");
return (GHOST_TUns8*) usrPath;
snprintf(usrPath, sizeof(usrPath), "%s/Library/Application Support/Blender/%s", env, versionstr);
return (GHOST_TUns8*)usrPath;
}
else
return NULL;
}
const GHOST_TUns8* GHOST_SystemPathsCarbon::getBinaryDir() const
const GHOST_TUns8 *GHOST_SystemPathsCarbon::getBinaryDir() const
{
CFURLRef bundleURL;
CFStringRef pathStr;
@ -76,10 +78,10 @@ const GHOST_TUns8* GHOST_SystemPathsCarbon::getBinaryDir() const
CFStringGetCString(pathStr, path, 255, kCFStringEncodingASCII);
CFRelease(pathStr);
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 */

@ -60,28 +60,28 @@ public:
/**
* 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/).
*/
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.
* @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
* @return Unsigned char string pointing to the binary dir
*/
virtual const GHOST_TUns8* getBinaryDir() const;
* Determine the directory of the current binary
* @return Unsigned char string pointing to the binary dir
*/
virtual const GHOST_TUns8 *getBinaryDir() const;
/**
* Add the file to the operating system most recently used files
*/
void addToSystemRecentFiles(const char* filename) const;
* Add the file to the operating system most recently used files
*/
void addToSystemRecentFiles(const char *filename) const;
};
#endif // __GHOST_SYSTEMPATHSCARBON_H__

@ -54,28 +54,28 @@ public:
/**
* Determine the base dir in which shared resources are located. It will first try to use
* "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/).
*/
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.
* @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
* @return Unsigned char string pointing to the binary dir
*/
virtual const GHOST_TUns8* getBinaryDir() const;
* Determine the directory of the current binary
* @return Unsigned char string pointing to the binary dir
*/
virtual const GHOST_TUns8 *getBinaryDir() const;
/**
* 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__

@ -50,9 +50,9 @@ GHOST_SystemPathsCocoa::~GHOST_SystemPathsCocoa()
#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];
NSString *basePath;
NSArray *paths;
@ -66,15 +66,15 @@ const GHOST_TUns8* GHOST_SystemPathsCocoa::getSystemDir() const
return NULL;
}
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
snprintf(tempPath, sizeof(tempPath), "%s/Blender/%s", [basePath cStringUsingEncoding:NSASCIIStringEncoding], versionstr);
[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];
NSString *basePath;
NSArray *paths;
@ -88,10 +88,10 @@ const GHOST_TUns8* GHOST_SystemPathsCocoa::getUserDir() const
return NULL;
}
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
snprintf(tempPath, sizeof(tempPath), "%s/Blender/%s", [basePath cStringUsingEncoding:NSASCIIStringEncoding], versionstr);
[pool drain];
return tempPath;
return (GHOST_TUns8*)tempPath;
}
const GHOST_TUns8* GHOST_SystemPathsCocoa::getBinaryDir() const

@ -69,46 +69,50 @@ GHOST_SystemPathsWin32::~GHOST_SystemPathsWin32()
{
}
const GHOST_TUns8* GHOST_SystemPathsWin32::getSystemDir() const
const GHOST_TUns8 *GHOST_SystemPathsWin32::getSystemDir(int, const char *versionstr) const
{
static char knownpath[MAX_PATH*3] = {0}; /* 1 utf-16 might translante into 3 utf-8. 2 utf-16 translates into 4 utf-8*/
static char knownpath[MAX_PATH * 3 + 128] = {0}; /* 1 utf-16 might translante into 3 utf-8. 2 utf-16 translates into 4 utf-8*/
wchar_t knownpath_16[MAX_PATH];
HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
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 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};
wchar_t knownpath_16[MAX_PATH];
static char knownpath[MAX_PATH * 3 + 128] = {0};
wchar_t knownpath_16[MAX_PATH];
HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
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 NULL;
}
const GHOST_TUns8* GHOST_SystemPathsWin32::getBinaryDir() const
const GHOST_TUns8 *GHOST_SystemPathsWin32::getBinaryDir() const
{
static char fullname[MAX_PATH*3] = {0};
wchar_t fullname_16[MAX_PATH*3];
static char fullname[MAX_PATH * 3] = {0};
wchar_t fullname_16[MAX_PATH * 3];
if(GetModuleFileNameW(0, fullname_16, MAX_PATH)) {
conv_utf_16_to_8(fullname_16,fullname,MAX_PATH*3);
return (GHOST_TUns8*)fullname;
if (GetModuleFileNameW(0, fullname_16, MAX_PATH)) {
conv_utf_16_to_8(fullname_16, fullname, MAX_PATH * 3);
return (GHOST_TUns8 *)fullname;
}
return NULL;

@ -64,23 +64,23 @@ public:
/**
* 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/).
*/
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.
* @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
* @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

@ -41,10 +41,8 @@
#include <stdio.h> // for fprintf only
#include <cstdlib> // for exit
#ifdef WITH_XDG_USER_DIRS
# include <pwd.h> // for get home without use getenv()
# include <limits.h> // for PATH_MAX
#endif
#include <pwd.h> // for get home without use getenv()
#include <limits.h> // for PATH_MAX
#ifdef PREFIX
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 */
return (const GHOST_TUns8 *)static_path;
if(static_path) {
static char system_path[PATH_MAX];
snprintf(system_path, sizeof(system_path), "%s/blender/%s", static_path, versionstr);
return (GHOST_TUns8*)system_path;
}
return NULL;
}
const GHOST_TUns8 *GHOST_SystemPathsX11::getUserDir() const
const GHOST_TUns8 *GHOST_SystemPathsX11::getUserDir(int version, const char *versionstr) const
{
#ifndef WITH_XDG_USER_DIRS
return (const GHOST_TUns8 *)getenv("HOME");
#else /* WITH_XDG_USER_DIRS */
const char *home = getenv("XDG_CONFIG_HOME");
static char user_path[PATH_MAX];
if (home) {
return (const GHOST_TUns8 *)home;
}
else {
static char user_path[PATH_MAX];
/* in blender 2.64, we migrate to XDG. to ensure the copy previous settings
* operator works we give a different path depending on the requested version */
if(version < 264) {
const char *home = getenv("HOME");
home = getenv("HOME");
if (home == NULL) {
home = getpwuid(getuid())->pw_dir;
if(home) {
snprintf(user_path, sizeof(user_path), "%s/.blender/%s", home, versionstr);
return (GHOST_TUns8*)user_path;
}
return NULL;
}
else {
const char *home= getenv("XDG_CONFIG_HOME");
if (home) {
snprintf(user_path, sizeof(user_path), "%s/blender/%s", home, versionstr);
}
else {
home= getenv("HOME");
if (home == NULL)
home= getpwuid(getuid())->pw_dir;
snprintf(user_path, sizeof(user_path), "%s/.config/blender/%s", home, versionstr);
}
snprintf(user_path, sizeof(user_path), "%s/.config", home);
return (const GHOST_TUns8 *)user_path;
}
#endif /* WITH_XDG_USER_DIRS */
}
const GHOST_TUns8 *GHOST_SystemPathsX11::getBinaryDir() const

@ -52,17 +52,17 @@ public:
/**
* Determine the base dir in which shared resources are located. It will first try to use
* "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/).
*/
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.
* @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

@ -39,18 +39,18 @@ GHOST_SystemSDL::GHOST_SystemSDL()
:
GHOST_System()
{
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) != 0) {
printf ("Error initializing SDL: %s\n", SDL_GetError());
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
printf("Error initializing SDL: %s\n", SDL_GetError());
}
/* SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); */
/* SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); */
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
/* SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); */
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
}
GHOST_SystemSDL::~GHOST_SystemSDL()
@ -71,9 +71,9 @@ GHOST_SystemSDL::createWindow(const STR_String& title,
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 (GHOST_kWindowStateFullScreen == state) {
@ -93,7 +93,7 @@ GHOST_SystemSDL::createWindow(const STR_String& title,
}
else {
delete window;
window= NULL;
window = NULL;
}
}
return window;
@ -120,8 +120,8 @@ GHOST_SystemSDL::getMainDisplayDimensions(GHOST_TUns32& width,
{
SDL_DisplayMode mode;
SDL_GetCurrentDisplayMode(0, &mode); /* note, always 0 display */
width= mode.w;
height= mode.h;
width = mode.w;
height = mode.h;
}
GHOST_TUns8
@ -133,7 +133,7 @@ GHOST_SystemSDL::getNumDisplays() const
GHOST_TSuccess
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_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_kModifierKeyLeftAlt, (mod & KMOD_LALT) != 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;
}
#define GXMAP(k,x,y) case x: k= y; break;
#define GXMAP(k, x, y) case x: k = y; break
static GHOST_TKey
convertSDLKey(SDL_Scancode key)
@ -154,97 +154,101 @@ convertSDLKey(SDL_Scancode key)
GHOST_TKey type;
if ((key >= SDL_SCANCODE_A) && (key <= SDL_SCANCODE_Z)) {
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_F1) && (key <= SDL_SCANCODE_F12)) {
type= GHOST_TKey(key - SDL_SCANCODE_F1 + int(GHOST_kKeyF1));
} else if ((key >= SDL_SCANCODE_F13) && (key <= SDL_SCANCODE_F24)) {
type= GHOST_TKey(key - SDL_SCANCODE_F13 + int(GHOST_kKeyF13));
} else {
switch(key) {
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_F1) && (key <= SDL_SCANCODE_F12)) {
type = GHOST_TKey(key - SDL_SCANCODE_F1 + int(GHOST_kKeyF1));
}
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 */
GXMAP(type,SDL_SCANCODE_BACKSPACE, GHOST_kKeyBackSpace);
GXMAP(type,SDL_SCANCODE_TAB, GHOST_kKeyTab);
GXMAP(type,SDL_SCANCODE_RETURN, GHOST_kKeyEnter);
GXMAP(type,SDL_SCANCODE_ESCAPE, GHOST_kKeyEsc);
GXMAP(type,SDL_SCANCODE_SPACE, GHOST_kKeySpace);
GXMAP(type, SDL_SCANCODE_BACKSPACE, GHOST_kKeyBackSpace);
GXMAP(type, SDL_SCANCODE_TAB, GHOST_kKeyTab);
GXMAP(type, SDL_SCANCODE_RETURN, GHOST_kKeyEnter);
GXMAP(type, SDL_SCANCODE_ESCAPE, GHOST_kKeyEsc);
GXMAP(type, SDL_SCANCODE_SPACE, GHOST_kKeySpace);
GXMAP(type,SDL_SCANCODE_SEMICOLON, GHOST_kKeySemicolon);
GXMAP(type,SDL_SCANCODE_PERIOD, GHOST_kKeyPeriod);
GXMAP(type,SDL_SCANCODE_COMMA, GHOST_kKeyComma);
GXMAP(type,SDL_SCANCODE_APOSTROPHE, GHOST_kKeyQuote);
GXMAP(type,SDL_SCANCODE_GRAVE, GHOST_kKeyAccentGrave);
GXMAP(type,SDL_SCANCODE_MINUS, GHOST_kKeyMinus);
GXMAP(type,SDL_SCANCODE_EQUALS, GHOST_kKeyEqual);
GXMAP(type, SDL_SCANCODE_SEMICOLON, GHOST_kKeySemicolon);
GXMAP(type, SDL_SCANCODE_PERIOD, GHOST_kKeyPeriod);
GXMAP(type, SDL_SCANCODE_COMMA, GHOST_kKeyComma);
GXMAP(type, SDL_SCANCODE_APOSTROPHE, GHOST_kKeyQuote);
GXMAP(type, SDL_SCANCODE_GRAVE, GHOST_kKeyAccentGrave);
GXMAP(type, SDL_SCANCODE_MINUS, GHOST_kKeyMinus);
GXMAP(type, SDL_SCANCODE_EQUALS, GHOST_kKeyEqual);
GXMAP(type,SDL_SCANCODE_SLASH, GHOST_kKeySlash);
GXMAP(type,SDL_SCANCODE_BACKSLASH, GHOST_kKeyBackslash);
GXMAP(type,SDL_SCANCODE_KP_EQUALS, GHOST_kKeyEqual);
GXMAP(type,SDL_SCANCODE_LEFTBRACKET, GHOST_kKeyLeftBracket);
GXMAP(type,SDL_SCANCODE_RIGHTBRACKET, GHOST_kKeyRightBracket);
GXMAP(type,SDL_SCANCODE_PAUSE, GHOST_kKeyPause);
GXMAP(type, SDL_SCANCODE_SLASH, GHOST_kKeySlash);
GXMAP(type, SDL_SCANCODE_BACKSLASH, GHOST_kKeyBackslash);
GXMAP(type, SDL_SCANCODE_KP_EQUALS, GHOST_kKeyEqual);
GXMAP(type, SDL_SCANCODE_LEFTBRACKET, GHOST_kKeyLeftBracket);
GXMAP(type, SDL_SCANCODE_RIGHTBRACKET, GHOST_kKeyRightBracket);
GXMAP(type, SDL_SCANCODE_PAUSE, GHOST_kKeyPause);
GXMAP(type,SDL_SCANCODE_LSHIFT, GHOST_kKeyLeftShift);
GXMAP(type,SDL_SCANCODE_RSHIFT, GHOST_kKeyRightShift);
GXMAP(type,SDL_SCANCODE_LCTRL, GHOST_kKeyLeftControl);
GXMAP(type,SDL_SCANCODE_RCTRL, GHOST_kKeyRightControl);
GXMAP(type,SDL_SCANCODE_LALT, GHOST_kKeyLeftAlt);
GXMAP(type,SDL_SCANCODE_RALT, GHOST_kKeyRightAlt);
GXMAP(type,SDL_SCANCODE_LGUI, GHOST_kKeyOS);
GXMAP(type,SDL_SCANCODE_RGUI, GHOST_kKeyOS);
GXMAP(type, SDL_SCANCODE_LSHIFT, GHOST_kKeyLeftShift);
GXMAP(type, SDL_SCANCODE_RSHIFT, GHOST_kKeyRightShift);
GXMAP(type, SDL_SCANCODE_LCTRL, GHOST_kKeyLeftControl);
GXMAP(type, SDL_SCANCODE_RCTRL, GHOST_kKeyRightControl);
GXMAP(type, SDL_SCANCODE_LALT, GHOST_kKeyLeftAlt);
GXMAP(type, SDL_SCANCODE_RALT, GHOST_kKeyRightAlt);
GXMAP(type, SDL_SCANCODE_LGUI, GHOST_kKeyOS);
GXMAP(type, SDL_SCANCODE_RGUI, GHOST_kKeyOS);
GXMAP(type,SDL_SCANCODE_INSERT, GHOST_kKeyInsert);
GXMAP(type,SDL_SCANCODE_DELETE, GHOST_kKeyDelete);
GXMAP(type,SDL_SCANCODE_HOME, GHOST_kKeyHome);
GXMAP(type,SDL_SCANCODE_END, GHOST_kKeyEnd);
GXMAP(type,SDL_SCANCODE_PAGEUP, GHOST_kKeyUpPage);
GXMAP(type,SDL_SCANCODE_PAGEDOWN, GHOST_kKeyDownPage);
GXMAP(type, SDL_SCANCODE_INSERT, GHOST_kKeyInsert);
GXMAP(type, SDL_SCANCODE_DELETE, GHOST_kKeyDelete);
GXMAP(type, SDL_SCANCODE_HOME, GHOST_kKeyHome);
GXMAP(type, SDL_SCANCODE_END, GHOST_kKeyEnd);
GXMAP(type, SDL_SCANCODE_PAGEUP, GHOST_kKeyUpPage);
GXMAP(type, SDL_SCANCODE_PAGEDOWN, GHOST_kKeyDownPage);
GXMAP(type,SDL_SCANCODE_LEFT, GHOST_kKeyLeftArrow);
GXMAP(type,SDL_SCANCODE_RIGHT, GHOST_kKeyRightArrow);
GXMAP(type,SDL_SCANCODE_UP, GHOST_kKeyUpArrow);
GXMAP(type,SDL_SCANCODE_DOWN, GHOST_kKeyDownArrow);
GXMAP(type, SDL_SCANCODE_LEFT, GHOST_kKeyLeftArrow);
GXMAP(type, SDL_SCANCODE_RIGHT, GHOST_kKeyRightArrow);
GXMAP(type, SDL_SCANCODE_UP, GHOST_kKeyUpArrow);
GXMAP(type, SDL_SCANCODE_DOWN, GHOST_kKeyDownArrow);
GXMAP(type,SDL_SCANCODE_CAPSLOCK, GHOST_kKeyCapsLock);
GXMAP(type,SDL_SCANCODE_SCROLLLOCK, GHOST_kKeyScrollLock);
GXMAP(type,SDL_SCANCODE_NUMLOCKCLEAR, GHOST_kKeyNumLock);
GXMAP(type,SDL_SCANCODE_PRINTSCREEN, GHOST_kKeyPrintScreen);
GXMAP(type, SDL_SCANCODE_CAPSLOCK, GHOST_kKeyCapsLock);
GXMAP(type, SDL_SCANCODE_SCROLLLOCK, GHOST_kKeyScrollLock);
GXMAP(type, SDL_SCANCODE_NUMLOCKCLEAR, GHOST_kKeyNumLock);
GXMAP(type, SDL_SCANCODE_PRINTSCREEN, GHOST_kKeyPrintScreen);
/* keypad events */
/* keypad events */
/* note, sdl defines a bunch of kp defines I never saw before like
* SDL_SCANCODE_KP_PERCENT, SDL_SCANCODE_KP_XOR - campbell */
GXMAP(type,SDL_SCANCODE_KP_0, GHOST_kKeyNumpad0);
GXMAP(type,SDL_SCANCODE_KP_1, GHOST_kKeyNumpad1);
GXMAP(type,SDL_SCANCODE_KP_2, GHOST_kKeyNumpad2);
GXMAP(type,SDL_SCANCODE_KP_3, GHOST_kKeyNumpad3);
GXMAP(type,SDL_SCANCODE_KP_4, GHOST_kKeyNumpad4);
GXMAP(type,SDL_SCANCODE_KP_5, GHOST_kKeyNumpad5);
GXMAP(type,SDL_SCANCODE_KP_6, GHOST_kKeyNumpad6);
GXMAP(type,SDL_SCANCODE_KP_7, GHOST_kKeyNumpad7);
GXMAP(type,SDL_SCANCODE_KP_8, GHOST_kKeyNumpad8);
GXMAP(type,SDL_SCANCODE_KP_9, GHOST_kKeyNumpad9);
GXMAP(type,SDL_SCANCODE_KP_PERIOD, GHOST_kKeyNumpadPeriod);
/* note, sdl defines a bunch of kp defines I never saw before like
* SDL_SCANCODE_KP_PERCENT, SDL_SCANCODE_KP_XOR - campbell */
GXMAP(type, SDL_SCANCODE_KP_0, GHOST_kKeyNumpad0);
GXMAP(type, SDL_SCANCODE_KP_1, GHOST_kKeyNumpad1);
GXMAP(type, SDL_SCANCODE_KP_2, GHOST_kKeyNumpad2);
GXMAP(type, SDL_SCANCODE_KP_3, GHOST_kKeyNumpad3);
GXMAP(type, SDL_SCANCODE_KP_4, GHOST_kKeyNumpad4);
GXMAP(type, SDL_SCANCODE_KP_5, GHOST_kKeyNumpad5);
GXMAP(type, SDL_SCANCODE_KP_6, GHOST_kKeyNumpad6);
GXMAP(type, SDL_SCANCODE_KP_7, GHOST_kKeyNumpad7);
GXMAP(type, SDL_SCANCODE_KP_8, GHOST_kKeyNumpad8);
GXMAP(type, SDL_SCANCODE_KP_9, GHOST_kKeyNumpad9);
GXMAP(type, SDL_SCANCODE_KP_PERIOD, GHOST_kKeyNumpadPeriod);
GXMAP(type,SDL_SCANCODE_KP_ENTER, GHOST_kKeyNumpadEnter);
GXMAP(type,SDL_SCANCODE_KP_PLUS, GHOST_kKeyNumpadPlus);
GXMAP(type,SDL_SCANCODE_KP_MINUS, GHOST_kKeyNumpadMinus);
GXMAP(type,SDL_SCANCODE_KP_MULTIPLY, GHOST_kKeyNumpadAsterisk);
GXMAP(type,SDL_SCANCODE_KP_DIVIDE, GHOST_kKeyNumpadSlash);
GXMAP(type, SDL_SCANCODE_KP_ENTER, GHOST_kKeyNumpadEnter);
GXMAP(type, SDL_SCANCODE_KP_PLUS, GHOST_kKeyNumpadPlus);
GXMAP(type, SDL_SCANCODE_KP_MINUS, GHOST_kKeyNumpadMinus);
GXMAP(type, SDL_SCANCODE_KP_MULTIPLY, GHOST_kKeyNumpadAsterisk);
GXMAP(type, SDL_SCANCODE_KP_DIVIDE, GHOST_kKeyNumpadSlash);
/* Media keys in some keyboards and laptops with XFree86/Xorg */
GXMAP(type,SDL_SCANCODE_AUDIOPLAY, GHOST_kKeyMediaPlay);
GXMAP(type,SDL_SCANCODE_AUDIOSTOP, GHOST_kKeyMediaStop);
GXMAP(type,SDL_SCANCODE_AUDIOPREV, GHOST_kKeyMediaFirst);
// GXMAP(type,XF86XK_AudioRewind, GHOST_kKeyMediaFirst);
GXMAP(type,SDL_SCANCODE_AUDIONEXT, GHOST_kKeyMediaLast);
/* Media keys in some keyboards and laptops with XFree86/Xorg */
GXMAP(type, SDL_SCANCODE_AUDIOPLAY, GHOST_kKeyMediaPlay);
GXMAP(type, SDL_SCANCODE_AUDIOSTOP, GHOST_kKeyMediaStop);
GXMAP(type, SDL_SCANCODE_AUDIOPREV, GHOST_kKeyMediaFirst);
// GXMAP(type,XF86XK_AudioRewind, GHOST_kKeyMediaFirst);
GXMAP(type, SDL_SCANCODE_AUDIONEXT, GHOST_kKeyMediaLast);
default:
printf("Unknown\n");
type= GHOST_kKeyUnknown;
break;
default:
printf("Unknown\n");
type = GHOST_kKeyUnknown;
break;
}
}
@ -256,64 +260,64 @@ convertSDLKey(SDL_Scancode key)
void
GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
{
GHOST_Event * g_event= NULL;
GHOST_Event *g_event = NULL;
switch(sdl_event->type) {
case SDL_WINDOWEVENT:
switch (sdl_event->type) {
case SDL_WINDOWEVENT:
{
SDL_WindowEvent &sdl_sub_evt= sdl_event->window;
GHOST_WindowSDL *window= findGhostWindow(SDL_GetWindowFromID(sdl_sub_evt.windowID));
SDL_WindowEvent &sdl_sub_evt = sdl_event->window;
GHOST_WindowSDL *window = findGhostWindow(SDL_GetWindowFromID(sdl_sub_evt.windowID));
//assert(window != NULL); // can be NULL on close window.
switch (sdl_sub_evt.event) {
case SDL_WINDOWEVENT_EXPOSED:
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window);
break;
case SDL_WINDOWEVENT_RESIZED:
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window);
break;
case SDL_WINDOWEVENT_MOVED:
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowMove, window);
break;
case SDL_WINDOWEVENT_FOCUS_GAINED:
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window);
break;
case SDL_WINDOWEVENT_FOCUS_LOST:
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowDeactivate, window);
break;
case SDL_WINDOWEVENT_CLOSE:
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window);
break;
case SDL_WINDOWEVENT_EXPOSED:
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window);
break;
case SDL_WINDOWEVENT_RESIZED:
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window);
break;
case SDL_WINDOWEVENT_MOVED:
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowMove, window);
break;
case SDL_WINDOWEVENT_FOCUS_GAINED:
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window);
break;
case SDL_WINDOWEVENT_FOCUS_LOST:
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowDeactivate, window);
break;
case SDL_WINDOWEVENT_CLOSE:
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window);
break;
}
}
break;
case SDL_QUIT:
g_event= new GHOST_Event(getMilliSeconds(), GHOST_kEventQuit, NULL);
break;
break;
case SDL_QUIT:
g_event = new GHOST_Event(getMilliSeconds(), GHOST_kEventQuit, NULL);
break;
case SDL_MOUSEMOTION:
case SDL_MOUSEMOTION:
{
SDL_MouseMotionEvent &sdl_sub_evt= sdl_event->motion;
SDL_Window *sdl_win= SDL_GetWindowFromID(sdl_sub_evt.windowID);
GHOST_WindowSDL *window= findGhostWindow(sdl_win);
SDL_MouseMotionEvent &sdl_sub_evt = sdl_event->motion;
SDL_Window *sdl_win = SDL_GetWindowFromID(sdl_sub_evt.windowID);
GHOST_WindowSDL *window = findGhostWindow(sdl_win);
assert(window != NULL);
int x_win, y_win;
SDL_GetWindowPosition(sdl_win, &x_win, &y_win);
GHOST_TInt32 x_root= sdl_sub_evt.x + x_win;
GHOST_TInt32 y_root= sdl_sub_evt.y + y_win;
GHOST_TInt32 x_root = sdl_sub_evt.x + x_win;
GHOST_TInt32 y_root = sdl_sub_evt.y + y_win;
#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 y_new= y_root;
GHOST_TInt32 x_new = x_root;
GHOST_TInt32 y_new = y_root;
GHOST_TInt32 x_accum, y_accum;
GHOST_Rect bounds;
/* fallback to window bounds */
if(window->getCursorGrabBounds(bounds)==GHOST_kFailure)
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure)
window->getClientBounds(bounds);
/* could also clamp to screen bounds
@ -322,14 +326,15 @@ GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
window->getCursorGrabAccum(x_accum, y_accum);
// cant use setCursorPosition because the mouse may have no focus!
if(x_new != x_root || y_new != y_root) {
if (1 ) { //xme.time > m_last_warp) {
if (x_new != x_root || y_new != y_root) {
if (1) { //xme.time > m_last_warp) {
/* when wrapping we don't need to add an event because the
* setCursorPosition call will cause a new event after */
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));
// m_last_warp= lastEventTime(xme.time);
} else {
}
else {
// setCursorPosition(x_new, y_new); /* wrap but don't accumulate */
SDL_WarpMouseInWindow(sdl_win, x_new - x_win, y_new - y_win);
}
@ -343,117 +348,117 @@ GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
else
#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;
}
case SDL_MOUSEBUTTONUP:
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
case SDL_MOUSEBUTTONDOWN:
{
SDL_MouseButtonEvent &sdl_sub_evt= sdl_event->button;
GHOST_TButtonMask gbmask= GHOST_kButtonMaskLeft;
GHOST_TEventType type= (sdl_sub_evt.state==SDL_PRESSED) ? GHOST_kEventButtonDown : GHOST_kEventButtonUp;
SDL_MouseButtonEvent &sdl_sub_evt = sdl_event->button;
GHOST_TButtonMask gbmask = GHOST_kButtonMaskLeft;
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);
/* process rest of normal mouse buttons */
if(sdl_sub_evt.button == SDL_BUTTON_LEFT)
gbmask= GHOST_kButtonMaskLeft;
else if(sdl_sub_evt.button == SDL_BUTTON_MIDDLE)
gbmask= GHOST_kButtonMaskMiddle;
else if(sdl_sub_evt.button == SDL_BUTTON_RIGHT)
gbmask= GHOST_kButtonMaskRight;
if (sdl_sub_evt.button == SDL_BUTTON_LEFT)
gbmask = GHOST_kButtonMaskLeft;
else if (sdl_sub_evt.button == SDL_BUTTON_MIDDLE)
gbmask = GHOST_kButtonMaskMiddle;
else if (sdl_sub_evt.button == SDL_BUTTON_RIGHT)
gbmask = GHOST_kButtonMaskRight;
/* these buttons are untested! */
else if(sdl_sub_evt.button == SDL_BUTTON_X1)
gbmask= GHOST_kButtonMaskButton4;
else if(sdl_sub_evt.button == SDL_BUTTON_X2)
gbmask= GHOST_kButtonMaskButton5;
else if (sdl_sub_evt.button == SDL_BUTTON_X1)
gbmask = GHOST_kButtonMaskButton4;
else if (sdl_sub_evt.button == SDL_BUTTON_X2)
gbmask = GHOST_kButtonMaskButton5;
else
break;
g_event= new GHOST_EventButton(getMilliSeconds(), type, window, gbmask);
g_event = new GHOST_EventButton(getMilliSeconds(), type, window, gbmask);
break;
}
case SDL_MOUSEWHEEL:
case SDL_MOUSEWHEEL:
{
SDL_MouseWheelEvent &sdl_sub_evt= sdl_event->wheel;
GHOST_WindowSDL *window= findGhostWindow(SDL_GetWindowFromID(sdl_sub_evt.windowID));
SDL_MouseWheelEvent &sdl_sub_evt = sdl_event->wheel;
GHOST_WindowSDL *window = findGhostWindow(SDL_GetWindowFromID(sdl_sub_evt.windowID));
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;
case SDL_KEYDOWN:
case SDL_KEYUP:
break;
case SDL_KEYDOWN:
case SDL_KEYUP:
{
SDL_KeyboardEvent &sdl_sub_evt= sdl_event->key;
SDL_Keycode sym= sdl_sub_evt.keysym.sym;
GHOST_TEventType type= (sdl_sub_evt.state == SDL_PRESSED) ? GHOST_kEventKeyDown : GHOST_kEventKeyUp;
SDL_KeyboardEvent &sdl_sub_evt = sdl_event->key;
SDL_Keycode sym = sdl_sub_evt.keysym.sym;
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);
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 */
/* printf("%d\n", sym); */
if(sym > 127) {
switch(sym) {
case SDLK_KP_DIVIDE: sym= '/'; break;
case SDLK_KP_MULTIPLY: sym= '*'; break;
case SDLK_KP_MINUS: sym= '-'; break;
case SDLK_KP_PLUS: sym= '+'; break;
case SDLK_KP_1: sym= '1'; break;
case SDLK_KP_2: sym= '2'; break;
case SDLK_KP_3: sym= '3'; break;
case SDLK_KP_4: sym= '4'; break;
case SDLK_KP_5: sym= '5'; break;
case SDLK_KP_6: sym= '6'; break;
case SDLK_KP_7: sym= '7'; break;
case SDLK_KP_8: sym= '8'; break;
case SDLK_KP_9: sym= '9'; break;
case SDLK_KP_0: sym= '0'; break;
case SDLK_KP_PERIOD: sym= '.'; break;
default: sym= 0; break;
if (sym > 127) {
switch (sym) {
case SDLK_KP_DIVIDE: sym = '/'; break;
case SDLK_KP_MULTIPLY: sym = '*'; break;
case SDLK_KP_MINUS: sym = '-'; break;
case SDLK_KP_PLUS: sym = '+'; break;
case SDLK_KP_1: sym = '1'; break;
case SDLK_KP_2: sym = '2'; break;
case SDLK_KP_3: sym = '3'; break;
case SDLK_KP_4: sym = '4'; break;
case SDLK_KP_5: sym = '5'; break;
case SDLK_KP_6: sym = '6'; break;
case SDLK_KP_7: sym = '7'; break;
case SDLK_KP_8: sym = '8'; break;
case SDLK_KP_9: sym = '9'; break;
case SDLK_KP_0: sym = '0'; break;
case SDLK_KP_PERIOD: sym = '.'; break;
default: sym = 0; break;
}
}
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 */
if(sym >= 'a' && sym <= ('a' + 32)) {
if (sym >= 'a' && sym <= ('a' + 32)) {
sym -= 32;
}
else {
switch(sym) {
case '`': sym= '~'; break;
case '1': sym= '!'; break;
case '2': sym= '@'; break;
case '3': sym= '#'; break;
case '4': sym= '$'; break;
case '5': sym= '%'; break;
case '6': sym= '^'; break;
case '7': sym= '&'; break;
case '8': sym= '*'; break;
case '9': 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;
switch (sym) {
case '`': sym = '~'; break;
case '1': sym = '!'; break;
case '2': sym = '@'; break;
case '3': sym = '#'; break;
case '4': sym = '$'; break;
case '5': sym = '%'; break;
case '6': sym = '^'; break;
case '7': sym = '&'; break;
case '8': sym = '*'; break;
case '9': 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;
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) {
@ -466,13 +471,13 @@ GHOST_SystemSDL::getCursorPosition(GHOST_TInt32& x,
GHOST_TInt32& y) const
{
int x_win, y_win;
SDL_Window *win= SDL_GetMouseFocus();
SDL_Window *win = SDL_GetMouseFocus();
SDL_GetWindowPosition(win, &x_win, &y_win);
int xi, yi;
SDL_GetMouseState(&xi, &yi);
x= xi + x_win;
y= yi + x_win;
x = xi + x_win;
y = yi + x_win;
return GHOST_kSuccess;
}
@ -482,7 +487,7 @@ GHOST_SystemSDL::setCursorPosition(GHOST_TInt32 x,
GHOST_TInt32 y)
{
int x_win, y_win;
SDL_Window *win= SDL_GetMouseFocus();
SDL_Window *win = SDL_GetMouseFocus();
SDL_GetWindowPosition(win, &x_win, &y_win);
SDL_WarpMouseInWindow(win, x - x_win, y - y_win);
@ -492,24 +497,24 @@ GHOST_SystemSDL::setCursorPosition(GHOST_TInt32 x,
bool
GHOST_SystemSDL::generateWindowExposeEvents()
{
std::vector<GHOST_WindowSDL *>::iterator w_start= m_dirty_windows.begin();
std::vector<GHOST_WindowSDL *>::const_iterator w_end= m_dirty_windows.end();
bool anyProcessed= false;
std::vector<GHOST_WindowSDL *>::iterator w_start = m_dirty_windows.begin();
std::vector<GHOST_WindowSDL *>::const_iterator w_end = m_dirty_windows.end();
bool anyProcessed = false;
for (;w_start != w_end; ++w_start) {
GHOST_Event * g_event= new
GHOST_Event(
getMilliSeconds(),
GHOST_kEventWindowUpdate,
*w_start
);
for (; w_start != w_end; ++w_start) {
GHOST_Event *g_event = new
GHOST_Event(
getMilliSeconds(),
GHOST_kEventWindowUpdate,
*w_start
);
(*w_start)->validate();
if (g_event) {
printf("Expose events pushed\n");
pushEvent(g_event);
anyProcessed= true;
anyProcessed = true;
}
}
@ -524,21 +529,22 @@ GHOST_SystemSDL::processEvents(bool waitForEvent)
// Get all the current events -- translate them into
// ghost events and call base class pushEvent() method.
bool anyProcessed= false;
bool anyProcessed = false;
do {
GHOST_TimerManager* timerMgr= getTimerManager();
GHOST_TimerManager *timerMgr = getTimerManager();
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);
//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());
// SleepTillEvent(m_display, next - getMilliSeconds()); // X11
}
@ -546,17 +552,17 @@ GHOST_SystemSDL::processEvents(bool waitForEvent)
}
if (timerMgr->fireTimers(getMilliSeconds())) {
anyProcessed= true;
anyProcessed = true;
}
SDL_Event sdl_event;
while (SDL_PollEvent(&sdl_event)) {
processEvent(&sdl_event);
anyProcessed= true;
anyProcessed = true;
}
if (generateWindowExposeEvents()) {
anyProcessed= true;
anyProcessed = true;
}
} 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
// 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 *>::const_iterator win_end= win_vec.end();
std::vector<GHOST_IWindow *>::iterator win_it = win_vec.begin();
std::vector<GHOST_IWindow *>::const_iterator win_end = win_vec.end();
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) {
return window;
}
@ -600,7 +606,7 @@ GHOST_SystemSDL::addDirtyWindow(GHOST_WindowSDL *bad_wind)
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_kButtonMaskMiddle, (state & SDL_BUTTON_MMASK) != 0);
buttons.set(GHOST_kButtonMaskRight, (state & SDL_BUTTON_RMASK) != 0);

@ -110,7 +110,7 @@ private:
);
/* SDL specific */
GHOST_WindowSDL * findGhostWindow(SDL_Window *sdl_win);
GHOST_WindowSDL *findGhostWindow(SDL_Window *sdl_win);
bool
generateWindowExposeEvents();

File diff suppressed because it is too large Load Diff

@ -45,7 +45,7 @@
#include "GHOST_System.h"
#if defined(__CYGWIN32__)
# define __int64 long long
# define __int64 long long
#endif
class GHOST_EventButton;
@ -93,7 +93,7 @@ public:
* Returns the number of displays on this system.
* @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.
@ -114,16 +114,16 @@ public:
* @param type The type of drawing context installed in this window.
* @param stereoVisual Stereo visual for quad buffered stereo.
* @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).
*/
virtual GHOST_IWindow* createWindow(
const STR_String& title,
GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TDrawingContextType type,
const bool stereoVisual = false,
const GHOST_TUns16 numOfAASamples = 0,
const GHOST_TEmbedderWindowID parentWindow = 0 );
virtual GHOST_IWindow *createWindow(
const STR_String& title,
GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height,
GHOST_TWindowState state, GHOST_TDrawingContextType type,
const bool stereoVisual = false,
const GHOST_TUns16 numOfAASamples = 0,
const GHOST_TEmbedderWindowID parentWindow = 0);
/***************************************************************************************
** Event management functionality
@ -180,7 +180,7 @@ public:
* @param selection Used by X11 only
* @return Returns the Clipboard
*/
virtual GHOST_TUns8* getClipboard(bool selection) const;
virtual GHOST_TUns8 *getClipboard(bool selection) const;
/**
* Puts buffer to system clipboard
@ -199,13 +199,13 @@ public:
* @param window The window on which the event occurred
* @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
* in the application
*/
virtual int confirmQuit(GHOST_IWindow * window) const;
virtual int confirmQuit(GHOST_IWindow *window) const;
protected:
/**
@ -239,7 +239,7 @@ protected:
* @param vk Pointer to virtual key
* @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).
@ -248,7 +248,7 @@ protected:
* events generated for both keys.
* @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.
@ -257,7 +257,7 @@ protected:
* @param mask The button mask of this event.
* @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.
@ -265,7 +265,7 @@ protected:
* @param window The window receiving the event (the active window).
* @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.
@ -273,7 +273,7 @@ protected:
* @param wParam The wParam 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).
@ -282,7 +282,7 @@ protected:
* @param window The window receiving the event (the active window).
* @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
@ -299,13 +299,13 @@ protected:
* @param window The window receiving the event (the active window).
* @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.
* @param minmax The MINMAXINFO structure.
*/
static void processMinMaxInfo(MINMAXINFO * minmax);
static void processMinMaxInfo(MINMAXINFO *minmax);
#ifdef WITH_INPUT_NDOF
/**
@ -342,14 +342,14 @@ protected:
static LRESULT WINAPI s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
/**
* Toggles console
* @action 0 - Hides
* 1 - Shows
* 2 - Toggles
* 3 - Hides if it runs not from command line
* * - Does nothing
* @return current status (1 -visible, 0 - hidden)
*/
* Toggles console
* @action 0 - Hides
* 1 - Shows
* 2 - Toggles
* 3 - Hides if it runs not from command line
* * - Does nothing
* @return current status (1 -visible, 0 - hidden)
*/
int toggleConsole(int action);
/** The current state of the modifier keys. */
@ -390,12 +390,12 @@ inline void GHOST_SystemWin32::handleKeyboardChange(void)
// save the language identifier.
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 == -1 means no key that translates passed char code
// high byte contains shift state. bit 2 ctrl pressed, bit 4 alt pressed
// 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;
break;
}

@ -19,54 +19,54 @@
// GHOST_WindowWin32
#ifndef __ITaskbarList_INTERFACE_DEFINED__
#define __ITaskbarList_INTERFACE_DEFINED__
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} }; }
class ITaskbarList : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE HrInit (void) = 0;
virtual HRESULT STDMETHODCALLTYPE AddTab (HWND hwnd) = 0;
virtual HRESULT STDMETHODCALLTYPE DeleteTab (HWND hwnd) = 0;
virtual HRESULT STDMETHODCALLTYPE ActivateTab (HWND hwnd) = 0;
virtual HRESULT STDMETHODCALLTYPE SetActiveAlt (HWND hwnd) = 0;
};
#endif /* ITaskbarList */
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} }; }
class ITaskbarList : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE HrInit(void) = 0;
virtual HRESULT STDMETHODCALLTYPE AddTab(HWND hwnd) = 0;
virtual HRESULT STDMETHODCALLTYPE DeleteTab(HWND hwnd) = 0;
virtual HRESULT STDMETHODCALLTYPE ActivateTab(HWND hwnd) = 0;
virtual HRESULT STDMETHODCALLTYPE SetActiveAlt(HWND hwnd) = 0;
};
#endif /* ITaskbarList */
#ifndef __ITaskbarList2_INTERFACE_DEFINED__
#define __ITaskbarList2_INTERFACE_DEFINED__
extern "C" {const GUID IID_ITaskbarList2 = {0x602D4995, 0xB13A, 0x429b, {0xA6, 0x6E, 0x19, 0x35, 0xE4, 0x4F, 0x43, 0x17} }; }
class ITaskbarList2 : public ITaskbarList
{
public:
virtual HRESULT STDMETHODCALLTYPE MarkFullscreenWindow(HWND hwnd, BOOL fFullscreen) = 0;
};
#endif /* ITaskbarList2 */
extern "C" {const GUID IID_ITaskbarList2 = {0x602D4995, 0xB13A, 0x429b, {0xA6, 0x6E, 0x19, 0x35, 0xE4, 0x4F, 0x43, 0x17} }; }
class ITaskbarList2 : public ITaskbarList
{
public:
virtual HRESULT STDMETHODCALLTYPE MarkFullscreenWindow(HWND hwnd, BOOL fFullscreen) = 0;
};
#endif /* ITaskbarList2 */
#ifndef __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 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 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
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
{
public:
virtual HRESULT STDMETHODCALLTYPE SetProgressValue (HWND hwnd, ULONGLONG ullCompleted, ULONGLONG ullTotal) = 0;
virtual HRESULT STDMETHODCALLTYPE SetProgressState (HWND hwnd, TBPFLAG tbpFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE RegisterTab (HWND hwndTab, HWND hwndMDI) = 0;
virtual HRESULT STDMETHODCALLTYPE UnregisterTab (HWND hwndTab) = 0;
virtual HRESULT STDMETHODCALLTYPE SetTabOrder (HWND hwndTab, HWND hwndInsertBefore) = 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 ThumbBarUpdateButtons (HWND hwnd, UINT cButtons, THUMBBUTTON * pButton) = 0;
virtual HRESULT STDMETHODCALLTYPE ThumbBarSetImageList (HWND hwnd, HIMAGELIST himl) = 0;
virtual HRESULT STDMETHODCALLTYPE SetOverlayIcon (HWND hwnd, HICON hIcon, LPCWSTR pszDescription) = 0;
virtual HRESULT STDMETHODCALLTYPE SetThumbnailTooltip (HWND hwnd, LPCWSTR pszTip) = 0;
virtual HRESULT STDMETHODCALLTYPE SetThumbnailClip (HWND hwnd, RECT *prcClip) = 0;
};
#endif /* ITaskbarList3 */
class ITaskbarList3 : public ITaskbarList2
{
public:
virtual HRESULT STDMETHODCALLTYPE SetProgressValue(HWND hwnd, ULONGLONG ullCompleted, ULONGLONG ullTotal) = 0;
virtual HRESULT STDMETHODCALLTYPE SetProgressState(HWND hwnd, TBPFLAG tbpFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE RegisterTab(HWND hwndTab, HWND hwndMDI) = 0;
virtual HRESULT STDMETHODCALLTYPE UnregisterTab(HWND hwndTab) = 0;
virtual HRESULT STDMETHODCALLTYPE SetTabOrder(HWND hwndTab, HWND hwndInsertBefore) = 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 ThumbBarUpdateButtons(HWND hwnd, UINT cButtons, THUMBBUTTON *pButton) = 0;
virtual HRESULT STDMETHODCALLTYPE ThumbBarSetImageList(HWND hwnd, HIMAGELIST himl) = 0;
virtual HRESULT STDMETHODCALLTYPE SetOverlayIcon(HWND hwnd, HICON hIcon, LPCWSTR pszDescription) = 0;
virtual HRESULT STDMETHODCALLTYPE SetThumbnailTooltip(HWND hwnd, LPCWSTR pszTip) = 0;
virtual HRESULT STDMETHODCALLTYPE SetThumbnailClip(HWND hwnd, RECT *prcClip) = 0;
};
#endif /* ITaskbarList3 */
#endif /*__GHOST_TASKBARWIN32_H__*/

@ -61,14 +61,14 @@ GHOST_TUns32 GHOST_TimerManager::getNumTimers()
}
bool GHOST_TimerManager::getTimerFound(GHOST_TimerTask* timer)
bool GHOST_TimerManager::getTimerFound(GHOST_TimerTask *timer)
{
TTimerVector::const_iterator iter = std::find(m_timers.begin(), m_timers.end(), timer);
return iter != m_timers.end();
}
GHOST_TSuccess GHOST_TimerManager::addTimer(GHOST_TimerTask* timer)
GHOST_TSuccess GHOST_TimerManager::addTimer(GHOST_TimerTask *timer)
{
GHOST_TSuccess success;
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;
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++) {
GHOST_TUns64 next = (*iter)->getNext();
if (next<smallest)
if (next < smallest)
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();
@ -148,7 +148,8 @@ bool GHOST_TimerManager::fireTimer(GHOST_TUns64 time, GHOST_TimerTask* task)
task->setNext(next);
return true;
} else {
}
else {
return false;
}
}

@ -64,13 +64,13 @@ public:
* Returns the number of timer tasks.
* @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.
* @return Indication of presence.
*/
virtual bool getTimerFound(GHOST_TimerTask* timer);
virtual bool getTimerFound(GHOST_TimerTask *timer);
/**
* Adds a timer task to the list.
@ -78,7 +78,7 @@ public:
* @param timer The timer task added to the list.
* @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.
@ -86,7 +86,7 @@ public:
* @param timer The timer task to be removed from the list.
* @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.
@ -108,7 +108,7 @@ public:
* @param task The timer task to check and optionally fire.
* @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:
/**
@ -116,7 +116,7 @@ protected:
*/
void disposeTimers();
typedef std::vector<GHOST_TimerTask*> TTimerVector;
typedef std::vector<GHOST_TimerTask *> TTimerVector;
/** The list with event consumers. */
TTimerVector m_timers;
};

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

@ -40,12 +40,12 @@
GHOST_Window::GHOST_Window(
GHOST_TUns32 width, GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const bool stereoVisual,
const GHOST_TUns16 numOfAASamples)
:
GHOST_TUns32 width, GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const bool stereoVisual,
const GHOST_TUns16 numOfAASamples)
:
m_drawingContextType(type),
m_cursorVisible(true),
m_cursorGrab(GHOST_kGrabDisable),
@ -58,14 +58,14 @@ GHOST_Window::GHOST_Window(
m_progressBarVisible = false;
m_cursorGrabAccumPos[0] = 0;
m_cursorGrabAccumPos[1] = 0;
m_cursorGrabAccumPos[0] = 0;
m_cursorGrabAccumPos[1] = 0;
m_fullScreen = state == GHOST_kWindowStateFullScreen;
if (m_fullScreen) {
m_fullScreenWidth = width;
m_fullScreenHeight = height;
}
m_fullScreen = state == GHOST_kWindowStateFullScreen;
if (m_fullScreen) {
m_fullScreenWidth = width;
m_fullScreenHeight = height;
}
}
@ -73,7 +73,7 @@ GHOST_Window::~GHOST_Window()
{
}
void* GHOST_Window::getOSWindow() const
void *GHOST_Window::getOSWindow() const
{
return NULL;
}
@ -107,16 +107,17 @@ GHOST_TSuccess GHOST_Window::setCursorVisibility(bool visible)
GHOST_TSuccess GHOST_Window::setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rect *bounds)
{
if(m_cursorGrab == mode)
if (m_cursorGrab == mode)
return GHOST_kSuccess;
if (setWindowCursorGrab(mode)) {
if(mode==GHOST_kGrabDisable)
m_cursorGrabBounds.m_l= m_cursorGrabBounds.m_r= -1;
if (mode == GHOST_kGrabDisable)
m_cursorGrabBounds.m_l = m_cursorGrabBounds.m_r = -1;
else if (bounds) {
m_cursorGrabBounds= *bounds;
} else { /* if bounds not defined, use window */
m_cursorGrabBounds = *bounds;
}
else { /* if bounds not defined, use window */
getClientBounds(m_cursorGrabBounds);
}
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)
{
bounds= m_cursorGrabBounds;
return (bounds.m_l==-1 && bounds.m_r==-1) ? GHOST_kFailure : GHOST_kSuccess;
bounds = m_cursorGrabBounds;
return (bounds.m_l == -1 && bounds.m_r == -1) ? GHOST_kFailure : GHOST_kSuccess;
}
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)
{
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,
int sizex, int sizey, int hotX, int hotY,
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;
return GHOST_kSuccess;
}

@ -83,12 +83,12 @@ public:
* @param numOfAASamples Number of samples used for AA (zero if no AA)
*/
GHOST_Window(
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
const bool stereoVisual = false,
const GHOST_TUns16 numOfAASamples = 0);
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
const bool stereoVisual = false,
const GHOST_TUns16 numOfAASamples = 0);
/**
* @section Interface inherited from GHOST_IWindow left for derived class
@ -121,7 +121,7 @@ public:
* Returns the associated OS object/handle
* @return The associated OS object/handle
*/
virtual void* getOSWindow() const;
virtual void *getOSWindow() const;
/**
* Returns the current cursor shape.
@ -145,15 +145,15 @@ public:
* @return Indication of success.
*/
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 bitmap[16][2],
GHOST_TUns8 mask[16][2],
int hotX,
int hotY);
GHOST_TUns8 mask[16][2],
int hotX,
int hotY);
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex, int sizey,
int hotX, int hotY,
int fg_color, int bg_color);
GHOST_TUns8 *mask,
int sizex, int sizey,
int hotX, int hotY,
int fg_color, int bg_color);
/**
* Returns the visibility state of the cursor.
@ -187,15 +187,19 @@ public:
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)
*/
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
*/
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
@ -278,7 +282,9 @@ protected:
* Sets the cursor grab on the window using
* 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
@ -295,7 +301,7 @@ protected:
int hotX, int hotY) = 0;
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. */
GHOST_TDrawingContextType m_drawingContextType;
@ -365,8 +371,8 @@ inline GHOST_TGrabCursorMode GHOST_Window::getCursorGrabMode() const
inline bool GHOST_Window::getCursorGrabModeIsWarp() const
{
return (m_cursorGrab == GHOST_kGrabWrap) ||
(m_cursorGrab == GHOST_kGrabHide);
return (m_cursorGrab == GHOST_kGrabWrap) ||
(m_cursorGrab == GHOST_kGrabHide);
}
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
{
x= m_cursorGrabAccumPos[0];
y= m_cursorGrabAccumPos[1];
x = m_cursorGrabAccumPos[0];
y = m_cursorGrabAccumPos[1];
}
inline void GHOST_Window::setCursorGrabAccum(GHOST_TInt32 x, GHOST_TInt32 y)
{
m_cursorGrabAccumPos[0]= x;
m_cursorGrabAccumPos[1]= y;
m_cursorGrabAccumPos[0] = x;
m_cursorGrabAccumPos[1] = y;
}
inline GHOST_TStandardCursor GHOST_Window::getCursorShape() const

@ -46,31 +46,31 @@ const GHOST_TInt32 GHOST_WindowCarbon::s_sizeRectSize = 16;
#endif //GHOST_DRAW_CARBON_GUTTER
static const GLint sPreferredFormatWindow[10] = {
AGL_RGBA,
AGL_DOUBLEBUFFER,
AGL_ACCELERATED,
AGL_DEPTH_SIZE, 32,
AGL_NONE,
AGL_RGBA,
AGL_DOUBLEBUFFER,
AGL_ACCELERATED,
AGL_DEPTH_SIZE, 32,
AGL_NONE,
};
static const GLint sPreferredFormatFullScreen[11] = {
AGL_RGBA,
AGL_DOUBLEBUFFER,
AGL_ACCELERATED,
AGL_FULLSCREEN,
AGL_DEPTH_SIZE, 32,
AGL_NONE,
AGL_RGBA,
AGL_DOUBLEBUFFER,
AGL_ACCELERATED,
AGL_FULLSCREEN,
AGL_DEPTH_SIZE, 32,
AGL_NONE,
};
WindowRef ugly_hack=NULL;
WindowRef ugly_hack = NULL;
const EventTypeSpec kWEvents[] = {
const EventTypeSpec kWEvents[] = {
{ 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;
GHOST_WindowCarbon *ghost_window;
@ -78,7 +78,7 @@ static OSStatus myWEventHandlerProc(EventHandlerCallRef handler, EventRef event,
int theState;
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);
theState = ghost_window->getMac_windowState();
if (theState == 1)
@ -91,16 +91,16 @@ static OSStatus myWEventHandlerProc(EventHandlerCallRef handler, EventRef event,
}
GHOST_WindowCarbon::GHOST_WindowCarbon(
const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const bool stereoVisual,
const GHOST_TUns16 numOfAASamples
) :
const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const bool stereoVisual,
const GHOST_TUns16 numOfAASamples
) :
GHOST_Window(width, height, state, GHOST_kDrawingContextTypeNone),
m_windowRef(0),
m_grafPtr(0),
@ -108,84 +108,87 @@ GHOST_WindowCarbon::GHOST_WindowCarbon(
m_customCursor(0),
m_fullScreenDirty(false)
{
Str255 title255;
Str255 title255;
OSStatus err;
//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) state= GHOST_kWindowStateNormal;
else if(state == GHOST_kWindowState8Maximized) state= GHOST_kWindowStateMaximized;
else if(state == GHOST_kWindowState8Minimized) state= GHOST_kWindowStateMinimized;
else if(state == GHOST_kWindowState8FullScreen) state= GHOST_kWindowStateFullScreen;
if (state >= GHOST_kWindowState8Normal) {
if (state == GHOST_kWindowState8Normal) state = GHOST_kWindowStateNormal;
else if (state == GHOST_kWindowState8Maximized) state = GHOST_kWindowStateMaximized;
else if (state == GHOST_kWindowState8Minimized) state = GHOST_kWindowStateMinimized;
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
setMac_windowState(1);
} else
}
else
setMac_windowState(0);
if (state != GHOST_kWindowStateFullScreen) {
Rect bnds = { top, left, top+height, left+width };
// Boolean visible = (state == GHOST_kWindowStateNormal) || (state == GHOST_kWindowStateMaximized); /*unused*/
gen2mac(title, title255);
err = ::CreateNewWindow( kDocumentWindowClass,
kWindowStandardDocumentAttributes+kWindowLiveResizeAttribute,
&bnds,
&m_windowRef);
if ( err != noErr) {
fprintf(stderr," error creating window %i \n",(int)err);
} else {
Rect bnds = { top, left, top + height, left + width };
// Boolean visible = (state == GHOST_kWindowStateNormal) || (state == GHOST_kWindowStateMaximized); /*unused*/
gen2mac(title, title255);
err = ::CreateNewWindow(kDocumentWindowClass,
kWindowStandardDocumentAttributes + kWindowLiveResizeAttribute,
&bnds,
&m_windowRef);
::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);
err = InstallWindowEventHandler (m_windowRef, myWEventHandlerProc, GetEventTypeCount(kWEvents), kWEvents,NULL,NULL);
if ( err != noErr) {
fprintf(stderr," error creating handler %i \n",(int)err);
} else {
err = InstallWindowEventHandler(m_windowRef, myWEventHandlerProc, GetEventTypeCount(kWEvents), kWEvents, NULL, NULL);
if (err != noErr) {
fprintf(stderr, " error creating handler %i \n", (int)err);
}
else {
// ::TransitionWindow (m_windowRef,kWindowZoomTransitionEffect,kWindowShowTransitionAction,NULL);
::ShowWindow(m_windowRef);
::MoveWindow (m_windowRef, left, top,true);
::MoveWindow(m_windowRef, left, top, true);
}
}
if (m_windowRef) {
m_grafPtr = ::GetWindowPort(m_windowRef);
setDrawingContextType(type);
updateDrawingContext();
activateDrawingContext();
}
if(ugly_hack==NULL) {
ugly_hack= m_windowRef;
if (m_windowRef) {
m_grafPtr = ::GetWindowPort(m_windowRef);
setDrawingContextType(type);
updateDrawingContext();
activateDrawingContext();
}
if (ugly_hack == NULL) {
ugly_hack = m_windowRef;
// when started from commandline, window remains in the back... also for play anim
ProcessSerialNumber psn;
GetCurrentProcess(&psn);
SetFrontProcess(&psn);
}
}
else {
/*
Rect bnds = { top, left, top+height, left+width };
gen2mac("", title255);
m_windowRef = ::NewCWindow(
nil, // Storage
&bnds, // Bounding rectangle of the window
title255, // Title of the window
0, // Window initially visible
plainDBox, // procID
(WindowRef)-1L, // Put window before all other windows
0, // Window has minimize box
(SInt32)this); // Store a pointer to the class in the refCon
*/
//GHOST_PRINT("GHOST_WindowCarbon::GHOST_WindowCarbon(): creating full-screen OpenGL context\n");
setDrawingContextType(GHOST_kDrawingContextTypeOpenGL);;installDrawingContext(GHOST_kDrawingContextTypeOpenGL);
updateDrawingContext();
activateDrawingContext();
}
else {
#if 0
Rect bnds = { top, left, top + height, left + width };
gen2mac("", title255);
m_windowRef = ::NewCWindow(
nil, // Storage
&bnds, // Bounding rectangle of the window
title255, // Title of the window
0, // Window initially visible
plainDBox, // procID
(WindowRef) - 1L, // Put window before all other windows
0, // Window has minimize box
(SInt32) this); // Store a pointer to the class in the refCon
#endif
//GHOST_PRINT("GHOST_WindowCarbon::GHOST_WindowCarbon(): creating full-screen OpenGL context\n");
setDrawingContextType(GHOST_kDrawingContextTypeOpenGL);; installDrawingContext(GHOST_kDrawingContextTypeOpenGL);
updateDrawingContext();
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(ugly_hack==m_windowRef) ugly_hack= NULL;
if (ugly_hack == m_windowRef) ugly_hack = NULL;
// printf("GHOST_WindowCarbon::~GHOST_WindowCarbon(): removing drawing context\n");
if(ugly_hack==NULL) setDrawingContextType(GHOST_kDrawingContextTypeNone);
if (m_windowRef) {
::DisposeWindow(m_windowRef);
if (ugly_hack == NULL) setDrawingContextType(GHOST_kDrawingContextTypeNone);
if (m_windowRef) {
::DisposeWindow(m_windowRef);
m_windowRef = 0;
}
}
bool GHOST_WindowCarbon::getValid() const
{
bool valid;
if (!m_fullScreen) {
valid = (m_windowRef != 0) && (m_grafPtr != 0) && ::IsValidWindowPtr(m_windowRef);
}
else {
valid = true;
}
return valid;
bool valid;
if (!m_fullScreen) {
valid = (m_windowRef != 0) && (m_grafPtr != 0) && ::IsValidWindowPtr(m_windowRef);
}
else {
valid = true;
}
return valid;
}
void GHOST_WindowCarbon::setTitle(const STR_String& title)
{
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setTitle(): window invalid")
Str255 title255;
gen2mac(title, title255);
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setTitle(): window invalid")
Str255 title255;
gen2mac(title, title255);
::SetWTitle(m_windowRef, title255);
}
void GHOST_WindowCarbon::getTitle(STR_String& title) const
{
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getTitle(): window invalid")
Str255 title255;
::GetWTitle(m_windowRef, title255);
mac2gen(title255, title);
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getTitle(): window invalid")
Str255 title255;
::GetWTitle(m_windowRef, title255);
mac2gen(title255, title);
}
@ -265,8 +268,7 @@ void GHOST_WindowCarbon::getClientBounds(GHOST_Rect& bounds) const
{
bounds.m_b -= s_sizeRectSize;
}
else
{
else {
bounds.m_t = bounds.m_b;
}
#endif //GHOST_DRAW_CARBON_GUTTER
@ -291,8 +293,8 @@ GHOST_TSuccess GHOST_WindowCarbon::setClientHeight(GHOST_TUns32 height)
GHOST_Rect cBnds, wBnds;
getClientBounds(cBnds);
#ifdef GHOST_DRAW_CARBON_GUTTER
if (((GHOST_TUns32)cBnds.getHeight()) != height+s_sizeRectSize) {
::SizeWindow(m_windowRef, cBnds.getWidth(), height+s_sizeRectSize, true);
if (((GHOST_TUns32)cBnds.getHeight()) != height + s_sizeRectSize) {
::SizeWindow(m_windowRef, cBnds.getWidth(), height + s_sizeRectSize, true);
}
#else //GHOST_DRAW_CARBON_GUTTER
if (((GHOST_TUns32)cBnds.getHeight()) != height) {
@ -310,8 +312,9 @@ GHOST_TSuccess GHOST_WindowCarbon::setClientSize(GHOST_TUns32 width, GHOST_TUns3
getClientBounds(cBnds);
#ifdef GHOST_DRAW_CARBON_GUTTER
if ((((GHOST_TUns32)cBnds.getWidth()) != width) ||
(((GHOST_TUns32)cBnds.getHeight()) != height+s_sizeRectSize)) {
::SizeWindow(m_windowRef, width, height+s_sizeRectSize, true);
(((GHOST_TUns32)cBnds.getHeight()) != height + s_sizeRectSize))
{
::SizeWindow(m_windowRef, width, height + s_sizeRectSize, true);
}
#else //GHOST_DRAW_CARBON_GUTTER
if ((((GHOST_TUns32)cBnds.getWidth()) != width) ||
@ -346,11 +349,11 @@ void GHOST_WindowCarbon::screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOS
Point point;
point.h = inX;
point.v = inY;
GrafPtr oldPort;
::GetPort(&oldPort);
::SetPort(m_grafPtr);
GrafPtr oldPort;
::GetPort(&oldPort);
::SetPort(m_grafPtr);
::GlobalToLocal(&point);
::SetPort(oldPort);
::SetPort(oldPort);
outX = point.h;
outY = point.v;
}
@ -362,11 +365,11 @@ void GHOST_WindowCarbon::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOS
Point point;
point.h = inX;
point.v = inY;
GrafPtr oldPort;
::GetPort(&oldPort);
::SetPort(m_grafPtr);
GrafPtr oldPort;
::GetPort(&oldPort);
::SetPort(m_grafPtr);
::LocalToGlobal(&point);
::SetPort(oldPort);
::SetPort(oldPort);
outX = point.h;
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_ASSERT(getValid(), "GHOST_WindowCarbon::setState(): window invalid")
switch (state) {
case GHOST_kWindowStateMinimized:
::HideWindow(m_windowRef);
break;
case GHOST_kWindowStateModified:
SetWindowModified(m_windowRef, 1);
break;
case GHOST_kWindowStateUnModified:
SetWindowModified(m_windowRef, 0);
break;
case GHOST_kWindowStateMaximized:
case GHOST_kWindowStateNormal:
default:
::ShowWindow(m_windowRef);
break;
}
return GHOST_kSuccess;
switch (state) {
case GHOST_kWindowStateMinimized:
::HideWindow(m_windowRef);
break;
case GHOST_kWindowStateModified:
SetWindowModified(m_windowRef, 1);
break;
case GHOST_kWindowStateUnModified:
SetWindowModified(m_windowRef, 0);
break;
case GHOST_kWindowStateMaximized:
case GHOST_kWindowStateNormal:
default:
::ShowWindow(m_windowRef);
break;
}
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_WindowCarbon::setOrder(GHOST_TWindowOrder order)
{
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::setOrder(): window invalid")
if (order == GHOST_kWindowOrderTop) {
//::BringToFront(m_windowRef); is wrong, front window should be active for input too
if (order == GHOST_kWindowOrderTop) {
//::BringToFront(m_windowRef); is wrong, front window should be active for input too
::SelectWindow(m_windowRef);
}
else {
}
else {
/* doesnt work if you do this with a mouseclick */
::SendBehind(m_windowRef, nil);
}
return GHOST_kSuccess;
::SendBehind(m_windowRef, nil);
}
return GHOST_kSuccess;
}
/*#define WAIT_FOR_VSYNC 1*/
@ -418,20 +421,20 @@ GHOST_TSuccess GHOST_WindowCarbon::swapBuffers()
{
#ifdef WAIT_FOR_VSYNC
/* wait for vsync, to avoid tearing artifacts */
long VBL = 1;
CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &VBL);
long VBL = 1;
CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &VBL);
#endif
GHOST_TSuccess succeeded = GHOST_kSuccess;
if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
if (m_aglCtx) {
::aglSwapBuffers(m_aglCtx);
}
else {
succeeded = GHOST_kFailure;
}
}
return succeeded;
GHOST_TSuccess succeeded = GHOST_kSuccess;
if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
if (m_aglCtx) {
::aglSwapBuffers(m_aglCtx);
}
else {
succeeded = GHOST_kFailure;
}
}
return succeeded;
}
GHOST_TSuccess GHOST_WindowCarbon::updateDrawingContext()
@ -462,9 +465,9 @@ GHOST_TSuccess GHOST_WindowCarbon::activateDrawingContext()
GLint b[4] =
{
bnds.m_l,
bnds.m_t+s_sizeRectSize,
bnds.m_r-bnds.m_l,
bnds.m_b-bnds.m_t
bnds.m_t + s_sizeRectSize,
bnds.m_r - bnds.m_l,
bnds.m_b - bnds.m_t
};
GLboolean result = ::aglSetInteger(m_aglCtx, AGL_BUFFER_RECT, b);
#endif //GHOST_DRAW_CARBON_GUTTER
@ -482,38 +485,38 @@ GHOST_TSuccess GHOST_WindowCarbon::installDrawingContext(GHOST_TDrawingContextTy
GHOST_TSuccess success = GHOST_kFailure;
switch (type) {
case GHOST_kDrawingContextTypeOpenGL:
{
{
if (!getValid()) break;
AGLPixelFormat pixelFormat;
if (!m_fullScreen) {
pixelFormat = ::aglChoosePixelFormat(0, 0, sPreferredFormatWindow);
m_aglCtx = ::aglCreateContext(pixelFormat, s_firstaglCtx);
if (!m_aglCtx) break;
AGLPixelFormat pixelFormat;
if (!m_fullScreen) {
pixelFormat = ::aglChoosePixelFormat(0, 0, sPreferredFormatWindow);
m_aglCtx = ::aglCreateContext(pixelFormat, s_firstaglCtx);
if (!m_aglCtx) break;
if (!s_firstaglCtx) s_firstaglCtx = m_aglCtx;
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);
success = ::aglSetDrawable(m_aglCtx, m_grafPtr) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure;
}
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:
success = GHOST_kSuccess;
@ -532,9 +535,9 @@ GHOST_TSuccess GHOST_WindowCarbon::removeDrawingContext()
switch (m_drawingContextType) {
case GHOST_kDrawingContextTypeOpenGL:
if (m_aglCtx) {
aglSetCurrentContext(NULL);
aglSetDrawable(m_aglCtx, NULL);
//aglDestroyContext(m_aglCtx);
aglSetCurrentContext(NULL);
aglSetDrawable(m_aglCtx, NULL);
//aglDestroyContext(m_aglCtx);
if (s_firstaglCtx == m_aglCtx) s_firstaglCtx = NULL;
success = ::aglDestroyContext(m_aglCtx) == GL_TRUE ? GHOST_kSuccess : GHOST_kFailure;
m_aglCtx = 0;
@ -553,22 +556,22 @@ GHOST_TSuccess GHOST_WindowCarbon::removeDrawingContext()
GHOST_TSuccess GHOST_WindowCarbon::invalidate()
{
GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::invalidate(): window invalid")
if (!m_fullScreen) {
Rect rect;
::GetPortBounds(m_grafPtr, &rect);
::InvalWindowRect(m_windowRef, &rect);
}
else {
//EventRef event;
//OSStatus status = ::CreateEvent(NULL, kEventClassWindow, kEventWindowUpdate, 0, 0, &event);
//GHOST_PRINT("GHOST_WindowCarbon::invalidate(): created event " << status << " \n");
//status = ::SetEventParameter(event, kEventParamDirectObject, typeWindowRef, sizeof(WindowRef), this);
//GHOST_PRINT("GHOST_WindowCarbon::invalidate(): set event parameter " << status << " \n");
//status = ::PostEventToQueue(::GetMainEventQueue(), event, kEventPriorityStandard);
//status = ::SendEventToEventTarget(event, ::GetApplicationEventTarget());
//GHOST_PRINT("GHOST_WindowCarbon::invalidate(): added event to queue " << status << " \n");
m_fullScreenDirty = true;
}
if (!m_fullScreen) {
Rect rect;
::GetPortBounds(m_grafPtr, &rect);
::InvalWindowRect(m_windowRef, &rect);
}
else {
//EventRef event;
//OSStatus status = ::CreateEvent(NULL, kEventClassWindow, kEventWindowUpdate, 0, 0, &event);
//GHOST_PRINT("GHOST_WindowCarbon::invalidate(): created event " << status << " \n");
//status = ::SetEventParameter(event, kEventParamDirectObject, typeWindowRef, sizeof(WindowRef), this);
//GHOST_PRINT("GHOST_WindowCarbon::invalidate(): set event parameter " << status << " \n");
//status = ::PostEventToQueue(::GetMainEventQueue(), event, kEventPriorityStandard);
//status = ::SendEventToEventTarget(event, ::GetApplicationEventTarget());
//GHOST_PRINT("GHOST_WindowCarbon::invalidate(): added event to queue " << status << " \n");
m_fullScreenDirty = true;
}
return GHOST_kSuccess;
}
@ -578,7 +581,7 @@ void GHOST_WindowCarbon::gen2mac(const STR_String& in, Str255 out) const
STR_String tempStr = in;
int num = tempStr.Length();
if (num > 255) num = 255;
::memcpy(out+1, tempStr.Ptr(), num);
::memcpy(out + 1, tempStr.Ptr(), 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
{
char tmp[256];
::memcpy(tmp, in+1, in[0]);
::memcpy(tmp, in + 1, in[0]);
tmp[in[0]] = '\0';
out = tmp;
}
@ -607,35 +610,36 @@ void GHOST_WindowCarbon::loadCursor(bool visible, GHOST_TStandardCursor cursor)
}
if (cursor == GHOST_kStandardCursorCustom && m_customCursor) {
::SetCursor( m_customCursor );
} else {
::SetCursor(m_customCursor);
}
else {
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) {
default:
GCMAP( GHOST_kStandardCursorDefault, kThemeArrowCursor);
GCMAP( GHOST_kStandardCursorRightArrow, kThemeAliasArrowCursor);
GCMAP( GHOST_kStandardCursorLeftArrow, kThemeArrowCursor);
GCMAP( GHOST_kStandardCursorInfo, kThemeArrowCursor);
GCMAP( GHOST_kStandardCursorDestroy, kThemeArrowCursor);
GCMAP( GHOST_kStandardCursorHelp, kThemeArrowCursor);
GCMAP( GHOST_kStandardCursorCycle, kThemeArrowCursor);
GCMAP( GHOST_kStandardCursorSpray, kThemeArrowCursor);
GCMAP( GHOST_kStandardCursorWait, kThemeWatchCursor);
GCMAP( GHOST_kStandardCursorText, kThemeIBeamCursor);
GCMAP( GHOST_kStandardCursorCrosshair, kThemeCrossCursor);
GCMAP( GHOST_kStandardCursorUpDown, kThemeClosedHandCursor);
GCMAP( GHOST_kStandardCursorLeftRight, kThemeClosedHandCursor);
GCMAP( GHOST_kStandardCursorTopSide, kThemeArrowCursor);
GCMAP( GHOST_kStandardCursorBottomSide, kThemeArrowCursor);
GCMAP( GHOST_kStandardCursorLeftSide, kThemeResizeLeftCursor);
GCMAP( GHOST_kStandardCursorRightSide, kThemeResizeRightCursor);
GCMAP( GHOST_kStandardCursorTopLeftCorner, kThemeArrowCursor);
GCMAP( GHOST_kStandardCursorTopRightCorner, kThemeArrowCursor);
GCMAP( GHOST_kStandardCursorBottomRightCorner, kThemeArrowCursor);
GCMAP( GHOST_kStandardCursorBottomLeftCorner, kThemeArrowCursor);
GCMAP( GHOST_kStandardCursorCopy, kThemeCopyArrowCursor);
default:
GCMAP(GHOST_kStandardCursorDefault, kThemeArrowCursor);
GCMAP(GHOST_kStandardCursorRightArrow, kThemeAliasArrowCursor);
GCMAP(GHOST_kStandardCursorLeftArrow, kThemeArrowCursor);
GCMAP(GHOST_kStandardCursorInfo, kThemeArrowCursor);
GCMAP(GHOST_kStandardCursorDestroy, kThemeArrowCursor);
GCMAP(GHOST_kStandardCursorHelp, kThemeArrowCursor);
GCMAP(GHOST_kStandardCursorCycle, kThemeArrowCursor);
GCMAP(GHOST_kStandardCursorSpray, kThemeArrowCursor);
GCMAP(GHOST_kStandardCursorWait, kThemeWatchCursor);
GCMAP(GHOST_kStandardCursorText, kThemeIBeamCursor);
GCMAP(GHOST_kStandardCursorCrosshair, kThemeCrossCursor);
GCMAP(GHOST_kStandardCursorUpDown, kThemeClosedHandCursor);
GCMAP(GHOST_kStandardCursorLeftRight, kThemeClosedHandCursor);
GCMAP(GHOST_kStandardCursorTopSide, kThemeArrowCursor);
GCMAP(GHOST_kStandardCursorBottomSide, kThemeArrowCursor);
GCMAP(GHOST_kStandardCursorLeftSide, kThemeResizeLeftCursor);
GCMAP(GHOST_kStandardCursorRightSide, kThemeResizeRightCursor);
GCMAP(GHOST_kStandardCursorTopLeftCorner, kThemeArrowCursor);
GCMAP(GHOST_kStandardCursorTopRightCorner, kThemeArrowCursor);
GCMAP(GHOST_kStandardCursorBottomRightCorner, kThemeArrowCursor);
GCMAP(GHOST_kStandardCursorBottomLeftCorner, kThemeArrowCursor);
GCMAP(GHOST_kStandardCursorCopy, kThemeCopyArrowCursor);
};
#undef GCMAP
@ -646,7 +650,7 @@ void GHOST_WindowCarbon::loadCursor(bool visible, GHOST_TStandardCursor cursor)
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 */
static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
{
ch= ((ch>>1)&0x55) | ((ch<<1)&0xAA);
ch= ((ch>>2)&0x33) | ((ch<<2)&0xCC);
ch= ((ch>>4)&0x0F) | ((ch<<4)&0xF0);
ch = ((ch >> 1) & 0x55) | ((ch << 1) & 0xAA);
ch = ((ch >> 2) & 0x33) | ((ch << 2) & 0xCC);
ch = ((ch >> 4) & 0x0F) | ((ch << 4) & 0xF0);
return ch;
}
#endif
@ -688,15 +692,15 @@ static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
/** Reverse the bits in a GHOST_TUns16 */
static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
{
shrt= ((shrt>>1)&0x5555) | ((shrt<<1)&0xAAAA);
shrt= ((shrt>>2)&0x3333) | ((shrt<<2)&0xCCCC);
shrt= ((shrt>>4)&0x0F0F) | ((shrt<<4)&0xF0F0);
shrt= ((shrt>>8)&0x00FF) | ((shrt<<8)&0xFF00);
shrt = ((shrt >> 1) & 0x5555) | ((shrt << 1) & 0xAAAA);
shrt = ((shrt >> 2) & 0x3333) | ((shrt << 2) & 0xCCCC);
shrt = ((shrt >> 4) & 0x0F0F) | ((shrt << 4) & 0xF0F0);
shrt = ((shrt >> 8) & 0x00FF) | ((shrt << 8) & 0xFF00);
return shrt;
}
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;
@ -708,13 +712,13 @@ GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 *bitma
m_customCursor = new Cursor;
if (!m_customCursor) return GHOST_kFailure;
for (y=0; y<16; y++) {
for (y = 0; y < 16; y++) {
#if !defined(__LITTLE_ENDIAN__)
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->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));
#else
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->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));
#endif
}
@ -730,9 +734,9 @@ GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 *bitma
}
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);
}

@ -73,16 +73,16 @@ public:
* @param stereoVisual Stereo visual for quad buffered stereo.
*/
GHOST_WindowCarbon(
const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
const bool stereoVisual = false,
const GHOST_TUns16 numOfAASamples = 0
);
const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
const bool stereoVisual = false,
const GHOST_TUns16 numOfAASamples = 0
);
/**
* Destructor.
@ -94,7 +94,7 @@ public:
* Returns indication as to whether the window is valid.
* @return The validity of the window.
*/
virtual bool getValid() const;
virtual bool getValid() const;
/**
* 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.
* @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.
* The left and top members of the rectangle are always zero.
* @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.
* @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.
* @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.
* @param width The new width 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).
@ -154,7 +154,7 @@ public:
* @param outX The x-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
@ -163,7 +163,7 @@ public:
* @param outX The x-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).
@ -206,16 +206,20 @@ public:
*/
virtual bool getFullScreenDirty();
/* accessor for fullscreen window */
/* accessor for fullscreen window */
virtual void setMac_windowState(short value);
virtual short getMac_windowState();
const GHOST_TabletData* GetTabletData()
{ return &m_tablet; }
const GHOST_TabletData *GetTabletData()
{
return &m_tablet;
}
GHOST_TabletData& GetCarbonTabletData()
{ return m_tablet; }
{
return m_tablet;
}
protected:
/**
* Tries to install a rendering context in this window.
@ -232,7 +236,7 @@ protected:
/**
* Invalidates the contents of this window.
* @return Indication of success.
* @return Indication of success.
*/
virtual GHOST_TSuccess invalidate();
@ -253,7 +257,7 @@ protected:
* native window system calls.
*/
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);
@ -278,7 +282,7 @@ protected:
/** The first created OpenGL context (for sharing display lists) */
static AGLContext s_firstaglCtx;
Cursor* m_customCursor;
Cursor *m_customCursor;
GHOST_TabletData m_tablet;
@ -286,15 +290,15 @@ protected:
bool m_fullScreenDirty;
/** specific MacOs X full screen window setting as we use partially system mechanism
values : 0 not maximizable default
1 normal state
2 maximized state
this will be reworked when rebuilding GHOST carbon to use new OS X apis
in order to be unified with GHOST fullscreen/maximised settings
(lukep)
**/
* values : 0 not maximizable default
* 1 normal state
* 2 maximized state
*
* this will be reworked when rebuilding GHOST carbon to use new OS X apis
* in order to be unified with GHOST fullscreen/maximised settings
*
* (lukep)
**/
short mac_windowState;

@ -74,17 +74,17 @@ public:
* @param numOfAASamples Number of samples used for AA (zero if no AA)
*/
GHOST_WindowCocoa(
GHOST_SystemCocoa *systemCocoa,
const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 bottom,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
const bool stereoVisual = false,
const GHOST_TUns16 numOfAASamples = 0
);
GHOST_SystemCocoa *systemCocoa,
const STR_String& title,
GHOST_TInt32 left,
GHOST_TInt32 bottom,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
const bool stereoVisual = false,
const GHOST_TUns16 numOfAASamples = 0
);
/**
* Destructor.
@ -96,13 +96,13 @@ public:
* Returns indication as to whether the window is valid.
* @return The validity of the window.
*/
virtual bool getValid() const;
virtual bool getValid() const;
/**
* Returns 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.
@ -121,33 +121,33 @@ public:
* 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.
*/
virtual void getWindowBounds(GHOST_Rect& bounds) const;
virtual void getWindowBounds(GHOST_Rect& bounds) const;
/**
* Returns the client rectangle dimensions.
* The left and top members of the rectangle are always zero.
* @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.
* @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.
* @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.
* @param width The new width 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).
@ -169,7 +169,7 @@ public:
* @param outX The x-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
@ -178,7 +178,7 @@ public:
* @param outX The x-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
@ -204,7 +204,7 @@ public:
* Gets the screen the window is displayed in
* @return The NSScreen object
*/
NSScreen* getScreen();
NSScreen *getScreen();
/**
* Sets the state of the window (normal, minimized, maximized).
@ -242,11 +242,15 @@ public:
virtual void loadCursor(bool visible, GHOST_TStandardCursor cursor) const;
const GHOST_TabletData* GetTabletData()
{ return &m_tablet; }
const GHOST_TabletData *GetTabletData()
{
return &m_tablet;
}
GHOST_TabletData& GetCocoaTabletData()
{ return m_tablet; }
{
return m_tablet;
}
/**
* Sets the progress bar value displayed in the window/application icon
@ -274,7 +278,7 @@ protected:
/**
* Invalidates the contents of this window.
* @return Indication of success.
* @return Indication of success.
*/
virtual GHOST_TSuccess invalidate();
@ -301,7 +305,7 @@ protected:
* native window system calls.
*/
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);
@ -320,7 +324,7 @@ protected:
/** The first created OpenGL context (for sharing display lists) */
static NSOpenGLContext *s_firstOpenGLcontext;
NSCursor* m_customCursor;
NSCursor *m_customCursor;
GHOST_TabletData m_tablet;
};

@ -1441,7 +1441,7 @@ static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
}
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;
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_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);
}

@ -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;
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;
if (window) {
@ -79,7 +79,7 @@ GHOST_TSuccess GHOST_WindowManager::removeWindow(const GHOST_IWindow* window)
endFullScreen();
}
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()) {
setWindowInactive(window);
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;
if (window) {
if (getFullScreen() && (window == m_fullScreenWindow)) {
found = true;
}
else {
std::vector<GHOST_IWindow*>::const_iterator result = find(m_windows.begin(), m_windows.end(), window);
if (result != m_windows.end()) {
found = true;
}
}
if (getFullScreen() && (window == m_fullScreenWindow)) {
found = true;
}
else {
std::vector<GHOST_IWindow *>::const_iterator result = find(m_windows.begin(), m_windows.end(), window);
if (result != m_windows.end()) {
found = true;
}
}
}
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)
{
GHOST_TSuccess success = GHOST_kFailure;
@ -151,13 +151,13 @@ GHOST_TSuccess GHOST_WindowManager::endFullScreen(void)
setActiveWindow(m_activeWindowBeforeFullScreen);
}
}
success = GHOST_kSuccess;
success = GHOST_kSuccess;
}
return success;
}
GHOST_TSuccess GHOST_WindowManager::setActiveWindow(GHOST_IWindow* window)
GHOST_TSuccess GHOST_WindowManager::setActiveWindow(GHOST_IWindow *window)
{
GHOST_TSuccess success = GHOST_kSuccess;
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;
}
void GHOST_WindowManager::setWindowInactive(const GHOST_IWindow* window)
void GHOST_WindowManager::setWindowInactive(const GHOST_IWindow *window)
{
if (window == m_activeWindow) {
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++) {
if ((*iter)->getOSWindow() == osWindow)
@ -207,7 +207,7 @@ GHOST_IWindow* GHOST_WindowManager::getWindowAssociatedWithOSWindow(void* osWind
bool GHOST_WindowManager::getAnyModifiedState()
{
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++) {
if ((*iter)->getModifiedState())

@ -63,40 +63,40 @@ public:
* @param window Pointer to the window to be added.
* @return Indication of success.
*/
virtual GHOST_TSuccess addWindow(GHOST_IWindow* window);
virtual GHOST_TSuccess addWindow(GHOST_IWindow *window);
/**
* Remove a window from our list.
* @param window Pointer to the window to be removed.
* @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.
* @param window Pointer to the window to query.
* @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.
* @return A boolean indicator.
*/
virtual bool getFullScreen(void) const;
virtual bool getFullScreen(void) const;
/**
* Returns pointer to the full-screen window.
* @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.
* @param window The window displayed fullscreen.
* @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.
@ -109,21 +109,21 @@ public:
* There can be only one window active which should be in the current window list.
* @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).
* 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).
*/
virtual GHOST_IWindow* getActiveWindow(void) const;
virtual GHOST_IWindow *getActiveWindow(void) const;
/**
* Set this window to be inactive (not receiving events).
* @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
* @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
@ -150,16 +150,16 @@ public:
protected:
/** 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. */
GHOST_IWindow* m_fullScreenWindow;
GHOST_IWindow *m_fullScreenWindow;
/** The active window. */
GHOST_IWindow* m_activeWindow;
GHOST_IWindow *m_activeWindow;
/** Window that was active before entering fullscreen state. */
GHOST_IWindow* m_activeWindowBeforeFullScreen;
GHOST_IWindow *m_activeWindowBeforeFullScreen;
#ifdef WITH_CXX_GUARDEDALLOC
public:

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