From 2fab9c5ce3ffe59d4a8a918fd02e4596f482fe6e Mon Sep 17 00:00:00 2001 From: patthoyts Date: Thu, 24 Jul 2003 02:10:00 +0000 Subject: * win/tkWinCursor.c: Fix for bug #776646 for a native hand2 and fleur (move) cursor under win. * tests/cursor.test: Check that documented cursors are available. --- ChangeLog | 6 +++ tests/cursor.test | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++++- win/tkWinCursor.c | 15 ++++-- 3 files changed, 170 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e13463b..ff19578 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-07-24 Pat Thoyts + + * win/tkWinCursor.c: Fix for bug #776646 for a native hand2 and + fleur (move) cursor under win. + * tests/cursor.test: Check that documented cursors are available. + 2003-07-20 Daniel Steffen * macosx/buildTkConfig.tcl: fix to TK_BUILD_* ref generation diff --git a/tests/cursor.test b/tests/cursor.test index 861853f..ab042d5 100644 --- a/tests/cursor.test +++ b/tests/cursor.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: cursor.test,v 1.9 2003/04/01 21:06:22 dgp Exp $ +# RCS: @(#) $Id: cursor.test,v 1.10 2003/07/24 02:10:01 patthoyts Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -129,6 +129,157 @@ test cursor-4.1 {FreeCursorObjProc} {testcursor} { set result } {{{1 3}} {{1 2}} {{1 1}} {}} +# ------------------------------------------------------------------------- + +test cursor-5.1 {assert consistent cursor configuration command} \ + -setup { button .b } \ + -body { + list [catch {.b configure -cursor {watch red black}} msg] $msg + } \ + -cleanup {destroy .b} \ + -result {0 {}} + +# ------------------------------------------------------------------------- +# Check for the standard set of cursors. + +set n 0 +foreach cursor { + X_cursor + arrow + based_arrow_down + based_arrow_up + boat + bogosity + bottom_left_corner + bottom_right_corner + bottom_side + bottom_tee + box_spiral + center_ptr + circle + clock + coffee_mug + cross + cross_reverse + crosshair + diamond_cross + dot + dotbox + double_arrow + draft_large + draft_small + draped_box + exchange + fleur + gobbler + gumby + hand1 + hand2 + heart + icon + iron_cross + left_ptr + left_side + left_tee + leftbutton + ll_angle + lr_angle + man + middlebutton + mouse + pencil + pirate + plus + question_arrow + right_ptr + right_side + right_tee + rightbutton + rtl_logo + sailboat + sb_down_arrow + sb_h_double_arrow + sb_left_arrow + sb_right_arrow + sb_up_arrow + sb_v_double_arrow + shuttle + sizing + spider + spraycan + star + target + tcross + top_left_arrow + top_left_corner + top_right_corner + top_side + top_tee + trek + ul_angle + umbrella + ur_angle + watch + xterm +} { + test cursor-6.$n {check cursor $cursor} \ + -setup {button .b -text $cursor} \ + -body { + list [catch {.b configure -cursor $cursor} msg] $msg + } \ + -cleanup {destroy .b} \ + -result {0 {}} + incr n +} +unset n + +# ------------------------------------------------------------------------- +# Check the Windows specific cursors +set n 0 +foreach cursor { + no + starting + size + size_ne_sw + size_ns + size_nw_se + size_we + uparrow + wait +} { + test cursor-7.$n {check cursor $cursor} \ + -constraints {pcOnly} \ + -setup {button .b -text $cursor} \ + -body { + list [catch {.b configure -cursor $cursor} msg] $msg + } \ + -cleanup {destroy .b} \ + -result {0 {}} + incr n +} +unset n + +# ------------------------------------------------------------------------- +# Check the Mac specific cursors +set n 0 +foreach cursor { + text + cross-hair +} { + test cursor-8.$n {check cursor $cursor} \ + -constraints {macOnly} \ + -setup {button .b -text $cursor} \ + -body { + list [catch {.b configure -cursor $cursor} msg] $msg + } \ + -cleanup {destroy .b} \ + -result {0 {}} + incr n +} +unset n + +# ------------------------------------------------------------------------- + destroy .t # cleanup diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c index b54bc2d..73ae25c 100644 --- a/win/tkWinCursor.c +++ b/win/tkWinCursor.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinCursor.c,v 1.11 2003/07/18 23:55:13 patthoyts Exp $ + * RCS: @(#) $Id: tkWinCursor.c,v 1.12 2003/07/24 02:10:01 patthoyts Exp $ */ #include "tkWinInt.h" @@ -25,6 +25,14 @@ typedef struct { } TkWinCursor; /* + * The HAND cursor is only present when WINVER >= 0x0500. If this is + * not available at runtime, it will default to the unix-style cursor. + */ +#ifndef IDC_HAND +#define IDC_HAND MAKEINTRESOURCE(32649) +#endif + +/* * The table below is used to map from the name of a predefined cursor * to its resource identifier. */ @@ -38,7 +46,7 @@ static struct CursorName { {"ibeam", IDC_IBEAM}, {"icon", IDC_ICON}, {"no", IDC_NO}, - {"size", IDC_SIZE}, + {"size", IDC_SIZEALL}, {"size_ne_sw", IDC_SIZENESW}, {"size_ns", IDC_SIZENS}, {"size_nw_se", IDC_SIZENWSE}, @@ -46,12 +54,13 @@ static struct CursorName { {"uparrow", IDC_UPARROW}, {"wait", IDC_WAIT}, {"crosshair", IDC_CROSS}, - {"fleur", IDC_SIZE}, + {"fleur", IDC_SIZEALL}, {"sb_v_double_arrow", IDC_SIZENS}, {"sb_h_double_arrow", IDC_SIZEWE}, {"center_ptr", IDC_UPARROW}, {"watch", IDC_WAIT}, {"xterm", IDC_IBEAM}, + {"hand2", IDC_HAND}, {NULL, 0} }; -- cgit v0.12