[Pkg-wmaker-commits] [wmstickynotes] 38/81: Fixed wmhints for icon window (patch from Moritz <thinksilicon at users.sf.net>). Added a couple malloc failure checks.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Tue Aug 25 02:33:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmstickynotes.

commit b2a4c2a5e7e6ec56a5fe9a51c02a90c82fc96ed9
Author: hnc <hnc at 7fc852e4-12a7-4f5b-bad7-374d67da4d19>
Date:   Fri Dec 5 22:39:42 2014 +0000

    Fixed wmhints for icon window (patch from Moritz <thinksilicon at users.sf.net>).  Added a couple malloc failure checks.
    
    
    git-svn-id: svn://svn.code.sf.net/p/wmstickynotes/code@19 7fc852e4-12a7-4f5b-bad7-374d67da4d19
---
 AUTHORS         |  2 +-
 ChangeLog       |  5 +++++
 README          |  1 -
 THANKS          |  3 +++
 configure.ac    |  4 ++--
 wmstickynotes.c | 18 +++++++++++++++---
 6 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 497b8c5..942dfdd 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1 +1 @@
-Heath Caldwell <hncaldwell at gmail.com>
+Heath Caldwell <hncaldwell at fastmail.com>
diff --git a/ChangeLog b/ChangeLog
index c80bbcf..ff71be1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-05  Heath Caldwell <hncaldwell at fastmail.com>
+	* Release wmstickynotes-0.3.
+	* Fixed wmhints for icon window (patch from Moritz <thinksilicon at users.sf.net>).
+	* Added a couple malloc failure checks.
+
 2011-04-20  Heath Caldwell <hncaldwell at gmail.com>
 	* Release wmstickynotes-0.2.
 	* Fixed window withdrawing.
diff --git a/README b/README
index 21ca6e3..eac1d9e 100644
--- a/README
+++ b/README
@@ -1,6 +1,5 @@
 wmstickynotes
 -------------
-Heath Caldwell <hncaldwell at gmail.com>
 
 This program is a Window Maker style dockapp which allows you to create note
 windows.  By default, the notes, along with their position, size, and color,
diff --git a/THANKS b/THANKS
index a391b7b..21e4e30 100644
--- a/THANKS
+++ b/THANKS
@@ -4,3 +4,6 @@ which helped me learn how to make a gtk+ dockapp.
 
 Thanks to wbk <coydog at coydogsoftware.net> for the suggestion to add an argument
 for not storing the notes.
+
+Thanks to Moritz <thinksilicon at users.sf.net> for a patch to properly set the
+wmhints for the icon window.
diff --git a/configure.ac b/configure.ac
index 474f81c..c8a5f9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
 #
 # $Id$
 #
-# Heath Caldwell <hncaldwell at gmail.com>
+# Heath Caldwell <hncaldwell at fastmail.com>
 #
 
-AC_INIT([wmstickynotes], [0.3], [Heath Caldwell <hncaldwell at gmail.com>])
+AC_INIT([wmstickynotes], [0.4], [Heath Caldwell <hncaldwell at fastmail.com>])
 AM_INIT_AUTOMAKE
 AC_CONFIG_HEADER([config.h])
 
diff --git a/wmstickynotes.c b/wmstickynotes.c
index ecaf9b0..40a505a 100644
--- a/wmstickynotes.c
+++ b/wmstickynotes.c
@@ -179,10 +179,14 @@ int main(int argc, char *argv[])
 	gtk_widget_show_all(GTK_WIDGET(color_menu));
 	gtk_widget_show_all(window);
 
+	mywmhints.icon_window = GDK_WINDOW_XID(window->window);
+	mywmhints.window_group = GDK_WINDOW_XID(window->window);
+	mywmhints.icon_x = 0;
+	mywmhints.icon_y = 0;
+	mywmhints.flags = IconWindowHint | StateHint;
 	mywmhints.initial_state = WithdrawnState;
-	mywmhints.flags = StateHint;
 
-	XSetWMHints(GDK_WINDOW_XDISPLAY(window->window), GDK_WINDOW_XWINDOW(window->window), &mywmhints);
+	XSetWMHints(GDK_WINDOW_XDISPLAY(window->window), GDK_WINDOW_XID(window->window), &mywmhints);
 
 	g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
 	g_signal_connect(G_OBJECT(main_button_box), "button-press-event", G_CALLBACK(main_button_pressed), color_menu);
@@ -302,6 +306,10 @@ void create_note(Note *old_note, ColorScheme *scheme)
 	Note *note;
 	
 	note = old_note ? old_note : malloc(sizeof(Note));
+	if(!note) {
+		fprintf(stderr, "Failed to allocate note.\n");
+		return;
+	}
 
 	if(!old_note) {
 		highest_note_id++;
@@ -394,9 +402,13 @@ void read_old_notes()
 		}
 		if(i < strlen(entry->d_name)) continue;
 
-		file = fopen(entry->d_name, "r");
 		note = malloc(sizeof(Note));
+		if(!note) {
+			fprintf(stderr, "Failed to allocate note for %s.\n", entry->d_name);
+			continue;
+		}
 
+		file = fopen(entry->d_name, "r");
 		note->id = atoi(entry->d_name);
 		if(note->id > highest_note_id) highest_note_id = note->id;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmstickynotes.git



More information about the Pkg-wmaker-commits mailing list