comparison src/channel.c @ 8218:3456e2ebebd4 v7.4.1402

commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 23 17:14:37 2016 +0100 patch 7.4.1402 Problem: GTK 3 is not supported. Solution: Add GTK 3 support. (Kazunobu Kuriyama)
author Christian Brabandt <cb@256bit.org>
date Tue, 23 Feb 2016 17:15:05 +0100
parents b717dae2f26d
children 4f0677020a43
comparison
equal deleted inserted replaced
8217:c52abf35df88 8218:3456e2ebebd4
359 channel_read_fd((int)(long)clientData); 359 channel_read_fd((int)(long)clientData);
360 } 360 }
361 #endif 361 #endif
362 362
363 #ifdef FEAT_GUI_GTK 363 #ifdef FEAT_GUI_GTK
364 # if GTK_CHECK_VERSION(3,0,0)
365 static gboolean
366 messageFromNetbeans(GIOChannel *unused1 UNUSED,
367 GIOCondition unused2 UNUSED,
368 gpointer clientData)
369 {
370 channel_read_fd(GPOINTER_TO_INT(clientData));
371 return TRUE; /* Return FALSE instead in case the event source is to
372 * be removed after this function returns. */
373 }
374 # else
364 static void 375 static void
365 messageFromNetbeans(gpointer clientData, 376 messageFromNetbeans(gpointer clientData,
366 gint unused1 UNUSED, 377 gint unused1 UNUSED,
367 GdkInputCondition unused2 UNUSED) 378 GdkInputCondition unused2 UNUSED)
368 { 379 {
369 channel_read_fd((int)(long)clientData); 380 channel_read_fd((int)(long)clientData);
370 } 381 }
382 # endif
371 #endif 383 #endif
372 384
373 static void 385 static void
374 channel_gui_register_one(channel_T *channel, int part) 386 channel_gui_register_one(channel_T *channel, int part)
375 { 387 {
386 # else 398 # else
387 # ifdef FEAT_GUI_GTK 399 # ifdef FEAT_GUI_GTK
388 /* Tell gdk we are interested in being called when there 400 /* Tell gdk we are interested in being called when there
389 * is input on the editor connection socket. */ 401 * is input on the editor connection socket. */
390 if (channel->ch_part[part].ch_inputHandler == 0) 402 if (channel->ch_part[part].ch_inputHandler == 0)
403 # if GTK_CHECK_VERSION(3,0,0)
404 {
405 GIOChannel *chnnl = g_io_channel_unix_new(
406 (gint)channel->ch_part[part].ch_fd);
407
408 channel->ch_part[part].ch_inputHandler = g_io_add_watch(
409 chnnl,
410 G_IO_IN|G_IO_HUP|G_IO_ERR|G_IO_PRI,
411 messageFromNetbeans,
412 GINT_TO_POINTER(channel->ch_part[part].ch_fd));
413
414 g_io_channel_unref(chnnl);
415 }
416 # else
391 channel->ch_part[part].ch_inputHandler = gdk_input_add( 417 channel->ch_part[part].ch_inputHandler = gdk_input_add(
392 (gint)channel->ch_part[part].ch_fd, 418 (gint)channel->ch_part[part].ch_fd,
393 (GdkInputCondition) 419 (GdkInputCondition)
394 ((int)GDK_INPUT_READ + (int)GDK_INPUT_EXCEPTION), 420 ((int)GDK_INPUT_READ + (int)GDK_INPUT_EXCEPTION),
395 messageFromNetbeans, 421 messageFromNetbeans,
396 (gpointer)(long)channel->ch_part[part].ch_fd); 422 (gpointer)(long)channel->ch_part[part].ch_fd);
423 # endif
397 # else 424 # else
398 # ifdef FEAT_GUI_W32 425 # ifdef FEAT_GUI_W32
399 /* Tell Windows we are interested in receiving message when there 426 /* Tell Windows we are interested in receiving message when there
400 * is input on the editor connection socket. */ 427 * is input on the editor connection socket. */
401 if (channel->ch_part[part].ch_inputHandler == -1) 428 if (channel->ch_part[part].ch_inputHandler == -1)
455 } 482 }
456 # else 483 # else
457 # ifdef FEAT_GUI_GTK 484 # ifdef FEAT_GUI_GTK
458 if (channel->ch_part[part].ch_inputHandler != 0) 485 if (channel->ch_part[part].ch_inputHandler != 0)
459 { 486 {
487 # if GTK_CHECK_VERSION(3,0,0)
488 g_source_remove(channel->ch_part[part].ch_inputHandler);
489 # else
460 gdk_input_remove(channel->ch_part[part].ch_inputHandler); 490 gdk_input_remove(channel->ch_part[part].ch_inputHandler);
491 # endif
461 channel->ch_part[part].ch_inputHandler = 0; 492 channel->ch_part[part].ch_inputHandler = 0;
462 } 493 }
463 # else 494 # else
464 # ifdef FEAT_GUI_W32 495 # ifdef FEAT_GUI_W32
465 if (channel->ch_part[part].ch_inputHandler == 0) 496 if (channel->ch_part[part].ch_inputHandler == 0)
604 { 635 {
605 struct timeval tv; 636 struct timeval tv;
606 fd_set wfds; 637 fd_set wfds;
607 #if defined(__APPLE__) && __APPLE__ == 1 638 #if defined(__APPLE__) && __APPLE__ == 1
608 # define PASS_RFDS 639 # define PASS_RFDS
609 fd_set rfds; 640 fd_set rfds;
610 641
611 FD_ZERO(&rfds); 642 FD_ZERO(&rfds);
612 FD_SET(sd, &rfds); 643 FD_SET(sd, &rfds);
613 #endif 644 #endif
614 FD_ZERO(&wfds); 645 FD_ZERO(&wfds);