Skip to content

Commit

Permalink
Merge pull request #11 from masm11/revert-10-pgtk-no-conn
Browse files Browse the repository at this point in the history
Revert "Revert pgtkconn removal"
  • Loading branch information
Yuuki Harano committed Jan 20, 2020
2 parents 234779f + 4784a89 commit 2fe3355
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 170 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -2822,7 +2822,7 @@ LIBS=$OLD_LIBS
PGTK_OBJ=
PGTK_LIBS=
if test "$window_system" = "pgtk"; then
PGTK_OBJ="pgtkconn.o pgtkfns.o pgtkterm.o pgtkselect.o pgtkmenu.o pgtkim.o xsettings.o"
PGTK_OBJ="pgtkfns.o pgtkterm.o pgtkselect.o pgtkmenu.o pgtkim.o xsettings.o"
PGTK_LIBS="$GTK_LIBS -ldl"
AC_DEFINE([HAVE_PGTK], 1, [Define to 1 if you have pure Gtk+-3.])
fi
Expand Down
103 changes: 0 additions & 103 deletions src/pgtkconn.c

This file was deleted.

26 changes: 0 additions & 26 deletions src/pgtkconn.h

This file was deleted.

42 changes: 5 additions & 37 deletions src/pgtkterm.c
Expand Up @@ -58,7 +58,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include "font.h"
#include "xsettings.h"
#include "pgtkselect.h"
#include "pgtkconn.h"

#define STORE_KEYSYM_FOR_DEBUG(keysym) ((void)0)

Expand Down Expand Up @@ -96,7 +95,6 @@ static void pgtk_clip_to_row (struct window *w, struct glyph_row *row,
static struct frame *
pgtk_any_window_to_frame (GdkWindow *window);


static void evq_enqueue(union buffered_input_event *ev)
{
struct event_queue_t *evq = &event_q;
Expand Down Expand Up @@ -4304,17 +4302,7 @@ pgtk_delete_terminal (struct terminal *terminal)
dpyinfo->gdpy = NULL;
}

/* ...but if called from x_connection_closed, the display may already
be closed and dpyinfo->display was set to 0 to indicate that. Since
X server is most likely gone, explicit close is the only reliable
way to continue and avoid Bug#19147. */
else if (dpyinfo->connection >= 0)
emacs_close (dpyinfo->connection);

/* No more input on this descriptor. */
delete_keyboard_wait_descriptor (dpyinfo->connection);
/* Mark as dead. */
dpyinfo->connection = -1;
delete_keyboard_wait_descriptor(0);

pgtk_delete_display (dpyinfo);
unblock_input ();
Expand Down Expand Up @@ -6124,7 +6112,6 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name)
static char *initial_display = NULL;
char *dpy_name;
Lisp_Object lisp_dpy_name = Qnil;
int conn_fd;

block_input ();

Expand All @@ -6140,11 +6127,6 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name)
++x_initialized;
}

#if 0
if (! x_display_ok (SSDATA (display_name)))
error ("Display %s can't be opened", SSDATA (display_name));
#endif

dpy_name = SSDATA (display_name);
if (strlen(dpy_name) == 0 && initial_display != NULL)
dpy_name = initial_display;
Expand Down Expand Up @@ -6212,14 +6194,7 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name)
return 0;
}

conn_fd = pgtk_detect_connection(dpy);
if (conn_fd < 0) {
unblock_input();
return 0;
}

/* We have definitely succeeded. Record the new connection. */

dpyinfo = xzalloc (sizeof *dpyinfo);
pgtk_initialize_display_info (dpyinfo);
terminal = pgtk_create_terminal (dpyinfo);
Expand Down Expand Up @@ -6251,7 +6226,6 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name)

dpyinfo->name_list_element = Fcons (lisp_dpy_name, Qnil);
dpyinfo->gdpy = dpy;
dpyinfo->connection = conn_fd;

/* https://lists.gnu.org/r/emacs-devel/2015-11/msg00194.html */
dpyinfo->smallest_font_height = 1;
Expand Down Expand Up @@ -6297,16 +6271,10 @@ pgtk_term_init (Lisp_Object display_name, char *resource_name)

xsettings_initialize (dpyinfo);

/* This is only needed for distinguishing keyboard and process input. */
if (dpyinfo->connection != 0)
add_keyboard_wait_descriptor (dpyinfo->connection);

#ifdef F_SETOWN
fcntl (dpyinfo->connection, F_SETOWN, getpid ());
#endif /* ! defined (F_SETOWN) */

if (interrupt_input)
init_sigio (dpyinfo->connection);
/* According to w32term.c this will stop the emacs console handling
code from handling keyboard input when we want gtk to do that for
us */
add_keyboard_wait_descriptor (0);

pgtk_selection_init();

Expand Down
3 changes: 0 additions & 3 deletions src/pgtkterm.h
Expand Up @@ -131,9 +131,6 @@ struct pgtk_display_info
/* This says how to access this display in Gdk. */
GdkDisplay *gdpy;

/* A connection number (file descriptor) for the display. */
int connection;

/* This is a cons cell of the form (NAME . FONT-LIST-CACHE). */
Lisp_Object name_list_element;

Expand Down

0 comments on commit 2fe3355

Please sign in to comment.