comparison gtk/dw.c @ 1104:84473658ce37

Cleaned up warnings building GTK2 on 64bit.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 26 Jul 2011 05:40:47 +0000
parents 99899e6b51c2
children 884951ef2e7f
comparison
equal deleted inserted replaced
1103:bf932c9316ff 1104:84473658ce37
1864 { 1864 {
1865 char *data = NULL; 1865 char *data = NULL;
1866 int z, id = GPOINTER_TO_INT(icon); 1866 int z, id = GPOINTER_TO_INT(icon);
1867 1867
1868 if(id & (1 << 31)) 1868 if(id & (1 << 31))
1869 return _find_private_pixmap(bitmap, (HICN)(id & 0xFFFFFF), userwidth, userheight); 1869 return _find_private_pixmap(bitmap, GINT_TO_POINTER((id & 0xFFFFFF)), userwidth, userheight);
1870 1870
1871 for(z=0;z<_resources.resource_max;z++) 1871 for(z=0;z<_resources.resource_max;z++)
1872 { 1872 {
1873 if(_resources.resource_id[z] == id) 1873 if(_resources.resource_id[z] == id)
1874 { 1874 {
1914 { 1914 {
1915 char *data = NULL; 1915 char *data = NULL;
1916 int z, id = GPOINTER_TO_INT(icon); 1916 int z, id = GPOINTER_TO_INT(icon);
1917 1917
1918 if(id & (1 << 31)) 1918 if(id & (1 << 31))
1919 return _find_private_pixbuf((HICN)(id & 0xFFFFFF)); 1919 return _find_private_pixbuf(GINT_TO_POINTER((id & 0xFFFFFF)));
1920 1920
1921 for(z=0;z<_resources.resource_max;z++) 1921 for(z=0;z<_resources.resource_max;z++)
1922 { 1922 {
1923 if(_resources.resource_id[z] == id) 1923 if(_resources.resource_id[z] == id)
1924 { 1924 {
3211 3211
3212 DW_MUTEX_LOCK; 3212 DW_MUTEX_LOCK;
3213 if(pointertype & (1 << 31)) 3213 if(pointertype & (1 << 31))
3214 { 3214 {
3215 GdkBitmap *bitmap = NULL; 3215 GdkBitmap *bitmap = NULL;
3216 GdkPixmap *pixmap = _find_private_pixmap(&bitmap, (HICN)(pointertype & 0xFFFFFF), NULL, NULL); 3216 GdkPixmap *pixmap = _find_private_pixmap(&bitmap, GINT_TO_POINTER((pointertype & 0xFFFFFF)), NULL, NULL);
3217 cursor = gdk_cursor_new_from_pixmap(pixmap, (GdkPixmap *)bitmap, &_colors[DW_CLR_WHITE], &_colors[DW_CLR_BLACK], 8, 8); 3217 cursor = gdk_cursor_new_from_pixmap(pixmap, (GdkPixmap *)bitmap, &_colors[DW_CLR_WHITE], &_colors[DW_CLR_BLACK], 8, 8);
3218 } 3218 }
3219 else if(!pointertype) 3219 else if(!pointertype)
3220 cursor = NULL; 3220 cursor = NULL;
3221 else 3221 else
5709 5709
5710 pixbuf = _find_pixbuf(icon); 5710 pixbuf = _find_pixbuf(icon);
5711 5711
5712 gtk_tree_store_insert_after(store, iter, (GtkTreeIter *)parent, (GtkTreeIter *)item); 5712 gtk_tree_store_insert_after(store, iter, (GtkTreeIter *)parent, (GtkTreeIter *)item);
5713 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); 5713 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1);
5714 if(pixbuf && !((int)icon & (1 << 31))) 5714 if(pixbuf && !(GPOINTER_TO_INT(icon) & (1 << 31)))
5715 g_object_unref(pixbuf); 5715 g_object_unref(pixbuf);
5716 retval = (HTREEITEM)iter; 5716 retval = (HTREEITEM)iter;
5717 } 5717 }
5718 DW_MUTEX_UNLOCK; 5718 DW_MUTEX_UNLOCK;
5719 5719
5862 5862
5863 pixbuf = _find_pixbuf(icon); 5863 pixbuf = _find_pixbuf(icon);
5864 5864
5865 gtk_tree_store_append (store, iter, (GtkTreeIter *)parent); 5865 gtk_tree_store_append (store, iter, (GtkTreeIter *)parent);
5866 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1); 5866 gtk_tree_store_set (store, iter, 0, title, 1, pixbuf, 2, itemdata, 3, iter, -1);
5867 if(pixbuf && !((int)icon & (1 << 31))) 5867 if(pixbuf && !(GPOINTER_TO_INT(icon) & (1 << 31)))
5868 g_object_unref(pixbuf); 5868 g_object_unref(pixbuf);
5869 retval = (HTREEITEM)iter; 5869 retval = (HTREEITEM)iter;
5870 } 5870 }
5871 DW_MUTEX_UNLOCK; 5871 DW_MUTEX_UNLOCK;
5872 5872
6002 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store"))) 6002 (store = (GtkTreeStore *)gtk_object_get_data(GTK_OBJECT(tree), "_dw_tree_store")))
6003 { 6003 {
6004 pixbuf = _find_pixbuf(icon); 6004 pixbuf = _find_pixbuf(icon);
6005 6005
6006 gtk_tree_store_set(store, (GtkTreeIter *)item, 0, title, 1, pixbuf, -1); 6006 gtk_tree_store_set(store, (GtkTreeIter *)item, 0, title, 1, pixbuf, -1);
6007 if(pixbuf && !((int)icon & (1 << 31))) 6007 if(pixbuf && !(GPOINTER_TO_INT(icon) & (1 << 31)))
6008 g_object_unref(pixbuf); 6008 g_object_unref(pixbuf);
6009 } 6009 }
6010 DW_MUTEX_UNLOCK; 6010 DW_MUTEX_UNLOCK;
6011 #else 6011 #else
6012 GtkWidget *label, *hbox, *pixmap; 6012 GtkWidget *label, *hbox, *pixmap;
6770 { 6770 {
6771 /* If it is a private icon, find the item 6771 /* If it is a private icon, find the item
6772 * free the associated structures and set 6772 * free the associated structures and set
6773 * the entry to unused. 6773 * the entry to unused.
6774 */ 6774 */
6775 if((int)handle & (1 << 31)) 6775 if(GPOINTER_TO_INT(handle) & (1 << 31))
6776 { 6776 {
6777 unsigned long id = (int)handle & 0xFFFFFF; 6777 unsigned long id = GPOINTER_TO_INT(handle) & 0xFFFFFF;
6778 6778
6779 if(id < _PixmapCount && _PixmapArray[id].used) 6779 if(id < _PixmapCount && _PixmapArray[id].used)
6780 { 6780 {
6781 #if GTK_MAJOR_VERSION > 1 6781 #if GTK_MAJOR_VERSION > 1
6782 if(_PixmapArray[id].pixbuf) 6782 if(_PixmapArray[id].pixbuf)
8809 return NULL; 8809 return NULL;
8810 } 8810 }
8811 8811
8812 /* Create a thread to handle this event semaphore */ 8812 /* Create a thread to handle this event semaphore */
8813 pthread_create(&dwthread, NULL, (void *)_handle_sem, (void *)tmpsock); 8813 pthread_create(&dwthread, NULL, (void *)_handle_sem, (void *)tmpsock);
8814 return (HEV)ev; 8814 return GINT_TO_POINTER(ev);
8815 } 8815 }
8816 8816
8817 /* Open an already existing named event semaphore. 8817 /* Open an already existing named event semaphore.
8818 * Parameters: 8818 * Parameters:
8819 * eve: Pointer to an event handle to receive handle. 8819 * eve: Pointer to an event handle to receive handle.
8830 un.sun_family=AF_UNIX; 8830 un.sun_family=AF_UNIX;
8831 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH); 8831 mkdir("/tmp/.dw", S_IWGRP|S_IWOTH);
8832 strcpy(un.sun_path, "/tmp/.dw/"); 8832 strcpy(un.sun_path, "/tmp/.dw/");
8833 strcat(un.sun_path, name); 8833 strcat(un.sun_path, name);
8834 connect(ev, (struct sockaddr *)&un, sizeof(un)); 8834 connect(ev, (struct sockaddr *)&un, sizeof(un));
8835 return (HEV)ev; 8835 return GINT_TO_POINTER(ev);
8836 } 8836 }
8837 8837
8838 /* Resets the event semaphore so threads who call wait 8838 /* Resets the event semaphore so threads who call wait
8839 * on this semaphore will block. 8839 * on this semaphore will block.
8840 * Parameters: 8840 * Parameters:
8844 int dw_named_event_reset(HEV eve) 8844 int dw_named_event_reset(HEV eve)
8845 { 8845 {
8846 /* signal reset */ 8846 /* signal reset */
8847 char tmp = (char)0; 8847 char tmp = (char)0;
8848 8848
8849 if((int)eve < 0) 8849 if(GPOINTER_TO_INT(eve) < 0)
8850 return 0; 8850 return 0;
8851 8851
8852 if(write((int)eve, &tmp, 1) == 1) 8852 if(write(GPOINTER_TO_INT(eve), &tmp, 1) == 1)
8853 return 0; 8853 return 0;
8854 return 1; 8854 return 1;
8855 } 8855 }
8856 8856
8857 /* Sets the posted state of an event semaphore, any threads 8857 /* Sets the posted state of an event semaphore, any threads
8864 { 8864 {
8865 8865
8866 /* signal post */ 8866 /* signal post */
8867 char tmp = (char)1; 8867 char tmp = (char)1;
8868 8868
8869 if((int)eve < 0) 8869 if(GPOINTER_TO_INT(eve) < 0)
8870 return 0; 8870 return 0;
8871 8871
8872 if(write((int)eve, &tmp, 1) == 1) 8872 if(write(GPOINTER_TO_INT(eve), &tmp, 1) == 1)
8873 return 0; 8873 return 0;
8874 return 1; 8874 return 1;
8875 } 8875 }
8876 8876
8877 /* Waits on the specified semaphore until it becomes 8877 /* Waits on the specified semaphore until it becomes
8887 fd_set rd; 8887 fd_set rd;
8888 struct timeval tv, *useme; 8888 struct timeval tv, *useme;
8889 int retval = 0; 8889 int retval = 0;
8890 char tmp; 8890 char tmp;
8891 8891
8892 if((int)eve < 0) 8892 if(GPOINTER_TO_INT(eve) < 0)
8893 return DW_ERROR_NON_INIT; 8893 return DW_ERROR_NON_INIT;
8894 8894
8895 /* Set the timout or infinite */ 8895 /* Set the timout or infinite */
8896 if(timeout == -1) 8896 if(timeout == -1)
8897 useme = NULL; 8897 useme = NULL;
8902 8902
8903 useme = &tv; 8903 useme = &tv;
8904 } 8904 }
8905 8905
8906 FD_ZERO(&rd); 8906 FD_ZERO(&rd);
8907 FD_SET((int)eve, &rd); 8907 FD_SET(GPOINTER_TO_INT(eve), &rd);
8908 8908
8909 /* Signal wait */ 8909 /* Signal wait */
8910 tmp = (char)2; 8910 tmp = (char)2;
8911 write((int)eve, &tmp, 1); 8911 write(GPOINTER_TO_INT(eve), &tmp, 1);
8912 8912
8913 retval = select((int)eve+1, &rd, NULL, NULL, useme); 8913 retval = select(GPOINTER_TO_INT(eve)+1, &rd, NULL, NULL, useme);
8914 8914
8915 /* Signal done waiting. */ 8915 /* Signal done waiting. */
8916 tmp = (char)3; 8916 tmp = (char)3;
8917 write((int)eve, &tmp, 1); 8917 write(GPOINTER_TO_INT(eve), &tmp, 1);
8918 8918
8919 if(retval == 0) 8919 if(retval == 0)
8920 return DW_ERROR_TIMEOUT; 8920 return DW_ERROR_TIMEOUT;
8921 else if(retval == -1) 8921 else if(retval == -1)
8922 return DW_ERROR_INTERRUPT; 8922 return DW_ERROR_INTERRUPT;
8923 8923
8924 /* Clear the entry from the pipe so 8924 /* Clear the entry from the pipe so
8925 * we don't loop endlessly. :) 8925 * we don't loop endlessly. :)
8926 */ 8926 */
8927 read((int)eve, &tmp, 1); 8927 read(GPOINTER_TO_INT(eve), &tmp, 1);
8928 return 0; 8928 return 0;
8929 } 8929 }
8930 8930
8931 /* Release this semaphore, if there are no more open 8931 /* Release this semaphore, if there are no more open
8932 * handles on this semaphore the semaphore will be destroyed. 8932 * handles on this semaphore the semaphore will be destroyed.
8937 int dw_named_event_close(HEV eve) 8937 int dw_named_event_close(HEV eve)
8938 { 8938 {
8939 /* Finally close the domain socket, 8939 /* Finally close the domain socket,
8940 * cleanup will continue in _handle_sem. 8940 * cleanup will continue in _handle_sem.
8941 */ 8941 */
8942 close((int)eve); 8942 close(GPOINTER_TO_INT(eve));
8943 return 0; 8943 return 0;
8944 } 8944 }
8945 8945
8946 /* 8946 /*
8947 * Setup thread independent color sets. 8947 * Setup thread independent color sets.
9088 tmp[1] = data; 9088 tmp[1] = data;
9089 9089
9090 rc = pthread_create(&gtkthread, NULL, (void *)_dwthreadstart, (void *)tmp); 9090 rc = pthread_create(&gtkthread, NULL, (void *)_dwthreadstart, (void *)tmp);
9091 if ( rc == 0 ) 9091 if ( rc == 0 )
9092 return gtkthread; 9092 return gtkthread;
9093 else 9093 return (DWTID)DW_ERROR_UNKNOWN;
9094 return (DWTID)rc;
9095 } 9094 }
9096 9095
9097 /* 9096 /*
9098 * Ends execution of current thread immediately. 9097 * Ends execution of current thread immediately.
9099 */ 9098 */