comparison os2/dw.c @ 986:87dc0f5f96d0

Fix return type of dw_listbox_selected() to be "int" instead of "unsigned int" to allow -1 return. Changed return values of a number of functions to be consistent across platforms and use the defines.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 07 May 2011 05:14:06 +0000
parents 2b1b9b995748
children 3d898b78c2ad
comparison
equal deleted inserted replaced
985:cfc0777aceb5 986:87dc0f5f96d0
2632 static int _recursing = 0; 2632 static int _recursing = 0;
2633 2633
2634 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2))) 2634 if(_recursing == 0 && (tmp->window == conthwnd || (!id && tmp->window == (HWND)mp2)))
2635 { 2635 {
2636 char buf1[500]; 2636 char buf1[500];
2637 unsigned int index = dw_listbox_selected(tmp->window); 2637 int index = dw_listbox_selected(tmp->window);
2638 2638
2639 dw_listbox_get_text(tmp->window, index, buf1, 500); 2639 dw_listbox_get_text(tmp->window, index, buf1, 500);
2640 2640
2641 _recursing = 1; 2641 _recursing = 1;
2642 2642
6286 /* 6286 /*
6287 * Returns the index to the item in the list currently selected. 6287 * Returns the index to the item in the list currently selected.
6288 * Parameters: 6288 * Parameters:
6289 * handle: Handle to the listbox to be queried. 6289 * handle: Handle to the listbox to be queried.
6290 */ 6290 */
6291 unsigned int API dw_listbox_selected(HWND handle) 6291 int API dw_listbox_selected(HWND handle)
6292 { 6292 {
6293 return (unsigned int)WinSendMsg(handle, 6293 return (unsigned int)WinSendMsg(handle,
6294 LM_QUERYSELECTION, 6294 LM_QUERYSELECTION,
6295 MPFROMSHORT(LIT_CURSOR), 6295 MPFROMSHORT(LIT_CURSOR),
6296 0); 6296 0);
7060 cnri.slBitmapOrIcon.cy = 16; 7060 cnri.slBitmapOrIcon.cy = 16;
7061 7061
7062 WinSendMsg(handle, CM_SETCNRINFO, &cnri, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON)); 7062 WinSendMsg(handle, CM_SETCNRINFO, &cnri, MPFROMLONG(CMA_FLWINDOWATTR | CMA_SLBITMAPORICON));
7063 7063
7064 free(offStruct); 7064 free(offStruct);
7065 return TRUE; 7065 return DW_ERROR_NONE;
7066 } 7066 }
7067 7067
7068 /* 7068 /*
7069 * Sets up the filesystem columns, note: filesystem always has an icon/filename field. 7069 * Sets up the filesystem columns, note: filesystem always has an icon/filename field.
7070 * Parameters: 7070 * Parameters:
7089 7089
7090 dw_container_setup(handle, newflags, newtitles, count + 2, count ? 2 : 0); 7090 dw_container_setup(handle, newflags, newtitles, count + 2, count ? 2 : 0);
7091 7091
7092 free(newtitles); 7092 free(newtitles);
7093 free(newflags); 7093 free(newflags);
7094 return TRUE; 7094 return DW_ERROR_NONE;
7095 } 7095 }
7096 7096
7097 /* 7097 /*
7098 * Obtains an icon from a module (or header in GTK). 7098 * Obtains an icon from a module (or header in GTK).
7099 * Parameters: 7099 * Parameters:
8847 int API dw_event_reset(HEV eve) 8847 int API dw_event_reset(HEV eve)
8848 { 8848 {
8849 ULONG count; 8849 ULONG count;
8850 8850
8851 if(DosResetEventSem(eve, &count)) 8851 if(DosResetEventSem(eve, &count))
8852 return FALSE; 8852 return DW_ERROR_GENERAL;
8853 return TRUE; 8853 return DW_ERROR_NONE;
8854 } 8854 }
8855 8855
8856 /* 8856 /*
8857 * Posts a semaphore created by dw_event_new(). Causing all threads 8857 * Posts a semaphore created by dw_event_new(). Causing all threads
8858 * waiting on this event in dw_event_wait to continue. 8858 * waiting on this event in dw_event_wait to continue.
8860 * eve: The handle to the event returned by dw_event_new(). 8860 * eve: The handle to the event returned by dw_event_new().
8861 */ 8861 */
8862 int API dw_event_post(HEV eve) 8862 int API dw_event_post(HEV eve)
8863 { 8863 {
8864 if(DosPostEventSem(eve)) 8864 if(DosPostEventSem(eve))
8865 return FALSE; 8865 return DW_ERROR_GENERAL;
8866 return TRUE; 8866 return DW_ERROR_NONE;
8867 } 8867 }
8868 8868
8869 8869
8870 /* 8870 /*
8871 * Waits on a semaphore created by dw_event_new(), until the 8871 * Waits on a semaphore created by dw_event_new(), until the
8875 */ 8875 */
8876 int API dw_event_wait(HEV eve, unsigned long timeout) 8876 int API dw_event_wait(HEV eve, unsigned long timeout)
8877 { 8877 {
8878 int rc = DosWaitEventSem(eve, timeout); 8878 int rc = DosWaitEventSem(eve, timeout);
8879 if(!rc) 8879 if(!rc)
8880 return 1; 8880 return DW_ERROR_NONE;
8881 if(rc == ERROR_TIMEOUT) 8881 if(rc == ERROR_TIMEOUT)
8882 return -1; 8882 return DW_ERROR_TIMEOUT;
8883 return 0; 8883 return DW_ERROR_GENERAL;
8884 } 8884 }
8885 8885
8886 /* 8886 /*
8887 * Closes a semaphore created by dw_event_new(). 8887 * Closes a semaphore created by dw_event_new().
8888 * Parameters: 8888 * Parameters:
8889 * eve: The handle to the event returned by dw_event_new(). 8889 * eve: The handle to the event returned by dw_event_new().
8890 */ 8890 */
8891 int API dw_event_close(HEV *eve) 8891 int API dw_event_close(HEV *eve)
8892 { 8892 {
8893 if(!eve || ~DosCloseEventSem(*eve)) 8893 if(!eve || ~DosCloseEventSem(*eve))
8894 return FALSE; 8894 return DW_ERROR_GENERAL;
8895 return TRUE; 8895 return DW_ERROR_NONE;
8896 } 8896 }
8897 8897
8898 /* Create a named event semaphore which can be 8898 /* Create a named event semaphore which can be
8899 * opened from other processes. 8899 * opened from other processes.
8900 * Parameters: 8900 * Parameters: