Mercurial > dwindows
changeset 75:c629838d9805
Updated to latest DW, and updated the Makefile to install the header files
along with the libraries.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 13 Mar 2002 17:35:36 +0000 |
parents | f794f2baabf2 |
children | ce0f5528bab0 |
files | Makefile.in gtk/dw.c win/dw.c |
diffstat | 3 files changed, 79 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- 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; \
--- 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)
--- 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 <windows.h> #include <windowsx.h> #include <commctrl.h> +#include <shlwapi.h> #include <stdlib.h> #include <string.h> #include <stdio.h> @@ -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;z<THREAD_LIMIT;z++) { @@ -2744,17 +2786,6 @@ _hBrush[z] = CreateSolidBrush(_foreground[z]); } -#if 0 - { - DWORD dwResult = GetSysColor(COLOR_3DFACE); - - dw_messagebox("DW", - "Window color: {%x, %x, %x}", - GetRValue(dwResult), - GetGValue(dwResult), - GetBValue(dwResult)); - } -#endif return 0; } @@ -4119,7 +4150,15 @@ */ void dw_window_set_text(HWND handle, char *text) { + char tmpbuf[100]; + + GetClassName(handle, tmpbuf, 99); + SetWindowText(handle, text); + + /* Combobox */ + if(strnicmp(tmpbuf, COMBOBOXCLASSNAME, strlen(COMBOBOXCLASSNAME)+1)==0) + SendMessage(handle, CB_SETEDITSEL, 0, MAKELPARAM(-1, 0)); } /* @@ -5089,7 +5128,7 @@ if(cinfo && cinfo->buddy) 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);