Mercurial > vim
comparison src/winclip.c @ 15868:7fad90423bd2 v8.1.0941
patch 8.1.0941: macros for MS-Windows are inconsistent
commit https://github.com/vim/vim/commit/4f97475d326c2773a78561fb874e4f23c25cbcd9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 17 17:44:42 2019 +0100
patch 8.1.0941: macros for MS-Windows are inconsistent
Problem: Macros for MS-Windows are inconsistent, using "32", "3264 and
others.
Solution: Use MSWIN for all MS-Windows builds. Use FEAT_GUI_MSWIN for the
GUI build. (Hirohito Higashi, closes #3932)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 17 Feb 2019 17:45:08 +0100 |
parents | 62b3805506b3 |
children | 209f65bb155f |
comparison
equal
deleted
inserted
replaced
15867:4a3823e692d3 | 15868:7fad90423bd2 |
---|---|
20 /* | 20 /* |
21 * Compile only the clipboard handling features when compiling for cygwin | 21 * Compile only the clipboard handling features when compiling for cygwin |
22 * posix environment. | 22 * posix environment. |
23 */ | 23 */ |
24 #ifdef FEAT_CYGWIN_WIN32_CLIPBOARD | 24 #ifdef FEAT_CYGWIN_WIN32_CLIPBOARD |
25 # define WIN3264 | 25 # define MSWIN |
26 # define WIN32_LEAN_AND_MEAN | 26 # define WIN32_LEAN_AND_MEAN |
27 # include <windows.h> | 27 # include <windows.h> |
28 # include "winclip.pro" | 28 # include "winclip.pro" |
29 #endif | 29 #endif |
30 | 30 |
297 clip_mch_request_selection(VimClipboard *cbd) | 297 clip_mch_request_selection(VimClipboard *cbd) |
298 { | 298 { |
299 VimClipType_t metadata = { -1, -1, -1, -1 }; | 299 VimClipType_t metadata = { -1, -1, -1, -1 }; |
300 HGLOBAL hMem = NULL; | 300 HGLOBAL hMem = NULL; |
301 char_u *str = NULL; | 301 char_u *str = NULL; |
302 #if defined(WIN3264) | 302 #if defined(MSWIN) |
303 char_u *to_free = NULL; | 303 char_u *to_free = NULL; |
304 #endif | 304 #endif |
305 HGLOBAL rawh = NULL; | 305 HGLOBAL rawh = NULL; |
306 int str_size = 0; | 306 int str_size = 0; |
307 int maxlen; | 307 int maxlen; |
359 } | 359 } |
360 } | 360 } |
361 } | 361 } |
362 if (str == NULL) | 362 if (str == NULL) |
363 { | 363 { |
364 #if defined(WIN3264) | 364 #if defined(MSWIN) |
365 /* Try to get the clipboard in Unicode if it's not an empty string. */ | 365 /* Try to get the clipboard in Unicode if it's not an empty string. */ |
366 if (IsClipboardFormatAvailable(CF_UNICODETEXT) && metadata.ucslen != 0) | 366 if (IsClipboardFormatAvailable(CF_UNICODETEXT) && metadata.ucslen != 0) |
367 { | 367 { |
368 HGLOBAL hMemW; | 368 HGLOBAL hMemW; |
369 | 369 |
415 for (str_size = 0; str_size < maxlen; ++str_size) | 415 for (str_size = 0; str_size < maxlen; ++str_size) |
416 if (str[str_size] == NUL) | 416 if (str[str_size] == NUL) |
417 break; | 417 break; |
418 } | 418 } |
419 | 419 |
420 #if defined(WIN3264) | 420 #if defined(MSWIN) |
421 /* The text is in the active codepage. Convert to | 421 /* The text is in the active codepage. Convert to |
422 * 'encoding', going through UTF-16. */ | 422 * 'encoding', going through UTF-16. */ |
423 acp_to_enc(str, str_size, &to_free, &maxlen); | 423 acp_to_enc(str, str_size, &to_free, &maxlen); |
424 if (to_free != NULL) | 424 if (to_free != NULL) |
425 { | 425 { |
452 if (hMem != NULL) | 452 if (hMem != NULL) |
453 GlobalUnlock(hMem); | 453 GlobalUnlock(hMem); |
454 if (rawh != NULL) | 454 if (rawh != NULL) |
455 GlobalUnlock(rawh); | 455 GlobalUnlock(rawh); |
456 CloseClipboard(); | 456 CloseClipboard(); |
457 #if defined(WIN3264) | 457 #if defined(MSWIN) |
458 vim_free(to_free); | 458 vim_free(to_free); |
459 #endif | 459 #endif |
460 } | 460 } |
461 | 461 |
462 /* | 462 /* |
469 VimClipType_t metadata; | 469 VimClipType_t metadata; |
470 long_u txtlen; | 470 long_u txtlen; |
471 HGLOBAL hMemRaw = NULL; | 471 HGLOBAL hMemRaw = NULL; |
472 HGLOBAL hMem = NULL; | 472 HGLOBAL hMem = NULL; |
473 HGLOBAL hMemVim = NULL; | 473 HGLOBAL hMemVim = NULL; |
474 # if defined(WIN3264) | 474 # if defined(MSWIN) |
475 HGLOBAL hMemW = NULL; | 475 HGLOBAL hMemW = NULL; |
476 # endif | 476 # endif |
477 | 477 |
478 /* If the '*' register isn't already filled in, fill it in now */ | 478 /* If the '*' register isn't already filled in, fill it in now */ |
479 cbd->owned = TRUE; | 479 cbd->owned = TRUE; |
506 } | 506 } |
507 else | 507 else |
508 metadata.rawlen = 0; | 508 metadata.rawlen = 0; |
509 } | 509 } |
510 | 510 |
511 # if defined(WIN3264) | 511 # if defined(MSWIN) |
512 { | 512 { |
513 WCHAR *out; | 513 WCHAR *out; |
514 int len = metadata.txtlen; | 514 int len = metadata.txtlen; |
515 | 515 |
516 /* Convert the text to UTF-16. This is put on the clipboard as | 516 /* Convert the text to UTF-16. This is put on the clipboard as |
588 { | 588 { |
589 if (EmptyClipboard()) | 589 if (EmptyClipboard()) |
590 { | 590 { |
591 SetClipboardData(cbd->format, hMemVim); | 591 SetClipboardData(cbd->format, hMemVim); |
592 hMemVim = 0; | 592 hMemVim = 0; |
593 # if defined(WIN3264) | 593 # if defined(MSWIN) |
594 if (hMemW != NULL) | 594 if (hMemW != NULL) |
595 { | 595 { |
596 if (SetClipboardData(CF_UNICODETEXT, hMemW) != NULL) | 596 if (SetClipboardData(CF_UNICODETEXT, hMemW) != NULL) |
597 hMemW = NULL; | 597 hMemW = NULL; |
598 } | 598 } |
609 /* Free any allocations we didn't give to the clipboard: */ | 609 /* Free any allocations we didn't give to the clipboard: */ |
610 if (hMemRaw) | 610 if (hMemRaw) |
611 GlobalFree(hMemRaw); | 611 GlobalFree(hMemRaw); |
612 if (hMem) | 612 if (hMem) |
613 GlobalFree(hMem); | 613 GlobalFree(hMem); |
614 # if defined(WIN3264) | 614 # if defined(MSWIN) |
615 if (hMemW) | 615 if (hMemW) |
616 GlobalFree(hMemW); | 616 GlobalFree(hMemW); |
617 # endif | 617 # endif |
618 if (hMemVim) | 618 if (hMemVim) |
619 GlobalFree(hMemVim); | 619 GlobalFree(hMemVim); |
744 } | 744 } |
745 | 745 |
746 return enc_str; | 746 return enc_str; |
747 } | 747 } |
748 | 748 |
749 #if defined(WIN3264) || defined(PROTO) | 749 #if defined(MSWIN) || defined(PROTO) |
750 /* | 750 /* |
751 * Convert from the active codepage to 'encoding'. | 751 * Convert from the active codepage to 'encoding'. |
752 * Input is "str[str_size]". | 752 * Input is "str[str_size]". |
753 * The result is in allocated memory: "out[outlen]". With terminating NUL. | 753 * The result is in allocated memory: "out[outlen]". With terminating NUL. |
754 */ | 754 */ |