Fix various problems encountered
* egl.c (AddShmFormat): Fix coding style. * explicit_synchronization.c (HandleSurfaceCommit): Remove redundant NULL check. * run.c (RunStep): Flush clients after completing selection transfers. Fix sizeof when allocating pollfds. * seat.c (CancelResizeOperation): Avoid NULL-pointer dereference when subcompositor is not specified. * shm.c (DereferencePool, CreatePool): Remove redundant checks of pool->size; it can never be zero. * subsurface.c (Setup): Remove redundant NULL check. * text_input.c (SetCursorRectangle): Fix some statements. (FindTextSections, EncodeIMString, CheckStyles, ConvertString) (PreeditString, CommitString): Fix usage of format modifiers in debug trace code. * xdata.c (HandleSelectionNotify): Use selection time, not event time. * xdg_popup.c (MoveWindow, InternalReposition): Remove various redundant checks.
This commit is contained in:
parent
c4f2e07a4b
commit
3fe08b5c7c
9 changed files with 33 additions and 40 deletions
4
egl.c
4
egl.c
|
@ -2110,8 +2110,8 @@ static void
|
||||||
AddShmFormat (uint32_t format)
|
AddShmFormat (uint32_t format)
|
||||||
{
|
{
|
||||||
shm_formats
|
shm_formats
|
||||||
= XLRealloc (shm_formats,
|
= XLRealloc (shm_formats, (sizeof *shm_formats
|
||||||
sizeof *shm_formats * ++n_shm_formats);
|
* ++n_shm_formats));
|
||||||
|
|
||||||
shm_formats[n_shm_formats - 1].format = format;
|
shm_formats[n_shm_formats - 1].format = format;
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,8 +248,7 @@ HandleSurfaceCommit (Synchronization *synchronization, Surface *surface)
|
||||||
surface. */
|
surface. */
|
||||||
surface->release->surface = surface;
|
surface->release->surface = surface;
|
||||||
|
|
||||||
if (surface->release
|
if (!(surface->pending_state.pending & PendingBuffer
|
||||||
&& !(surface->pending_state.pending & PendingBuffer
|
|
||||||
&& surface->pending_state.buffer))
|
&& surface->pending_state.buffer))
|
||||||
wl_resource_post_error (synchronization->resource,
|
wl_resource_post_error (synchronization->resource,
|
||||||
NoBuffer, "no buffer attached"
|
NoBuffer, "no buffer attached"
|
||||||
|
|
11
run.c
11
run.c
|
@ -203,10 +203,7 @@ RunStep (void)
|
||||||
struct pollfd *fds;
|
struct pollfd *fds;
|
||||||
PollFd **pollfds, *item, *last;
|
PollFd **pollfds, *item, *last;
|
||||||
|
|
||||||
XFlush (compositor.display);
|
fds = alloca (sizeof *fds * (num_poll_fd + 2));
|
||||||
wl_display_flush_clients (compositor.wl_display);
|
|
||||||
|
|
||||||
fds = alloca (sizeof fds * (num_poll_fd + 2));
|
|
||||||
|
|
||||||
/* This is used as an optimization to not have to loop over the
|
/* This is used as an optimization to not have to loop over the
|
||||||
entire descriptor list twice. */
|
entire descriptor list twice. */
|
||||||
|
@ -220,6 +217,12 @@ RunStep (void)
|
||||||
/* Drain complete selection transfers. */
|
/* Drain complete selection transfers. */
|
||||||
FinishTransfers ();
|
FinishTransfers ();
|
||||||
|
|
||||||
|
/* FinishTransfers can potentially send events to Wayland clients
|
||||||
|
and make X requests. Flush after it is called. */
|
||||||
|
XFlush (compositor.display);
|
||||||
|
wl_display_flush_clients (compositor.wl_display);
|
||||||
|
|
||||||
|
/* Obtain the connections. */
|
||||||
x_connection = ConnectionNumber (compositor.display);
|
x_connection = ConnectionNumber (compositor.display);
|
||||||
wl_connection = wl_event_loop_get_fd (compositor.wl_event_loop);
|
wl_connection = wl_event_loop_get_fd (compositor.wl_event_loop);
|
||||||
|
|
||||||
|
|
2
seat.c
2
seat.c
|
@ -2018,7 +2018,7 @@ CancelResizeOperation (Seat *seat, Time time, Subcompositor *subcompositor,
|
||||||
|
|
||||||
/* Ungrab the pointer. */
|
/* Ungrab the pointer. */
|
||||||
XIUngrabDevice (compositor.display, seat->master_pointer,
|
XIUngrabDevice (compositor.display, seat->master_pointer,
|
||||||
xev->time);
|
time);
|
||||||
|
|
||||||
if (!subcompositor)
|
if (!subcompositor)
|
||||||
return;
|
return;
|
||||||
|
|
4
shm.c
4
shm.c
|
@ -88,8 +88,6 @@ DereferencePool (Pool *pool)
|
||||||
/* Cancel the busfault trap. */
|
/* Cancel the busfault trap. */
|
||||||
|
|
||||||
if (pool->data != (void *) -1
|
if (pool->data != (void *) -1
|
||||||
/* If the pool is of size 0, no busfault was installed. */
|
|
||||||
&& pool->size
|
|
||||||
/* If reading from the pool cannot possibly cause SIGBUS, then
|
/* If reading from the pool cannot possibly cause SIGBUS, then
|
||||||
no bus fault trap was installed. */
|
no bus fault trap was installed. */
|
||||||
&& !(pool->flags & PoolCannotSigbus))
|
&& !(pool->flags & PoolCannotSigbus))
|
||||||
|
@ -486,7 +484,7 @@ CreatePool (struct wl_client *client, struct wl_resource *resource,
|
||||||
/* Begin trapping SIGBUS from this pool. The client may truncate
|
/* Begin trapping SIGBUS from this pool. The client may truncate
|
||||||
the file without telling us, in which case accessing its contents
|
the file without telling us, in which case accessing its contents
|
||||||
will cause crashes. */
|
will cause crashes. */
|
||||||
if (!(pool->flags & PoolCannotSigbus) && pool->size)
|
if (!(pool->flags & PoolCannotSigbus))
|
||||||
XLRecordBusfault (pool->data, pool->size);
|
XLRecordBusfault (pool->data, pool->size);
|
||||||
|
|
||||||
pool->fd = fd;
|
pool->fd = fd;
|
||||||
|
|
|
@ -737,7 +737,6 @@ Setup (Surface *surface, Role *role)
|
||||||
ViewInsert (parent_view, surface->view);
|
ViewInsert (parent_view, surface->view);
|
||||||
|
|
||||||
/* Now move the subsurface to its initial location (0, 0) */
|
/* Now move the subsurface to its initial location (0, 0) */
|
||||||
if (subsurface->parent)
|
|
||||||
MoveFractional (subsurface);
|
MoveFractional (subsurface);
|
||||||
|
|
||||||
/* Now add the subsurface to the parent's list of subsurfaces. */
|
/* Now add the subsurface to the parent's list of subsurfaces. */
|
||||||
|
|
26
text_input.c
26
text_input.c
|
@ -485,7 +485,7 @@ SetCursorRectangle (struct wl_client *client, struct wl_resource *resource,
|
||||||
if ((input->current_state.pending & PendingCursorRectangle
|
if ((input->current_state.pending & PendingCursorRectangle
|
||||||
/* PendingEnabled will clear the current state's cursor
|
/* PendingEnabled will clear the current state's cursor
|
||||||
rectangle. */
|
rectangle. */
|
||||||
&& !input->pending_state.pending & PendingEnabled)
|
&& !(input->pending_state.pending & PendingEnabled))
|
||||||
&& x == input->current_state.cursor_x
|
&& x == input->current_state.cursor_x
|
||||||
&& y == input->current_state.cursor_y
|
&& y == input->current_state.cursor_y
|
||||||
&& width == input->current_state.cursor_width
|
&& width == input->current_state.cursor_width
|
||||||
|
@ -1956,8 +1956,8 @@ FindTextSections (const char *string, size_t string_size,
|
||||||
while (factor)
|
while (factor)
|
||||||
{
|
{
|
||||||
found = memrchr (string, '\n', found - string);
|
found = memrchr (string, '\n', found - string);
|
||||||
DebugPrint ("LineStart processing found %p %zd", found,
|
DebugPrint ("LineStart processing found %p %td", found,
|
||||||
found - string);
|
found ? found - string : 0);
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
|
@ -2126,7 +2126,7 @@ EncodeIMString (const char *input, size_t input_size, int *chars)
|
||||||
{
|
{
|
||||||
rc = iconv (cd, &inbuf, &input_size, &outptr,
|
rc = iconv (cd, &inbuf, &input_size, &outptr,
|
||||||
&outbytesleft);
|
&outbytesleft);
|
||||||
DebugPrint ("iconv gave: %tu", rc);
|
DebugPrint ("iconv gave: %zu", rc);
|
||||||
|
|
||||||
if (rc == (size_t) -1)
|
if (rc == (size_t) -1)
|
||||||
{
|
{
|
||||||
|
@ -2144,7 +2144,7 @@ EncodeIMString (const char *input, size_t input_size, int *chars)
|
||||||
outsize += BUFSIZ;
|
outsize += BUFSIZ;
|
||||||
outbytesleft += BUFSIZ;
|
outbytesleft += BUFSIZ;
|
||||||
|
|
||||||
DebugPrint ("expanding outsize to %tu, outbytesleft now %tu",
|
DebugPrint ("expanding outsize to %zu, outbytesleft now %zu",
|
||||||
outsize, outbytesleft);
|
outsize, outbytesleft);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2167,7 +2167,7 @@ EncodeIMString (const char *input, size_t input_size, int *chars)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The conversion finished. */
|
/* The conversion finished. */
|
||||||
DebugPrint ("conversion finished, size_out %tu",
|
DebugPrint ("conversion finished, size_out %zu",
|
||||||
outsize - outbytesleft);
|
outsize - outbytesleft);
|
||||||
|
|
||||||
/* Now, count the number of multibyte characters. */
|
/* Now, count the number of multibyte characters. */
|
||||||
|
@ -2624,7 +2624,7 @@ CheckStyles (XIM xim)
|
||||||
/* Otherwise, find the best style in our order of preference. */
|
/* Otherwise, find the best style in our order of preference. */
|
||||||
for (i = 0; xim_style_order[i] != XimStyleNone; ++i)
|
for (i = 0; xim_style_order[i] != XimStyleNone; ++i)
|
||||||
{
|
{
|
||||||
DebugPrint ("considering style: %u", xim_style_order[i]);
|
DebugPrint ("considering style: %d", (int) xim_style_order[i]);
|
||||||
|
|
||||||
switch (xim_style_order[i])
|
switch (xim_style_order[i])
|
||||||
{
|
{
|
||||||
|
@ -2945,7 +2945,7 @@ ConvertString (char *buffer, size_t nbytes, size_t *size_out)
|
||||||
outsize = BUFSIZ;
|
outsize = BUFSIZ;
|
||||||
outbytesleft = outsize;
|
outbytesleft = outsize;
|
||||||
|
|
||||||
DebugPrint ("converting string of size %tu", nbytes);
|
DebugPrint ("converting string of size %zu", nbytes);
|
||||||
|
|
||||||
/* Reset the cd state. */
|
/* Reset the cd state. */
|
||||||
iconv (current_cd, NULL, NULL, &outptr, &outbytesleft);
|
iconv (current_cd, NULL, NULL, &outptr, &outbytesleft);
|
||||||
|
@ -2956,7 +2956,7 @@ ConvertString (char *buffer, size_t nbytes, size_t *size_out)
|
||||||
rc = iconv (current_cd, &buffer, &nbytes,
|
rc = iconv (current_cd, &buffer, &nbytes,
|
||||||
&outptr, &outbytesleft);
|
&outptr, &outbytesleft);
|
||||||
|
|
||||||
DebugPrint ("iconv gave: %tu", rc);
|
DebugPrint ("iconv gave: %zu", rc);
|
||||||
|
|
||||||
if (rc == (size_t) -1)
|
if (rc == (size_t) -1)
|
||||||
{
|
{
|
||||||
|
@ -2974,7 +2974,7 @@ ConvertString (char *buffer, size_t nbytes, size_t *size_out)
|
||||||
outsize += BUFSIZ;
|
outsize += BUFSIZ;
|
||||||
outbytesleft += BUFSIZ;
|
outbytesleft += BUFSIZ;
|
||||||
|
|
||||||
DebugPrint ("expanding outsize to %tu, outbytesleft now %tu",
|
DebugPrint ("expanding outsize to %zu, outbytesleft now %zu",
|
||||||
outsize, outbytesleft);
|
outsize, outbytesleft);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2983,7 +2983,7 @@ ConvertString (char *buffer, size_t nbytes, size_t *size_out)
|
||||||
}
|
}
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
DebugPrint ("conversion finished, size_out %tu",
|
DebugPrint ("conversion finished, size_out %zu",
|
||||||
outsize - outbytesleft);
|
outsize - outbytesleft);
|
||||||
|
|
||||||
/* Return outbuf and the number of bytes put in it. */
|
/* Return outbuf and the number of bytes put in it. */
|
||||||
|
@ -3032,7 +3032,7 @@ PreeditString (TextInput *input, const char *buffer,
|
||||||
end += skip;
|
end += skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugPrint ("end-start (%p-%p): %zd", end, start,
|
DebugPrint ("end-start (%p-%p): %td", end, start,
|
||||||
end - start);
|
end - start);
|
||||||
|
|
||||||
/* Now, start to end contain a UTF-8 sequence less than 4000
|
/* Now, start to end contain a UTF-8 sequence less than 4000
|
||||||
|
@ -3101,7 +3101,7 @@ CommitString (TextInput *input, const char *buffer,
|
||||||
end += skip;
|
end += skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugPrint ("end-start (%p-%p): %zd", end, start,
|
DebugPrint ("end-start (%p-%p): %td", end, start,
|
||||||
end - start);
|
end - start);
|
||||||
|
|
||||||
/* Now, start to end contain a UTF-8 sequence less than 4000
|
/* Now, start to end contain a UTF-8 sequence less than 4000
|
||||||
|
|
8
xdata.c
8
xdata.c
|
@ -1147,14 +1147,14 @@ HandleSelectionNotify (XFixesSelectionNotifyEvent *event)
|
||||||
|
|
||||||
if (event->owner != None
|
if (event->owner != None
|
||||||
&& event->selection == CLIPBOARD)
|
&& event->selection == CLIPBOARD)
|
||||||
NoticeClipboardChanged (event->timestamp);
|
NoticeClipboardChanged (event->selection_timestamp);
|
||||||
else if (event->selection == CLIPBOARD)
|
else if (event->selection == CLIPBOARD)
|
||||||
NoticeClipboardCleared (event->timestamp);
|
NoticeClipboardCleared (event->selection_timestamp);
|
||||||
else if (event->owner != None
|
else if (event->owner != None
|
||||||
&& event->selection == XA_PRIMARY)
|
&& event->selection == XA_PRIMARY)
|
||||||
NoticePrimaryChanged (event->timestamp);
|
NoticePrimaryChanged (event->selection_timestamp);
|
||||||
else if (event->selection == XA_PRIMARY)
|
else if (event->selection == XA_PRIMARY)
|
||||||
NoticePrimaryCleared (event->timestamp);
|
NoticePrimaryCleared (event->selection_timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
|
10
xdg_popup.c
10
xdg_popup.c
|
@ -279,10 +279,7 @@ MoveWindow (XdgPopup *popup)
|
||||||
int geometry_x, geometry_y, x, y;
|
int geometry_x, geometry_y, x, y;
|
||||||
Window window;
|
Window window;
|
||||||
|
|
||||||
/* No parent was specified. */
|
/* No parent was specified or the role is detached. */
|
||||||
if (!popup->parent)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!popup->role || !popup->parent)
|
if (!popup->role || !popup->parent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -416,10 +413,7 @@ InternalReposition (XdgPopup *popup)
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
FrameClock *clock;
|
FrameClock *clock;
|
||||||
|
|
||||||
/* No parent was specified. */
|
/* No parent was specified or the role is detached. */
|
||||||
if (!popup->parent)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!popup->role || !popup->parent)
|
if (!popup->role || !popup->parent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue