Mercurial > hg > xemacs-beta
comparison src/event-msw.c @ 903:4a27df428c73
[xemacs-hg @ 2002-07-06 05:48:14 by andyp]
sync with 21.4
author | andyp |
---|---|
date | Sat, 06 Jul 2002 05:48:22 +0000 |
parents | 79c6ff3eef26 |
children | 3b122a8e1d51 |
comparison
equal
deleted
inserted
replaced
902:2fd2239ea63a | 903:4a27df428c73 |
---|---|
1731 * depends on dnd support. | 1731 * depends on dnd support. |
1732 */ | 1732 */ |
1733 #ifdef HAVE_DRAGNDROP | 1733 #ifdef HAVE_DRAGNDROP |
1734 extern int mswindows_dde_enable; | 1734 extern int mswindows_dde_enable; |
1735 | 1735 |
1736 EXFUN(Fread_from_string, 3); | |
1737 | |
1738 /* The following variables are used to maintain consistency of result and | |
1739 * error reporting to the client. | |
1740 * The basic protocol is to Execute a lisp form, and then Request one or | |
1741 * more of the following items: Status (1 = OK, 0 = Error), Result, or Error. | |
1742 * When the lisp form is queued, the dde_eval_pending flag is set to 1, | |
1743 * to indicate that the items are not yet available. The dde_eval_pending | |
1744 * flag is set to 0 when the evaluation is complete. Requests for the result | |
1745 * items will block while the dde_eval_pending flag is 1, to avoid clients | |
1746 * getting inconsistent results. | |
1747 */ | |
1748 static int dde_eval_pending; | |
1749 static Lisp_Object dde_eval_result; | |
1750 static Lisp_Object dde_eval_error; | |
1751 | |
1752 static Lisp_Object | |
1753 dde_error (Lisp_Object err, Lisp_Object obj) | |
1754 { | |
1755 dde_eval_error = err; | |
1756 return Qnil; | |
1757 } | |
1758 | |
1759 /* Read lisp forms from a string. Evaluate the forms as if they were | |
1760 * wrapped in a progn form. Return the result of the form. | |
1761 */ | |
1762 static Lisp_Object | |
1763 dde_eval_string (Lisp_Object str) | |
1764 { | |
1765 struct gcpro gcpro1, gcpro2; | |
1766 Lisp_Object args[3]; | |
1767 Lisp_Object obj; | |
1768 | |
1769 /* Heavy handed GCPROing, on the principle of it's better to be safe than | |
1770 * sorry... | |
1771 */ | |
1772 args[0] = Qnil; | |
1773 args[1] = Qnil; | |
1774 args[2] = Qnil; | |
1775 GCPRO2 (args[0], str); | |
1776 gcpro1.nvars = 3; | |
1777 | |
1778 /* Wrap the user supplied string in string "(progn ...)". | |
1779 * We can now just read-from-string a single form. If we | |
1780 * get an error, or finish before the end of the string, | |
1781 * we know the original string had syntax errors. | |
1782 */ | |
1783 args[0] = build_string ("(progn "); | |
1784 args[1] = str; | |
1785 args[2] = build_string (")"); | |
1786 str = Fconcat (3, args); | |
1787 | |
1788 obj = Fread_from_string (str, Qnil, Qnil); | |
1789 UNGCPRO; | |
1790 | |
1791 /* The following doesn't check that the length fits in an EMACS_INT. | |
1792 * This won't be a problem in reality...? | |
1793 * | |
1794 * If the read didn't get to the end of the string, we have a syntax | |
1795 * error in the string supplied by the user. | |
1796 */ | |
1797 if (XINT (XCDR (obj)) != XSTRING_LENGTH (str)) | |
1798 return Qnil; | |
1799 | |
1800 GCPRO1 (obj); | |
1801 obj = Feval (XCAR (obj)); | |
1802 | |
1803 RETURN_UNGCPRO(obj); | |
1804 } | |
1805 | |
1806 /* Evaluate the supplied string as a sequence of Lisp forms, wrapped in | |
1807 * a progn. Catch any evaluation errors. Set the evaluation status and | |
1808 * result variables. | |
1809 */ | |
1810 static void | |
1811 dde_eval (Lisp_Object str) | |
1812 { | |
1813 dde_eval_error = Qnil; | |
1814 dde_eval_result = condition_case_1 (Qt, dde_eval_string, str, | |
1815 dde_error, Qnil); | |
1816 dde_eval_pending = 0; | |
1817 | |
1818 /* Re-enable callbacks in case the client is waiting on a request */ | |
1819 DdeEnableCallback (mswindows_dde_mlid, NULL, EC_ENABLEALL); | |
1820 | |
1821 /* Post advise notifications on the result item */ | |
1822 DdePostAdvise (mswindows_dde_mlid, mswindows_dde_topic_eval, | |
1823 mswindows_dde_item_result); | |
1824 } | |
1825 | |
1826 /* A list of DDE advise tokens. Each token is an uninterned symbol, | |
1827 * whose value is the DDE string handle for its name (stored as a float, | |
1828 * as a Lisp int cannot hold a full C int). | |
1829 * The token's 'dde-data property is used to store data for a dde-advise. | |
1830 */ | |
1831 Lisp_Object Vdde_advise_items; | |
1832 | |
1833 /* The symbol 'HSZ */ | |
1834 Lisp_Object QHSZ; | |
1835 | |
1836 DEFUN("dde-alloc-advise-item", Fdde_alloc_advise_item, 0, 1, 0, /* | |
1837 Allocate an advise item, and return its token. | |
1838 */ | |
1839 (name)) | |
1840 { | |
1841 Lisp_Object token; | |
1842 Extbyte *str; | |
1843 HSZ hsz; | |
1844 struct gcpro gcpro1, gcpro2; | |
1845 | |
1846 if (!NILP (name)) | |
1847 CHECK_STRING (name); | |
1848 else | |
1849 { | |
1850 static int num = 0; | |
1851 char buf[20]; | |
1852 sprintf (buf, "Tok%d", num); | |
1853 ++num; | |
1854 name = build_string (buf); | |
1855 } | |
1856 | |
1857 token = Qnil; | |
1858 GCPRO2 (name, token); | |
1859 token = Fmake_symbol (name); | |
1860 TO_EXTERNAL_FORMAT (LISP_STRING, name, C_STRING_ALLOCA, str, | |
1861 Qmswindows_tstr); | |
1862 hsz = qxeDdeCreateStringHandle (mswindows_dde_mlid, str, | |
1863 XEUNICODE_P ? CP_WINUNICODE : CP_WINANSI); | |
1864 | |
1865 Fput(token, QHSZ, make_float ((int)hsz)); | |
1866 Vdde_advise_items = Fcons (token, Vdde_advise_items); | |
1867 | |
1868 RETURN_UNGCPRO(token); | |
1869 } | |
1870 | |
1871 DEFUN("dde-free-advise-item", Fdde_free_advise_item, 1, 1, 0, /* | |
1872 Free the resources associated with advise item ITEM. | |
1873 | |
1874 Frees all resources allocated to allow clients to set up advise loops | |
1875 on ITEM. It is assumed that no active advise loops remain. However, no | |
1876 problems should arise if they do - it's just that we won't ever send any | |
1877 notifications again. | |
1878 | |
1879 If the user does not free an advise item, resources will be leaked. | |
1880 */ | |
1881 (item)) | |
1882 { | |
1883 HSZ hsz; | |
1884 Lisp_Object val; | |
1885 | |
1886 CHECK_SYMBOL (item); | |
1887 val = Fget (item, QHSZ, Qnil); | |
1888 if (!FLOATP (val)) | |
1889 return Qnil; | |
1890 hsz = (HSZ)(int)XFLOAT_DATA (val); | |
1891 DdeFreeStringHandle (mswindows_dde_mlid, hsz); | |
1892 Vdde_advise_items = delq_no_quit (item, Vdde_advise_items); | |
1893 return Qnil; | |
1894 } | |
1895 | |
1896 DEFUN("dde-advise", Fdde_advise, 2, 2, 0, /* | |
1897 Post a DDE advise for ITEM with associated data DATA. | |
1898 | |
1899 Records the value DATA for sending back to clients waiting for | |
1900 notifications on DDE item ITEM in the system topic, and posts | |
1901 the advise transaction. | |
1902 | |
1903 ITEM must be an advise token allocated using dde-alloc-advise-item. | |
1904 */ | |
1905 (item, data)) | |
1906 { | |
1907 HSZ hsz; | |
1908 Lisp_Object val; | |
1909 | |
1910 CHECK_SYMBOL (item); | |
1911 val = Fget (item, QHSZ, Qnil); | |
1912 if (!FLOATP (val)) | |
1913 return Qnil; | |
1914 hsz = (HSZ)(int)XFLOAT_DATA (val); | |
1915 | |
1916 Fset (item, data); | |
1917 DdePostAdvise (mswindows_dde_mlid, mswindows_dde_topic_eval, hsz); | |
1918 return Qnil; | |
1919 } | |
1920 | |
1736 HDDEDATA CALLBACK | 1921 HDDEDATA CALLBACK |
1737 mswindows_dde_callback (UINT uType, UINT uFmt, HCONV hconv, | 1922 mswindows_dde_callback (UINT uType, UINT uFmt, HCONV hconv, |
1738 HSZ hszTopic, HSZ hszItem, HDDEDATA hdata, | 1923 HSZ hszTopic, HSZ hszItem, HDDEDATA hdata, |
1739 DWORD dwData1, DWORD dwData2) | 1924 DWORD dwData1, DWORD dwData2) |
1740 { | 1925 { |
1741 switch (uType) | 1926 switch (uType) |
1742 { | 1927 { |
1743 case XTYP_CONNECT: | 1928 case XTYP_CONNECT: |
1744 if (!DdeCmpStringHandles (hszTopic, mswindows_dde_topic_system)) | 1929 if (!DdeCmpStringHandles (hszTopic, mswindows_dde_topic_system) |
1930 || !DdeCmpStringHandles (hszTopic, mswindows_dde_topic_eval)) | |
1745 return (HDDEDATA) TRUE; | 1931 return (HDDEDATA) TRUE; |
1746 return (HDDEDATA) FALSE; | 1932 return (HDDEDATA) FALSE; |
1747 | 1933 |
1748 case XTYP_WILDCONNECT: | 1934 case XTYP_WILDCONNECT: |
1749 { | 1935 { |
1750 /* We only support one {service,topic} pair */ | 1936 /* We support two {service,topic} pairs */ |
1751 HSZPAIR pairs[2] = | 1937 HSZPAIR pairs[3] = |
1752 { | 1938 { |
1753 { mswindows_dde_service, mswindows_dde_topic_system }, { 0, 0 } }; | 1939 { mswindows_dde_service, mswindows_dde_topic_system }, |
1754 | 1940 { mswindows_dde_service, mswindows_dde_topic_eval }, |
1755 if (!(hszItem | 1941 { 0, 0 } |
1756 || DdeCmpStringHandles (hszItem, mswindows_dde_service)) && | 1942 }; |
1757 !(hszTopic | 1943 |
1758 || DdeCmpStringHandles (hszTopic, mswindows_dde_topic_system))) | 1944 if ((!hszItem |
1945 || !DdeCmpStringHandles (hszItem, mswindows_dde_service)) && | |
1946 (!hszTopic | |
1947 || !DdeCmpStringHandles (hszTopic, mswindows_dde_topic_system) | |
1948 || !DdeCmpStringHandles (hszTopic, mswindows_dde_topic_eval))) | |
1759 return (DdeCreateDataHandle (mswindows_dde_mlid, (LPBYTE) pairs, | 1949 return (DdeCreateDataHandle (mswindows_dde_mlid, (LPBYTE) pairs, |
1760 sizeof (pairs), 0L, 0, uFmt, 0)); | 1950 sizeof (pairs), 0L, 0, uFmt, 0)); |
1761 } | 1951 } |
1762 return (HDDEDATA) NULL; | 1952 return (HDDEDATA) NULL; |
1763 | 1953 |
1954 case XTYP_ADVSTART: | |
1955 if (!mswindows_dde_enable) | |
1956 return (HDDEDATA) FALSE; | |
1957 | |
1958 /* We only support advise loops on the eval topic for text data */ | |
1959 if (!DdeCmpStringHandles (hszTopic, mswindows_dde_topic_eval) | |
1960 && (uFmt == CF_TEXT || uFmt == CF_UNICODETEXT)) | |
1961 { | |
1962 /* Only allocated items or Result, are allowed */ | |
1963 if (!DdeCmpStringHandles (hszItem, mswindows_dde_item_result)) | |
1964 return (HDDEDATA) TRUE; | |
1965 | |
1966 { | |
1967 EXTERNAL_LIST_LOOP_2 (elt, Vdde_advise_items) | |
1968 { | |
1969 Lisp_Object val; | |
1970 HSZ hsz; | |
1971 if (!SYMBOLP (elt)) | |
1972 continue; | |
1973 val = Fget (elt, QHSZ, Qnil); | |
1974 if (!FLOATP (val)) | |
1975 continue; | |
1976 hsz = (HSZ) (int) XFLOAT_DATA (val); | |
1977 if (!DdeCmpStringHandles (hszItem, hsz)) | |
1978 return (HDDEDATA) TRUE; | |
1979 } | |
1980 } | |
1981 } | |
1982 return (HDDEDATA) FALSE; | |
1983 | |
1984 /* Both advise requests and normal requests work the same */ | |
1985 case XTYP_ADVREQ: | |
1986 case XTYP_REQUEST: | |
1987 if (!mswindows_dde_enable) | |
1988 return (HDDEDATA) NULL; | |
1989 | |
1990 if (DdeCmpStringHandles (hszTopic, mswindows_dde_topic_eval) != 0) | |
1991 return (HDDEDATA) NULL; | |
1992 | |
1993 /* If this is a normal request and we're in the middle of | |
1994 * an Execute, block until the Execute completes. | |
1995 */ | |
1996 if (dde_eval_pending && uType == XTYP_REQUEST) | |
1997 return (HDDEDATA) CBR_BLOCK; | |
1998 | |
1999 /* We can only support requests for ANSI or Unicode text */ | |
2000 if (uFmt != CF_TEXT && uFmt != CF_UNICODETEXT) | |
2001 return (HDDEDATA) NULL; | |
2002 | |
2003 { | |
2004 Lisp_Object args[2]; | |
2005 struct gcpro gcpro1; | |
2006 Lisp_Object res; | |
2007 Extbyte *result; | |
2008 DWORD bytes; | |
2009 | |
2010 args[0] = Qnil; | |
2011 args[1] = Qnil; | |
2012 GCPRO1 (args[0]); | |
2013 gcpro1.nvars = 2; | |
2014 | |
2015 | |
2016 if (!DdeCmpStringHandles (hszItem, mswindows_dde_item_result)) | |
2017 { | |
2018 if (NILP (dde_eval_error)) | |
2019 { | |
2020 args[0] = build_string ("OK: %s"); | |
2021 args[1] = dde_eval_result; | |
2022 } | |
2023 else | |
2024 { | |
2025 args[0] = build_string ("ERR: %s"); | |
2026 args[1] = dde_eval_error; | |
2027 } | |
2028 } | |
2029 else | |
2030 { | |
2031 EXTERNAL_LIST_LOOP_2 (elt, Vdde_advise_items) | |
2032 { | |
2033 Lisp_Object val; | |
2034 HSZ hsz; | |
2035 if (!SYMBOLP (elt)) | |
2036 continue; | |
2037 val = Fget (elt, QHSZ, Qnil); | |
2038 if (!FLOATP (val)) | |
2039 continue; | |
2040 hsz = (HSZ) (int) XFLOAT_DATA (val); | |
2041 if (!DdeCmpStringHandles (hszItem, hsz)) | |
2042 args[1] = Fsymbol_value (elt); | |
2043 } | |
2044 args[0] = build_string ("%s"); | |
2045 } | |
2046 | |
2047 res = Fformat (2, args); | |
2048 UNGCPRO; | |
2049 | |
2050 bytes = (uFmt == CF_TEXT ? 1 : 2) * (XSTRING_LENGTH (res) + 1); | |
2051 TO_EXTERNAL_FORMAT (LISP_STRING, res, | |
2052 C_STRING_ALLOCA, result, | |
2053 uFmt == CF_TEXT ? Qmswindows_multibyte | |
2054 : Qmswindows_unicode); | |
2055 | |
2056 /* If we cannot create the data handle, this passes the null | |
2057 * return back to the client, which signals an error as we wish. | |
2058 */ | |
2059 return DdeCreateDataHandle (mswindows_dde_mlid, (LPBYTE)result, | |
2060 bytes, 0L, hszItem, uFmt, 0); | |
2061 } | |
2062 | |
1764 case XTYP_EXECUTE: | 2063 case XTYP_EXECUTE: |
1765 if (!mswindows_dde_enable) | 2064 if (!mswindows_dde_enable) |
1766 return (HDDEDATA) DDE_FBUSY; | 2065 return (HDDEDATA) DDE_FBUSY; |
1767 | 2066 |
1768 if (!DdeCmpStringHandles (hszTopic, mswindows_dde_topic_system)) | 2067 if (!DdeCmpStringHandles (hszTopic, mswindows_dde_topic_eval)) |
2068 { | |
2069 DWORD len; | |
2070 LPBYTE extcmd; | |
2071 Lisp_Object tmp; | |
2072 | |
2073 /* Grab a pointer to the raw data supplied */ | |
2074 extcmd = DdeAccessData (hdata, &len); | |
2075 | |
2076 TO_INTERNAL_FORMAT (DATA, (extcmd, len), | |
2077 LISP_STRING, tmp, | |
2078 Qmswindows_tstr); | |
2079 | |
2080 /* Release and free the data handle */ | |
2081 DdeUnaccessData (hdata); | |
2082 DdeFreeDataHandle (hdata); | |
2083 | |
2084 /* Set a flag to say that the evaluation isn't yet complete, | |
2085 * enqueue the evaluation, send a dummy event to trigger the | |
2086 * event loop (I've no idea why this is needed, but it works...) | |
2087 * and return success to the client. | |
2088 */ | |
2089 dde_eval_pending = 1; | |
2090 enqueue_magic_eval_event (dde_eval, tmp); | |
2091 mswindows_enqueue_magic_event (NULL, XM_BUMPQUEUE); | |
2092 return (HDDEDATA) DDE_FACK; | |
2093 } | |
2094 else if (!DdeCmpStringHandles (hszTopic, mswindows_dde_topic_system)) | |
1769 { | 2095 { |
1770 DWORD len = DdeGetData (hdata, NULL, 0, 0); | 2096 DWORD len = DdeGetData (hdata, NULL, 0, 0); |
1771 LPBYTE extcmd = (LPBYTE) ALLOCA (len + 1); | 2097 LPBYTE extcmd = (LPBYTE) ALLOCA (len + 1); |
1772 Ibyte *cmd; | 2098 Ibyte *cmd; |
1773 Ibyte *end; | 2099 Ibyte *end; |
1784 C_STRING_ALLOCA, cmd, | 2110 C_STRING_ALLOCA, cmd, |
1785 Qmswindows_tstr); | 2111 Qmswindows_tstr); |
1786 | 2112 |
1787 /* Check syntax & that it's an [Open("foo")] command, which we | 2113 /* Check syntax & that it's an [Open("foo")] command, which we |
1788 * treat like a file drop */ | 2114 * treat like a file drop */ |
1789 /* #### Ought to be generalised and accept some other commands */ | |
1790 if (*cmd == '[') | 2115 if (*cmd == '[') |
1791 cmd++; | 2116 cmd++; |
1792 if (qxestrncasecmp_c (cmd, MSWINDOWS_DDE_ITEM_OPEN, | 2117 if (qxestrncasecmp_c (cmd, MSWINDOWS_DDE_ITEM_OPEN, |
1793 strlen (MSWINDOWS_DDE_ITEM_OPEN))) | 2118 strlen (MSWINDOWS_DDE_ITEM_OPEN))) |
1794 return DDE_FNOTPROCESSED; | 2119 return DDE_FNOTPROCESSED; |
2964 messages directly to the windows procedure when doing solid drags | 3289 messages directly to the windows procedure when doing solid drags |
2965 and the message queue doesn't get processed. */ | 3290 and the message queue doesn't get processed. */ |
2966 mswindows_handle_paint (XFRAME (mswindows_find_frame (hwnd))); | 3291 mswindows_handle_paint (XFRAME (mswindows_find_frame (hwnd))); |
2967 break; | 3292 break; |
2968 | 3293 |
3294 case WM_ACTIVATE: | |
3295 { | |
3296 /* | |
3297 * If we receive a WM_ACTIVATE message that indicates that our frame | |
3298 * is being activated, make sure that the frame is marked visible | |
3299 * if the window itself is visible. This seems to fix the problem | |
3300 * where XEmacs appears to lock-up after switching desktops with | |
3301 * some virtual window managers. | |
3302 */ | |
3303 int state = (int)(short) LOWORD(wParam); | |
3304 #ifdef DEBUG_XEMACS | |
3305 if (debug_mswindows_events) | |
3306 stderr_out("state = %d\n", state); | |
3307 #endif /* DEBUG_XEMACS */ | |
3308 if (state == WA_ACTIVE || state == WA_CLICKACTIVE) | |
3309 { | |
3310 #ifdef DEBUG_XEMACS | |
3311 if (debug_mswindows_events) | |
3312 stderr_out(" activating\n"); | |
3313 #endif /* DEBUG_XEMACS */ | |
3314 | |
3315 fobj = mswindows_find_frame (hwnd); | |
3316 frame = XFRAME (fobj); | |
3317 if (IsWindowVisible (hwnd)) | |
3318 { | |
3319 #ifdef DEBUG_XEMACS | |
3320 if (debug_mswindows_events) | |
3321 stderr_out(" window is visible\n"); | |
3322 #endif /* DEBUG_XEMACS */ | |
3323 if (!FRAME_VISIBLE_P (frame)) | |
3324 { | |
3325 #ifdef DEBUG_XEMACS | |
3326 if (debug_mswindows_events) | |
3327 stderr_out(" frame is not visible\n"); | |
3328 #endif /* DEBUG_XEMACS */ | |
3329 /* | |
3330 * It seems that we have to enqueue the XM_MAPFRAME event | |
3331 * prior to setting the frame visible so that | |
3332 * suspend-or-iconify-emacs works properly. | |
3333 */ | |
3334 mswindows_enqueue_magic_event (hwnd, XM_MAPFRAME); | |
3335 FRAME_VISIBLE_P (frame) = 1; | |
3336 FRAME_ICONIFIED_P (frame) = 0; | |
3337 } | |
3338 #ifdef DEBUG_XEMACS | |
3339 else | |
3340 { | |
3341 if (debug_mswindows_events) | |
3342 stderr_out(" frame is visible\n"); | |
3343 } | |
3344 #endif /* DEBUG_XEMACS */ | |
3345 } | |
3346 #ifdef DEBUG_XEMACS | |
3347 else | |
3348 { | |
3349 if (debug_mswindows_events) | |
3350 stderr_out(" window is not visible\n"); | |
3351 } | |
3352 #endif /* DEBUG_XEMACS */ | |
3353 } | |
3354 return qxeDefWindowProc (hwnd, message_, wParam, lParam); | |
3355 } | |
3356 break; | |
3357 | |
2969 case WM_WINDOWPOSCHANGED: | 3358 case WM_WINDOWPOSCHANGED: |
2970 /* This is sent before WM_SIZE; in fact, the processing of this | 3359 /* This is sent before WM_SIZE; in fact, the processing of this |
2971 by DefWindowProc() sends WM_SIZE. But WM_SIZE is not sent when | 3360 by DefWindowProc() sends WM_SIZE. But WM_SIZE is not sent when |
2972 a window is hidden (make-frame-invisible), so we need to process | 3361 a window is hidden (make-frame-invisible), so we need to process |
2973 this and update the state flags. */ | 3362 this and update the state flags. */ |
3073 FRAME_MSWINDOWS_TARGET_RECT (frame) = 0; | 3462 FRAME_MSWINDOWS_TARGET_RECT (frame) = 0; |
3074 } | 3463 } |
3075 } | 3464 } |
3076 else | 3465 else |
3077 { | 3466 { |
3078 if (!msframe->sizing && !FRAME_VISIBLE_P (frame)) { | 3467 if (!msframe->sizing && !FRAME_VISIBLE_P (frame)) |
3079 mswindows_enqueue_magic_event (hwnd, XM_MAPFRAME); | 3468 { |
3080 /* APA: Now that the magic XM_MAPFRAME event has | 3469 mswindows_enqueue_magic_event (hwnd, XM_MAPFRAME); |
3081 * been sent we can mark the frame as visible (just | 3470 /* APA: Now that the magic XM_MAPFRAME event has |
3082 * like 21.1 did). */ | 3471 * been sent we can mark the frame as visible (just |
3083 FRAME_VISIBLE_P (frame) = 1; | 3472 * like 21.1 did). */ |
3084 } | 3473 FRAME_VISIBLE_P (frame) = 1; |
3474 } | |
3085 | 3475 |
3086 if (!msframe->sizing || mswindows_dynamic_frame_resize) | 3476 if (!msframe->sizing || mswindows_dynamic_frame_resize) |
3087 redisplay (); | 3477 redisplay (); |
3088 } | 3478 } |
3089 } | 3479 } |
4723 if (debug_mswindows_events > 1) | 5113 if (debug_mswindows_events > 1) |
4724 { | 5114 { |
4725 stderr_out (" wparam=%d lparam=%d hwnd=%x frame: ", | 5115 stderr_out (" wparam=%d lparam=%d hwnd=%x frame: ", |
4726 wParam, (int) lParam, (unsigned int) hwnd); | 5116 wParam, (int) lParam, (unsigned int) hwnd); |
4727 debug_print (frame); | 5117 debug_print (frame); |
5118 if (message_ == WM_WINDOWPOSCHANGED || | |
5119 message_ == WM_WINDOWPOSCHANGING) | |
5120 { | |
5121 WINDOWPOS *wp = (WINDOWPOS *) lParam; | |
5122 stderr_out(" WINDOWPOS: x=%d, y=%d, h=%d, w=%d\n", | |
5123 wp->x, wp->y, wp->cx, wp->cy); | |
5124 } | |
5125 else if (message_ == WM_MOVE) | |
5126 { | |
5127 int x = (int)(short) LOWORD(lParam); /* horizontal position */ | |
5128 int y = (int)(short) HIWORD(lParam); /* vertical position */ | |
5129 stderr_out(" MOVE: x=%d, y=%d\n", x, y); | |
5130 } | |
5131 else if (message_ == WM_SIZE) | |
5132 { | |
5133 int w = (int)(short) LOWORD(lParam); /* width */ | |
5134 int h = (int)(short) HIWORD(lParam); /* height */ | |
5135 stderr_out(" SIZE: w=%d, h=%d\n", w, h); | |
5136 } | |
4728 } | 5137 } |
4729 else | 5138 else |
4730 stderr_out ("\n"); | 5139 stderr_out ("\n"); |
4731 } | 5140 } |
4732 | 5141 |
4760 mswindows_event_stream->unselect_process_cb = emacs_mswindows_unselect_process; | 5169 mswindows_event_stream->unselect_process_cb = emacs_mswindows_unselect_process; |
4761 mswindows_event_stream->create_io_streams_cb = emacs_mswindows_create_io_streams; | 5170 mswindows_event_stream->create_io_streams_cb = emacs_mswindows_create_io_streams; |
4762 mswindows_event_stream->delete_io_streams_cb = emacs_mswindows_delete_io_streams; | 5171 mswindows_event_stream->delete_io_streams_cb = emacs_mswindows_delete_io_streams; |
4763 mswindows_event_stream->current_event_timestamp_cb = | 5172 mswindows_event_stream->current_event_timestamp_cb = |
4764 emacs_mswindows_current_event_timestamp; | 5173 emacs_mswindows_current_event_timestamp; |
5174 | |
5175 dde_eval_pending = 0; | |
4765 } | 5176 } |
4766 | 5177 |
4767 void | 5178 void |
4768 vars_of_event_mswindows (void) | 5179 vars_of_event_mswindows (void) |
4769 { | 5180 { |
4778 staticpro (&mswindows_s_dispatch_event_queue); | 5189 staticpro (&mswindows_s_dispatch_event_queue); |
4779 mswindows_s_dispatch_event_queue_tail = Qnil; | 5190 mswindows_s_dispatch_event_queue_tail = Qnil; |
4780 dump_add_root_object (&mswindows_s_dispatch_event_queue_tail); | 5191 dump_add_root_object (&mswindows_s_dispatch_event_queue_tail); |
4781 | 5192 |
4782 mswindows_error_caught_in_modal_loop = 0; | 5193 mswindows_error_caught_in_modal_loop = 0; |
5194 | |
5195 #ifdef HAVE_DRAGNDROP | |
5196 Fprovide (Qdde); | |
5197 | |
5198 DEFVAR_LISP ("dde-advise-items", &Vdde_advise_items /* | |
5199 A list of allocated DDE advise items. | |
5200 Each item is an uninterned symbol, created using dde-alloc-advise-item. | |
5201 | |
5202 The symbol's value is the data which is returned to the DDE client when | |
5203 a request for the item is made (or a dde-advise call is made). | |
5204 | |
5205 The symbol also has a 'HSZ property, which holds the DDE string handle | |
5206 for the item, as a float. This is for internal use only, and should not | |
5207 be modified. | |
5208 */ ); | |
5209 Vdde_advise_items = Qnil; | |
5210 | |
5211 dde_eval_result = Qnil; | |
5212 staticpro (&dde_eval_result); | |
5213 dde_eval_error = Qnil; | |
5214 staticpro (&dde_eval_error); | |
5215 #endif | |
4783 | 5216 |
4784 #ifdef DEBUG_XEMACS | 5217 #ifdef DEBUG_XEMACS |
4785 DEFVAR_INT ("debug-mswindows-events", &debug_mswindows_events /* | 5218 DEFVAR_INT ("debug-mswindows-events", &debug_mswindows_events /* |
4786 If non-zero, display debug information about Windows messages that XEmacs sees. | 5219 If non-zero, display debug information about Windows messages that XEmacs sees. |
4787 Information is displayed in a console window. Currently defined values are: | 5220 Information is displayed in a console window. Currently defined values are: |
4851 } | 5284 } |
4852 | 5285 |
4853 void | 5286 void |
4854 syms_of_event_mswindows (void) | 5287 syms_of_event_mswindows (void) |
4855 { | 5288 { |
5289 #ifdef HAVE_DRAGNDROP | |
5290 DEFSYMBOL(QHSZ); | |
5291 DEFSUBR(Fdde_alloc_advise_item); | |
5292 DEFSUBR(Fdde_free_advise_item); | |
5293 DEFSUBR(Fdde_advise); | |
5294 #endif | |
4856 } | 5295 } |
4857 | 5296 |
4858 void | 5297 void |
4859 lstream_type_create_mswindows_selectable (void) | 5298 lstream_type_create_mswindows_selectable (void) |
4860 { | 5299 { |