Tk Source Code

Check-in [38168e21]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixed [c95d4691ff] - winfo screenheight w/dual monitors returns the screen height of the primary display
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | mistake
Files: files | file ages | folders
SHA1: 38168e2176fcd277a08d6ce55a8706704d75e4f2
User & Date: fvogel 2016-04-21 16:33:03.016
References
2016-04-24
15:05 Ticket [c95d4691] winfo screenheight w/dual monitors returns the screen height of the primary display status still Open with 3 other changes artifact: a546c084 user: fvogel
2016-04-21
16:37 Ticket [c95d4691]: 3 changes artifact: 4f364c13 user: fvogel
Context
2016-04-21
16:33
Fixed [c95d4691ff] - winfo screenheight w/dual monitors returns the screen height of the primary display Closed-Leaf check-in: 38168e21 user: fvogel tags: mistake
2016-04-08
19:04
Fixed typo in [text] man page check-in: af60ae73 user: fvogel tags: core-8-6-branch
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/tkCmds.c.
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
		Tcl_NewIntObj(CellsOfScreen(Tk_Screen(tkwin))));
	break;
    case WIN_SCREENDEPTH:
	Tcl_SetObjResult(interp,
		Tcl_NewIntObj(DefaultDepthOfScreen(Tk_Screen(tkwin))));
	break;
    case WIN_SCREENHEIGHT:
	Tcl_SetObjResult(interp,
		Tcl_NewIntObj(HeightOfScreen(Tk_Screen(tkwin))));
	break;
    case WIN_SCREENWIDTH:
	Tcl_SetObjResult(interp,
		Tcl_NewIntObj(WidthOfScreen(Tk_Screen(tkwin))));
	break;
    case WIN_SCREENMMHEIGHT:
	Tcl_SetObjResult(interp,
		Tcl_NewIntObj(HeightMMOfScreen(Tk_Screen(tkwin))));
	break;
    case WIN_SCREENMMWIDTH:
	Tcl_SetObjResult(interp,







|
|


|
|







1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
		Tcl_NewIntObj(CellsOfScreen(Tk_Screen(tkwin))));
	break;
    case WIN_SCREENDEPTH:
	Tcl_SetObjResult(interp,
		Tcl_NewIntObj(DefaultDepthOfScreen(Tk_Screen(tkwin))));
	break;
    case WIN_SCREENHEIGHT:
 	Tcl_SetObjResult(interp,
		Tcl_NewIntObj(TkpHeightOfScreen(tkwin)));
	break;
    case WIN_SCREENWIDTH:
 	Tcl_SetObjResult(interp,
		Tcl_NewIntObj(TkpWidthOfScreen(tkwin)));
	break;
    case WIN_SCREENMMHEIGHT:
	Tcl_SetObjResult(interp,
		Tcl_NewIntObj(HeightMMOfScreen(Tk_Screen(tkwin))));
	break;
    case WIN_SCREENMMWIDTH:
	Tcl_SetObjResult(interp,
Changes to generic/tkInt.h.
1213
1214
1215
1216
1217
1218
1219


1220
1221
1222
1223
1224
1225
1226
			    const char *nsname, const char *name,
			    ClientData clientData, const TkEnsemble *map);
MODULE_SCOPE int	TkInitTkCmd(Tcl_Interp *interp,
			    ClientData clientData);
MODULE_SCOPE int	TkInitFontchooser(Tcl_Interp *interp,
			    ClientData clientData);
MODULE_SCOPE void	TkpWarpPointer(TkDisplay *dispPtr);



#ifdef _WIN32
#define TkParseColor XParseColor
#else
MODULE_SCOPE Status TkParseColor (Display * display,
				Colormap map, const char* spec,
				XColor * colorPtr);







>
>







1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
			    const char *nsname, const char *name,
			    ClientData clientData, const TkEnsemble *map);
MODULE_SCOPE int	TkInitTkCmd(Tcl_Interp *interp,
			    ClientData clientData);
MODULE_SCOPE int	TkInitFontchooser(Tcl_Interp *interp,
			    ClientData clientData);
MODULE_SCOPE void	TkpWarpPointer(TkDisplay *dispPtr);
MODULE_SCOPE int	TkpHeightOfScreen(Tk_Window tkwin);
MODULE_SCOPE int	TkpWidthOfScreen(Tk_Window tkwin);

#ifdef _WIN32
#define TkParseColor XParseColor
#else
MODULE_SCOPE Status TkParseColor (Display * display,
				Colormap map, const char* spec,
				XColor * colorPtr);
Changes to macosx/tkMacOSXWm.c.
6751
6752
6753
6754
6755
6756
6757














































6758
6759
6760
6761
6762
6763
6764

    /* Repeat for all the children */
    for (childPtr = winPtr->childList; childPtr != NULL;
	    childPtr = childPtr->nextPtr) {
	RemapWindows(childPtr, (MacDrawable *) winPtr->window);
    }
}















































/*
 * Local Variables:
 * mode: objc
 * c-basic-offset: 4
 * fill-column: 79
 * coding: utf-8







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810

    /* Repeat for all the children */
    for (childPtr = winPtr->childList; childPtr != NULL;
	    childPtr = childPtr->nextPtr) {
	RemapWindows(childPtr, (MacDrawable *) winPtr->window);
    }
}

/*
 *----------------------------------------------------------------------
 *
 * TkpHeightOfScreen
 *
 *	Return the height (in pixels) of the screen.
 *
 * Results:
 *	The pixel height of the screen.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

int
TkpHeightOfScreen(
    Tk_Window tkwin)
{
    return HeightOfScreen(Tk_Screen(tkwin));
}

/*
 *----------------------------------------------------------------------
 *
 * TkpWidthOfScreen
 *
 *	Return the width (in pixels) of the screen.
 *
 * Results:
 *	The pixel width of the screen.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

int
TkpWidthOfScreen(
    Tk_Window tkwin)
{
    return WidthOfScreen(Tk_Screen(tkwin));
}

/*
 * Local Variables:
 * mode: objc
 * c-basic-offset: 4
 * fill-column: 79
 * coding: utf-8
Changes to unix/tkUnixWm.c.
7407
7408
7409
7410
7411
7412
7413














































7414
7415
7416
7417
7418
7419
7420
	} else if (parentPtr->window) {
	    XReparentWindow(parentPtr->display, winPtr->window,
		    parentPtr->window,
		    win_attr.x, win_attr.y);
	}
    }
}















































/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
	} else if (parentPtr->window) {
	    XReparentWindow(parentPtr->display, winPtr->window,
		    parentPtr->window,
		    win_attr.x, win_attr.y);
	}
    }
}

/*
 *----------------------------------------------------------------------
 *
 * TkpHeightOfScreen
 *
 *	Return the height (in pixels) of the screen.
 *
 * Results:
 *	The pixel height of the screen.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

int
TkpHeightOfScreen(
    Tk_Window tkwin)
{
    return HeightOfScreen(Tk_Screen(tkwin));
}

/*
 *----------------------------------------------------------------------
 *
 * TkpWidthOfScreen
 *
 *	Return the width (in pixels) of the screen.
 *
 * Results:
 *	The pixel width of the screen.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

int
TkpWidthOfScreen(
    Tk_Window tkwin)
{
    return WidthOfScreen(Tk_Screen(tkwin));
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
Changes to win/tkWinWm.c.
8674
8675
8676
8677
8678
8679
8680






























































































8681
8682
8683
8684
8685
8686
8687

    for (childPtr = winPtr->childList; childPtr != NULL;
	    childPtr = childPtr->nextPtr) {
	RemapWindows(childPtr,
		winPtr->window ? Tk_GetHWND(winPtr->window) : NULL);
    }
}































































































/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781

    for (childPtr = winPtr->childList; childPtr != NULL;
	    childPtr = childPtr->nextPtr) {
	RemapWindows(childPtr,
		winPtr->window ? Tk_GetHWND(winPtr->window) : NULL);
    }
}

/*
 *----------------------------------------------------------------------
 *
 * GetMonitorRect
 *
 *	Return the rectangle of the monitor on which the given window
 *	is displayed.
 *
 * Results:
 *	The display rectangle of the monitor, in virtual screen
 *	coordinates.
 *
 * Side effects:
 *	The passed window comes into existence if it was not already
 *	the case.
 *
 *----------------------------------------------------------------------
 */

RECT
GetMonitorRect(
    Tk_Window tkwin)
{
    HWND hWnd;
    HMONITOR hMonitor;
    MONITORINFO mi;

    Tk_MakeWindowExist(tkwin);

    /*
     * Get monitor information for the monitor showing the window.
     */

    hWnd = Tk_GetHWND(Tk_WindowId(tkwin));
    hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY);

    mi.cbSize = sizeof(mi);
    GetMonitorInfo(hMonitor, &mi);

    return mi.rcMonitor;
}

/*
 *----------------------------------------------------------------------
 *
 * TkpHeightOfScreen
 *
 *	Return the height (in pixels) of the monitor on which the given
 *	window is displayed.
 *
 * Results:
 *	The pixel height of the monitor.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

int
TkpHeightOfScreen(
    Tk_Window tkwin)
{
    RECT rc = GetMonitorRect(tkwin);

    return (rc.bottom - rc.top);
}

/*
 *----------------------------------------------------------------------
 *
 * TkpWidthOfScreen
 *
 *	Return the width (in pixels) of the monitor on which the given
 *	window is displayed.
 *
 * Results:
 *	The pixel width of the monitor.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

int
TkpWidthOfScreen(
    Tk_Window tkwin)
{
    RECT rc = GetMonitorRect(tkwin);

    return (rc.right - rc.left);
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End: