This repository has been archived by the owner on Jun 8, 2021. It is now read-only.
Time coord #314
Merged
Merged
Time coord #314
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule gir-files
updated
4 files
+1 −1 | Gtk-3.0.gir | |
+1 −1 | Gtk-4.0.gir | |
+2 −2 | JavaScriptCore-4.0.gir | |
+6 −1 | fix.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
Generated by gir (https://github.com/gtk-rs/gir @ b869768) | ||
from gir-files (https://github.com/gtk-rs/gir-files @ cae49a8) | ||
Generated by gir (https://github.com/gtk-rs/gir @ 9e3cb65) | ||
from gir-files (https://github.com/gtk-rs/gir-files @ f7e3c51) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
// Copyright 2013-2015, The Gtk-rs Project Developers. | ||
// See the COPYRIGHT file at the top-level directory of this distribution. | ||
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> | ||
|
||
use gdk_sys; | ||
use glib::translate::*; | ||
use glib_sys; | ||
use std::mem; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
#[derive(Clone)] | ||
#[repr(C)] | ||
pub struct TimeCoord { | ||
pub time: u32, | ||
pub axes: [f64; gdk_sys::GDK_MAX_TIMECOORD_AXES as usize], | ||
} | ||
|
||
#[doc(hidden)] | ||
impl Uninitialized for TimeCoord { | ||
#[inline] | ||
unsafe fn uninitialized() -> Self { | ||
mem::zeroed() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not MaybeUninit? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll check it. Good catch! |
||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl<'a> ToGlibPtr<'a, *const gdk_sys::GdkTimeCoord> for TimeCoord { | ||
type Storage = &'a Self; | ||
|
||
#[inline] | ||
fn to_glib_none(&'a self) -> Stash<'a, *const gdk_sys::GdkTimeCoord, Self> { | ||
let ptr: *const TimeCoord = &*self; | ||
Stash(ptr as *const gdk_sys::GdkTimeCoord, self) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl<'a> ToGlibPtrMut<'a, *mut gdk_sys::GdkTimeCoord> for TimeCoord { | ||
type Storage = &'a mut Self; | ||
|
||
#[inline] | ||
fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut gdk_sys::GdkTimeCoord, Self> { | ||
let ptr: *mut TimeCoord = &mut *self; | ||
StashMut(ptr as *mut gdk_sys::GdkTimeCoord, self) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlibPtrNone<*const gdk_sys::GdkTimeCoord> for TimeCoord { | ||
unsafe fn from_glib_none(ptr: *const gdk_sys::GdkTimeCoord) -> Self { | ||
(*(ptr as *const TimeCoord)).clone() | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlibPtrNone<*mut gdk_sys::GdkTimeCoord> for TimeCoord { | ||
unsafe fn from_glib_none(ptr: *mut gdk_sys::GdkTimeCoord) -> Self { | ||
(*(ptr as *mut TimeCoord)).clone() | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlibPtrBorrow<*const gdk_sys::GdkTimeCoord> for TimeCoord { | ||
unsafe fn from_glib_borrow(ptr: *const gdk_sys::GdkTimeCoord) -> Self { | ||
(*(ptr as *const TimeCoord)).clone() | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlibPtrBorrow<*mut gdk_sys::GdkTimeCoord> for TimeCoord { | ||
unsafe fn from_glib_borrow(ptr: *mut gdk_sys::GdkTimeCoord) -> Self { | ||
(*(ptr as *mut TimeCoord)).clone() | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlibPtrFull<*mut gdk_sys::GdkTimeCoord> for TimeCoord { | ||
unsafe fn from_glib_full(ptr: *mut gdk_sys::GdkTimeCoord) -> Self { | ||
let time_coord = (*(ptr as *mut TimeCoord)).clone(); | ||
glib_sys::g_free(ptr as *mut _); | ||
time_coord | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
impl FromGlibPtrFull<*const gdk_sys::GdkTimeCoord> for TimeCoord { | ||
unsafe fn from_glib_full(ptr: *const gdk_sys::GdkTimeCoord) -> Self { | ||
let time_coord = (*(ptr as *const TimeCoord)).clone(); | ||
glib_sys::g_free(ptr as *mut _); | ||
time_coord | ||
} | ||
} | ||
|
||
impl FromGlibContainerAsVec<gdk_sys::GdkTimeCoord, *mut gdk_sys::GdkTimeCoord> for TimeCoord { | ||
unsafe fn from_glib_none_num_as_vec(ptr: *mut gdk_sys::GdkTimeCoord, num: usize) -> Vec<Self> { | ||
if num == 0 || ptr.is_null() { | ||
return Vec::new(); | ||
} | ||
|
||
let mut res = Vec::with_capacity(num); | ||
for i in 0..num { | ||
res.push((*(ptr.offset(i as isize) as *mut TimeCoord)).clone()); | ||
} | ||
res | ||
} | ||
|
||
unsafe fn from_glib_container_num_as_vec( | ||
ptr: *mut gdk_sys::GdkTimeCoord, | ||
num: usize, | ||
) -> Vec<Self> { | ||
let res = FromGlibContainerAsVec::from_glib_none_num_as_vec(ptr, num); | ||
glib_sys::g_free(ptr as *mut _); | ||
res | ||
} | ||
|
||
unsafe fn from_glib_full_num_as_vec(ptr: *mut gdk_sys::GdkTimeCoord, num: usize) -> Vec<Self> { | ||
if num == 0 || ptr.is_null() { | ||
return Vec::new(); | ||
} | ||
|
||
let mut res = Vec::with_capacity(num); | ||
for i in 0..num { | ||
res.push((*(ptr.offset(i as isize) as *mut TimeCoord)).clone()); | ||
} | ||
glib_sys::g_free(ptr as *mut _); | ||
res | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in commit message: TimeDoord -> TimeCoord