[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20487] branches/soc-2009-jaguarandi: svn merge -r 20133:20486 https://svn.blender.org/svnroot/bf-blender/ branches/blender2.5/blender

André Pinto andresusanopinto at gmail.com
Fri May 29 02:54:53 CEST 2009


Revision: 20487
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20487
Author:   jaguarandi
Date:     2009-05-29 02:54:52 +0200 (Fri, 29 May 2009)

Log Message:
-----------
svn merge -r 20133:20486 https://svn.blender.org/svnroot/bf-blender/branches/blender2.5/blender

2.5 trunk has a nice bug fix for rendering

Modified Paths:
--------------
    branches/soc-2009-jaguarandi/intern/ghost/intern/GHOST_SystemWin32.cpp
    branches/soc-2009-jaguarandi/intern/ghost/intern/GHOST_SystemX11.cpp
    branches/soc-2009-jaguarandi/intern/ghost/intern/GHOST_SystemX11.h
    branches/soc-2009-jaguarandi/projectfiles_vc9/blender/editors/ED_editors.vcproj
    branches/soc-2009-jaguarandi/release/datafiles/blenderbuttons
    branches/soc-2009-jaguarandi/release/ui/buttons_data_camera.py
    branches/soc-2009-jaguarandi/release/ui/buttons_data_lamp.py
    branches/soc-2009-jaguarandi/release/ui/buttons_data_lattice.py
    branches/soc-2009-jaguarandi/release/ui/buttons_data_modifier.py
    branches/soc-2009-jaguarandi/release/ui/buttons_material.py
    branches/soc-2009-jaguarandi/release/ui/buttons_objects.py
    branches/soc-2009-jaguarandi/release/ui/buttons_scene.py
    branches/soc-2009-jaguarandi/release/ui/buttons_world.py
    branches/soc-2009-jaguarandi/release/ui/space_text.py
    branches/soc-2009-jaguarandi/source/blender/blenfont/intern/blf.c
    branches/soc-2009-jaguarandi/source/blender/blenkernel/BKE_colortools.h
    branches/soc-2009-jaguarandi/source/blender/blenkernel/BKE_context.h
    branches/soc-2009-jaguarandi/source/blender/blenkernel/BKE_library.h
    branches/soc-2009-jaguarandi/source/blender/blenkernel/BKE_multires.h
    branches/soc-2009-jaguarandi/source/blender/blenkernel/BKE_object.h
    branches/soc-2009-jaguarandi/source/blender/blenkernel/BKE_screen.h
    branches/soc-2009-jaguarandi/source/blender/blenkernel/SConscript
    branches/soc-2009-jaguarandi/source/blender/blenkernel/intern/colortools.c
    branches/soc-2009-jaguarandi/source/blender/blenkernel/intern/context.c
    branches/soc-2009-jaguarandi/source/blender/blenkernel/intern/fcurve.c
    branches/soc-2009-jaguarandi/source/blender/blenkernel/intern/ipo.c
    branches/soc-2009-jaguarandi/source/blender/blenkernel/intern/library.c
    branches/soc-2009-jaguarandi/source/blender/blenkernel/intern/modifier.c
    branches/soc-2009-jaguarandi/source/blender/blenkernel/intern/multires.c
    branches/soc-2009-jaguarandi/source/blender/blenkernel/intern/object.c
    branches/soc-2009-jaguarandi/source/blender/blenlib/BLI_arithb.h
    branches/soc-2009-jaguarandi/source/blender/blenlib/intern/arithb.c
    branches/soc-2009-jaguarandi/source/blender/blenlib/intern/fileops.c
    branches/soc-2009-jaguarandi/source/blender/blenlib/intern/rct.c
    branches/soc-2009-jaguarandi/source/blender/blenloader/intern/readfile.c
    branches/soc-2009-jaguarandi/source/blender/blenloader/intern/writefile.c
    branches/soc-2009-jaguarandi/source/blender/editors/animation/anim_filter.c
    branches/soc-2009-jaguarandi/source/blender/editors/animation/anim_ipo_utils.c
    branches/soc-2009-jaguarandi/source/blender/editors/animation/keyframing.c
    branches/soc-2009-jaguarandi/source/blender/editors/armature/editarmature.c
    branches/soc-2009-jaguarandi/source/blender/editors/armature/poselib.c
    branches/soc-2009-jaguarandi/source/blender/editors/curve/curve_ops.c
    branches/soc-2009-jaguarandi/source/blender/editors/curve/editcurve.c
    branches/soc-2009-jaguarandi/source/blender/editors/datafiles/blenderbuttons.c
    branches/soc-2009-jaguarandi/source/blender/editors/include/BIF_glutil.h
    branches/soc-2009-jaguarandi/source/blender/editors/include/ED_fileselect.h
    branches/soc-2009-jaguarandi/source/blender/editors/include/ED_object.h
    branches/soc-2009-jaguarandi/source/blender/editors/include/ED_screen.h
    branches/soc-2009-jaguarandi/source/blender/editors/include/ED_screen_types.h
    branches/soc-2009-jaguarandi/source/blender/editors/include/ED_view3d.h
    branches/soc-2009-jaguarandi/source/blender/editors/include/UI_interface.h
    branches/soc-2009-jaguarandi/source/blender/editors/include/UI_resources.h
    branches/soc-2009-jaguarandi/source/blender/editors/include/UI_view2d.h
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface_anim.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface_api.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface_draw.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface_handlers.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface_icons.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface_intern.h
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface_layout.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface_panel.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface_regions.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface_style.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface_utils.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface_widgets.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/resources.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/view2d.c
    branches/soc-2009-jaguarandi/source/blender/editors/interface/view2d_ops.c
    branches/soc-2009-jaguarandi/source/blender/editors/mesh/editmesh_tools.c
    branches/soc-2009-jaguarandi/source/blender/editors/object/editconstraint.c
    branches/soc-2009-jaguarandi/source/blender/editors/object/object_edit.c
    branches/soc-2009-jaguarandi/source/blender/editors/object/object_intern.h
    branches/soc-2009-jaguarandi/source/blender/editors/object/object_modifier.c
    branches/soc-2009-jaguarandi/source/blender/editors/object/object_ops.c
    branches/soc-2009-jaguarandi/source/blender/editors/physics/editparticle.c
    branches/soc-2009-jaguarandi/source/blender/editors/preview/previewrender.c
    branches/soc-2009-jaguarandi/source/blender/editors/screen/area.c
    branches/soc-2009-jaguarandi/source/blender/editors/screen/glutil.c
    branches/soc-2009-jaguarandi/source/blender/editors/screen/screen_edit.c
    branches/soc-2009-jaguarandi/source/blender/editors/screen/screen_ops.c
    branches/soc-2009-jaguarandi/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2009-jaguarandi/source/blender/editors/sculpt_paint/sculpt.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_buttons/buttons_header.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_buttons/buttons_intern.h
    branches/soc-2009-jaguarandi/source/blender/editors/space_buttons/space_buttons.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_file/Makefile
    branches/soc-2009-jaguarandi/source/blender/editors/space_file/SConscript
    branches/soc-2009-jaguarandi/source/blender/editors/space_file/file_draw.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_file/file_header.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_file/file_intern.h
    branches/soc-2009-jaguarandi/source/blender/editors/space_file/file_ops.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_file/filelist.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_file/filelist.h
    branches/soc-2009-jaguarandi/source/blender/editors/space_file/filesel.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_graph/graph_buttons.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_graph/graph_draw.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_graph/graph_edit.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_graph/graph_intern.h
    branches/soc-2009-jaguarandi/source/blender/editors/space_graph/graph_select.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_graph/space_graph.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_image/SConscript
    branches/soc-2009-jaguarandi/source/blender/editors/space_image/image_draw.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_image/image_header.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_image/image_intern.h
    branches/soc-2009-jaguarandi/source/blender/editors/space_image/image_ops.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_image/space_image.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_info/info_header.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_info/space_info.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_node/drawnode.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_node/node_edit.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_node/node_header.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_outliner/outliner.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_outliner/space_outliner.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_sequencer/sequencer_header.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_text/space_text.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_text/text_draw.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_text/text_header.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_text/text_ops.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_time/space_time.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_time/time_header.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_view3d/drawarmature.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_view3d/space_view3d.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_view3d/view3d_buttons.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_view3d/view3d_header.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_view3d/view3d_intern.h
    branches/soc-2009-jaguarandi/source/blender/editors/space_view3d/view3d_snap.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_view3d/view3d_toolbar.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_view3d/view3d_view.c
    branches/soc-2009-jaguarandi/source/blender/editors/transform/transform.c
    branches/soc-2009-jaguarandi/source/blender/editors/transform/transform_ops.c
    branches/soc-2009-jaguarandi/source/blender/editors/uvedit/uvedit_unwrap_ops.c
    branches/soc-2009-jaguarandi/source/blender/imbuf/IMB_imbuf_types.h
    branches/soc-2009-jaguarandi/source/blender/imbuf/intern/allocimbuf.c
    branches/soc-2009-jaguarandi/source/blender/makesdna/DNA_action_types.h
    branches/soc-2009-jaguarandi/source/blender/makesdna/DNA_anim_types.h
    branches/soc-2009-jaguarandi/source/blender/makesdna/DNA_material_types.h
    branches/soc-2009-jaguarandi/source/blender/makesdna/DNA_screen_types.h
    branches/soc-2009-jaguarandi/source/blender/makesdna/DNA_space_types.h
    branches/soc-2009-jaguarandi/source/blender/makesdna/DNA_userdef_types.h
    branches/soc-2009-jaguarandi/source/blender/makesdna/DNA_view3d_types.h
    branches/soc-2009-jaguarandi/source/blender/makesrna/RNA_access.h
    branches/soc-2009-jaguarandi/source/blender/makesrna/RNA_define.h
    branches/soc-2009-jaguarandi/source/blender/makesrna/RNA_enum_types.h
    branches/soc-2009-jaguarandi/source/blender/makesrna/RNA_types.h
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/makesrna.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_ID.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_access.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_armature.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_brush.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_camera.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_constraint.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_context.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_controller.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_curve.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_define.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_internal.h
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_internal_types.h
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_lamp.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_material.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_mesh.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_modifier.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_nodetree.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_object.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_particle.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_pose.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_rna.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_scene.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_screen.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_sensor.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_sound.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_space.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_texture.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_ui.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_userdef.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_wm.c
    branches/soc-2009-jaguarandi/source/blender/makesrna/intern/rna_world.c
    branches/soc-2009-jaguarandi/source/blender/python/epy_doc_gen.py
    branches/soc-2009-jaguarandi/source/blender/python/intern/bpy_interface.c
    branches/soc-2009-jaguarandi/source/blender/python/intern/bpy_operator.c
    branches/soc-2009-jaguarandi/source/blender/python/intern/bpy_operator_wrap.c
    branches/soc-2009-jaguarandi/source/blender/python/intern/bpy_rna.c
    branches/soc-2009-jaguarandi/source/blender/python/intern/bpy_ui.c
    branches/soc-2009-jaguarandi/source/blender/python/intern/bpy_util.c
    branches/soc-2009-jaguarandi/source/blender/python/intern/bpy_util.h
    branches/soc-2009-jaguarandi/source/blender/render/intern/source/convertblender.c
    branches/soc-2009-jaguarandi/source/blender/render/intern/source/rendercore.c
    branches/soc-2009-jaguarandi/source/blender/windowmanager/WM_types.h
    branches/soc-2009-jaguarandi/source/blender/windowmanager/intern/wm_operators.c
    branches/soc-2009-jaguarandi/source/blender/windowmanager/intern/wm_window.c
    branches/soc-2009-jaguarandi/source/blender/windowmanager/wm_event_types.h
    branches/soc-2009-jaguarandi/source/darwin/blender.app/Contents/Resources/blender file icon.icns
    branches/soc-2009-jaguarandi/source/darwin/blender.app/Contents/Resources/blender icon.icns
    branches/soc-2009-jaguarandi/source/darwin/blendercreator.app/Contents/Resources/blender creator icon.icns
    branches/soc-2009-jaguarandi/source/darwin/blendercreator.app/Contents/Resources/blender file icon.icns
    branches/soc-2009-jaguarandi/source/darwin/blenderplayer.app/Contents/Resources/blender file icon.icns
    branches/soc-2009-jaguarandi/source/darwin/blenderplayer.app/Contents/Resources/blender player icon.icns
    branches/soc-2009-jaguarandi/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
    branches/soc-2009-jaguarandi/tools/Blender.py
    branches/soc-2009-jaguarandi/tools/btools.py

Added Paths:
-----------
    branches/soc-2009-jaguarandi/release/ui/buttons_data_armature.py
    branches/soc-2009-jaguarandi/release/ui/buttons_data_bone.py
    branches/soc-2009-jaguarandi/release/ui/buttons_data_curve.py
    branches/soc-2009-jaguarandi/release/ui/buttons_data_empty.py
    branches/soc-2009-jaguarandi/release/ui/buttons_data_mesh.py
    branches/soc-2009-jaguarandi/release/ui/buttons_data_text.py
    branches/soc-2009-jaguarandi/release/ui/buttons_object_constraint.py
    branches/soc-2009-jaguarandi/release/ui/buttons_physic_cloth.py
    branches/soc-2009-jaguarandi/release/ui/buttons_texture.py
    branches/soc-2009-jaguarandi/release/ui/space_outliner.py
    branches/soc-2009-jaguarandi/release/windows/extra/python26.zip
    branches/soc-2009-jaguarandi/source/blender/editors/interface/interface_templates.c
    branches/soc-2009-jaguarandi/source/blender/editors/space_image/image_buttons.c

Removed Paths:
-------------
    branches/soc-2009-jaguarandi/release/windows/extra/python26.zip
    branches/soc-2009-jaguarandi/source/blender/editors/space_image/image_panels.c

Modified: branches/soc-2009-jaguarandi/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- branches/soc-2009-jaguarandi/intern/ghost/intern/GHOST_SystemWin32.cpp	2009-05-29 00:20:41 UTC (rev 20486)
+++ branches/soc-2009-jaguarandi/intern/ghost/intern/GHOST_SystemWin32.cpp	2009-05-29 00:54:52 UTC (rev 20487)
@@ -39,6 +39,7 @@
 #endif
 
 #include "GHOST_SystemWin32.h"
+//#include <stdio.h> //for printf()
 
 // win64 doesn't define GWL_USERDATA
 #ifdef WIN32
@@ -536,7 +537,7 @@
 LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
 	GHOST_Event* event = 0;
-	LRESULT lResult;
+	LRESULT lResult = 0;
 	GHOST_SystemWin32* system = ((GHOST_SystemWin32*)getSystem());
 	GHOST_ASSERT(system, "GHOST_SystemWin32::s_wndProc(): system not initialized")
 
@@ -746,6 +747,9 @@
 					 * the message is sent asynchronously, so the window is activated immediately. 
 					 */
 					event = processWindowEvent(LOWORD(wParam) ? GHOST_kEventWindowActivate : GHOST_kEventWindowDeactivate, window);
+					/* WARNING: Let DefWindowProc handle WM_ACTIVATE, otherwise WM_MOUSEWHEEL
+					will not be dispatched to OUR active window if we minimize one of OUR windows. */
+					lResult = ::DefWindowProc(hwnd, msg, wParam, lParam);
 					break;
 				case WM_PAINT:
 					/* An application sends the WM_PAINT message when the system or another application 
@@ -905,7 +909,6 @@
 
 	if (event) {
 		system->pushEvent(event);
-		lResult = 0;
 	}
 	else {
 		lResult = ::DefWindowProc(hwnd, msg, wParam, lParam);

Modified: branches/soc-2009-jaguarandi/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- branches/soc-2009-jaguarandi/intern/ghost/intern/GHOST_SystemX11.cpp	2009-05-29 00:20:41 UTC (rev 20486)
+++ branches/soc-2009-jaguarandi/intern/ghost/intern/GHOST_SystemX11.cpp	2009-05-29 00:54:52 UTC (rev 20487)
@@ -117,8 +117,16 @@
 	m_net_fullscreen= XInternAtom(m_display,
 					"_NET_WM_STATE_FULLSCREEN", False);
 	m_motif= XInternAtom(m_display, "_MOTIF_WM_HINTS", False);
+	m_targets= XInternAtom(m_display, "TARGETS", False);
+	m_string= XInternAtom(m_display, "STRING", False);
+	m_compound_text= XInternAtom(m_display, "COMPOUND_TEXT", False);
+	m_text= XInternAtom(m_display, "TEXT", False);
+	m_clipboard= XInternAtom(m_display, "CLIPBOARD", False);
+	m_primary= XInternAtom(m_display, "PRIMARY", False);
+	m_xclip_out= XInternAtom(m_display, "XCLIP_OUT", False);
+	m_incr= XInternAtom(m_display, "INCR", False);
+	m_utf8_string= XInternAtom(m_display, "UTF8_STRING", False);
 
-
 	// compute the initial time
 	timeval tv;
 	if (gettimeofday(&tv,NULL) == -1) {
@@ -1004,144 +1012,298 @@
 
 #undef GXMAP
 
-	GHOST_TUns8*
-GHOST_SystemX11::
-getClipboard(bool selection
-) const {
-	//Flag 
-	//0 = Regular clipboard 1 = selection
-	static Atom Primary_atom, clip_String, compound_text, a_text, a_string;
-	Atom rtype;
-	Window m_window, owner;
-	unsigned char *data, *tmp_data;
-	int bits, count;
-	unsigned long len, bytes;
-	XEvent xevent;
-	
+/* from xclip.c xcout() v0.11 */
+
+#define XCLIB_XCOUT_NONE		0 /* no context */
+#define XCLIB_XCOUT_SENTCONVSEL		1 /* sent a request */
+#define XCLIB_XCOUT_INCR		2 /* in an incr loop */
+#define XCLIB_XCOUT_FALLBACK		3 /* STRING failed, need fallback to UTF8 */
+#define XCLIB_XCOUT_FALLBACK_UTF8	4 /* UTF8 failed, move to compouned */
+#define XCLIB_XCOUT_FALLBACK_COMP	5 /* compouned failed, move to text. */
+#define XCLIB_XCOUT_FALLBACK_TEXT	6
+
+// Retrieves the contents of a selections.
+void GHOST_SystemX11::getClipboard_xcout(XEvent evt,
+	Atom sel, Atom target, unsigned char **txt,
+	unsigned long *len, unsigned int *context) const
+{
+	Atom pty_type;
+	int pty_format;
+	unsigned char *buffer;
+	unsigned long pty_size, pty_items;
+	unsigned char *ltxt= *txt;
+
 	vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();
 	vector<GHOST_IWindow *>::iterator win_it = win_vec.begin();
 	GHOST_WindowX11 * window = static_cast<GHOST_WindowX11 *>(*win_it);
-	m_window = window->getXWindow();
+	Window win = window->getXWindow();
 
-	clip_String = XInternAtom(m_display, "_BLENDER_STRING", False);
-	compound_text = XInternAtom(m_display, "COMPOUND_TEXT", False);
-	a_text= XInternAtom(m_display, "TEXT", False);
-	a_string= XInternAtom(m_display, "STRING", False);
+	switch (*context) {
+		// There is no context, do an XConvertSelection()
+		case XCLIB_XCOUT_NONE:
+			// Initialise return length to 0
+			if (*len > 0) {
+				free(*txt);
+				*len = 0;
+			}
 
-	//lets check the owner and if it is us then return the static buffer
-	if(!selection) {
-		Primary_atom = XInternAtom(m_display, "CLIPBOARD", False);
-		owner = XGetSelectionOwner(m_display, Primary_atom);
-		if (owner == m_window) {
-			data = (unsigned char*) malloc(strlen(txt_cut_buffer)+1);
-			strcpy((char*)data, txt_cut_buffer);
-			return (GHOST_TUns8*)data;
-		} else if (owner == None) {
-			return NULL;
+			// Send a selection request
+			XConvertSelection(m_display, sel, target, m_xclip_out, win, CurrentTime);
+			*context = XCLIB_XCOUT_SENTCONVSEL;
+			return;
+
+		case XCLIB_XCOUT_SENTCONVSEL:
+			if (evt.type != SelectionNotify)
+				return;
+
+			if (target == m_utf8_string && evt.xselection.property == None) {
+				*context= XCLIB_XCOUT_FALLBACK_UTF8;
+				return;
+			}
+			else if (target == m_compound_text && evt.xselection.property == None) {
+				*context= XCLIB_XCOUT_FALLBACK_COMP;
+				return;
+			}
+			else if (target == m_text && evt.xselection.property == None) {
+				*context= XCLIB_XCOUT_FALLBACK_TEXT;
+				return;
+			}
+
+			// find the size and format of the data in property
+			XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False,
+				AnyPropertyType, &pty_type, &pty_format,
+				&pty_items, &pty_size, &buffer);
+			XFree(buffer);
+
+			if (pty_type == m_incr) {
+				// start INCR mechanism by deleting property
+				XDeleteProperty(m_display, win, m_xclip_out);
+				XFlush(m_display);
+				*context = XCLIB_XCOUT_INCR;
+				return;
+			}
+
+			// if it's not incr, and not format == 8, then there's
+			// nothing in the selection (that xclip understands, anyway)
+
+			if (pty_format != 8) {
+				*context = XCLIB_XCOUT_NONE;
+				return;
+			}
+
+			// not using INCR mechanism, just read the property
+			XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size,
+					False, AnyPropertyType, &pty_type,
+					&pty_format, &pty_items, &pty_size, &buffer);
+
+			// finished with property, delete it
+			XDeleteProperty(m_display, win, m_xclip_out);
+
+			// copy the buffer to the pointer for returned data
+			ltxt = (unsigned char *) malloc(pty_items);
+			memcpy(ltxt, buffer, pty_items);
+
+			// set the length of the returned data
+			*len = pty_items;
+			*txt = ltxt;
+
+			// free the buffer
+			XFree(buffer);
+
+			*context = XCLIB_XCOUT_NONE;
+
+			// complete contents of selection fetched, return 1
+			return;
+
+		case XCLIB_XCOUT_INCR:
+			// To use the INCR method, we basically delete the
+			// property with the selection in it, wait for an
+			// event indicating that the property has been created,
+			// then read it, delete it, etc.
+
+			// make sure that the event is relevant
+			if (evt.type != PropertyNotify)
+				return;
+
+			// skip unless the property has a new value
+			if (evt.xproperty.state != PropertyNewValue)
+				return;
+
+			// check size and format of the property
+			XGetWindowProperty(m_display, win, m_xclip_out, 0, 0, False,
+				AnyPropertyType, &pty_type, &pty_format,
+				&pty_items, &pty_size, (unsigned char **) &buffer);
+
+			if (pty_format != 8) {
+				// property does not contain text, delete it
+				// to tell the other X client that we have read	
+				// it and to send the next property
+				XFree(buffer);
+				XDeleteProperty(m_display, win, m_xclip_out);
+				return;
+			}
+
+			if (pty_size == 0) {
+				// no more data, exit from loop
+				XFree(buffer);
+				XDeleteProperty(m_display, win, m_xclip_out);
+				*context = XCLIB_XCOUT_NONE;
+
+				// this means that an INCR transfer is now
+				// complete, return 1
+				return;
+			}
+
+			XFree(buffer);
+
+			// if we have come this far, the propery contains
+			// text, we know the size.
+			XGetWindowProperty(m_display, win, m_xclip_out, 0, (long) pty_size,
+				False, AnyPropertyType, &pty_type, &pty_format,
+				&pty_items, &pty_size, (unsigned char **) &buffer);
+
+			// allocate memory to accommodate data in *txt
+			if (*len == 0) {
+				*len = pty_items;
+				ltxt = (unsigned char *) malloc(*len);
+			}
+			else {
+				*len += pty_items;
+				ltxt = (unsigned char *) realloc(ltxt, *len);
+			}
+
+			// add data to ltxt
+			memcpy(&ltxt[*len - pty_items], buffer, pty_items);
+
+			*txt = ltxt;
+			XFree(buffer);
+
+			// delete property to get the next item
+			XDeleteProperty(m_display, win, m_xclip_out);
+			XFlush(m_display);
+			return;
+	}
+	return;
+}
+
+GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const
+{
+	Atom sseln;
+	Atom target= m_string;
+	Window owner;
+
+	// from xclip.c doOut() v0.11
+	unsigned char *sel_buf;
+	unsigned long sel_len= 0;
+	XEvent evt;
+	unsigned int context= XCLIB_XCOUT_NONE;
+
+	if (selection == True)
+		sseln= m_primary;
+	else
+		sseln= m_clipboard;
+
+	vector<GHOST_IWindow *> & win_vec = m_windowManager->getWindows();
+	vector<GHOST_IWindow *>::iterator win_it = win_vec.begin();
+	GHOST_WindowX11 * window = static_cast<GHOST_WindowX11 *>(*win_it);
+	Window win = window->getXWindow();
+
+	/* check if we are the owner. */
+	owner= XGetSelectionOwner(m_display, sseln);
+	if (owner == win) {
+		if (sseln == m_clipboard) {
+			sel_buf= (unsigned char *)malloc(strlen(txt_cut_buffer)+1);
+			strcpy((char *)sel_buf, txt_cut_buffer);
+			return((GHOST_TUns8*)sel_buf);
 		}
-	} else {
-		Primary_atom = XInternAtom(m_display, "PRIMARY", False);
-		owner = XGetSelectionOwner(m_display, Primary_atom);
-		if (owner == m_window) {
-			data = (unsigned char*) malloc(strlen(txt_select_buffer)+1);
-			strcpy((char*)data, txt_select_buffer);
-			return (GHOST_TUns8*)data;
-		} else if (owner == None) {
-			return NULL;
+		else {
+			sel_buf= (unsigned char *)malloc(strlen(txt_select_buffer)+1);
+			strcpy((char *)sel_buf, txt_select_buffer);
+			return((GHOST_TUns8*)sel_buf);
 		}
 	}
+	else if (owner == None)
+		return(NULL);
 
-	if(!Primary_atom) {
-		return NULL;
-	}
-	
-	XDeleteProperty(m_display, m_window, Primary_atom);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list