# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1016040936 0 # Node ID c629838d980558f667b15bb4e0e7fcf7cabbb2db # Parent f794f2baabf240bcdd57086741dd88ae785e19d6 Updated to latest DW, and updated the Makefile to install the header files along with the libraries. diff -r f794f2baabf2 -r c629838d9805 Makefile.in --- a/Makefile.in Mon Feb 18 19:10:28 2002 +0000 +++ b/Makefile.in Wed Mar 13 17:35:36 2002 +0000 @@ -73,6 +73,8 @@ all: $(SYSCONF_LINK_TARGET) $(SYSCONF_LINK_TARGET2) install: + $(INSTALL) dw.h $(PREFIX)/include; \ + $(INSTALL) compat.h $(PREFIX)/include; \ cd $(DESTDIR); \ $(INSTALL) $(SYSCONF_LINK_TARGET) $(PREFIX)/lib; \ $(INSTALL) $(SYSCONF_LINK_TARGET2) $(PREFIX)/lib; \ diff -r f794f2baabf2 -r c629838d9805 gtk/dw.c --- a/gtk/dw.c Mon Feb 18 19:10:28 2002 +0000 +++ b/gtk/dw.c Wed Mar 13 17:35:36 2002 +0000 @@ -60,14 +60,14 @@ GtkWidget *last_window = NULL; -int _dw_file_active = 0, _dw_ignore_click = 0; +int _dw_file_active = 0, _dw_ignore_click = 0, _dw_unselecting = 0; pthread_t _dw_thread = (pthread_t)-1; -int _dw_mutex_locked = FALSE; +int _dw_mutex_locked[DW_THREAD_LIMIT]; /* Use default border size for the default enlightenment theme */ int _dw_border_width = 12, _dw_border_height = 28; -#define DW_MUTEX_LOCK { if(pthread_self() != _dw_thread && _dw_mutex_locked == FALSE) { gdk_threads_enter(); _dw_mutex_locked = TRUE; _locked_by_me = TRUE; } } -#define DW_MUTEX_UNLOCK { if(pthread_self() != _dw_thread && _locked_by_me == TRUE) { gdk_threads_leave(); _dw_mutex_locked = FALSE; _locked_by_me = FALSE; } } +#define DW_MUTEX_LOCK { int index = _find_thread_index(dw_thread_id()); if(pthread_self() != _dw_thread && _dw_mutex_locked[index] == FALSE) { gdk_threads_enter(); _dw_mutex_locked[index] = TRUE; _locked_by_me = TRUE; } } +#define DW_MUTEX_UNLOCK { if(pthread_self() != _dw_thread && _locked_by_me == TRUE) { gdk_threads_leave(); _dw_mutex_locked[_find_thread_index(dw_thread_id())] = FALSE; _locked_by_me = FALSE; } } #define DEFAULT_SIZE_WIDTH 12 #define DEFAULT_SIZE_HEIGHT 6 @@ -464,8 +464,14 @@ void _unselect_row(GtkWidget *widget, gint row, gint column, GdkEventButton *event, gpointer data) { - GList *tmp = (GList *)gtk_object_get_data(GTK_OBJECT(widget), "selectlist"); - char *rowdata = gtk_clist_get_row_data(GTK_CLIST(widget), row); + GList *tmp; + char *rowdata; + + if(_dw_unselecting) + return; + + tmp = (GList *)gtk_object_get_data(GTK_OBJECT(widget), "selectlist"); + rowdata = gtk_clist_get_row_data(GTK_CLIST(widget), row); if(rowdata) { @@ -3358,7 +3364,10 @@ g_list_free(list); gtk_object_set_data(GTK_OBJECT(clist), "selectlist", NULL); + + _dw_unselecting = 1; gtk_clist_unselect_all(GTK_CLIST(clist)); + _dw_unselecting = 0; } /* @@ -3712,7 +3721,7 @@ list = (GList *)gtk_object_get_data(GTK_OBJECT(clist), "selectlist"); gtk_object_set_data(GTK_OBJECT(clist), "selectlist", NULL); gtk_object_set_data(GTK_OBJECT(clist), "querylist", (gpointer)list); - gtk_clist_unselect_all(GTK_CLIST(clist)); + _dw_unselect(clist); if(list) { @@ -4754,7 +4763,7 @@ { if(style & DW_CCS_EXTENDSEL) { - gtk_clist_set_selection_mode(GTK_CLIST(handle2), GTK_SELECTION_MULTIPLE); + gtk_clist_set_selection_mode(GTK_CLIST(handle2), GTK_SELECTION_EXTENDED); gtk_object_set_data(GTK_OBJECT(handle2), "multi", (gpointer)1); } if(style & DW_CCS_SINGLESEL) diff -r f794f2baabf2 -r c629838d9805 win/dw.c --- a/win/dw.c Mon Feb 18 19:10:28 2002 +0000 +++ b/win/dw.c Wed Mar 13 17:35:36 2002 +0000 @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -25,12 +26,12 @@ HINSTANCE DWInstance = NULL; -DWORD dwVersion = 0; +DWORD dwVersion = 0, dwComctlVer = 0; DWTID _dwtid = -1; -/* I should probably check the actual file version, but this will do for now */ -#define IS_WIN98PLUS (LOBYTE(LOWORD(dwVersion)) > 4 || \ - (LOBYTE(LOWORD(dwVersion)) == 4 && HIBYTE(LOWORD(dwVersion)) > 0)) +#define PACKVERSION(major,minor) MAKELONG(minor,major) + +#define IS_IE5PLUS (dwComctlVer >= PACKVERSION(5,80)) char monthlist[][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -241,6 +242,46 @@ return isnt; } +DWORD GetDllVersion(LPCTSTR lpszDllName) +{ + + HINSTANCE hinstDll; + DWORD dwVersion = 0; + + hinstDll = LoadLibrary(lpszDllName); + + if(hinstDll) + { + DLLGETVERSIONPROC pDllGetVersion; + + pDllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hinstDll, "DllGetVersion"); + + /* Because some DLLs might not implement this function, you + * must test for it explicitly. Depending on the particular + * DLL, the lack of a DllGetVersion function can be a useful + * indicator of the version. + */ + if(pDllGetVersion) + { + DLLVERSIONINFO dvi; + HRESULT hr; + + ZeroMemory(&dvi, sizeof(dvi)); + dvi.cbSize = sizeof(dvi); + + hr = (*pDllGetVersion)(&dvi); + + if(SUCCEEDED(hr)) + { + dwVersion = PACKVERSION(dvi.dwMajorVersion, dvi.dwMinorVersion); + } + } + + FreeLibrary(hinstDll); + } + return dwVersion; +} + /* This function adds a signal handler callback into the linked list. */ void _new_signal(ULONG message, HWND window, void *signalfunction, void *data) @@ -1745,7 +1786,7 @@ position = atol(tempbuf); - if(IS_WIN98PLUS) + if(IS_IE5PLUS) SendMessage(hWnd, UDM_SETPOS32, 0, (LPARAM)position); else SendMessage(hWnd, UDM_SETPOS, 0, (LPARAM)MAKELONG((short)position, 0)); @@ -1876,7 +1917,7 @@ position = atol(tmpbuf); - if(IS_WIN98PLUS) + if(IS_IE5PLUS) val = (long)SendMessage(cinfo->buddy, UDM_GETPOS32, 0, 0); else val = (long)SendMessage(cinfo->buddy, UDM_GETPOS, 0, 0); @@ -2735,6 +2776,7 @@ #endif /* We need the version to check capability like up-down controls */ dwVersion = GetVersion(); + dwComctlVer = GetDllVersion(TEXT("comctl32.dll")); for(z=0;zbuddy) SetWindowText(cinfo->buddy, tmpbuf); - if(IS_WIN98PLUS) + if(IS_IE5PLUS) SendMessage(handle, UDM_SETPOS32, 0, (LPARAM)position); else SendMessage(handle, UDM_SETPOS, 0, (LPARAM)MAKELONG((short)position, 0)); @@ -5104,7 +5143,7 @@ */ void dw_spinbutton_set_limits(HWND handle, long upper, long lower) { - if(IS_WIN98PLUS) + if(IS_IE5PLUS) SendMessage(handle, UDM_SETRANGE32, (WPARAM)lower,(LPARAM)upper); else SendMessage(handle, UDM_SETRANGE32, (WPARAM)((short)lower), @@ -5129,7 +5168,7 @@ */ long dw_spinbutton_query(HWND handle) { - if(IS_WIN98PLUS) + if(IS_IE5PLUS) return (long)SendMessage(handle, UDM_GETPOS32, 0, 0); else return (long)SendMessage(handle, UDM_GETPOS, 0, 0); @@ -5357,7 +5396,7 @@ */ void dw_tree_delete(HWND handle, HWND item) { - if((HTREEITEM)item == TVI_ROOT) + if((HTREEITEM)item == TVI_ROOT || !item) return; TreeView_DeleteItem(handle, (HTREEITEM)item);