diff options
| author | Paul Eggert | 2014-12-26 13:43:00 -0800 |
|---|---|---|
| committer | Paul Eggert | 2014-12-26 13:44:31 -0800 |
| commit | 7a305f8bb5d777caf68702212ef85e7b3cbf765b (patch) | |
| tree | dd04c55cd5e42e2c9f2388dadc96e148210e23a7 /src | |
| parent | 7284a174abc03c9ccf45aa43c939585beea351b7 (diff) | |
| download | emacs-7a305f8bb5d777caf68702212ef85e7b3cbf765b.tar.gz emacs-7a305f8bb5d777caf68702212ef85e7b3cbf765b.zip | |
Use bool for boolean in xselect.c, xsettings.c
* xselect.c (x_get_local_selection, struct selection_data)
(x_selection_request_lisp_error, struct prop_location)
(x_handle_selection_request, x_convert_selection)
(waiting_for_other_props_on_window, expect_property_change)
(wait_for_property_change, x_handle_property_notify)
(x_get_foreign_selection, x_get_window_property)
(receive_incremental_selection)
(x_get_window_property_as_lisp_data)
(lisp_data_to_selection_data, Fx_get_selection_internal)
(x_send_client_event):
* xselect.c, xterm.h (x_handle_dnd_message):
* xsettings.c (dpyinfo_valid, parse_settings, read_settings)
(apply_xft_settings, read_and_apply_settings)
(xft_settings_event, init_gsettings, init_xsettings)
(syms_of_xsettings):
Use bool for boolean.
* xselect.c (x_get_window_property): Omit last arg, which was an
unused boolean.
* xsettings.c (apply_xft_settings): Remove 2nd arg, which was
always true. All callers changed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 24 | ||||
| -rw-r--r-- | src/xselect.c | 95 | ||||
| -rw-r--r-- | src/xsettings.c | 58 | ||||
| -rw-r--r-- | src/xterm.h | 8 |
4 files changed, 102 insertions, 83 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 72601fe7c58..e8428abc926 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,27 @@ | |||
| 1 | 2014-12-26 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Use bool for boolean in xselect.c, xsettings.c | ||
| 4 | * xselect.c (x_get_local_selection, struct selection_data) | ||
| 5 | (x_selection_request_lisp_error, struct prop_location) | ||
| 6 | (x_handle_selection_request, x_convert_selection) | ||
| 7 | (waiting_for_other_props_on_window, expect_property_change) | ||
| 8 | (wait_for_property_change, x_handle_property_notify) | ||
| 9 | (x_get_foreign_selection, x_get_window_property) | ||
| 10 | (receive_incremental_selection) | ||
| 11 | (x_get_window_property_as_lisp_data) | ||
| 12 | (lisp_data_to_selection_data, Fx_get_selection_internal) | ||
| 13 | (x_send_client_event): | ||
| 14 | * xselect.c, xterm.h (x_handle_dnd_message): | ||
| 15 | * xsettings.c (dpyinfo_valid, parse_settings, read_settings) | ||
| 16 | (apply_xft_settings, read_and_apply_settings) | ||
| 17 | (xft_settings_event, init_gsettings, init_xsettings) | ||
| 18 | (syms_of_xsettings): | ||
| 19 | Use bool for boolean. | ||
| 20 | * xselect.c (x_get_window_property): Omit last arg, which was an | ||
| 21 | unused boolean. | ||
| 22 | * xsettings.c (apply_xft_settings): Remove 2nd arg, which was | ||
| 23 | always true. All callers changed. | ||
| 24 | |||
| 1 | 2014-12-26 Eli Zaretskii <eliz@gnu.org> | 25 | 2014-12-26 Eli Zaretskii <eliz@gnu.org> |
| 2 | 26 | ||
| 3 | * w32proc.c (sys_spawnve, get_lcid_callback): Use strcpy instead | 27 | * w32proc.c (sys_spawnve, get_lcid_callback): Use strcpy instead |
diff --git a/src/xselect.c b/src/xselect.c index 92e89822293..3f8a1321954 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -46,9 +46,10 @@ struct prop_location; | |||
| 46 | struct selection_data; | 46 | struct selection_data; |
| 47 | 47 | ||
| 48 | static void x_decline_selection_request (struct input_event *); | 48 | static void x_decline_selection_request (struct input_event *); |
| 49 | static int x_convert_selection (struct input_event *, Lisp_Object, Lisp_Object, | 49 | static bool x_convert_selection (struct input_event *, Lisp_Object, |
| 50 | Atom, int, struct x_display_info *); | 50 | Lisp_Object, Atom, bool, |
| 51 | static int waiting_for_other_props_on_window (Display *, Window); | 51 | struct x_display_info *); |
| 52 | static bool waiting_for_other_props_on_window (Display *, Window); | ||
| 52 | static struct prop_location *expect_property_change (Display *, Window, | 53 | static struct prop_location *expect_property_change (Display *, Window, |
| 53 | Atom, int); | 54 | Atom, int); |
| 54 | static void unexpect_property_change (struct prop_location *); | 55 | static void unexpect_property_change (struct prop_location *); |
| @@ -360,7 +361,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value, | |||
| 360 | 361 | ||
| 361 | static Lisp_Object | 362 | static Lisp_Object |
| 362 | x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type, | 363 | x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type, |
| 363 | int local_request, struct x_display_info *dpyinfo) | 364 | bool local_request, struct x_display_info *dpyinfo) |
| 364 | { | 365 | { |
| 365 | Lisp_Object local_value; | 366 | Lisp_Object local_value; |
| 366 | Lisp_Object handler_fn, value, check; | 367 | Lisp_Object handler_fn, value, check; |
| @@ -470,7 +471,7 @@ struct selection_data | |||
| 470 | ptrdiff_t size; | 471 | ptrdiff_t size; |
| 471 | int format; | 472 | int format; |
| 472 | Atom type; | 473 | Atom type; |
| 473 | int nofree; | 474 | bool nofree; |
| 474 | Atom property; | 475 | Atom property; |
| 475 | /* This can be set to non-NULL during x_reply_selection_request, if | 476 | /* This can be set to non-NULL during x_reply_selection_request, if |
| 476 | the selection is waiting for an INCR transfer to complete. Don't | 477 | the selection is waiting for an INCR transfer to complete. Don't |
| @@ -498,7 +499,7 @@ x_selection_request_lisp_error (void) | |||
| 498 | for (cs = converted_selections; cs; cs = next) | 499 | for (cs = converted_selections; cs; cs = next) |
| 499 | { | 500 | { |
| 500 | next = cs->next; | 501 | next = cs->next; |
| 501 | if (cs->nofree == 0 && cs->data) | 502 | if (! cs->nofree && cs->data) |
| 502 | xfree (cs->data); | 503 | xfree (cs->data); |
| 503 | xfree (cs); | 504 | xfree (cs); |
| 504 | } | 505 | } |
| @@ -531,7 +532,7 @@ struct prop_location | |||
| 531 | Window window; | 532 | Window window; |
| 532 | Atom property; | 533 | Atom property; |
| 533 | int desired_state; | 534 | int desired_state; |
| 534 | int arrived; | 535 | bool arrived; |
| 535 | struct prop_location *next; | 536 | struct prop_location *next; |
| 536 | }; | 537 | }; |
| 537 | 538 | ||
| @@ -747,7 +748,7 @@ x_handle_selection_request (struct input_event *event) | |||
| 747 | Lisp_Object target_symbol = x_atom_to_symbol (dpyinfo, target); | 748 | Lisp_Object target_symbol = x_atom_to_symbol (dpyinfo, target); |
| 748 | Atom property = SELECTION_EVENT_PROPERTY (event); | 749 | Atom property = SELECTION_EVENT_PROPERTY (event); |
| 749 | Lisp_Object local_selection_data; | 750 | Lisp_Object local_selection_data; |
| 750 | int success = 0; | 751 | bool success = false; |
| 751 | ptrdiff_t count = SPECPDL_INDEX (); | 752 | ptrdiff_t count = SPECPDL_INDEX (); |
| 752 | GCPRO2 (local_selection_data, target_symbol); | 753 | GCPRO2 (local_selection_data, target_symbol); |
| 753 | 754 | ||
| @@ -805,9 +806,9 @@ x_handle_selection_request (struct input_event *event) | |||
| 805 | 806 | ||
| 806 | if (subproperty != None) | 807 | if (subproperty != None) |
| 807 | x_convert_selection (event, selection_symbol, subtarget, | 808 | x_convert_selection (event, selection_symbol, subtarget, |
| 808 | subproperty, 1, dpyinfo); | 809 | subproperty, true, dpyinfo); |
| 809 | } | 810 | } |
| 810 | success = 1; | 811 | success = true; |
| 811 | } | 812 | } |
| 812 | else | 813 | else |
| 813 | { | 814 | { |
| @@ -815,7 +816,7 @@ x_handle_selection_request (struct input_event *event) | |||
| 815 | property = SELECTION_EVENT_TARGET (event); | 816 | property = SELECTION_EVENT_TARGET (event); |
| 816 | success = x_convert_selection (event, selection_symbol, | 817 | success = x_convert_selection (event, selection_symbol, |
| 817 | target_symbol, property, | 818 | target_symbol, property, |
| 818 | 0, dpyinfo); | 819 | false, dpyinfo); |
| 819 | } | 820 | } |
| 820 | 821 | ||
| 821 | DONE: | 822 | DONE: |
| @@ -844,15 +845,15 @@ x_handle_selection_request (struct input_event *event) | |||
| 844 | 845 | ||
| 845 | /* Perform the requested selection conversion, and write the data to | 846 | /* Perform the requested selection conversion, and write the data to |
| 846 | the converted_selections linked list, where it can be accessed by | 847 | the converted_selections linked list, where it can be accessed by |
| 847 | x_reply_selection_request. If FOR_MULTIPLE is non-zero, write out | 848 | x_reply_selection_request. If FOR_MULTIPLE, write out |
| 848 | the data even if conversion fails, using conversion_fail_tag. | 849 | the data even if conversion fails, using conversion_fail_tag. |
| 849 | 850 | ||
| 850 | Return 0 if the selection failed to convert, 1 otherwise. */ | 851 | Return true iff successful. */ |
| 851 | 852 | ||
| 852 | static int | 853 | static bool |
| 853 | x_convert_selection (struct input_event *event, Lisp_Object selection_symbol, | 854 | x_convert_selection (struct input_event *event, Lisp_Object selection_symbol, |
| 854 | Lisp_Object target_symbol, Atom property, | 855 | Lisp_Object target_symbol, Atom property, |
| 855 | int for_multiple, struct x_display_info *dpyinfo) | 856 | bool for_multiple, struct x_display_info *dpyinfo) |
| 856 | { | 857 | { |
| 857 | struct gcpro gcpro1; | 858 | struct gcpro gcpro1; |
| 858 | Lisp_Object lisp_selection; | 859 | Lisp_Object lisp_selection; |
| @@ -861,7 +862,7 @@ x_convert_selection (struct input_event *event, Lisp_Object selection_symbol, | |||
| 861 | 862 | ||
| 862 | lisp_selection | 863 | lisp_selection |
| 863 | = x_get_local_selection (selection_symbol, target_symbol, | 864 | = x_get_local_selection (selection_symbol, target_symbol, |
| 864 | 0, dpyinfo); | 865 | false, dpyinfo); |
| 865 | 866 | ||
| 866 | /* A nil return value means we can't perform the conversion. */ | 867 | /* A nil return value means we can't perform the conversion. */ |
| 867 | if (NILP (lisp_selection) | 868 | if (NILP (lisp_selection) |
| @@ -874,7 +875,7 @@ x_convert_selection (struct input_event *event, Lisp_Object selection_symbol, | |||
| 874 | cs->size = 1; | 875 | cs->size = 1; |
| 875 | cs->format = 32; | 876 | cs->format = 32; |
| 876 | cs->type = XA_ATOM; | 877 | cs->type = XA_ATOM; |
| 877 | cs->nofree = 1; | 878 | cs->nofree = true; |
| 878 | cs->property = property; | 879 | cs->property = property; |
| 879 | cs->wait_object = NULL; | 880 | cs->wait_object = NULL; |
| 880 | cs->next = converted_selections; | 881 | cs->next = converted_selections; |
| @@ -882,20 +883,20 @@ x_convert_selection (struct input_event *event, Lisp_Object selection_symbol, | |||
| 882 | } | 883 | } |
| 883 | 884 | ||
| 884 | UNGCPRO; | 885 | UNGCPRO; |
| 885 | return 0; | 886 | return false; |
| 886 | } | 887 | } |
| 887 | 888 | ||
| 888 | /* Otherwise, record the converted selection to binary. */ | 889 | /* Otherwise, record the converted selection to binary. */ |
| 889 | cs = xmalloc (sizeof *cs); | 890 | cs = xmalloc (sizeof *cs); |
| 890 | cs->data = NULL; | 891 | cs->data = NULL; |
| 891 | cs->nofree = 1; | 892 | cs->nofree = true; |
| 892 | cs->property = property; | 893 | cs->property = property; |
| 893 | cs->wait_object = NULL; | 894 | cs->wait_object = NULL; |
| 894 | cs->next = converted_selections; | 895 | cs->next = converted_selections; |
| 895 | converted_selections = cs; | 896 | converted_selections = cs; |
| 896 | lisp_data_to_selection_data (dpyinfo, lisp_selection, cs); | 897 | lisp_data_to_selection_data (dpyinfo, lisp_selection, cs); |
| 897 | UNGCPRO; | 898 | UNGCPRO; |
| 898 | return 1; | 899 | return true; |
| 899 | } | 900 | } |
| 900 | 901 | ||
| 901 | /* Handle a SelectionClear event EVENT, which indicates that some | 902 | /* Handle a SelectionClear event EVENT, which indicates that some |
| @@ -1012,19 +1013,16 @@ x_clear_frame_selections (struct frame *f) | |||
| 1012 | } | 1013 | } |
| 1013 | } | 1014 | } |
| 1014 | 1015 | ||
| 1015 | /* Nonzero if any properties for DISPLAY and WINDOW | 1016 | /* True if any properties for DISPLAY and WINDOW |
| 1016 | are on the list of what we are waiting for. */ | 1017 | are on the list of what we are waiting for. */ |
| 1017 | 1018 | ||
| 1018 | static int | 1019 | static bool |
| 1019 | waiting_for_other_props_on_window (Display *display, Window window) | 1020 | waiting_for_other_props_on_window (Display *display, Window window) |
| 1020 | { | 1021 | { |
| 1021 | struct prop_location *rest = property_change_wait_list; | 1022 | for (struct prop_location *p = property_change_wait_list; p; p = p->next) |
| 1022 | while (rest) | 1023 | if (p->display == display && p->window == window) |
| 1023 | if (rest->display == display && rest->window == window) | 1024 | return true; |
| 1024 | return 1; | 1025 | return false; |
| 1025 | else | ||
| 1026 | rest = rest->next; | ||
| 1027 | return 0; | ||
| 1028 | } | 1026 | } |
| 1029 | 1027 | ||
| 1030 | /* Add an entry to the list of property changes we are waiting for. | 1028 | /* Add an entry to the list of property changes we are waiting for. |
| @@ -1043,7 +1041,7 @@ expect_property_change (Display *display, Window window, | |||
| 1043 | pl->property = property; | 1041 | pl->property = property; |
| 1044 | pl->desired_state = state; | 1042 | pl->desired_state = state; |
| 1045 | pl->next = property_change_wait_list; | 1043 | pl->next = property_change_wait_list; |
| 1046 | pl->arrived = 0; | 1044 | pl->arrived = false; |
| 1047 | property_change_wait_list = pl; | 1045 | property_change_wait_list = pl; |
| 1048 | return pl; | 1046 | return pl; |
| 1049 | } | 1047 | } |
| @@ -1106,7 +1104,7 @@ wait_for_property_change (struct prop_location *location) | |||
| 1106 | EMACS_INT secs = timeout / 1000; | 1104 | EMACS_INT secs = timeout / 1000; |
| 1107 | int nsecs = (timeout % 1000) * 1000000; | 1105 | int nsecs = (timeout % 1000) * 1000000; |
| 1108 | TRACE2 (" Waiting %"pI"d secs, %d nsecs", secs, nsecs); | 1106 | TRACE2 (" Waiting %"pI"d secs, %d nsecs", secs, nsecs); |
| 1109 | wait_reading_process_output (secs, nsecs, 0, 0, | 1107 | wait_reading_process_output (secs, nsecs, 0, false, |
| 1110 | property_change_reply, NULL, 0); | 1108 | property_change_reply, NULL, 0); |
| 1111 | 1109 | ||
| 1112 | if (NILP (XCAR (property_change_reply))) | 1110 | if (NILP (XCAR (property_change_reply))) |
| @@ -1138,7 +1136,7 @@ x_handle_property_notify (const XPropertyEvent *event) | |||
| 1138 | (event->state == PropertyDelete ? "deletion" : "change"), | 1136 | (event->state == PropertyDelete ? "deletion" : "change"), |
| 1139 | XGetAtomName (event->display, event->atom)); | 1137 | XGetAtomName (event->display, event->atom)); |
| 1140 | 1138 | ||
| 1141 | rest->arrived = 1; | 1139 | rest->arrived = true; |
| 1142 | 1140 | ||
| 1143 | /* If this is the one wait_for_property_change is waiting for, | 1141 | /* If this is the one wait_for_property_change is waiting for, |
| 1144 | tell it to wake up. */ | 1142 | tell it to wake up. */ |
| @@ -1204,7 +1202,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type, | |||
| 1204 | during this time. In fact, the SAVE_TARGETS mechanism requires | 1202 | during this time. In fact, the SAVE_TARGETS mechanism requires |
| 1205 | us to handle a clipboard manager's requests before it returns | 1203 | us to handle a clipboard manager's requests before it returns |
| 1206 | SelectionNotify. */ | 1204 | SelectionNotify. */ |
| 1207 | #if 0 | 1205 | #if false |
| 1208 | x_start_queuing_selection_requests (); | 1206 | x_start_queuing_selection_requests (); |
| 1209 | record_unwind_protect_void (x_stop_queuing_selection_requests); | 1207 | record_unwind_protect_void (x_stop_queuing_selection_requests); |
| 1210 | #endif | 1208 | #endif |
| @@ -1216,7 +1214,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type, | |||
| 1216 | secs = timeout / 1000; | 1214 | secs = timeout / 1000; |
| 1217 | nsecs = (timeout % 1000) * 1000000; | 1215 | nsecs = (timeout % 1000) * 1000000; |
| 1218 | TRACE1 (" Start waiting %"pI"d secs for SelectionNotify", secs); | 1216 | TRACE1 (" Start waiting %"pI"d secs for SelectionNotify", secs); |
| 1219 | wait_reading_process_output (secs, nsecs, 0, 0, | 1217 | wait_reading_process_output (secs, nsecs, 0, false, |
| 1220 | reading_selection_reply, NULL, 0); | 1218 | reading_selection_reply, NULL, 0); |
| 1221 | TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply))); | 1219 | TRACE1 (" Got event = %d", !NILP (XCAR (reading_selection_reply))); |
| 1222 | 1220 | ||
| @@ -1240,7 +1238,7 @@ static void | |||
| 1240 | x_get_window_property (Display *display, Window window, Atom property, | 1238 | x_get_window_property (Display *display, Window window, Atom property, |
| 1241 | unsigned char **data_ret, ptrdiff_t *bytes_ret, | 1239 | unsigned char **data_ret, ptrdiff_t *bytes_ret, |
| 1242 | Atom *actual_type_ret, int *actual_format_ret, | 1240 | Atom *actual_type_ret, int *actual_format_ret, |
| 1243 | unsigned long *actual_size_ret, int delete_p) | 1241 | unsigned long *actual_size_ret) |
| 1244 | { | 1242 | { |
| 1245 | ptrdiff_t total_size; | 1243 | ptrdiff_t total_size; |
| 1246 | unsigned long bytes_remaining; | 1244 | unsigned long bytes_remaining; |
| @@ -1413,7 +1411,7 @@ receive_incremental_selection (struct x_display_info *dpyinfo, | |||
| 1413 | XFlush (display); | 1411 | XFlush (display); |
| 1414 | unblock_input (); | 1412 | unblock_input (); |
| 1415 | 1413 | ||
| 1416 | while (1) | 1414 | while (true) |
| 1417 | { | 1415 | { |
| 1418 | unsigned char *tmp_data; | 1416 | unsigned char *tmp_data; |
| 1419 | ptrdiff_t tmp_size_bytes; | 1417 | ptrdiff_t tmp_size_bytes; |
| @@ -1427,7 +1425,7 @@ receive_incremental_selection (struct x_display_info *dpyinfo, | |||
| 1427 | TRACE0 (" Get property value"); | 1425 | TRACE0 (" Get property value"); |
| 1428 | x_get_window_property (display, window, property, | 1426 | x_get_window_property (display, window, property, |
| 1429 | &tmp_data, &tmp_size_bytes, | 1427 | &tmp_data, &tmp_size_bytes, |
| 1430 | type_ret, format_ret, size_ret, 1); | 1428 | type_ret, format_ret, size_ret); |
| 1431 | 1429 | ||
| 1432 | TRACE1 (" Read increment of %"pD"d bytes", tmp_size_bytes); | 1430 | TRACE1 (" Read increment of %"pD"d bytes", tmp_size_bytes); |
| 1433 | 1431 | ||
| @@ -1488,13 +1486,12 @@ x_get_window_property_as_lisp_data (struct x_display_info *dpyinfo, | |||
| 1488 | TRACE0 ("Reading selection data"); | 1486 | TRACE0 ("Reading selection data"); |
| 1489 | 1487 | ||
| 1490 | x_get_window_property (display, window, property, &data, &bytes, | 1488 | x_get_window_property (display, window, property, &data, &bytes, |
| 1491 | &actual_type, &actual_format, &actual_size, 1); | 1489 | &actual_type, &actual_format, &actual_size); |
| 1492 | if (! data) | 1490 | if (! data) |
| 1493 | { | 1491 | { |
| 1494 | int there_is_a_selection_owner; | ||
| 1495 | block_input (); | 1492 | block_input (); |
| 1496 | there_is_a_selection_owner | 1493 | bool there_is_a_selection_owner |
| 1497 | = XGetSelectionOwner (display, selection_atom); | 1494 | = XGetSelectionOwner (display, selection_atom) != 0; |
| 1498 | unblock_input (); | 1495 | unblock_input (); |
| 1499 | if (there_is_a_selection_owner) | 1496 | if (there_is_a_selection_owner) |
| 1500 | signal_error ("Selection owner couldn't convert", | 1497 | signal_error ("Selection owner couldn't convert", |
| @@ -1687,7 +1684,7 @@ lisp_data_to_selection_data (struct x_display_info *dpyinfo, | |||
| 1687 | Lisp_Object type = Qnil; | 1684 | Lisp_Object type = Qnil; |
| 1688 | 1685 | ||
| 1689 | eassert (cs != NULL); | 1686 | eassert (cs != NULL); |
| 1690 | cs->nofree = 0; | 1687 | cs->nofree = false; |
| 1691 | 1688 | ||
| 1692 | if (CONSP (obj) && SYMBOLP (XCAR (obj))) | 1689 | if (CONSP (obj) && SYMBOLP (XCAR (obj))) |
| 1693 | { | 1690 | { |
| @@ -1714,7 +1711,7 @@ lisp_data_to_selection_data (struct x_display_info *dpyinfo, | |||
| 1714 | cs->format = 8; | 1711 | cs->format = 8; |
| 1715 | cs->size = SBYTES (obj); | 1712 | cs->size = SBYTES (obj); |
| 1716 | cs->data = SDATA (obj); | 1713 | cs->data = SDATA (obj); |
| 1717 | cs->nofree = 1; | 1714 | cs->nofree = true; |
| 1718 | } | 1715 | } |
| 1719 | else if (SYMBOLP (obj)) | 1716 | else if (SYMBOLP (obj)) |
| 1720 | { | 1717 | { |
| @@ -1981,7 +1978,7 @@ On Nextstep, TIME-STAMP and TERMINAL are unused. */) | |||
| 1981 | if (!f) | 1978 | if (!f) |
| 1982 | error ("X selection unavailable for this frame"); | 1979 | error ("X selection unavailable for this frame"); |
| 1983 | 1980 | ||
| 1984 | val = x_get_local_selection (selection_symbol, target_type, 1, | 1981 | val = x_get_local_selection (selection_symbol, target_type, true, |
| 1985 | FRAME_DISPLAY_INFO (f)); | 1982 | FRAME_DISPLAY_INFO (f)); |
| 1986 | 1983 | ||
| 1987 | if (NILP (val) && FRAME_LIVE_P (f)) | 1984 | if (NILP (val) && FRAME_LIVE_P (f)) |
| @@ -2432,7 +2429,7 @@ FRAME is on. If FRAME is nil, the selected frame is used. */) | |||
| 2432 | 2429 | ||
| 2433 | /* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. */ | 2430 | /* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. */ |
| 2434 | 2431 | ||
| 2435 | int | 2432 | bool |
| 2436 | x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event, | 2433 | x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event, |
| 2437 | struct x_display_info *dpyinfo, struct input_event *bufp) | 2434 | struct x_display_info *dpyinfo, struct input_event *bufp) |
| 2438 | { | 2435 | { |
| @@ -2448,7 +2445,7 @@ x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event, | |||
| 2448 | for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i) | 2445 | for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i) |
| 2449 | if (dpyinfo->x_dnd_atoms[i] == event->message_type) break; | 2446 | if (dpyinfo->x_dnd_atoms[i] == event->message_type) break; |
| 2450 | 2447 | ||
| 2451 | if (i == dpyinfo->x_dnd_atoms_length) return 0; | 2448 | if (i == dpyinfo->x_dnd_atoms_length) return false; |
| 2452 | 2449 | ||
| 2453 | XSETFRAME (frame, f); | 2450 | XSETFRAME (frame, f); |
| 2454 | 2451 | ||
| @@ -2484,7 +2481,7 @@ x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event, | |||
| 2484 | bufp->arg = vec; | 2481 | bufp->arg = vec; |
| 2485 | bufp->modifiers = 0; | 2482 | bufp->modifiers = 0; |
| 2486 | 2483 | ||
| 2487 | return 1; | 2484 | return true; |
| 2488 | } | 2485 | } |
| 2489 | 2486 | ||
| 2490 | DEFUN ("x-send-client-message", Fx_send_client_message, | 2487 | DEFUN ("x-send-client-message", Fx_send_client_message, |
| @@ -2535,7 +2532,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, | |||
| 2535 | Window wdest; | 2532 | Window wdest; |
| 2536 | XEvent event; | 2533 | XEvent event; |
| 2537 | struct frame *f = decode_window_system_frame (from); | 2534 | struct frame *f = decode_window_system_frame (from); |
| 2538 | int to_root; | 2535 | bool to_root; |
| 2539 | 2536 | ||
| 2540 | CHECK_NUMBER (format); | 2537 | CHECK_NUMBER (format); |
| 2541 | CHECK_CONS (values); | 2538 | CHECK_CONS (values); |
| @@ -2592,7 +2589,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, | |||
| 2592 | event then goes to clients selecting for events on the root window. */ | 2589 | event then goes to clients selecting for events on the root window. */ |
| 2593 | x_catch_errors (dpyinfo->display); | 2590 | x_catch_errors (dpyinfo->display); |
| 2594 | { | 2591 | { |
| 2595 | int propagate = to_root ? False : True; | 2592 | bool propagate = !to_root; |
| 2596 | long mask = to_root ? 0xffffff : 0; | 2593 | long mask = to_root ? 0xffffff : 0; |
| 2597 | 2594 | ||
| 2598 | XSendEvent (dpyinfo->display, wdest, propagate, mask, &event); | 2595 | XSendEvent (dpyinfo->display, wdest, propagate, mask, &event); |
diff --git a/src/xsettings.c b/src/xsettings.c index 5f4275df545..afdeab9f206 100644 --- a/src/xsettings.c +++ b/src/xsettings.c | |||
| @@ -68,11 +68,11 @@ store_config_changed_event (Lisp_Object arg, Lisp_Object display_name) | |||
| 68 | kbd_buffer_store_event (&event); | 68 | kbd_buffer_store_event (&event); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | /* Return non-zero if DPYINFO is still valid. */ | 71 | /* Return true if DPYINFO is still valid. */ |
| 72 | static int | 72 | static bool |
| 73 | dpyinfo_valid (struct x_display_info *dpyinfo) | 73 | dpyinfo_valid (struct x_display_info *dpyinfo) |
| 74 | { | 74 | { |
| 75 | int found = 0; | 75 | bool found = false; |
| 76 | if (dpyinfo != NULL) | 76 | if (dpyinfo != NULL) |
| 77 | { | 77 | { |
| 78 | struct x_display_info *d; | 78 | struct x_display_info *d; |
| @@ -419,7 +419,7 @@ parse_settings (unsigned char *prop, | |||
| 419 | CARD32 vlen, ival = 0; | 419 | CARD32 vlen, ival = 0; |
| 420 | char name[128]; /* The names we are looking for are not this long. */ | 420 | char name[128]; /* The names we are looking for are not this long. */ |
| 421 | char sval[128]; /* The values we are looking for are not this long. */ | 421 | char sval[128]; /* The values we are looking for are not this long. */ |
| 422 | int want_this; | 422 | bool want_this; |
| 423 | int to_cpy; | 423 | int to_cpy; |
| 424 | 424 | ||
| 425 | sval[0] = '\0'; | 425 | sval[0] = '\0'; |
| @@ -565,9 +565,9 @@ parse_settings (unsigned char *prop, | |||
| 565 | 565 | ||
| 566 | /* Read settings from the XSettings property window on display for DPYINFO. | 566 | /* Read settings from the XSettings property window on display for DPYINFO. |
| 567 | Store settings read in SETTINGS. | 567 | Store settings read in SETTINGS. |
| 568 | Return non-zero if successful, zero if not. */ | 568 | Return true iff successful. */ |
| 569 | 569 | ||
| 570 | static int | 570 | static bool |
| 571 | read_settings (struct x_display_info *dpyinfo, struct xsettings *settings) | 571 | read_settings (struct x_display_info *dpyinfo, struct xsettings *settings) |
| 572 | { | 572 | { |
| 573 | Atom act_type; | 573 | Atom act_type; |
| @@ -597,17 +597,16 @@ read_settings (struct x_display_info *dpyinfo, struct xsettings *settings) | |||
| 597 | } | 597 | } |
| 598 | 598 | ||
| 599 | /* Apply Xft settings in SETTINGS to the Xft library. | 599 | /* Apply Xft settings in SETTINGS to the Xft library. |
| 600 | If SEND_EVENT_P is non-zero store a Lisp event that Xft settings changed. */ | 600 | Store a Lisp event that Xft settings changed. */ |
| 601 | 601 | ||
| 602 | static void | 602 | static void |
| 603 | apply_xft_settings (struct x_display_info *dpyinfo, | 603 | apply_xft_settings (struct x_display_info *dpyinfo, |
| 604 | int send_event_p, | ||
| 605 | struct xsettings *settings) | 604 | struct xsettings *settings) |
| 606 | { | 605 | { |
| 607 | #ifdef HAVE_XFT | 606 | #ifdef HAVE_XFT |
| 608 | FcPattern *pat; | 607 | FcPattern *pat; |
| 609 | struct xsettings oldsettings; | 608 | struct xsettings oldsettings; |
| 610 | int changed = 0; | 609 | bool changed = false; |
| 611 | 610 | ||
| 612 | memset (&oldsettings, 0, sizeof (oldsettings)); | 611 | memset (&oldsettings, 0, sizeof (oldsettings)); |
| 613 | pat = FcPatternCreate (); | 612 | pat = FcPatternCreate (); |
| @@ -627,7 +626,7 @@ apply_xft_settings (struct x_display_info *dpyinfo, | |||
| 627 | { | 626 | { |
| 628 | FcPatternDel (pat, FC_ANTIALIAS); | 627 | FcPatternDel (pat, FC_ANTIALIAS); |
| 629 | FcPatternAddBool (pat, FC_ANTIALIAS, settings->aa); | 628 | FcPatternAddBool (pat, FC_ANTIALIAS, settings->aa); |
| 630 | ++changed; | 629 | changed = true; |
| 631 | oldsettings.aa = settings->aa; | 630 | oldsettings.aa = settings->aa; |
| 632 | } | 631 | } |
| 633 | 632 | ||
| @@ -636,7 +635,7 @@ apply_xft_settings (struct x_display_info *dpyinfo, | |||
| 636 | { | 635 | { |
| 637 | FcPatternDel (pat, FC_HINTING); | 636 | FcPatternDel (pat, FC_HINTING); |
| 638 | FcPatternAddBool (pat, FC_HINTING, settings->hinting); | 637 | FcPatternAddBool (pat, FC_HINTING, settings->hinting); |
| 639 | ++changed; | 638 | changed = true; |
| 640 | oldsettings.hinting = settings->hinting; | 639 | oldsettings.hinting = settings->hinting; |
| 641 | } | 640 | } |
| 642 | if ((settings->seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings->rgba) | 641 | if ((settings->seen & SEEN_RGBA) != 0 && oldsettings.rgba != settings->rgba) |
| @@ -644,7 +643,7 @@ apply_xft_settings (struct x_display_info *dpyinfo, | |||
| 644 | FcPatternDel (pat, FC_RGBA); | 643 | FcPatternDel (pat, FC_RGBA); |
| 645 | FcPatternAddInteger (pat, FC_RGBA, settings->rgba); | 644 | FcPatternAddInteger (pat, FC_RGBA, settings->rgba); |
| 646 | oldsettings.rgba = settings->rgba; | 645 | oldsettings.rgba = settings->rgba; |
| 647 | ++changed; | 646 | changed = true; |
| 648 | } | 647 | } |
| 649 | 648 | ||
| 650 | /* Older fontconfig versions don't have FC_LCD_FILTER. */ | 649 | /* Older fontconfig versions don't have FC_LCD_FILTER. */ |
| @@ -653,7 +652,7 @@ apply_xft_settings (struct x_display_info *dpyinfo, | |||
| 653 | { | 652 | { |
| 654 | FcPatternDel (pat, FC_LCD_FILTER); | 653 | FcPatternDel (pat, FC_LCD_FILTER); |
| 655 | FcPatternAddInteger (pat, FC_LCD_FILTER, settings->lcdfilter); | 654 | FcPatternAddInteger (pat, FC_LCD_FILTER, settings->lcdfilter); |
| 656 | ++changed; | 655 | changed = true; |
| 657 | oldsettings.lcdfilter = settings->lcdfilter; | 656 | oldsettings.lcdfilter = settings->lcdfilter; |
| 658 | } | 657 | } |
| 659 | 658 | ||
| @@ -663,7 +662,7 @@ apply_xft_settings (struct x_display_info *dpyinfo, | |||
| 663 | { | 662 | { |
| 664 | FcPatternDel (pat, FC_HINT_STYLE); | 663 | FcPatternDel (pat, FC_HINT_STYLE); |
| 665 | FcPatternAddInteger (pat, FC_HINT_STYLE, settings->hintstyle); | 664 | FcPatternAddInteger (pat, FC_HINT_STYLE, settings->hintstyle); |
| 666 | ++changed; | 665 | changed = true; |
| 667 | oldsettings.hintstyle = settings->hintstyle; | 666 | oldsettings.hintstyle = settings->hintstyle; |
| 668 | } | 667 | } |
| 669 | #endif | 668 | #endif |
| @@ -673,7 +672,7 @@ apply_xft_settings (struct x_display_info *dpyinfo, | |||
| 673 | { | 672 | { |
| 674 | FcPatternDel (pat, FC_DPI); | 673 | FcPatternDel (pat, FC_DPI); |
| 675 | FcPatternAddDouble (pat, FC_DPI, settings->dpi); | 674 | FcPatternAddDouble (pat, FC_DPI, settings->dpi); |
| 676 | ++changed; | 675 | changed = true; |
| 677 | oldsettings.dpi = settings->dpi; | 676 | oldsettings.dpi = settings->dpi; |
| 678 | 677 | ||
| 679 | /* Changing the DPI on this display affects all frames on it. | 678 | /* Changing the DPI on this display affects all frames on it. |
| @@ -699,9 +698,8 @@ apply_xft_settings (struct x_display_info *dpyinfo, | |||
| 699 | char buf[sizeof format + d_formats * d_growth + lf_formats * lf_growth]; | 698 | char buf[sizeof format + d_formats * d_growth + lf_formats * lf_growth]; |
| 700 | 699 | ||
| 701 | XftDefaultSet (dpyinfo->display, pat); | 700 | XftDefaultSet (dpyinfo->display, pat); |
| 702 | if (send_event_p) | 701 | store_config_changed_event (Qfont_render, |
| 703 | store_config_changed_event (Qfont_render, | 702 | XCAR (dpyinfo->name_list_element)); |
| 704 | XCAR (dpyinfo->name_list_element)); | ||
| 705 | Vxft_settings | 703 | Vxft_settings |
| 706 | = make_formatted_string (buf, format, | 704 | = make_formatted_string (buf, format, |
| 707 | oldsettings.aa, oldsettings.hinting, | 705 | oldsettings.aa, oldsettings.hinting, |
| @@ -715,17 +713,17 @@ apply_xft_settings (struct x_display_info *dpyinfo, | |||
| 715 | } | 713 | } |
| 716 | 714 | ||
| 717 | /* Read XSettings from the display for DPYINFO. | 715 | /* Read XSettings from the display for DPYINFO. |
| 718 | If SEND_EVENT_P is non-zero store a Lisp event settings that changed. */ | 716 | If SEND_EVENT_P store a Lisp event settings that changed. */ |
| 719 | 717 | ||
| 720 | static void | 718 | static void |
| 721 | read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p) | 719 | read_and_apply_settings (struct x_display_info *dpyinfo, bool send_event_p) |
| 722 | { | 720 | { |
| 723 | struct xsettings settings; | 721 | struct xsettings settings; |
| 724 | 722 | ||
| 725 | if (!read_settings (dpyinfo, &settings)) | 723 | if (!read_settings (dpyinfo, &settings)) |
| 726 | return; | 724 | return; |
| 727 | 725 | ||
| 728 | apply_xft_settings (dpyinfo, True, &settings); | 726 | apply_xft_settings (dpyinfo, &settings); |
| 729 | if (settings.seen & SEEN_TB_STYLE) | 727 | if (settings.seen & SEEN_TB_STYLE) |
| 730 | { | 728 | { |
| 731 | if (send_event_p) | 729 | if (send_event_p) |
| @@ -751,27 +749,27 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p) | |||
| 751 | void | 749 | void |
| 752 | xft_settings_event (struct x_display_info *dpyinfo, const XEvent *event) | 750 | xft_settings_event (struct x_display_info *dpyinfo, const XEvent *event) |
| 753 | { | 751 | { |
| 754 | bool check_window_p = 0, apply_settings_p = 0; | 752 | bool check_window_p = false, apply_settings_p = false; |
| 755 | 753 | ||
| 756 | switch (event->type) | 754 | switch (event->type) |
| 757 | { | 755 | { |
| 758 | case DestroyNotify: | 756 | case DestroyNotify: |
| 759 | if (dpyinfo->xsettings_window == event->xany.window) | 757 | if (dpyinfo->xsettings_window == event->xany.window) |
| 760 | check_window_p = 1; | 758 | check_window_p = true; |
| 761 | break; | 759 | break; |
| 762 | 760 | ||
| 763 | case ClientMessage: | 761 | case ClientMessage: |
| 764 | if (event->xclient.message_type == dpyinfo->Xatom_xsettings_mgr | 762 | if (event->xclient.message_type == dpyinfo->Xatom_xsettings_mgr |
| 765 | && event->xclient.data.l[1] == dpyinfo->Xatom_xsettings_sel | 763 | && event->xclient.data.l[1] == dpyinfo->Xatom_xsettings_sel |
| 766 | && event->xclient.window == dpyinfo->root_window) | 764 | && event->xclient.window == dpyinfo->root_window) |
| 767 | check_window_p = 1; | 765 | check_window_p = true; |
| 768 | break; | 766 | break; |
| 769 | 767 | ||
| 770 | case PropertyNotify: | 768 | case PropertyNotify: |
| 771 | if (event->xproperty.window == dpyinfo->xsettings_window | 769 | if (event->xproperty.window == dpyinfo->xsettings_window |
| 772 | && event->xproperty.state == PropertyNewValue | 770 | && event->xproperty.state == PropertyNewValue |
| 773 | && event->xproperty.atom == dpyinfo->Xatom_xsettings_prop) | 771 | && event->xproperty.atom == dpyinfo->Xatom_xsettings_prop) |
| 774 | apply_settings_p = 1; | 772 | apply_settings_p = true; |
| 775 | break; | 773 | break; |
| 776 | } | 774 | } |
| 777 | 775 | ||
| @@ -781,11 +779,11 @@ xft_settings_event (struct x_display_info *dpyinfo, const XEvent *event) | |||
| 781 | dpyinfo->xsettings_window = None; | 779 | dpyinfo->xsettings_window = None; |
| 782 | get_prop_window (dpyinfo); | 780 | get_prop_window (dpyinfo); |
| 783 | if (dpyinfo->xsettings_window != None) | 781 | if (dpyinfo->xsettings_window != None) |
| 784 | apply_settings_p = 1; | 782 | apply_settings_p = true; |
| 785 | } | 783 | } |
| 786 | 784 | ||
| 787 | if (apply_settings_p) | 785 | if (apply_settings_p) |
| 788 | read_and_apply_settings (dpyinfo, True); | 786 | read_and_apply_settings (dpyinfo, true); |
| 789 | } | 787 | } |
| 790 | 788 | ||
| 791 | /* Initialize GSettings and read startup values. */ | 789 | /* Initialize GSettings and read startup values. */ |
| @@ -795,7 +793,7 @@ init_gsettings (void) | |||
| 795 | { | 793 | { |
| 796 | #ifdef HAVE_GSETTINGS | 794 | #ifdef HAVE_GSETTINGS |
| 797 | GVariant *val; | 795 | GVariant *val; |
| 798 | int schema_found = 0; | 796 | bool schema_found = false; |
| 799 | 797 | ||
| 800 | #if ! GLIB_CHECK_VERSION (2, 36, 0) | 798 | #if ! GLIB_CHECK_VERSION (2, 36, 0) |
| 801 | g_type_init (); | 799 | g_type_init (); |
| @@ -937,7 +935,7 @@ init_xsettings (struct x_display_info *dpyinfo) | |||
| 937 | 935 | ||
| 938 | get_prop_window (dpyinfo); | 936 | get_prop_window (dpyinfo); |
| 939 | if (dpyinfo->xsettings_window != None) | 937 | if (dpyinfo->xsettings_window != None) |
| 940 | read_and_apply_settings (dpyinfo, False); | 938 | read_and_apply_settings (dpyinfo, false); |
| 941 | 939 | ||
| 942 | unblock_input (); | 940 | unblock_input (); |
| 943 | } | 941 | } |
| @@ -1030,7 +1028,7 @@ syms_of_xsettings (void) | |||
| 1030 | When this is non-nil and the system defined fixed width font changes, we | 1028 | When this is non-nil and the system defined fixed width font changes, we |
| 1031 | update frames dynamically. | 1029 | update frames dynamically. |
| 1032 | If this variable is nil, Emacs ignores system font changes. */); | 1030 | If this variable is nil, Emacs ignores system font changes. */); |
| 1033 | use_system_font = 0; | 1031 | use_system_font = false; |
| 1034 | 1032 | ||
| 1035 | DEFVAR_LISP ("xft-settings", Vxft_settings, | 1033 | DEFVAR_LISP ("xft-settings", Vxft_settings, |
| 1036 | doc: /* Font settings applied to Xft. */); | 1034 | doc: /* Font settings applied to Xft. */); |
diff --git a/src/xterm.h b/src/xterm.h index 84bb58c7232..13877d33935 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -1049,10 +1049,10 @@ extern void x_send_client_event (Lisp_Object display, | |||
| 1049 | Lisp_Object format, | 1049 | Lisp_Object format, |
| 1050 | Lisp_Object values); | 1050 | Lisp_Object values); |
| 1051 | 1051 | ||
| 1052 | extern int x_handle_dnd_message (struct frame *, | 1052 | extern bool x_handle_dnd_message (struct frame *, |
| 1053 | const XClientMessageEvent *, | 1053 | const XClientMessageEvent *, |
| 1054 | struct x_display_info *, | 1054 | struct x_display_info *, |
| 1055 | struct input_event *); | 1055 | struct input_event *); |
| 1056 | extern int x_check_property_data (Lisp_Object); | 1056 | extern int x_check_property_data (Lisp_Object); |
| 1057 | extern void x_fill_property_data (Display *, | 1057 | extern void x_fill_property_data (Display *, |
| 1058 | Lisp_Object, | 1058 | Lisp_Object, |