[med-svn] [Git][med-team/praat][master] 6 commits: New upstream version 6.1.30

Rafael Laboissiere gitlab at salsa.debian.org
Tue Nov 10 10:52:26 GMT 2020



Rafael Laboissiere pushed to branch master at Debian Med / praat


Commits:
c8ddfe9c by Rafael Laboissière at 2020-11-07T18:05:29-03:00
New upstream version 6.1.30
- - - - -
44e9be9b by Rafael Laboissière at 2020-11-07T18:08:07-03:00
Merge tag 'upstream/6.1.30'

Upstream version 6.1.30

- - - - -
1513d187 by Rafael Laboissière at 2020-11-07T18:15:47-03:00
d/What_s_new_.html: Update upstream changelog

Gbp-Dch: Ignore

- - - - -
c60d9e6a by Rafael Laboissière at 2020-11-08T08:44:48-03:00
d/rules: Explicitly link against libX11 when building sendpraat

It is strange that this inclusion is needed now and was not needed for
previous versions of the package.  Anyway, without usign -lX11, the
sendpraat program can not be built now, since many symbols are not
found, like XInternAtom, XSendEvent, XOpenDisplay, etc.

- - - - -
507609a0 by Rafael Laboissière at 2020-11-09T16:49:52-03:00
d/p/fix-compilation-errors-praat-cpp.patch: New patch

- - - - -
43ed9131 by Rafael Laboissière at 2020-11-10T07:51:53-03:00
Changelog entry for version 6.1.30-1

Gbp-Dch: Ignore

- - - - -


24 changed files:

- debian/What_s_new_.html
- debian/changelog
- + debian/patches/fix-compilation-errors-praat-cpp.patch
- debian/patches/series
- debian/rules
- fon/FunctionEditor.cpp
- fon/MovieWindow.cpp
- fon/RealTierArea.cpp
- fon/SpectrumEditor.cpp
- fon/TextGridEditor.cpp
- fon/manual_tutorials.cpp
- makefiles/makefile.defs.linux.pulse
- melder/melder_audio.cpp
- sys/GraphicsScreen.cpp
- sys/GuiDialog.cpp
- sys/GuiDrawingArea.cpp
- sys/GuiShell.cpp
- sys/GuiWindow.cpp
- sys/Picture.cpp
- sys/motifEmulator.cpp
- sys/praat.cpp
- sys/praat_actions.cpp
- sys/praat_version.h
- sys/sendpraat.c


Changes:

=====================================
debian/What_s_new_.html
=====================================
@@ -7,6 +7,12 @@ What's new?
 <p>
 Latest changes in Praat.</p>
 <p>
+<b>6.1.30</b> (3 November 2020)</p>
+<ul>
+<li>
+ Windows: prevented a crash that could occur in the Sound window when clicking with the touchpad while dragging with the mouse (or the reverse).
+</ul>
+<p>
 <b>6.1.29</b> (27 October 2020)</p>
 <ul>
 <li>
@@ -760,7 +766,7 @@ What used to be new?</h3>
 </ul>
 <hr>
 <address>
-	<p>© ppgb, October 27, 2020</p>
+	<p>© ppgb, November 3, 2020</p>
 </address>
 </body>
 </html>


=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+praat (6.1.30-1) unstable; urgency=medium
+
+  * New upstream version 6.1.30
+  * d/rules: Explicitly link against libX11 when building sendpraat
+  * d/p/fix-compilation-errors-praat-cpp.patch: New patch
+
+ -- Rafael Laboissière <rafael at debian.org>  Mon, 09 Nov 2020 17:01:31 -0300
+
 praat (6.1.29-1) unstable; urgency=medium
 
   * New upstream version 6.1.29


=====================================
debian/patches/fix-compilation-errors-praat-cpp.patch
=====================================
@@ -0,0 +1,73 @@
+Description: Fix compilation errors in sys/praat.cpp
+Author: Paul Boersma <paul.boersma at uva.nl>
+Origin: upstream, https://github.com/praat/praat/commit/5db421ed4ee3fce909648cf790557a14b69a5b93
+Reviewed-By: Rafael Laboissière <rafael at debian.org>
+Last-Update: 2020-11-09
+
+--- praat-6.1.30.orig/sys/praat.cpp
++++ praat-6.1.30/sys/praat.cpp
+@@ -850,7 +850,7 @@ void praat_dontUsePictureWindow () { pra
+ 
+ /********** INITIALIZATION OF THE PRAAT SHELL **********/
+ 
+-#if defined (UNIX)
++#if defined (UNIX) && ! defined (NO_GRAPHICS) && ! defined (NO_GUI)
+ 	/*
+ 		sendpraat messages can enter in two ways: via SIGUSR1 and via XSendEvent().
+ 	*/
+@@ -860,27 +860,25 @@ void praat_dontUsePictureWindow () { pra
+ 	*/
+ 	static void cb_sigusr1 (int signum) {
+ 		Melder_assert (signum == SIGUSR1);
+-		#if ! defined (NO_GRAPHICS)
+-			#if ALLOW_GDK_DRAWING
+-				GdkEventClient gevent;
+-				gevent. type = GDK_CLIENT_EVENT;
+-				gevent. window = GTK_WIDGET (theCurrentPraatApplication -> topShell -> d_gtkWindow) -> window;
+-				gevent. send_event = 1;
+-				gevent. message_type = gdk_atom_intern_static_string ("SENDPRAAT");
+-				gevent. data_format = 8;
+-				// Melder_casual (U"event put");
+-				gdk_event_put ((GdkEvent *) & gevent);
+-			#else
+-				GdkEventProperty gevent;   // or GdkEventSetting, once we can find its signal name
+-				gevent. type = GDK_PROPERTY_NOTIFY;   // or GDK_SETTING
+-				gevent. window = gtk_widget_get_window (GTK_WIDGET (theCurrentPraatApplication -> topShell -> d_gtkWindow));
+-				gevent. send_event = 1;
+-				gevent. atom = gdk_atom_intern_static_string ("SENDPRAAT");
+-				gevent. time = 0;
+-				gevent. state = GDK_PROPERTY_NEW_VALUE;
+-				// Melder_casual (U"event put");
+-				gdk_event_put ((GdkEvent *) & gevent);
+-			#endif
++		#if ALLOW_GDK_DRAWING
++			GdkEventClient gevent;
++			gevent. type = GDK_CLIENT_EVENT;
++			gevent. window = GTK_WIDGET (theCurrentPraatApplication -> topShell -> d_gtkWindow) -> window;
++			gevent. send_event = 1;
++			gevent. message_type = gdk_atom_intern_static_string ("SENDPRAAT");
++			gevent. data_format = 8;
++			// Melder_casual (U"event put");
++			gdk_event_put ((GdkEvent *) & gevent);
++		#else
++			GdkEventProperty gevent;   // or GdkEventSetting, once we can find its signal name
++			gevent. type = GDK_PROPERTY_NOTIFY;   // or GDK_SETTING
++			gevent. window = gtk_widget_get_window (GTK_WIDGET (theCurrentPraatApplication -> topShell -> d_gtkWindow));
++			gevent. send_event = 1;
++			gevent. atom = gdk_atom_intern_static_string ("SENDPRAAT");
++			gevent. time = 0;
++			gevent. state = GDK_PROPERTY_NEW_VALUE;
++			// Melder_casual (U"event put");
++			gdk_event_put ((GdkEvent *) & gevent);   // this is safe only if gdk_event_put is reentrant, which is unlikely because the event queue is global
+ 		#endif
+ 	}
+ 	#if 0
+@@ -931,7 +929,7 @@ void praat_dontUsePictureWindow () { pra
+ #endif
+ 
+ #if defined (UNIX)
+-	#if ! defined (NO_GRAPHICS)
++	#if ! defined (NO_GRAPHICS) && ! defined (NO_GUI)
+ 		#if ALLOW_GDK_DRAWING
+ 			static gboolean cb_userMessage (GtkWidget /* widget */, GdkEventClient * /* event */, gpointer /* userData */) {
+ 				//Melder_casual (U"client event called");


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,3 @@
 use-ldflags.patch
 cross-build.patch
+fix-compilation-errors-praat-cpp.patch


=====================================
debian/rules
=====================================
@@ -64,7 +64,7 @@ sendpraat: sys/sendpraat.c
 		$(shell dpkg-buildflags --get CFLAGS)		\
 		$(shell dpkg-buildflags --get LDFLAGS)		\
 		-std=gnu99 -DSTAND_ALONE -DUNIX			\
-		-o sendpraat sys/sendpraat.c			\
+		-o sendpraat sys/sendpraat.c -lX11		\
 		$(shell $(PKG_CONFIG) --cflags --libs gtk+-2.0)
 
 override_dh_auto_build: sendpraat praat.1 praat_nogui.1 sendpraat.1 praat-open-files.1


=====================================
fon/FunctionEditor.cpp
=====================================
@@ -1061,10 +1061,13 @@ bool structFunctionEditor :: v_mouseInWideDataView (GuiDrawingArea_MouseEvent ev
 	Melder_assert (our startSelection <= our endSelection);
 	Melder_clip (our startWindow, & mouseTime, our endWindow);   // WYSIWYG
 	static double anchorTime = undefined;
-	static bool hasBeenDraggedBeyondVicinityRadiusAtLeastOnce = false;
 	if (event -> isClick()) {
-		Melder_assert (isundef (anchorTime));   // sanity check for the fixed order click-drag-drop
-		Melder_assert (! hasBeenDraggedBeyondVicinityRadiusAtLeastOnce);   // sanity check for the fixed order click-drag-drop
+		/*
+			Ignore any click that occurs during a drag,
+			such as might occur when the user has both a mouse and a trackpad.
+		*/
+		if (isdefined (anchorTime))
+			return false;
 		const double selectedMiddleTime = 0.5 * (our startSelection + our endSelection);
 		const bool theyWantToExtendTheCurrentSelectionAtTheLeft =
 				(event -> shiftKeyPressed && mouseTime < selectedMiddleTime) || event -> isLeftBottomFunctionKeyPressed();
@@ -1084,21 +1087,25 @@ bool structFunctionEditor :: v_mouseInWideDataView (GuiDrawingArea_MouseEvent ev
 		Melder_sort (& our startSelection, & our endSelection);
 		Melder_assert (isdefined (anchorTime));
 	} else if (event -> isDrag() || event -> isDrop()) {
-		if (isdefined (anchorTime)) {   // `false` if a descendant preempted the above click handling
-			if (! hasBeenDraggedBeyondVicinityRadiusAtLeastOnce) {
-				const double distanceToAnchor_mm = fabs (Graphics_dxWCtoMM (our graphics.get(), mouseTime - anchorTime));
-				constexpr double vicinityRadius_mm = 1.0;
-				if (distanceToAnchor_mm > vicinityRadius_mm)
-					hasBeenDraggedBeyondVicinityRadiusAtLeastOnce = true;
-			}
-			if (hasBeenDraggedBeyondVicinityRadiusAtLeastOnce) {
-				our startSelection = std::min (anchorTime, mouseTime);
-				our endSelection = std::max (anchorTime, mouseTime);
-			}
-			if (event -> isDrop()) {
-				anchorTime = undefined;
-				hasBeenDraggedBeyondVicinityRadiusAtLeastOnce = false;
-			}
+		/*
+			Ignore any drag or drop that happens after a descendant preempted the above click handling.
+		*/
+		if (isundef (anchorTime))
+			return false;
+		static bool hasBeenDraggedBeyondVicinityRadiusAtLeastOnce = false;
+		if (! hasBeenDraggedBeyondVicinityRadiusAtLeastOnce) {
+			const double distanceToAnchor_mm = fabs (Graphics_dxWCtoMM (our graphics.get(), mouseTime - anchorTime));
+			constexpr double vicinityRadius_mm = 1.0;
+			if (distanceToAnchor_mm > vicinityRadius_mm)
+				hasBeenDraggedBeyondVicinityRadiusAtLeastOnce = true;
+		}
+		if (hasBeenDraggedBeyondVicinityRadiusAtLeastOnce) {
+			our startSelection = std::min (anchorTime, mouseTime);
+			our endSelection = std::max (anchorTime, mouseTime);
+		}
+		if (event -> isDrop()) {
+			anchorTime = undefined;
+			hasBeenDraggedBeyondVicinityRadiusAtLeastOnce = false;
 		}
 	}
 	return true;


=====================================
fon/MovieWindow.cpp
=====================================
@@ -57,7 +57,7 @@ void structMovieWindow :: v_draw () {
 		Graphics_setWindow (our graphics.get(), 0.0, 1.0, 0.0, 1.0);
 		Graphics_fillRectangle (our graphics.get(), 0.0, 1.0, 0.0, 1.0);
 		TimeSoundEditor_drawSound (this, -1.0, 1.0);
-		Graphics_flushWs (our graphics.get());
+		//Graphics_flushWs (our graphics.get());
 		Graphics_resetViewport (our graphics.get(), viewport);
 	}
 	if (true) {
@@ -78,20 +78,20 @@ void structMovieWindow :: v_draw () {
 			if (timeRight > our endWindow) timeRight = our endWindow;
 			Movie_paintOneImageInside (movie, our graphics.get(), iframe, timeLeft, timeRight, 0.0, 1.0);
 		}
-		Graphics_flushWs (our graphics.get());
+		//Graphics_flushWs (our graphics.get());
 		Graphics_resetViewport (our graphics.get(), viewport);
 	}
 	if (showAnalysis) {
 		Graphics_Viewport viewport = Graphics_insetViewport (our graphics.get(), 0.0, 1.0, 0.3, soundY);
 		our v_draw_analysis ();
-		Graphics_flushWs (our graphics.get());
+		//Graphics_flushWs (our graphics.get());
 		Graphics_resetViewport (our graphics.get(), viewport);
 		/* Draw pulses. */
 		if (our p_pulses_show) {
 			viewport = Graphics_insetViewport (our graphics.get(), 0.0, 1.0, soundY, 1.0);
 			our v_draw_analysis_pulses ();
 			TimeSoundEditor_drawSound (this, -1.0, 1.0);   // second time, partially across the pulses
-			Graphics_flushWs (our graphics.get());
+			//Graphics_flushWs (our graphics.get());
 			Graphics_resetViewport (our graphics.get(), viewport);
 		}
 	}


=====================================
fon/RealTierArea.cpp
=====================================
@@ -175,7 +175,8 @@ bool RealTierArea_mouse (RealTierArea me, RealTier tier, GuiDrawingArea_MouseEve
 	const double y_world = (1.0 - y_fraction_withinRealTierArea) * my ymin + y_fraction_withinRealTierArea * my ymax;
 	my viewRealTierAsWorldByWorld ();
 	if (event -> isClick()) {
-		Melder_assert (isundef (my anchorTime));
+		if (isdefined (my anchorTime))
+			return false;
 		RealPoint clickedPoint = nullptr;
 		integer inearestPoint = AnyTier_timeToNearestIndexInTimeWindow (tier->asAnyTier(), x_world, my startWindow(), my endWindow());
 		if (inearestPoint != 0) {
@@ -187,7 +188,7 @@ bool RealTierArea_mouse (RealTierArea me, RealTier tier, GuiDrawingArea_MouseEve
 			anchorIsInFreePart = true;
 			my ycursor = y_world;
 			my editor -> viewDataAsWorldByFraction ();
-			return my editor -> structFunctionEditor :: v_mouseInWideDataView (event, x_world, y_fraction);
+			return my editor -> structFunctionEditor :: v_mouseInWideDataView (event, x_world, y_fraction) || true;
 		}
 		anchorIsNearPoint = true;
 		my draggingSelection = event -> shiftKeyPressed &&
@@ -208,7 +209,7 @@ bool RealTierArea_mouse (RealTierArea me, RealTier tier, GuiDrawingArea_MouseEve
 		if (anchorIsInFreePart) {
 			my ycursor = y_world;
 			my editor -> viewDataAsWorldByFraction ();
-			return my editor -> structFunctionEditor :: v_mouseInWideDataView (event, x_world, y_fraction);
+			return my editor -> structFunctionEditor :: v_mouseInWideDataView (event, x_world, y_fraction) || true;
 		}
 		Melder_assert (anchorIsNearPoint);
 		my dt = x_world - my anchorTime;


=====================================
fon/SpectrumEditor.cpp
=====================================
@@ -70,8 +70,7 @@ void structSpectrumEditor :: v_draw () {
 
 bool structSpectrumEditor :: v_mouseInWideDataView (GuiDrawingArea_MouseEvent event, double x_world, double y_fraction) {
 	our cursorHeight = our minimum + y_fraction * (our maximum - our minimum);
-	(void) our SpectrumEditor_Parent :: v_mouseInWideDataView (event, x_world, y_fraction);
-	return FunctionEditor_UPDATE_NEEDED;
+	return our SpectrumEditor_Parent :: v_mouseInWideDataView (event, x_world, y_fraction) || true;
 }
 
 static autoSpectrum Spectrum_band (Spectrum me, double fmin, double fmax) {


=====================================
fon/TextGridEditor.cpp
=====================================
@@ -1725,9 +1725,10 @@ bool structTextGridEditor :: v_mouseInWideDataView (GuiDrawingArea_MouseEvent ev
 			Melder_sort (& our startSelection, & our endSelection);
 			return FunctionEditor_UPDATE_NEEDED;
 		}
-		Melder_assert (isundef (anchorTime));   // sanity check for the fixed order click-drag-drop
+		if (isdefined (anchorTime))   // sanity check for the fixed order click-drag-drop
+			return false;
 		Melder_assert (clickedLeftBoundary == 0);
-		Melder_assert (! hasBeenDraggedBeyondVicinityRadiusAtLeastOnce);   // sanity check for the fixed order click-drag-drop
+		Melder_assert (! hasBeenDraggedBeyondVicinityRadiusAtLeastOnce);
 		our draggingTiers.reset();
 		/*
 			The user clicked in the grid part.


=====================================
fon/manual_tutorials.cpp
=====================================
@@ -22,8 +22,10 @@
 void manual_tutorials_init (ManPages me);
 void manual_tutorials_init (ManPages me) {
 
-MAN_BEGIN (U"What's new?", U"ppgb", 20201027)
+MAN_BEGIN (U"What's new?", U"ppgb", 20201103)
 INTRO (U"Latest changes in Praat.")
+NORMAL (U"##6.1.30# (3 November 2020)")
+LIST_ITEM (U"• Windows: prevented a crash that could occur in the Sound window when clicking with the touchpad while dragging with the mouse (or the reverse).")
 NORMAL (U"##6.1.29# (27 October 2020)")
 LIST_ITEM (U"• Mac: corrected a bug revealed by Xcode 12 since 6.1.22 that could cause Praat to crash when using empty vectors, "
 	"such as when querying a Harmonicity for its mean in regions without frames.")


=====================================
makefiles/makefile.defs.linux.pulse
=====================================
@@ -1,7 +1,7 @@
 # File: makefile.defs.linux.pulse
 
 # System: Linux
-# David Weenink and Paul Boersma 2020-09-17
+# David Weenink and Paul Boersma 2020-11-01
 
 CC = gcc
 


=====================================
melder/melder_audio.cpp
=====================================
@@ -663,7 +663,7 @@ void pulseAudio_server_info_cb (pa_context *context, const pa_server_info *info,
 }
 
 void pulseAudio_serverReport () {
-	// TODO: initiaize context
+	// TODO: initialize context
 	struct MelderPlay *me = & thePlay;
 	if (my pulseAudio.mainloop) {
 		pa_threaded_mainloop_lock (my pulseAudio.mainloop);


=====================================
sys/GraphicsScreen.cpp
=====================================
@@ -347,6 +347,7 @@ void structGraphicsScreen :: v_updateWs () {
 			// ignore gdk_cairo_reset_clip
 		} else {
 			if (our d_cairoGraphicsContext && our d_drawingArea) {  // update clipping rectangle to new graphics size
+				Melder_casual (U"It is a mistake to ever arrive here.");
 				cairo_reset_clip (our d_cairoGraphicsContext);
 				cairo_rectangle (our d_cairoGraphicsContext, rect.x, rect.y, rect.width, rect.height);
 				cairo_clip (our d_cairoGraphicsContext);


=====================================
sys/GuiDialog.cpp
=====================================
@@ -71,6 +71,7 @@ GuiDialog GuiDialog_create (GuiWindow parent, int x, int y, int width, int heigh
 			goAwayCallback ? G_CALLBACK (_GuiGtkDialog_goAwayCallback) : G_CALLBACK (gtk_widget_hide_on_delete), me.get());
 		gtk_window_set_default_size (GTK_WINDOW (my d_gtkWindow), width, height);
 		gtk_window_set_modal (GTK_WINDOW (my d_gtkWindow), flags & GuiDialog_MODAL);
+		gtk_window_set_resizable (GTK_WINDOW (my d_gtkWindow), false);
 		GuiShell_setTitle (me.get(), title);
 		//GuiObject vbox = GTK_DIALOG (my d_gtkWindow) -> vbox;
 		GuiObject vbox = gtk_dialog_get_content_area (GTK_DIALOG (my d_gtkWindow));


=====================================
sys/GuiDrawingArea.cpp
=====================================
@@ -229,6 +229,7 @@ Thing_implement (GuiDrawingArea, GuiControl, 0);
 			event. x = x;
 			event. y = y;
 			event. phase = phase;
+			Melder_casual (U": phase ", (int) phase);
 			event. shiftKeyPressed = GetKeyState (VK_SHIFT) < 0;
 			event. optionKeyPressed = GetKeyState (VK_MENU) < 0;
 			event. commandKeyPressed = GetKeyState (VK_CONTROL) < 0;


=====================================
sys/GuiShell.cpp
=====================================
@@ -76,7 +76,7 @@ int GuiShell_getShellWidth (GuiShell me) {
 	int width = 0;
 	#if gtk
 		GtkAllocation allocation;
-		gtk_widget_get_allocation (GTK_WIDGET (my d_gtkWindow), & allocation);
+		gtk_widget_get_allocation (GTK_WIDGET (my d_gtkWindow), & allocation);   // TODO: replace with gtk_window_get_size()
 		width = allocation.width;
 	#elif motif
 		width = my d_xmShell -> width;
@@ -90,7 +90,7 @@ int GuiShell_getShellHeight (GuiShell me) {
 	int height = 0;
 	#if gtk
 		GtkAllocation allocation;
-		gtk_widget_get_allocation (GTK_WIDGET (my d_gtkWindow), & allocation);
+		gtk_widget_get_allocation (GTK_WIDGET (my d_gtkWindow), & allocation);   // TODO: replace with gtk_window_get_size()
 		height = allocation.height;
 	#elif motif
 		height = my d_xmShell -> height;


=====================================
sys/GuiWindow.cpp
=====================================
@@ -1,6 +1,6 @@
 /* GuiWindow.cpp
  *
- * Copyright (C) 1993-2012,2013,2014,2015,2016,2017 Paul Boersma, 2013 Tom Naughton
+ * Copyright (C) 1993-2018,2020 Paul Boersma, 2013 Tom Naughton
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by


=====================================
sys/Picture.cpp
=====================================
@@ -108,8 +108,21 @@ static void gui_drawingarea_cb_expose (Picture me, GuiDrawingArea_ExposeEvent ev
 			if (Melder_debug == 54) {
 				// ignore gdk_cairo_reset_clip
 			} else {
-				gdk_cairo_reset_clip ((cairo_t *) Graphics_x_getCR (my graphics.get()), GDK_DRAWABLE (GTK_WIDGET (event -> widget -> d_widget) -> window));
-				gdk_cairo_reset_clip ((cairo_t *) Graphics_x_getCR (my selectionGraphics.get()), GDK_DRAWABLE (GTK_WIDGET (event -> widget -> d_widget) -> window));
+				//gdk_cairo_reset_clip ((cairo_t *) Graphics_x_getCR (my graphics.get()), GDK_DRAWABLE (GTK_WIDGET (event -> widget -> d_widget) -> window));
+				//gdk_cairo_reset_clip ((cairo_t *) Graphics_x_getCR (my selectionGraphics.get()), GDK_DRAWABLE (GTK_WIDGET (event -> widget -> d_widget) -> window));
+			}
+		#else
+			cairo_t *context = (cairo_t *) Graphics_x_getCR (my graphics.get());
+			if (Melder_debug == 54 ||1) {
+				// ignore gdk_cairo_reset_clip
+			} else {
+				cairo_reset_clip (context);
+				cairo_matrix_t matrix;
+				cairo_get_matrix (context, & matrix);
+				cairo_identity_matrix (context);
+				cairo_rectangle (context, 0, 0, 2000, 2000);
+				cairo_clip (context);
+				cairo_set_matrix (context, & matrix);
 			}
 		#endif
 	#else


=====================================
sys/motifEmulator.cpp
=====================================
@@ -2678,6 +2678,7 @@ static LRESULT CALLBACK windowProc (HWND window, UINT message, WPARAM wParam, LP
 		HANDLE_MSG (window, WM_COMMAND, on_command);
 		HANDLE_MSG (window, WM_DESTROY, on_destroy);
 		HANDLE_MSG (window, WM_LBUTTONDOWN, on_lbuttonDown);
+		HANDLE_MSG (window, WM_LBUTTONDBLCLK, on_lbuttonDown);   // double-click counts as two clicks
 		HANDLE_MSG (window, WM_LBUTTONUP, on_lbuttonUp);
 		HANDLE_MSG (window, WM_MOUSEMOVE, on_mouseMove);
 		HANDLE_MSG (window, WM_PAINT, on_paint);


=====================================
sys/praat.cpp
=====================================
@@ -46,6 +46,7 @@
 
 #if gtk
 	#include <gdk/gdkx.h>
+	#include <X11/Xlib.h>
 #endif
 
 Thing_implement (Praat_Command, Thing, 0);
@@ -850,13 +851,17 @@ void praat_dontUsePictureWindow () { praatP.dontUsePictureWindow = true; }
 /********** INITIALIZATION OF THE PRAAT SHELL **********/
 
 #if defined (UNIX)
+	/*
+		sendpraat messages can enter in two ways: via SIGUSR1 and via XSendEvent().
+	*/
+	/*
+		SIGUSR1 comes in at interrupt time.
+		We generate an event that should enter the main event loop at loop time.
+	*/
 	static void cb_sigusr1 (int signum) {
 		Melder_assert (signum == SIGUSR1);
-		#if 0
-			gboolean retval;
-			g_signal_emit_by_name (GTK_OBJECT (theCurrentPraatApplication -> topShell -> d_gtkWindow), "client-event", nullptr, & retval);
-		#else
-			#if ALLOW_GDK_DRAWING && ! defined (NO_GRAPHICS)
+		#if ! defined (NO_GRAPHICS)
+			#if ALLOW_GDK_DRAWING
 				GdkEventClient gevent;
 				gevent. type = GDK_CLIENT_EVENT;
 				gevent. window = GTK_WIDGET (theCurrentPraatApplication -> topShell -> d_gtkWindow) -> window;
@@ -865,37 +870,119 @@ void praat_dontUsePictureWindow () { praatP.dontUsePictureWindow = true; }
 				gevent. data_format = 8;
 				// Melder_casual (U"event put");
 				gdk_event_put ((GdkEvent *) & gevent);
+			#else
+				GdkEventProperty gevent;   // or GdkEventSetting, once we can find its signal name
+				gevent. type = GDK_PROPERTY_NOTIFY;   // or GDK_SETTING
+				gevent. window = gtk_widget_get_window (GTK_WIDGET (theCurrentPraatApplication -> topShell -> d_gtkWindow));
+				gevent. send_event = 1;
+				gevent. atom = gdk_atom_intern_static_string ("SENDPRAAT");
+				gevent. time = 0;
+				gevent. state = GDK_PROPERTY_NEW_VALUE;
+				// Melder_casual (U"event put");
+				gdk_event_put ((GdkEvent *) & gevent);
 			#endif
 		#endif
 	}
+	#if 0
+		/*
+			This would have been the route via Xt, which may not be available.
+		*/
+		int haveMessage = FALSE;
+		static void timerProc_userMessage (XtPointer dummy, XtIntervalId *id) {
+			FILE *f;
+			if ((f = Melder_fopen (& messageFile, "r")) != NULL) {
+				long pid;
+				int narg = fscanf (f, "#%ld", & pid);
+				fclose (f);
+				if (! praat_executeFromFile (Melder_fileToPath (& messageFile)))
+					Melder_flushError ("%s: message not completely handled.", praatP.title);
+				if (narg) kill (pid, SIGUSR2);
+			} else {
+				Melder_clearError ();
+			}
+		}
+		static void cb_sigusr1 (int signum) {
+			Melder_assert (signum == SIGUSR1);
+			signal (SIGUSR1, handleMessage);   /* Keep this handler in the air. */
+			haveMessage = TRUE;
+			/* Trial: */
+			haveMessage = FALSE;
+			XtAppAddTimeOut (praat.context, 100, timerProc_userMessage, 0);
+		}
+	#endif
+	/*
+		The route via XSendEvent() from the sendpraat program.
+	*/
+	static GdkFilterReturn sendpraatEventFilter (GdkXEvent *xevent, GdkEvent *event, gpointer data)
+	{
+		if (((XEvent *) xevent) -> type != ClientMessage)
+			return GDK_FILTER_CONTINUE;
+		XClientMessageEvent *evt = (XClientMessageEvent *) xevent;
+		Atom message_type = XInternAtom (evt -> display, "SENDPRAAT", FALSE);   // TODO: make static
+		if (evt -> message_type != message_type)
+			return GDK_FILTER_CONTINUE;
+		/*
+			TODO: call script
+		*/
+		Melder_casual (U"sendpraatEventFilter");
+		return GDK_FILTER_CONTINUE;   // TODO: check when to return something else than GDK_FILTER_CONTINUE
+	}
+	// TODO: gdk_window_add_filter (NULL, event_filter, NULL);
 #endif
 
 #if defined (UNIX)
-	#if ALLOW_GDK_DRAWING && ! defined (NO_GRAPHICS)
-		static gboolean cb_userMessage (GtkWidget /* widget */, GdkEventClient * /* event */, gpointer /* userData */) {
-			//Melder_casual (U"client event called");
-			autofile f;
-			try {
-				f.reset (Melder_fopen (& messageFile, "r"));
-			} catch (MelderError) {
-				Melder_clearError ();
-				return true;   // OK
+	#if ! defined (NO_GRAPHICS)
+		#if ALLOW_GDK_DRAWING
+			static gboolean cb_userMessage (GtkWidget /* widget */, GdkEventClient * /* event */, gpointer /* userData */) {
+				//Melder_casual (U"client event called");
+				autofile f;
+				try {
+					f.reset (Melder_fopen (& messageFile, "r"));
+				} catch (MelderError) {
+					Melder_clearError ();
+					return true;   // OK
+				}
+				long_not_integer pid = 0;
+				int narg = fscanf (f, "#%ld", & pid);
+				f.close (& messageFile);
+				{// scope
+					autoPraatBackground background;
+					try {
+						praat_executeScriptFromFile (& messageFile, nullptr);
+					} catch (MelderError) {
+						Melder_flushError (praatP.title.get(), U": message not completely handled.");
+					}
+				}
+				if (narg != 0 && pid != 0)
+					kill (pid, SIGUSR2);
+				return true;
 			}
-			long_not_integer pid = 0;
-			int narg = fscanf (f, "#%ld", & pid);
-			f.close (& messageFile);
-			{// scope
-				autoPraatBackground background;
+		#else
+			static gboolean cb_userMessage (GtkWidget /* widget */, GdkEventProperty * /* event */, gpointer /* userData */) {
+				Melder_casual (U"client event called");
+				autofile f;
 				try {
-					praat_executeScriptFromFile (& messageFile, nullptr);
+					f.reset (Melder_fopen (& messageFile, "r"));
 				} catch (MelderError) {
-					Melder_flushError (praatP.title.get(), U": message not completely handled.");
+					Melder_clearError ();
+					return true;   // OK
+				}
+				long_not_integer pid = 0;
+				int narg = fscanf (f, "#%ld", & pid);
+				f.close (& messageFile);
+				{// scope
+					autoPraatBackground background;
+					try {
+						praat_executeScriptFromFile (& messageFile, nullptr);
+					} catch (MelderError) {
+						Melder_flushError (praatP.title.get(), U": message not completely handled.");
+					}
 				}
+				if (narg != 0 && pid != 0)
+					kill (pid, SIGUSR2);
+				return true;
 			}
-			if (narg != 0 && pid != 0)
-				kill (pid, SIGUSR2);
-			return true;
-		}
+		#endif
 	#endif
 #elif defined (_WIN32)
 	static int cb_userMessage () {
@@ -1872,6 +1959,10 @@ void praat_run () {
 			#if ALLOW_GDK_DRAWING
 				g_signal_connect (G_OBJECT (theCurrentPraatApplication -> topShell -> d_gtkWindow), "client-event",
 					G_CALLBACK (cb_userMessage), nullptr);
+			#else
+				//g_signal_newv ("SENDPRAAT", G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, NULL, NULL, NULL, NULL, G_TYPE_NONE, 0, NULL);
+				g_signal_connect (G_OBJECT (theCurrentPraatApplication -> topShell -> d_gtkWindow), "property-notify-event",
+					G_CALLBACK (cb_userMessage), nullptr);
 			#endif
 			signal (SIGUSR1, cb_sigusr1);
 			#if ALLOW_GDK_DRAWING


=====================================
sys/praat_actions.cpp
=====================================
@@ -612,10 +612,6 @@ void praat_actions_show () {
 						me,
 							( my executable ? 0 : GuiButton_INSENSITIVE ) | ( my attractive ? GuiButton_ATTRACTIVE : 0 ));
 					y += Gui_PUSHBUTTON_HEIGHT + BUTTON_VSPACING;
-					#if gtk
-						/* Dit soort onzin zou eigenlijk in GuiButton moeten */
-						gtk_button_set_alignment (GTK_BUTTON (my button -> d_widget), 0.0f, 0.5f);
-					#endif
 				}
 			} else if (i == theActions.size || theActions.at [i + 1] -> depth == 0) {
 				/*


=====================================
sys/praat_version.h
=====================================
@@ -1,5 +1,5 @@
-#define PRAAT_VERSION_STR 6.1.29
-#define PRAAT_VERSION_NUM 6129
+#define PRAAT_VERSION_STR 6.1.30
+#define PRAAT_VERSION_NUM 6130
 #define PRAAT_YEAR 2020
-#define PRAAT_MONTH October
-#define PRAAT_DAY 27
+#define PRAAT_MONTH November
+#define PRAAT_DAY 3


=====================================
sys/sendpraat.c
=====================================
@@ -46,6 +46,7 @@
 	#include <unistd.h>
 	#include <ctype.h>
 	#include <wchar.h>
+	#include <X11/Xlib.h>
 	#if defined (NO_GRAPHICS) || defined (NO_GUI)   /* for use inside Praat */
 		#define gtk 0
 	#else
@@ -247,13 +248,46 @@ char *sendpraat (void *display, const char *programName, long timeOut, const cha
 			gevent. message_type = gdk_atom_intern_static_string ("SENDPRAAT");
 			gevent. data_format = 8;
 			if (! gdk_event_send_client_message_for_display (display, (GdkEvent *) & gevent, wid)) {
-				if (! displaySupplied) gdk_display_close (display);
+				if (! displaySupplied)
+					gdk_display_close (display);
 				sprintf (errorMessage, "Cannot send message to %s (window %ld). "
 					"The program %s may have been started by a different user, "
 					"or may have crashed.", programName, wid, programName);
 				return errorMessage;
 			}
-			if (! displaySupplied) gdk_display_close (display);
+			if (! displaySupplied)
+				gdk_display_close (display);
+#else
+			/*
+			 * Notify main window.
+			 */
+			XEvent event;
+			int displaySupplied = display != NULL;
+			if (! displaySupplied) {
+				display = XOpenDisplay (NULL);
+				if (display == NULL) {
+					sprintf (errorMessage, "Cannot open display %s.", XDisplayName (NULL));
+					return errorMessage;
+				}
+			}
+			event. type = ClientMessage;
+			event. xclient. serial = 0;
+			event. xclient. send_event = True;
+			event. xclient. display = display;
+			event. xclient. window = (Window) wid;
+			event. xclient. message_type = XInternAtom (display, "SENDPRAAT", False);
+			event. xclient. format = 8;   /* No byte swaps. */
+			strcpy (& event. xclient.data.b [0], "SENDPRAAT");
+			if (! XSendEvent (display, (Window) wid, True, KeyPressMask, & event)) {
+				if (! displaySupplied)
+					XCloseDisplay (display);
+				sprintf (errorMessage, "Cannot send message to %s (window %ld). "
+					"The program %s may have been started by a different user, "
+					"or may have crashed.", programName, wid, programName);
+				return errorMessage;
+			}
+			if (! displaySupplied)
+				XCloseDisplay (display);
 #endif
 		}
 		/*



View it on GitLab: https://salsa.debian.org/med-team/praat/-/compare/b8063278a0f3c14313799a7fdfee8e6752691d29...43ed913115117db74f371e7fe7c7a827f8508303

-- 
View it on GitLab: https://salsa.debian.org/med-team/praat/-/compare/b8063278a0f3c14313799a7fdfee8e6752691d29...43ed913115117db74f371e7fe7c7a827f8508303
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20201110/f15b5c80/attachment-0001.html>


More information about the debian-med-commit mailing list